From d9368152641a3018fe0ba7c8c4b435037db1568a Mon Sep 17 00:00:00 2001 From: Ash-exp Date: Wed, 25 Jun 2025 18:36:24 +0530 Subject: [PATCH 01/22] feat: build edit v2 refactoring --- api/restHandler/BulkUpdateRestHandler.go | 68 +- api/restHandler/BulkUpdateRestHandler_ent.go | 13 + api/router/BulkUpdateRouter.go | 18 +- api/router/BulkUpdateRouter_ent.go | 27 + go.mod | 10 + go.sum | 27 +- hack/tools.go | 8 + pkg/bulkAction/service/BulkUpdateService.go | 171 +- .../service/BulkUpdateService_ent.go | 12 +- specs/{ => bulkEdit/v1beta1}/bulk_update.yaml | 57 +- specs/bulkEdit/v1beta1/example.yml | 30 + specs/bulkEdit/v1beta1/schema.json | 126 + util/HttpUtil.go | 11 - util/context-utils.go | 49 - util/contextUtils.go | 129 + vendor/github.com/dprotaso/go-yit/.gitignore | 15 + vendor/github.com/dprotaso/go-yit/LICENSE | 19 + vendor/github.com/dprotaso/go-yit/README.md | 54 + .../github.com/dprotaso/go-yit/aggregates.go | 25 + vendor/github.com/dprotaso/go-yit/iterator.go | 204 + .../github.com/dprotaso/go-yit/predicates.go | 117 + vendor/github.com/getkin/kin-openapi/LICENSE | 21 + .../getkin/kin-openapi/openapi3/callback.go | 54 + .../getkin/kin-openapi/openapi3/components.go | 370 + .../getkin/kin-openapi/openapi3/contact.go | 68 + .../getkin/kin-openapi/openapi3/content.go | 124 + .../kin-openapi/openapi3/discriminator.go | 61 + .../getkin/kin-openapi/openapi3/doc.go | 4 + .../getkin/kin-openapi/openapi3/encoding.go | 148 + .../getkin/kin-openapi/openapi3/errors.go | 59 + .../getkin/kin-openapi/openapi3/example.go | 85 + .../openapi3/example_validation.go | 16 + .../getkin/kin-openapi/openapi3/extension.go | 32 + .../kin-openapi/openapi3/external_docs.go | 73 + .../getkin/kin-openapi/openapi3/header.go | 96 + .../getkin/kin-openapi/openapi3/helpers.go | 261 + .../getkin/kin-openapi/openapi3/info.go | 103 + .../kin-openapi/openapi3/internalize_refs.go | 546 + .../getkin/kin-openapi/openapi3/license.go | 66 + .../getkin/kin-openapi/openapi3/link.go | 94 + .../getkin/kin-openapi/openapi3/loader.go | 1213 ++ .../kin-openapi/openapi3/loader_uri_reader.go | 116 + .../getkin/kin-openapi/openapi3/maplike.go | 402 + .../getkin/kin-openapi/openapi3/marsh.go | 34 + .../getkin/kin-openapi/openapi3/media_type.go | 179 + .../getkin/kin-openapi/openapi3/openapi3.go | 205 + .../getkin/kin-openapi/openapi3/operation.go | 222 + .../getkin/kin-openapi/openapi3/parameter.go | 416 + .../getkin/kin-openapi/openapi3/path_item.go | 248 + .../getkin/kin-openapi/openapi3/paths.go | 268 + .../getkin/kin-openapi/openapi3/ref.go | 9 + .../getkin/kin-openapi/openapi3/refs.go | 1238 ++ .../getkin/kin-openapi/openapi3/refs.tmpl | 151 + .../kin-openapi/openapi3/refs_test.tmpl | 54 + .../kin-openapi/openapi3/request_body.go | 138 + .../getkin/kin-openapi/openapi3/response.go | 227 + .../getkin/kin-openapi/openapi3/schema.go | 2246 ++ .../kin-openapi/openapi3/schema_formats.go | 169 + .../kin-openapi/openapi3/schema_pattern.go | 35 + .../openapi3/schema_validation_settings.go | 92 + .../openapi3/security_requirements.go | 51 + .../kin-openapi/openapi3/security_scheme.go | 429 + .../openapi3/serialization_method.go | 17 + .../getkin/kin-openapi/openapi3/server.go | 302 + .../getkin/kin-openapi/openapi3/tag.go | 99 + .../openapi3/validation_options.go | 142 + .../getkin/kin-openapi/openapi3/visited.go | 41 + .../getkin/kin-openapi/openapi3/xml.go | 78 + vendor/github.com/invopop/yaml/.gitignore | 20 + vendor/github.com/invopop/yaml/.golangci.toml | 16 + vendor/github.com/invopop/yaml/LICENSE | 50 + vendor/github.com/invopop/yaml/README.md | 128 + vendor/github.com/invopop/yaml/fields.go | 499 + vendor/github.com/invopop/yaml/yaml.go | 312 + vendor/github.com/mohae/deepcopy/.gitignore | 26 + vendor/github.com/mohae/deepcopy/.travis.yml | 11 + vendor/github.com/mohae/deepcopy/LICENSE | 21 + vendor/github.com/mohae/deepcopy/README.md | 8 + vendor/github.com/mohae/deepcopy/deepcopy.go | 125 + .../oapi-codegen/oapi-codegen/v2/LICENSE | 201 + .../v2/cmd/oapi-codegen/oapi-codegen.go | 571 + .../oapi-codegen/v2/pkg/codegen/codegen.go | 1204 ++ .../v2/pkg/codegen/configuration.go | 313 + .../oapi-codegen/v2/pkg/codegen/extension.go | 113 + .../v2/pkg/codegen/externalref.go | 80 + .../oapi-codegen/v2/pkg/codegen/filter.go | 88 + .../oapi-codegen/v2/pkg/codegen/inline.go | 77 + .../v2/pkg/codegen/merge_schemas.go | 249 + .../v2/pkg/codegen/merge_schemas_v1.go | 111 + .../v2/pkg/codegen/minimum_go_version.go | 91 + .../oapi-codegen/v2/pkg/codegen/operations.go | 1116 + .../oapi-codegen/v2/pkg/codegen/prune.go | 489 + .../oapi-codegen/v2/pkg/codegen/schema.go | 915 + .../v2/pkg/codegen/template_helpers.go | 326 + .../templates/additional-properties.tmpl | 72 + .../codegen/templates/chi/chi-handler.tmpl | 50 + .../codegen/templates/chi/chi-interface.tmpl | 17 + .../codegen/templates/chi/chi-middleware.tmpl | 266 + .../templates/client-with-responses.tmpl | 134 + .../v2/pkg/codegen/templates/client.tmpl | 312 + .../v2/pkg/codegen/templates/constants.tmpl | 15 + .../templates/echo/echo-interface.tmpl | 7 + .../codegen/templates/echo/echo-register.tmpl | 33 + .../codegen/templates/echo/echo-wrappers.tmpl | 131 + .../templates/fiber/fiber-handler.tmpl | 25 + .../templates/fiber/fiber-interface.tmpl | 7 + .../templates/fiber/fiber-middleware.tmpl | 169 + .../codegen/templates/gin/gin-interface.tmpl | 7 + .../codegen/templates/gin/gin-register.tmpl | 33 + .../codegen/templates/gin/gin-wrappers.tmpl | 186 + .../templates/gorilla/gorilla-interface.tmpl | 7 + .../templates/gorilla/gorilla-middleware.tmpl | 266 + .../templates/gorilla/gorilla-register.tmpl | 49 + .../v2/pkg/codegen/templates/imports.tmpl | 50 + .../v2/pkg/codegen/templates/inline.tmpl | 84 + .../codegen/templates/iris/iris-handler.tmpl | 23 + .../templates/iris/iris-interface.tmpl | 7 + .../templates/iris/iris-middleware.tmpl | 161 + .../v2/pkg/codegen/templates/param-types.tmpl | 6 + .../pkg/codegen/templates/request-bodies.tmpl | 11 + .../templates/stdhttp/std-http-handler.tmpl | 55 + .../templates/stdhttp/std-http-interface.tmpl | 7 + .../stdhttp/std-http-middleware.tmpl | 266 + .../codegen/templates/strict/strict-echo.tmpl | 97 + .../strict/strict-fiber-interface.tmpl | 145 + .../templates/strict/strict-fiber.tmpl | 90 + .../codegen/templates/strict/strict-gin.tmpl | 106 + .../codegen/templates/strict/strict-http.tmpl | 121 + .../templates/strict/strict-interface.tmpl | 145 + .../strict/strict-iris-interface.tmpl | 147 + .../codegen/templates/strict/strict-iris.tmpl | 107 + .../templates/strict/strict-responses.tmpl | 41 + .../v2/pkg/codegen/templates/typedef.tmpl | 4 + .../union-and-additional-properties.tmpl | 72 + .../v2/pkg/codegen/templates/union.tmpl | 140 + .../v2/pkg/codegen/test_schema.json | 15 + .../v2/pkg/codegen/test_spec.yaml | 207 + .../oapi-codegen/v2/pkg/codegen/utils.go | 1112 + .../oapi-codegen/v2/pkg/util/inputmapping.go | 79 + .../oapi-codegen/v2/pkg/util/isjson.go | 14 + .../oapi-codegen/v2/pkg/util/loader.go | 100 + .../perimeterx/marshmallow/.gitignore | 4 + .../perimeterx/marshmallow/CHANGELOG.md | 49 + .../perimeterx/marshmallow/CODE_OF_CONDUCT.md | 133 + .../perimeterx/marshmallow/CONTRIBUTING.md | 47 + .../github.com/perimeterx/marshmallow/LICENSE | 21 + .../perimeterx/marshmallow/README.md | 205 + .../perimeterx/marshmallow/cache.go | 63 + .../github.com/perimeterx/marshmallow/doc.go | 10 + .../perimeterx/marshmallow/errors.go | 101 + .../perimeterx/marshmallow/options.go | 96 + .../perimeterx/marshmallow/reflection.go | 197 + .../perimeterx/marshmallow/unmarshal.go | 383 + .../marshmallow/unmarshal_from_json_map.go | 295 + .../github.com/speakeasy-api/jsonpath/LICENSE | 201 + .../jsonpath/pkg/jsonpath/config/config.go | 31 + .../jsonpath/pkg/jsonpath/filter.go | 456 + .../jsonpath/pkg/jsonpath/jsonpath.go | 35 + .../jsonpath/pkg/jsonpath/parser.go | 729 + .../jsonpath/pkg/jsonpath/segment.go | 83 + .../jsonpath/pkg/jsonpath/selector.go | 63 + .../jsonpath/pkg/jsonpath/token/token.go | 776 + .../jsonpath/pkg/jsonpath/yaml_eval.go | 278 + .../jsonpath/pkg/jsonpath/yaml_query.go | 393 + .../speakeasy-api/openapi-overlay/LICENSE | 8 + .../openapi-overlay/pkg/loader/overlay.go | 17 + .../openapi-overlay/pkg/loader/spec.go | 78 + .../openapi-overlay/pkg/overlay/apply.go | 238 + .../openapi-overlay/pkg/overlay/compare.go | 261 + .../openapi-overlay/pkg/overlay/jsonpath.go | 47 + .../openapi-overlay/pkg/overlay/parents.go | 23 + .../openapi-overlay/pkg/overlay/parse.go | 58 + .../openapi-overlay/pkg/overlay/schema.go | 66 + .../openapi-overlay/pkg/overlay/utils.go | 19 + .../openapi-overlay/pkg/overlay/validate.go | 61 + .../vmware-labs/yaml-jsonpath/LICENSE | 181 + .../vmware-labs/yaml-jsonpath/NOTICE | 7 + .../yaml-jsonpath/pkg/yamlpath/comparison.go | 93 + .../yaml-jsonpath/pkg/yamlpath/doc.go | 8 + .../yaml-jsonpath/pkg/yamlpath/filter.go | 297 + .../pkg/yamlpath/filter_parser.go | 295 + .../yaml-jsonpath/pkg/yamlpath/lexer.go | 1011 + .../yaml-jsonpath/pkg/yamlpath/path.go | 463 + .../yaml-jsonpath/pkg/yamlpath/slicer.go | 143 + .../x/mod/internal/lazyregexp/lazyre.go | 78 + vendor/golang.org/x/mod/modfile/print.go | 184 + vendor/golang.org/x/mod/modfile/read.go | 964 + vendor/golang.org/x/mod/modfile/rule.go | 1836 ++ vendor/golang.org/x/mod/modfile/work.go | 335 + vendor/golang.org/x/mod/module/module.go | 841 + vendor/golang.org/x/mod/module/pseudo.go | 250 + vendor/golang.org/x/text/cases/cases.go | 162 + vendor/golang.org/x/text/cases/context.go | 376 + vendor/golang.org/x/text/cases/fold.go | 34 + vendor/golang.org/x/text/cases/icu.go | 61 + vendor/golang.org/x/text/cases/info.go | 82 + vendor/golang.org/x/text/cases/map.go | 816 + .../golang.org/x/text/cases/tables10.0.0.go | 2255 ++ .../golang.org/x/text/cases/tables11.0.0.go | 2316 ++ .../golang.org/x/text/cases/tables12.0.0.go | 2359 +++ .../golang.org/x/text/cases/tables13.0.0.go | 2399 +++ .../golang.org/x/text/cases/tables15.0.0.go | 2527 +++ vendor/golang.org/x/text/cases/tables9.0.0.go | 2215 ++ vendor/golang.org/x/text/cases/trieval.go | 217 + vendor/golang.org/x/text/internal/internal.go | 49 + .../x/text/internal/language/common.go | 16 + .../x/text/internal/language/compact.go | 29 + .../text/internal/language/compact/compact.go | 61 + .../internal/language/compact/language.go | 260 + .../text/internal/language/compact/parents.go | 120 + .../text/internal/language/compact/tables.go | 1015 + .../x/text/internal/language/compact/tags.go | 91 + .../x/text/internal/language/compose.go | 167 + .../x/text/internal/language/coverage.go | 28 + .../x/text/internal/language/language.go | 627 + .../x/text/internal/language/lookup.go | 412 + .../x/text/internal/language/match.go | 226 + .../x/text/internal/language/parse.go | 608 + .../x/text/internal/language/tables.go | 3494 +++ .../x/text/internal/language/tags.go | 48 + vendor/golang.org/x/text/internal/match.go | 67 + vendor/golang.org/x/text/internal/tag/tag.go | 100 + vendor/golang.org/x/text/language/coverage.go | 187 + vendor/golang.org/x/text/language/doc.go | 98 + vendor/golang.org/x/text/language/language.go | 605 + vendor/golang.org/x/text/language/match.go | 735 + vendor/golang.org/x/text/language/parse.go | 256 + vendor/golang.org/x/text/language/tables.go | 298 + vendor/golang.org/x/text/language/tags.go | 145 + vendor/golang.org/x/tools/LICENSE | 27 + vendor/golang.org/x/tools/PATENTS | 22 + .../x/tools/go/ast/astutil/enclosing.go | 654 + .../x/tools/go/ast/astutil/imports.go | 491 + .../x/tools/go/ast/astutil/rewrite.go | 486 + .../golang.org/x/tools/go/ast/astutil/util.go | 13 + vendor/golang.org/x/tools/imports/forward.go | 77 + .../x/tools/internal/event/core/event.go | 85 + .../x/tools/internal/event/core/export.go | 70 + .../x/tools/internal/event/core/fast.go | 77 + .../golang.org/x/tools/internal/event/doc.go | 7 + .../x/tools/internal/event/event.go | 127 + .../x/tools/internal/event/keys/keys.go | 564 + .../x/tools/internal/event/keys/standard.go | 22 + .../x/tools/internal/event/keys/util.go | 21 + .../x/tools/internal/event/label/label.go | 214 + .../x/tools/internal/gocommand/invoke.go | 567 + .../internal/gocommand/invoke_notunix.go | 13 + .../x/tools/internal/gocommand/invoke_unix.go | 13 + .../x/tools/internal/gocommand/vendor.go | 163 + .../x/tools/internal/gocommand/version.go | 71 + .../x/tools/internal/gopathwalk/walk.go | 336 + .../x/tools/internal/imports/fix.go | 1897 ++ .../x/tools/internal/imports/imports.go | 359 + .../x/tools/internal/imports/mod.go | 841 + .../x/tools/internal/imports/mod_cache.go | 331 + .../x/tools/internal/imports/sortimports.go | 298 + .../x/tools/internal/imports/source.go | 63 + .../x/tools/internal/imports/source_env.go | 129 + .../tools/internal/imports/source_modindex.go | 103 + .../x/tools/internal/modindex/directories.go | 135 + .../x/tools/internal/modindex/index.go | 266 + .../x/tools/internal/modindex/lookup.go | 178 + .../x/tools/internal/modindex/modindex.go | 164 + .../x/tools/internal/modindex/symbols.go | 218 + .../x/tools/internal/modindex/types.go | 25 + .../x/tools/internal/stdlib/deps.go | 359 + .../x/tools/internal/stdlib/import.go | 89 + .../x/tools/internal/stdlib/manifest.go | 17676 ++++++++++++++++ .../x/tools/internal/stdlib/stdlib.go | 105 + vendor/modules.txt | 54 + wire_gen.go | 2 +- 271 files changed, 89934 insertions(+), 200 deletions(-) create mode 100644 api/restHandler/BulkUpdateRestHandler_ent.go create mode 100644 api/router/BulkUpdateRouter_ent.go create mode 100644 hack/tools.go rename specs/{ => bulkEdit/v1beta1}/bulk_update.yaml (91%) create mode 100644 specs/bulkEdit/v1beta1/example.yml create mode 100644 specs/bulkEdit/v1beta1/schema.json delete mode 100644 util/context-utils.go create mode 100644 util/contextUtils.go create mode 100644 vendor/github.com/dprotaso/go-yit/.gitignore create mode 100644 vendor/github.com/dprotaso/go-yit/LICENSE create mode 100644 vendor/github.com/dprotaso/go-yit/README.md create mode 100644 vendor/github.com/dprotaso/go-yit/aggregates.go create mode 100644 vendor/github.com/dprotaso/go-yit/iterator.go create mode 100644 vendor/github.com/dprotaso/go-yit/predicates.go create mode 100644 vendor/github.com/getkin/kin-openapi/LICENSE create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/callback.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/components.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/contact.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/content.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/discriminator.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/doc.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/encoding.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/errors.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/example.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/example_validation.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/extension.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/external_docs.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/header.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/helpers.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/info.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/internalize_refs.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/license.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/link.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/loader.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/loader_uri_reader.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/maplike.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/marsh.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/media_type.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/openapi3.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/operation.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/parameter.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/path_item.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/paths.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/ref.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/refs.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/refs.tmpl create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/refs_test.tmpl create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/request_body.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/response.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/schema.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/schema_formats.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/schema_pattern.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/schema_validation_settings.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/security_requirements.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/security_scheme.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/serialization_method.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/server.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/tag.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/validation_options.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/visited.go create mode 100644 vendor/github.com/getkin/kin-openapi/openapi3/xml.go create mode 100644 vendor/github.com/invopop/yaml/.gitignore create mode 100644 vendor/github.com/invopop/yaml/.golangci.toml create mode 100644 vendor/github.com/invopop/yaml/LICENSE create mode 100644 vendor/github.com/invopop/yaml/README.md create mode 100644 vendor/github.com/invopop/yaml/fields.go create mode 100644 vendor/github.com/invopop/yaml/yaml.go create mode 100644 vendor/github.com/mohae/deepcopy/.gitignore create mode 100644 vendor/github.com/mohae/deepcopy/.travis.yml create mode 100644 vendor/github.com/mohae/deepcopy/LICENSE create mode 100644 vendor/github.com/mohae/deepcopy/README.md create mode 100644 vendor/github.com/mohae/deepcopy/deepcopy.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/LICENSE create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen/oapi-codegen.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/codegen.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/configuration.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/extension.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/externalref.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/filter.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/inline.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/merge_schemas.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/merge_schemas_v1.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/minimum_go_version.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/operations.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/prune.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/schema.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/template_helpers.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/additional-properties.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-handler.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-middleware.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client-with-responses.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/constants.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-register.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-wrappers.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-handler.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-middleware.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-register.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-wrappers.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-middleware.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-register.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/imports.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/inline.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-handler.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-middleware.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/param-types.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/request-bodies.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-handler.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-middleware.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-echo.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-fiber-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-fiber.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-gin.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-http.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-iris-interface.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-iris.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-responses.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/typedef.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union-and-additional-properties.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union.tmpl create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/test_schema.json create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/test_spec.yaml create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/utils.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/inputmapping.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/isjson.go create mode 100644 vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/loader.go create mode 100644 vendor/github.com/perimeterx/marshmallow/.gitignore create mode 100644 vendor/github.com/perimeterx/marshmallow/CHANGELOG.md create mode 100644 vendor/github.com/perimeterx/marshmallow/CODE_OF_CONDUCT.md create mode 100644 vendor/github.com/perimeterx/marshmallow/CONTRIBUTING.md create mode 100644 vendor/github.com/perimeterx/marshmallow/LICENSE create mode 100644 vendor/github.com/perimeterx/marshmallow/README.md create mode 100644 vendor/github.com/perimeterx/marshmallow/cache.go create mode 100644 vendor/github.com/perimeterx/marshmallow/doc.go create mode 100644 vendor/github.com/perimeterx/marshmallow/errors.go create mode 100644 vendor/github.com/perimeterx/marshmallow/options.go create mode 100644 vendor/github.com/perimeterx/marshmallow/reflection.go create mode 100644 vendor/github.com/perimeterx/marshmallow/unmarshal.go create mode 100644 vendor/github.com/perimeterx/marshmallow/unmarshal_from_json_map.go create mode 100644 vendor/github.com/speakeasy-api/jsonpath/LICENSE create mode 100644 vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/config/config.go create mode 100644 vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/filter.go create mode 100644 vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/jsonpath.go create mode 100644 vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/parser.go create mode 100644 vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/segment.go create mode 100644 vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/selector.go create mode 100644 vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/token/token.go create mode 100644 vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/yaml_eval.go create mode 100644 vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/yaml_query.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/LICENSE create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/loader/overlay.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/loader/spec.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/apply.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/compare.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/jsonpath.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/parents.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/parse.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/schema.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/utils.go create mode 100644 vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/validate.go create mode 100644 vendor/github.com/vmware-labs/yaml-jsonpath/LICENSE create mode 100644 vendor/github.com/vmware-labs/yaml-jsonpath/NOTICE create mode 100644 vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/comparison.go create mode 100644 vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/doc.go create mode 100644 vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/filter.go create mode 100644 vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/filter_parser.go create mode 100644 vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/lexer.go create mode 100644 vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/path.go create mode 100644 vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/slicer.go create mode 100644 vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go create mode 100644 vendor/golang.org/x/mod/modfile/print.go create mode 100644 vendor/golang.org/x/mod/modfile/read.go create mode 100644 vendor/golang.org/x/mod/modfile/rule.go create mode 100644 vendor/golang.org/x/mod/modfile/work.go create mode 100644 vendor/golang.org/x/mod/module/module.go create mode 100644 vendor/golang.org/x/mod/module/pseudo.go create mode 100644 vendor/golang.org/x/text/cases/cases.go create mode 100644 vendor/golang.org/x/text/cases/context.go create mode 100644 vendor/golang.org/x/text/cases/fold.go create mode 100644 vendor/golang.org/x/text/cases/icu.go create mode 100644 vendor/golang.org/x/text/cases/info.go create mode 100644 vendor/golang.org/x/text/cases/map.go create mode 100644 vendor/golang.org/x/text/cases/tables10.0.0.go create mode 100644 vendor/golang.org/x/text/cases/tables11.0.0.go create mode 100644 vendor/golang.org/x/text/cases/tables12.0.0.go create mode 100644 vendor/golang.org/x/text/cases/tables13.0.0.go create mode 100644 vendor/golang.org/x/text/cases/tables15.0.0.go create mode 100644 vendor/golang.org/x/text/cases/tables9.0.0.go create mode 100644 vendor/golang.org/x/text/cases/trieval.go create mode 100644 vendor/golang.org/x/text/internal/internal.go create mode 100644 vendor/golang.org/x/text/internal/language/common.go create mode 100644 vendor/golang.org/x/text/internal/language/compact.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/compact.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/language.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/parents.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/tables.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/tags.go create mode 100644 vendor/golang.org/x/text/internal/language/compose.go create mode 100644 vendor/golang.org/x/text/internal/language/coverage.go create mode 100644 vendor/golang.org/x/text/internal/language/language.go create mode 100644 vendor/golang.org/x/text/internal/language/lookup.go create mode 100644 vendor/golang.org/x/text/internal/language/match.go create mode 100644 vendor/golang.org/x/text/internal/language/parse.go create mode 100644 vendor/golang.org/x/text/internal/language/tables.go create mode 100644 vendor/golang.org/x/text/internal/language/tags.go create mode 100644 vendor/golang.org/x/text/internal/match.go create mode 100644 vendor/golang.org/x/text/internal/tag/tag.go create mode 100644 vendor/golang.org/x/text/language/coverage.go create mode 100644 vendor/golang.org/x/text/language/doc.go create mode 100644 vendor/golang.org/x/text/language/language.go create mode 100644 vendor/golang.org/x/text/language/match.go create mode 100644 vendor/golang.org/x/text/language/parse.go create mode 100644 vendor/golang.org/x/text/language/tables.go create mode 100644 vendor/golang.org/x/text/language/tags.go create mode 100644 vendor/golang.org/x/tools/LICENSE create mode 100644 vendor/golang.org/x/tools/PATENTS create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/enclosing.go create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/imports.go create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/rewrite.go create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/util.go create mode 100644 vendor/golang.org/x/tools/imports/forward.go create mode 100644 vendor/golang.org/x/tools/internal/event/core/event.go create mode 100644 vendor/golang.org/x/tools/internal/event/core/export.go create mode 100644 vendor/golang.org/x/tools/internal/event/core/fast.go create mode 100644 vendor/golang.org/x/tools/internal/event/doc.go create mode 100644 vendor/golang.org/x/tools/internal/event/event.go create mode 100644 vendor/golang.org/x/tools/internal/event/keys/keys.go create mode 100644 vendor/golang.org/x/tools/internal/event/keys/standard.go create mode 100644 vendor/golang.org/x/tools/internal/event/keys/util.go create mode 100644 vendor/golang.org/x/tools/internal/event/label/label.go create mode 100644 vendor/golang.org/x/tools/internal/gocommand/invoke.go create mode 100644 vendor/golang.org/x/tools/internal/gocommand/invoke_notunix.go create mode 100644 vendor/golang.org/x/tools/internal/gocommand/invoke_unix.go create mode 100644 vendor/golang.org/x/tools/internal/gocommand/vendor.go create mode 100644 vendor/golang.org/x/tools/internal/gocommand/version.go create mode 100644 vendor/golang.org/x/tools/internal/gopathwalk/walk.go create mode 100644 vendor/golang.org/x/tools/internal/imports/fix.go create mode 100644 vendor/golang.org/x/tools/internal/imports/imports.go create mode 100644 vendor/golang.org/x/tools/internal/imports/mod.go create mode 100644 vendor/golang.org/x/tools/internal/imports/mod_cache.go create mode 100644 vendor/golang.org/x/tools/internal/imports/sortimports.go create mode 100644 vendor/golang.org/x/tools/internal/imports/source.go create mode 100644 vendor/golang.org/x/tools/internal/imports/source_env.go create mode 100644 vendor/golang.org/x/tools/internal/imports/source_modindex.go create mode 100644 vendor/golang.org/x/tools/internal/modindex/directories.go create mode 100644 vendor/golang.org/x/tools/internal/modindex/index.go create mode 100644 vendor/golang.org/x/tools/internal/modindex/lookup.go create mode 100644 vendor/golang.org/x/tools/internal/modindex/modindex.go create mode 100644 vendor/golang.org/x/tools/internal/modindex/symbols.go create mode 100644 vendor/golang.org/x/tools/internal/modindex/types.go create mode 100644 vendor/golang.org/x/tools/internal/stdlib/deps.go create mode 100644 vendor/golang.org/x/tools/internal/stdlib/import.go create mode 100644 vendor/golang.org/x/tools/internal/stdlib/manifest.go create mode 100644 vendor/golang.org/x/tools/internal/stdlib/stdlib.go diff --git a/api/restHandler/BulkUpdateRestHandler.go b/api/restHandler/BulkUpdateRestHandler.go index 4948634bd2..61b4a209f4 100644 --- a/api/restHandler/BulkUpdateRestHandler.go +++ b/api/restHandler/BulkUpdateRestHandler.go @@ -19,7 +19,7 @@ package restHandler import ( "encoding/json" "fmt" - bean4 "github.com/devtron-labs/devtron/pkg/auth/user/bean" + util2 "github.com/devtron-labs/devtron/pkg/auth/user/util" "github.com/devtron-labs/devtron/pkg/build/git/gitMaterial/repository" "github.com/devtron-labs/devtron/pkg/build/git/gitProvider" "github.com/devtron-labs/devtron/pkg/bulkAction/bean" @@ -40,7 +40,6 @@ import ( "github.com/devtron-labs/devtron/pkg/auth/user" "github.com/devtron-labs/devtron/pkg/chart" "github.com/devtron-labs/devtron/pkg/pipeline" - "github.com/devtron-labs/devtron/pkg/team" "github.com/devtron-labs/devtron/util/rbac" "github.com/gorilla/mux" "go.uber.org/zap" @@ -48,17 +47,31 @@ import ( ) type BulkUpdateRestHandler interface { - FindBulkUpdateReadme(w http.ResponseWriter, r *http.Request) - GetImpactedAppsName(w http.ResponseWriter, r *http.Request) - BulkUpdate(w http.ResponseWriter, r *http.Request) - + //deprecated BulkHibernate(w http.ResponseWriter, r *http.Request) + BulkHibernateV1(w http.ResponseWriter, r *http.Request) BulkUnHibernate(w http.ResponseWriter, r *http.Request) BulkDeploy(w http.ResponseWriter, r *http.Request) BulkBuildTrigger(w http.ResponseWriter, r *http.Request) HandleCdPipelineBulkAction(w http.ResponseWriter, r *http.Request) + BulkEditRestHandler +} + +type BulkEditRestHandler interface { + BulkEditV1Beta1RestHandler + BulkEditV1Beta2RestHandler } + +type BulkEditV1Beta1RestHandler interface { + FindBulkUpdateReadme(w http.ResponseWriter, r *http.Request) + GetImpactedAppsName(w http.ResponseWriter, r *http.Request) + BulkUpdate(w http.ResponseWriter, r *http.Request) +} + +type BulkEditV1Beta2RestHandler interface { +} + type BulkUpdateRestHandlerImpl struct { pipelineBuilder pipeline.PipelineBuilder ciPipelineRepository pipelineConfig.CiPipelineRepository @@ -69,7 +82,6 @@ type BulkUpdateRestHandlerImpl struct { propertiesConfigService pipeline.PropertiesConfigService userAuthService user.UserService validator *validator.Validate - teamService team.TeamService enforcer casbin.Enforcer gitSensorClient gitSensor.Client pipelineRepository pipelineConfig.PipelineRepository @@ -78,7 +90,7 @@ type BulkUpdateRestHandlerImpl struct { envService environment.EnvironmentService gitRegistryConfig gitProvider.GitRegistryConfig dockerRegistryConfig pipeline.DockerRegistryConfig - cdHandelr pipeline.CdHandler + cdHandler pipeline.CdHandler appCloneService appClone.AppCloneService materialRepository repository.MaterialRepository } @@ -88,7 +100,6 @@ func NewBulkUpdateRestHandlerImpl(pipelineBuilder pipeline.PipelineBuilder, logg chartService chart.ChartService, propertiesConfigService pipeline.PropertiesConfigService, userAuthService user.UserService, - teamService team.TeamService, enforcer casbin.Enforcer, ciHandler pipeline.CiHandler, validator *validator.Validate, @@ -96,7 +107,7 @@ func NewBulkUpdateRestHandlerImpl(pipelineBuilder pipeline.PipelineBuilder, logg ciPipelineRepository pipelineConfig.CiPipelineRepository, pipelineRepository pipelineConfig.PipelineRepository, enforcerUtil rbac.EnforcerUtil, envService environment.EnvironmentService, gitRegistryConfig gitProvider.GitRegistryConfig, dockerRegistryConfig pipeline.DockerRegistryConfig, - cdHandelr pipeline.CdHandler, + cdHandler pipeline.CdHandler, appCloneService appClone.AppCloneService, appWorkflowService appWorkflow.AppWorkflowService, materialRepository repository.MaterialRepository, @@ -109,7 +120,6 @@ func NewBulkUpdateRestHandlerImpl(pipelineBuilder pipeline.PipelineBuilder, logg propertiesConfigService: propertiesConfigService, userAuthService: userAuthService, validator: validator, - teamService: teamService, enforcer: enforcer, ciHandler: ciHandler, gitSensorClient: gitSensorClient, @@ -119,7 +129,7 @@ func NewBulkUpdateRestHandlerImpl(pipelineBuilder pipeline.PipelineBuilder, logg envService: envService, gitRegistryConfig: gitRegistryConfig, dockerRegistryConfig: dockerRegistryConfig, - cdHandelr: cdHandelr, + cdHandler: cdHandler, appCloneService: appCloneService, appWorkflowService: appWorkflowService, materialRepository: materialRepository, @@ -265,13 +275,8 @@ func (handler BulkUpdateRestHandlerImpl) BulkUpdate(w http.ResponseWriter, r *ht } } isSuperAdmin := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionCreate, "*") - userEmail := util.GetEmailFromContext(r.Context()) - userMetadata := &bean4.UserMetadata{ - UserEmailId: userEmail, - IsUserSuperAdmin: isSuperAdmin, - UserId: userId, - } - response := handler.bulkUpdateService.BulkUpdate(script.Spec, userMetadata) + userMetadata := util2.GetUserMetadata(r.Context(), userId, isSuperAdmin) + response := handler.bulkUpdateService.BulkUpdate(r.Context(), script.Spec, userMetadata) common.WriteJsonResp(w, nil, response, http.StatusOK) } @@ -282,12 +287,7 @@ func (handler BulkUpdateRestHandlerImpl) BulkHibernate(w http.ResponseWriter, r } token := r.Header.Get("token") isSuperAdmin := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionCreate, "*") - userEmail := util.GetEmailFromContext(r.Context()) - userMetadata := &bean4.UserMetadata{ - UserEmailId: userEmail, - IsUserSuperAdmin: isSuperAdmin, - UserId: request.UserId, - } + userMetadata := util2.GetUserMetadata(r.Context(), request.UserId, isSuperAdmin) response, err := handler.bulkUpdateService.BulkHibernate(r.Context(), request, handler.checkAuthForBulkHibernateAndUnhibernate, userMetadata) if err != nil { @@ -327,12 +327,7 @@ func (handler BulkUpdateRestHandlerImpl) BulkUnHibernate(w http.ResponseWriter, } token := r.Header.Get("token") isSuperAdmin := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionCreate, "*") - userEmail := util.GetEmailFromContext(r.Context()) - userMetadata := &bean4.UserMetadata{ - UserEmailId: userEmail, - IsUserSuperAdmin: isSuperAdmin, - UserId: request.UserId, - } + userMetadata := util2.GetUserMetadata(r.Context(), request.UserId, isSuperAdmin) response, err := handler.bulkUpdateService.BulkUnHibernate(r.Context(), request, handler.checkAuthForBulkHibernateAndUnhibernate, userMetadata) if err != nil { common.WriteJsonResp(w, err, nil, http.StatusInternalServerError) @@ -340,6 +335,7 @@ func (handler BulkUpdateRestHandlerImpl) BulkUnHibernate(w http.ResponseWriter, } common.WriteJsonResp(w, nil, response, http.StatusOK) } + func (handler BulkUpdateRestHandlerImpl) BulkDeploy(w http.ResponseWriter, r *http.Request) { token := r.Header.Get("token") userId, err := handler.userAuthService.GetLoggedInUser(r) @@ -361,14 +357,10 @@ func (handler BulkUpdateRestHandlerImpl) BulkDeploy(w http.ResponseWriter, r *ht common.WriteJsonResp(w, err, nil, http.StatusBadRequest) return } + ctx := util.NewRequestCtx(r.Context()) isSuperAdmin := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionCreate, "*") - userEmail := util.GetEmailFromContext(r.Context()) - userMetadata := &bean4.UserMetadata{ - UserEmailId: userEmail, - IsUserSuperAdmin: isSuperAdmin, - UserId: userId, - } - response, err := handler.bulkUpdateService.BulkDeploy(&request, token, handler.checkAuthBatch, userMetadata) + userMetadata := util2.GetUserMetadata(ctx, userId, isSuperAdmin) + response, err := handler.bulkUpdateService.BulkDeploy(ctx, &request, handler.checkAuthBatch, userMetadata) if err != nil { common.WriteJsonResp(w, err, nil, http.StatusInternalServerError) return diff --git a/api/restHandler/BulkUpdateRestHandler_ent.go b/api/restHandler/BulkUpdateRestHandler_ent.go new file mode 100644 index 0000000000..766729ef30 --- /dev/null +++ b/api/restHandler/BulkUpdateRestHandler_ent.go @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024. Devtron Inc. + */ + +package restHandler + +import ( + "net/http" +) + +func (handler BulkUpdateRestHandlerImpl) BulkHibernateV1(w http.ResponseWriter, r *http.Request) { + handler.BulkHibernate(w, r) // For backward compatibility, redirect to the new handler +} diff --git a/api/router/BulkUpdateRouter.go b/api/router/BulkUpdateRouter.go index 423bac665d..8c4067df94 100644 --- a/api/router/BulkUpdateRouter.go +++ b/api/router/BulkUpdateRouter.go @@ -35,17 +35,31 @@ func NewBulkUpdateRouterImpl(handler restHandler.BulkUpdateRestHandler) *BulkUpd } return router } + func (router BulkUpdateRouterImpl) initBulkUpdateRouter(bulkRouter *mux.Router) { bulkRouter.Path("/{apiVersion}/{kind}/readme").HandlerFunc(router.restHandler.FindBulkUpdateReadme).Methods("GET") + // Initialize v1beta1 routes + router.initV1beta1Router(bulkRouter) + // Initialize v1beta2 routes + router.initV1beta2Router(bulkRouter) + // Initialize Ent routes + router.initBulkUpdateRouterEnt(bulkRouter) +} + +func (router BulkUpdateRouterImpl) initV1beta1Router(bulkRouter *mux.Router) { bulkRouter.Path("/v1beta1/application/dryrun").HandlerFunc(router.restHandler.GetImpactedAppsName).Methods("POST") bulkRouter.Path("/v1beta1/application").HandlerFunc(router.restHandler.BulkUpdate).Methods("POST") bulkRouter.Path("/v1beta1/hibernate").HandlerFunc(router.restHandler.BulkHibernate).Methods("POST") bulkRouter.Path("/v1beta1/unhibernate").HandlerFunc(router.restHandler.BulkUnHibernate).Methods("POST") - bulkRouter.Path("/v1beta2/hibernate").HandlerFunc(router.restHandler.BulkHibernate).Methods("POST") - bulkRouter.Path("/v1beta2/unhibernate").HandlerFunc(router.restHandler.BulkUnHibernate).Methods("POST") bulkRouter.Path("/v1beta1/deploy").HandlerFunc(router.restHandler.BulkDeploy).Methods("POST") bulkRouter.Path("/v1beta1/build").HandlerFunc(router.restHandler.BulkBuildTrigger).Methods("POST") bulkRouter.Path("/v1beta1/cd-pipeline").HandlerFunc(router.restHandler.HandleCdPipelineBulkAction).Methods("POST") +} +func (router BulkUpdateRouterImpl) initV1beta2Router(bulkRouter *mux.Router) { + bulkRouter.Path("/v1beta2/unhibernate").HandlerFunc(router.restHandler.BulkUnHibernate).Methods("POST") + bulkRouter.Path("/v1beta2/hibernate").HandlerFunc(router.restHandler.BulkHibernateV1).Methods("POST") + // Initialize v1beta2 routes for Ent + router.initV1beta2RouterEnt(bulkRouter) } diff --git a/api/router/BulkUpdateRouter_ent.go b/api/router/BulkUpdateRouter_ent.go new file mode 100644 index 0000000000..251f49dc3f --- /dev/null +++ b/api/router/BulkUpdateRouter_ent.go @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024. Devtron Inc. + * + * 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. + */ + +package router + +import "github.com/gorilla/mux" + +func (router BulkUpdateRouterImpl) initBulkUpdateRouterEnt(bulkRouter *mux.Router) { + return +} + +func (router BulkUpdateRouterImpl) initV1beta2RouterEnt(bulkRouter *mux.Router) { + return +} diff --git a/go.mod b/go.mod index 2d3c498c75..30f5d2d875 100644 --- a/go.mod +++ b/go.mod @@ -52,6 +52,7 @@ require ( github.com/juju/errors v1.0.0 github.com/lib/pq v1.10.9 github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5 + github.com/oapi-codegen/oapi-codegen/v2 v2.4.2-0.20250511160408-c8cf342fd5ea github.com/otiai10/copy v1.0.2 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pkg/errors v0.9.1 @@ -295,18 +296,27 @@ require ( github.com/cenkalti/backoff/v5 v5.0.2 // indirect github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect + github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect + github.com/getkin/kin-openapi v0.128.0 // indirect github.com/google/go-github/v66 v66.0.0 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/invopop/yaml v0.3.1 // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect + github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect + github.com/speakeasy-api/jsonpath v0.6.0 // indirect + github.com/speakeasy-api/openapi-overlay v0.10.2 // indirect github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect + github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/zeebo/errs v1.4.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/contrib/detectors/gcp v1.36.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.36.0 // indirect + golang.org/x/tools v0.33.0 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect k8s.io/controller-manager v0.33.0 // indirect sigs.k8s.io/randfill v1.0.0 // indirect diff --git a/go.sum b/go.sum index 53b85d84f4..fffd9e1c85 100644 --- a/go.sum +++ b/go.sum @@ -257,6 +257,9 @@ github.com/docker/cli v28.1.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvM github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= +github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= @@ -304,6 +307,8 @@ github.com/gammazero/deque v1.0.0 h1:LTmimT8H7bXkkCy6gZX7zNLtkbz4NdS2z8LZuor3j34 github.com/gammazero/deque v1.0.0/go.mod h1:iflpYvtGfM3U8S8j+sZEKIak3SAKYpA5/SQewgfXDKo= github.com/gammazero/workerpool v1.1.3 h1:WixN4xzukFoN0XSeXF6puqEqFTl2mECI9S6W44HWy9Q= github.com/gammazero/workerpool v1.1.3/go.mod h1:wPjyBLDbyKnUn2XwwyD3EEwo9dHutia9/fwNmSHWACc= +github.com/getkin/kin-openapi v0.128.0 h1:jqq3D9vC9pPq1dGcOCv7yOp1DaEe7c/T1vzcLbITSp4= +github.com/getkin/kin-openapi v0.128.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew= @@ -368,8 +373,9 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8Wd github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= 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/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= +github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:56xuuqnHyryaerycW3BfssRdxQstACi0Epw/yC5E2xM= github.com/go-xorm/xorm v0.7.9 h1:LZze6n1UvRmM5gpL9/U9Gucwqo6aWlFVlfcHKH10qA0= github.com/go-xorm/xorm v0.7.9/go.mod h1:XiVxrMMIhFkwSkh96BW7PACl7UhLtx2iJIHMdmjh5sQ= @@ -524,6 +530,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/jsonschema v0.7.0 h1:2vgQcBz1n256N+FpX3Jq7Y17AjYt46Ig3zIWyy770So= github.com/invopop/jsonschema v0.7.0/go.mod h1:O9uiLokuu0+MGFlyiaqtWxwqJm41/+8Nj0lD7A36YH0= +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/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= github.com/jackc/pgx v3.6.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -631,6 +639,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= @@ -650,11 +660,14 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oapi-codegen/oapi-codegen/v2 v2.4.2-0.20250511160408-c8cf342fd5ea h1:xBe5UepV2E8pY5ZVWD79CvGvhSUXGyM/TtSzM6YaPoE= +github.com/oapi-codegen/oapi-codegen/v2 v2.4.2-0.20250511160408-c8cf342fd5ea/go.mod h1:MzpDMJAaekegzq+m6G+OjGTq2J81ziHrMebiFc1XmZ0= github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852/go.mod h1:eqOVx5Vwu4gd2mmMZvVZsgIqNSaW3xxRThUJ0k/TPk4= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= @@ -696,6 +709,8 @@ github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= +github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -746,6 +761,7 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= @@ -758,6 +774,10 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY= github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M= +github.com/speakeasy-api/jsonpath v0.6.0 h1:IhtFOV9EbXplhyRqsVhHoBmmYjblIRh5D1/g8DHMXJ8= +github.com/speakeasy-api/jsonpath v0.6.0/go.mod h1:ymb2iSkyOycmzKwbEAYPJV/yi2rSmvBCLZJcyD+VVWw= +github.com/speakeasy-api/openapi-overlay v0.10.2 h1:VOdQ03eGKeiHnpb1boZCGm7x8Haj6gST0P3SGTX95GU= +github.com/speakeasy-api/openapi-overlay v0.10.2/go.mod h1:n0iOU7AqKpNFfEt6tq7qYITC4f0yzVVdFw0S7hukemg= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= @@ -802,6 +822,8 @@ github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.4 h1:cuiLzLnaMeBhRmEv00Lpk3tkYrcxpmbU81tAY4Dw0tc= github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/vmihailenco/go-tinylfu v0.2.2 h1:H1eiG6HM36iniK6+21n9LLpzx1G9R3DJa2UjUjbynsI= github.com/vmihailenco/go-tinylfu v0.2.2/go.mod h1:CutYi2Q9puTxfcolkliPq4npPuofg9N9t8JVrjzwa3Q= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -810,6 +832,8 @@ github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9 github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= +github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xanzy/go-gitlab v0.114.0 h1:0wQr/KBckwrZPfEMjRqpUz0HmsKKON9UhCYv9KDy19M= @@ -1174,6 +1198,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/hack/tools.go b/hack/tools.go new file mode 100644 index 0000000000..8615cb4c57 --- /dev/null +++ b/hack/tools.go @@ -0,0 +1,8 @@ +//go:build tools +// +build tools + +package tools + +import ( + _ "github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen" +) diff --git a/pkg/bulkAction/service/BulkUpdateService.go b/pkg/bulkAction/service/BulkUpdateService.go index 030f99be2c..2e34755b99 100644 --- a/pkg/bulkAction/service/BulkUpdateService.go +++ b/pkg/bulkAction/service/BulkUpdateService.go @@ -37,6 +37,7 @@ import ( bean6 "github.com/devtron-labs/devtron/pkg/auth/user/bean" bean2 "github.com/devtron-labs/devtron/pkg/bean" "github.com/devtron-labs/devtron/pkg/build/trigger" + "github.com/devtron-labs/devtron/pkg/bulkAction/adaptor" bean4 "github.com/devtron-labs/devtron/pkg/bulkAction/bean" "github.com/devtron-labs/devtron/pkg/bulkAction/utils" chartRepoRepository "github.com/devtron-labs/devtron/pkg/chartRepo/repository" @@ -70,15 +71,15 @@ type BulkUpdateService interface { FindBulkUpdateReadme(operation string) (response *bean4.BulkUpdateSeeExampleResponse, err error) GetBulkAppName(bulkUpdateRequest *bean4.BulkUpdatePayload) (*bean4.ImpactedObjectsResponse, error) ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error) - BulkUpdateDeploymentTemplate(bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.DeploymentTemplateBulkUpdateResponse - BulkUpdateConfigMap(bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse - BulkUpdateSecret(bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse - BulkUpdate(bulkUpdateRequest *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) (bulkUpdateResponse *bean4.BulkUpdateResponse) + BulkUpdateDeploymentTemplate(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.DeploymentTemplateBulkUpdateResponse + BulkUpdateConfigMap(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse + BulkUpdateSecret(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse + BulkUpdate(ctx context.Context, bulkUpdateRequest *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) (bulkUpdateResponse *bean4.BulkUpdateResponse) // BulkHibernate deprecated BulkHibernate(ctx context.Context, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token string, appObject string, envObject string) bool, userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error) BulkHibernateV1(ctx context.Context, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token string, appObject string, envObject string) bool, userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error) BulkUnHibernate(ctx context.Context, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token string, appObject string, envObject string) bool, userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error) - BulkDeploy(request *bean4.BulkApplicationForEnvironmentPayload, token string, checkAuthBatch func(token string, appObject []string, envObject []string) (map[string]bool, map[string]bool), userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationForEnvironmentResponse, error) + BulkDeploy(ctx *util2.RequestCtx, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthBatch func(token string, appObject []string, envObject []string) (map[string]bool, map[string]bool), userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationForEnvironmentResponse, error) BulkBuildTrigger(request *bean4.BulkApplicationForEnvironmentPayload, ctx context.Context, w http.ResponseWriter, token string, checkAuthForBulkActions func(token string, appObject string, envObject string) bool) (*bean4.BulkApplicationForEnvironmentResponse, error) GetBulkActionImpactedPipelinesAndWfs(dto *bean4.CdBulkActionRequestDto) ([]*pipelineConfig.Pipeline, []int, []int, error) @@ -125,7 +126,8 @@ func NewBulkUpdateServiceImpl(bulkUpdateRepository bulkUpdate.BulkUpdateReposito chartRefService chartRef.ChartRefService, deployedAppService deployedApp.DeployedAppService, cdPipelineEventPublishService out.CDPipelineEventPublishService, - ciHandlerService trigger.HandlerService) *BulkUpdateServiceImpl { + ciHandlerService trigger.HandlerService, +) *BulkUpdateServiceImpl { return &BulkUpdateServiceImpl{ bulkUpdateRepository: bulkUpdateRepository, logger: logger, @@ -384,7 +386,8 @@ func (impl BulkUpdateServiceImpl) ApplyJsonPatch(patch jsonpatch.Patch, target s } return string(modified), err } -func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.DeploymentTemplateBulkUpdateResponse { + +func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.DeploymentTemplateBulkUpdateResponse { deploymentTemplateBulkUpdateResponse := &bean4.DeploymentTemplateBulkUpdateResponse{} var appNameIncludes []string var appNameExcludes []string @@ -415,11 +418,16 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(bulkUpdatePayload } else { for _, chart := range charts { appDetailsByChart, _ := impl.bulkUpdateRepository.FindAppByChartId(chart.Id) + appId := appDetailsByChart.Id + if validationErr := impl.isBaseDTConfigUpdateAllowed(ctx, appId, userMetadata); validationErr != nil { + deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, adaptor.GetDeploymentTemplateBulkUpdateResponseForOneApp(appId, appDetailsByChart.AppName, 0, validationErr.Error())) + continue + } modifiedValuesYml, err := impl.ApplyJsonPatch(deploymentTemplatePatch, chart.Values) if err != nil { impl.logger.Errorw("error in applying JSON patch to chart.Values", "err", err) bulkUpdateFailedResponse := &bean4.DeploymentTemplateBulkUpdateResponseForOneApp{ - AppId: appDetailsByChart.Id, + AppId: appId, AppName: appDetailsByChart.AppName, Message: fmt.Sprintf("Error in applying JSON patch : %s", err.Error()), } @@ -429,7 +437,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(bulkUpdatePayload if err != nil { impl.logger.Errorw("error in applying JSON patch to GlobalOverride", "err", err) bulkUpdateFailedResponse := &bean4.DeploymentTemplateBulkUpdateResponseForOneApp{ - AppId: appDetailsByChart.Id, + AppId: appId, AppName: appDetailsByChart.AppName, Message: fmt.Sprintf("Error in applying JSON patch : %s", err.Error()), } @@ -439,14 +447,14 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(bulkUpdatePayload if err != nil { impl.logger.Errorw("error in bulk updating charts", "err", err) bulkUpdateFailedResponse := &bean4.DeploymentTemplateBulkUpdateResponseForOneApp{ - AppId: appDetailsByChart.Id, + AppId: appId, AppName: appDetailsByChart.AppName, Message: fmt.Sprintf("Error in updating in db : %s", err.Error()), } deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, bulkUpdateFailedResponse) } else { bulkUpdateSuccessResponse := &bean4.DeploymentTemplateBulkUpdateResponseForOneApp{ - AppId: appDetailsByChart.Id, + AppId: appId, AppName: appDetailsByChart.AppName, Message: "Updated Successfully", } @@ -472,7 +480,6 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(bulkUpdatePayload } } } - } } } @@ -490,11 +497,16 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(bulkUpdatePayload } else { for _, chartEnv := range chartsEnv { appDetailsByChart, _ := impl.bulkUpdateRepository.FindAppByChartEnvId(chartEnv.Id) + appId := appDetailsByChart.Id + if validationErr := impl.isEnvDTConfigUpdateAllowed(ctx, appId, envId, userMetadata); validationErr != nil { + deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, adaptor.GetDeploymentTemplateBulkUpdateResponseForOneApp(appId, appDetailsByChart.AppName, envId, validationErr.Error())) + continue + } modified, err := impl.ApplyJsonPatch(deploymentTemplatePatch, chartEnv.EnvOverrideValues) if err != nil { impl.logger.Errorw("error in applying JSON patch", "err", err) bulkUpdateFailedResponse := &bean4.DeploymentTemplateBulkUpdateResponseForOneApp{ - AppId: appDetailsByChart.Id, + AppId: appId, AppName: appDetailsByChart.AppName, EnvId: envId, Message: fmt.Sprintf("Error in applying JSON patch : %s", err.Error()), @@ -505,7 +517,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(bulkUpdatePayload if err != nil { impl.logger.Errorw("error in bulk updating charts", "err", err) bulkUpdateFailedResponse := &bean4.DeploymentTemplateBulkUpdateResponseForOneApp{ - AppId: appDetailsByChart.Id, + AppId: appId, AppName: appDetailsByChart.AppName, EnvId: envId, Message: fmt.Sprintf("Error in updating in db : %s", err.Error()), @@ -513,7 +525,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(bulkUpdatePayload deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, bulkUpdateFailedResponse) } else { bulkUpdateSuccessResponse := &bean4.DeploymentTemplateBulkUpdateResponseForOneApp{ - AppId: appDetailsByChart.Id, + AppId: appId, AppName: appDetailsByChart.AppName, EnvId: envId, Message: "Updated Successfully", @@ -549,7 +561,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(bulkUpdatePayload return deploymentTemplateBulkUpdateResponse } -func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse { +func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse { configMapBulkUpdateResponse := &bean4.CmAndSecretBulkUpdateResponse{} var appNameIncludes []string var appNameExcludes []string @@ -577,6 +589,13 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(bulkUpdatePayload *bean4.B configMapBulkUpdateResponse.Message = append(configMapBulkUpdateResponse.Message, "No matching apps to update globally") } else { for _, configMapAppModel := range configMapAppModels { + appId := configMapAppModel.AppId + appDetailsById, err := impl.appRepository.FindById(appId) + if err != nil { + impl.logger.Errorw("error in fetching app details by id", "appId", appId, "err", err) + configMapBulkUpdateResponse.Message = append(configMapBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps globally : %s", err.Error())) + continue + } configMapNames := gjson.Get(configMapAppModel.ConfigMapData, "maps.#.name") messageCmNamesMap := make(map[string][]string) for i, configMapName := range configMapNames.Array() { @@ -630,7 +649,6 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(bulkUpdatePayload *bean4.B } } if len(messageCmNamesMap) != 0 { - appDetailsById, _ := impl.appRepository.FindById(configMapAppModel.AppId) for key, value := range messageCmNamesMap { if key == "Updated Successfully" { bulkUpdateSuccessResponse := &bean4.CmAndSecretBulkUpdateResponseForOneApp{ @@ -754,7 +772,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(bulkUpdatePayload *bean4.B } return configMapBulkUpdateResponse } -func (impl BulkUpdateServiceImpl) BulkUpdateSecret(bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse { +func (impl BulkUpdateServiceImpl) BulkUpdateSecret(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse { secretBulkUpdateResponse := &bean4.CmAndSecretBulkUpdateResponse{} var appNameIncludes []string var appNameExcludes []string @@ -782,6 +800,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(bulkUpdatePayload *bean4.Bulk secretBulkUpdateResponse.Message = append(secretBulkUpdateResponse.Message, "No matching apps to update globally") } else { for _, secretAppModel := range secretAppModels { + appId := secretAppModel.AppId secretNames := gjson.Get(secretAppModel.SecretData, "secrets.#.name") messageSecretNamesMap := make(map[string][]string) for i, secretName := range secretNames.Array() { @@ -841,7 +860,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(bulkUpdatePayload *bean4.Bulk } } if len(messageSecretNamesMap) != 0 { - appDetailsById, _ := impl.appRepository.FindById(secretAppModel.AppId) + appDetailsById, _ := impl.appRepository.FindById(appId) for key, value := range messageSecretNamesMap { if key == "Updated Successfully" { bulkUpdateSuccessResponse := &bean4.CmAndSecretBulkUpdateResponseForOneApp{ @@ -880,6 +899,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(bulkUpdatePayload *bean4.Bulk secretBulkUpdateResponse.Message = append(secretBulkUpdateResponse.Message, fmt.Sprintf("No matching apps to update for envId : %d", envId)) } else { for _, secretEnvModel := range secretEnvModels { + appId := secretEnvModel.AppId secretNames := gjson.Get(secretEnvModel.SecretData, "secrets.#.name") messageSecretNamesMap := make(map[string][]string) for i, secretName := range secretNames.Array() { @@ -939,7 +959,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(bulkUpdatePayload *bean4.Bulk } } if len(messageSecretNamesMap) != 0 { - appDetailsById, _ := impl.appRepository.FindById(secretEnvModel.AppId) + appDetailsById, _ := impl.appRepository.FindById(appId) for key, value := range messageSecretNamesMap { if key == "Updated Successfully" { bulkUpdateSuccessResponse := &bean4.CmAndSecretBulkUpdateResponseForOneApp{ @@ -971,19 +991,19 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(bulkUpdatePayload *bean4.Bulk } return secretBulkUpdateResponse } -func (impl BulkUpdateServiceImpl) BulkUpdate(bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.BulkUpdateResponse { +func (impl BulkUpdateServiceImpl) BulkUpdate(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.BulkUpdateResponse { bulkUpdateResponse := &bean4.BulkUpdateResponse{} var deploymentTemplateBulkUpdateResponse *bean4.DeploymentTemplateBulkUpdateResponse var configMapBulkUpdateResponse *bean4.CmAndSecretBulkUpdateResponse var secretBulkUpdateResponse *bean4.CmAndSecretBulkUpdateResponse if bulkUpdatePayload.DeploymentTemplate != nil && bulkUpdatePayload.DeploymentTemplate.Spec != nil && bulkUpdatePayload.DeploymentTemplate.Spec.PatchJson != "" { - deploymentTemplateBulkUpdateResponse = impl.BulkUpdateDeploymentTemplate(bulkUpdatePayload, userMetadata) + deploymentTemplateBulkUpdateResponse = impl.BulkUpdateDeploymentTemplate(ctx, bulkUpdatePayload, userMetadata) } if bulkUpdatePayload.ConfigMap != nil && bulkUpdatePayload.ConfigMap.Spec != nil && len(bulkUpdatePayload.ConfigMap.Spec.Names) != 0 && bulkUpdatePayload.ConfigMap.Spec.PatchJson != "" { - configMapBulkUpdateResponse = impl.BulkUpdateConfigMap(bulkUpdatePayload, userMetadata) + configMapBulkUpdateResponse = impl.BulkUpdateConfigMap(ctx, bulkUpdatePayload, userMetadata) } if bulkUpdatePayload.Secret != nil && bulkUpdatePayload.Secret.Spec != nil && len(bulkUpdatePayload.Secret.Spec.Names) != 0 && bulkUpdatePayload.Secret.Spec.PatchJson != "" { - secretBulkUpdateResponse = impl.BulkUpdateSecret(bulkUpdatePayload, userMetadata) + secretBulkUpdateResponse = impl.BulkUpdateSecret(ctx, bulkUpdatePayload, userMetadata) } bulkUpdateResponse.DeploymentTemplate = deploymentTemplateBulkUpdateResponse @@ -992,24 +1012,37 @@ func (impl BulkUpdateServiceImpl) BulkUpdate(bulkUpdatePayload *bean4.BulkUpdate return bulkUpdateResponse } -func (impl BulkUpdateServiceImpl) BulkHibernate(ctx context.Context, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token string, appObject string, envObject string) bool, +func (impl BulkUpdateServiceImpl) BulkHibernate(ctx context.Context, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token, appObject, envObject string) bool, userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error) { + return impl.bulkHibernateCommon(request, ctx, util2.GetTokenFromContext(ctx), checkAuthForBulkActions, impl.deployedAppService.StopStartApp, userMetadata) +} + +// stopAppFunc is the signature for the function that triggers the hibernation operation. +type stopAppFunc func(ctx context.Context, req *bean5.StopAppRequest, userMetadata *bean6.UserMetadata) (int, error) + +// bulkHibernateCommon contains the common bulk-hibernate logic. +func (impl BulkUpdateServiceImpl) bulkHibernateCommon(request *bean4.BulkApplicationForEnvironmentPayload, ctx context.Context, token string, checkAuthForBulkActions func(token, appObject, envObject string) bool, stopApp stopAppFunc, userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error) { + // Fetch pipelines based on filters. var pipelines []*pipelineConfig.Pipeline var err error - if len(request.AppIdIncludes) > 0 { + switch { + case len(request.AppIdIncludes) > 0: pipelines, err = impl.pipelineRepository.FindActiveByInFilter(request.EnvId, request.AppIdIncludes) - } else if len(request.AppIdExcludes) > 0 { + case len(request.AppIdExcludes) > 0: pipelines, err = impl.pipelineRepository.FindActiveByNotFilter(request.EnvId, request.AppIdExcludes) - } else { + default: pipelines, err = impl.pipelineRepository.FindActiveByEnvId(request.EnvId) } if err != nil { impl.logger.Errorw("error in fetching pipelines", "envId", request.EnvId, "err", err) return nil, err } + + // Prepare a map to group responses by app. response := make(map[string]map[string]any) - var cdPipelineIds []int + // Collect pipeline IDs to fetch deployment types. + var cdPipelineIds []int for _, pipeline := range pipelines { cdPipelineIds = append(cdPipelineIds, pipeline.Id) } @@ -1018,80 +1051,88 @@ func (impl BulkUpdateServiceImpl) BulkHibernate(ctx context.Context, request *be impl.logger.Errorw("error in fetching deploymentTypes", "pipelineIds", cdPipelineIds, "err", err) return nil, err } + + // Process each pipeline. for _, pipeline := range pipelines { appKey := utils.GenerateIdentifierKey(pipeline.AppId, pipeline.App.AppName) pipelineKey := utils.GenerateIdentifierKey(pipeline.Id, pipeline.Name) + // Initialize group map for app if needed. if _, ok := response[appKey]; !ok { - pResponse := make(map[string]any) - pResponse[pipelineKey] = true //by default assuming that the operation is successful, if not so then we'll mark it as false - response[appKey] = pResponse + response[appKey] = map[string]any{pipelineKey: true} // default to success } + + // Authorization check using tokens. appObject := impl.enforcerUtil.GetAppRBACNameByAppId(pipeline.AppId) envObject := impl.enforcerUtil.GetEnvRBACNameByAppId(pipeline.AppId, pipeline.EnvironmentId) - isValidAuth := checkAuthForBulkActions(util2.GetTokenFromContext(ctx), appObject, envObject) - if !isValidAuth { - //skip hibernate for the app if user does not have access on that - pipelineResponse := response[appKey] - pipelineResponse[pipelineKey] = false - pipelineResponse[AuthorizationError] = true - response[appKey] = pipelineResponse + if !checkAuthForBulkActions(util2.GetTokenFromContext(ctx), appObject, envObject) { + resp := response[appKey] + resp[pipelineKey] = false + resp[AuthorizationError] = true + response[appKey] = resp continue } + + // Check deployment history: skip if already in target state. deploymentHistory := deploymentTypeMap[pipeline.Id] if deploymentHistory.DeploymentType == models.DEPLOYMENTTYPE_STOP { impl.logger.Infow("application already hibernated", "app_id", pipeline.AppId) - pipelineResponse := response[appKey] - pipelineResponse[pipelineKey] = false + resp := response[appKey] + resp[pipelineKey] = false if deploymentHistory.Status == argoApplication.HIBERNATING { - pipelineResponse[Skipped] = "Application is already hibernated" + resp[Skipped] = "Application is already hibernated" } else { - pipelineResponse[Skipped] = "Hibernation already in progress" + resp[Skipped] = "Hibernation already in progress" } - response[appKey] = pipelineResponse + response[appKey] = resp continue } - var hibernateReqError error - //if pipeline.DeploymentAppType == util.PIPELINE_DEPLOYMENT_TYPE_ACD { + stopRequest := &bean5.StopAppRequest{ AppId: pipeline.AppId, EnvironmentId: pipeline.EnvironmentId, UserId: request.UserId, RequestType: bean5.STOP, } - _, hibernateReqError = impl.deployedAppService.StopStartApp(ctx, stopRequest, userMetadata) + + // Calling the injected service function. + _, hibernateReqError := stopApp(ctx, stopRequest, userMetadata) if hibernateReqError != nil { impl.logger.Errorw("error in hibernating application", "err", hibernateReqError, "pipeline", pipeline) - pipelineResponse := response[appKey] - pipelineResponse[pipelineKey] = false - pipelineResponse[Error] = hibernateReqError.Error() - response[appKey] = pipelineResponse + resp := response[appKey] + resp[pipelineKey] = false + resp[Error] = hibernateReqError.Error() + response[appKey] = resp continue } } + + // Convert the response map into API response. var responseArray []map[string]interface{} for appKey, pipelineResponse := range response { appMap := make(map[string]interface{}) appKeySplit := strings.Split(appKey, "_") - appId := appKeySplit[0] - appName := strings.Join(appKeySplit[1:], "_") - appMap["id"] = appId - appMap["appName"] = appName + appMap["id"] = appKeySplit[0] + appMap["appName"] = strings.Join(appKeySplit[1:], "_") for key, value := range pipelineResponse { - if key == AuthorizationError { + switch key { + case AuthorizationError: appMap[AuthorizationError] = value - } else if key == Error { + case Error: appMap[Error] = value - } else if key == Skipped { + case Skipped: appMap[Skipped] = value - } else { + default: appMap["success"] = value } } responseArray = append(responseArray, appMap) } - bulkOperationResponse := &bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse{} - bulkOperationResponse.BulkApplicationForEnvironmentPayload = *request - bulkOperationResponse.Response = responseArray + + // Build and return the final response. + bulkOperationResponse := &bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse{ + BulkApplicationForEnvironmentPayload: *request, + Response: responseArray, + } return bulkOperationResponse, nil } @@ -1255,7 +1296,7 @@ func (impl BulkUpdateServiceImpl) BulkUnHibernate(ctx context.Context, request * return bulkOperationResponse, nil } -func (impl BulkUpdateServiceImpl) BulkDeploy(request *bean4.BulkApplicationForEnvironmentPayload, token string, checkAuthBatch func(token string, appObject []string, envObject []string) (map[string]bool, map[string]bool), +func (impl BulkUpdateServiceImpl) BulkDeploy(ctx *util2.RequestCtx, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthBatch func(token string, appObject []string, envObject []string) (map[string]bool, map[string]bool), userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationForEnvironmentResponse, error) { var pipelines []*pipelineConfig.Pipeline var err error @@ -1323,7 +1364,7 @@ func (impl BulkUpdateServiceImpl) BulkDeploy(request *bean4.BulkApplicationForEn appObjectArr = append(appObjectArr, object[0]) envObjectArr = append(envObjectArr, object[1]) } - appResults, envResults := checkAuthBatch(token, appObjectArr, envObjectArr) + appResults, envResults := checkAuthBatch(util2.GetTokenFromContext(ctx), appObjectArr, envObjectArr) //authorization block ends here response := make(map[string]map[string]bool) @@ -1352,7 +1393,6 @@ func (impl BulkUpdateServiceImpl) BulkDeploy(request *bean4.BulkApplicationForEn response[appKey] = pipelineResponse continue } - artifactsListingFilterOptions := &bean.ArtifactsListFilterOptions{ Limit: 10, Offset: 0, @@ -1365,6 +1405,7 @@ func (impl BulkUpdateServiceImpl) BulkDeploy(request *bean4.BulkApplicationForEn pipelineResponse := response[appKey] pipelineResponse[appKey] = false response[appKey] = pipelineResponse + continue } artifacts := artifactResponse.CiArtifacts diff --git a/pkg/bulkAction/service/BulkUpdateService_ent.go b/pkg/bulkAction/service/BulkUpdateService_ent.go index 6d7da4c498..f8344d8bda 100644 --- a/pkg/bulkAction/service/BulkUpdateService_ent.go +++ b/pkg/bulkAction/service/BulkUpdateService_ent.go @@ -2,11 +2,19 @@ package service import ( "context" - bean2 "github.com/devtron-labs/devtron/pkg/auth/user/bean" + userBean "github.com/devtron-labs/devtron/pkg/auth/user/bean" "github.com/devtron-labs/devtron/pkg/bulkAction/bean" ) +func (impl BulkUpdateServiceImpl) isEnvDTConfigUpdateAllowed(ctx context.Context, appId, envId int, userMetadata *userBean.UserMetadata) error { + return nil +} + +func (impl BulkUpdateServiceImpl) isBaseDTConfigUpdateAllowed(ctx context.Context, appId int, userMetadata *userBean.UserMetadata) error { + return nil +} + func (impl BulkUpdateServiceImpl) BulkHibernateV1(ctx context.Context, request *bean.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token string, appObject string, envObject string) bool, - userMetadata *bean2.UserMetadata) (*bean.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error) { + userMetadata *userBean.UserMetadata) (*bean.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error) { return nil, nil } diff --git a/specs/bulk_update.yaml b/specs/bulkEdit/v1beta1/bulk_update.yaml similarity index 91% rename from specs/bulk_update.yaml rename to specs/bulkEdit/v1beta1/bulk_update.yaml index 78de81d0ce..8f10e6dfc2 100644 --- a/specs/bulk_update.yaml +++ b/specs/bulkEdit/v1beta1/bulk_update.yaml @@ -113,36 +113,33 @@ components: BulkUpdateSeeExampleResponse: type: object required: - - Script + - script properties: resource: type: string description: Resource from url path, i.e. {apiVersion} & {kind} script: $ref: '#/components/schemas/BulkUpdateScript' - description: Input Script for bulk update readMe: type: string description: Readme for bulk update BulkUpdateScript: type: object + description: Input Script for bulk edit required: - - ApiVersion - - Kind - - Spec + - apiVersion + - kind + - spec properties: apiVersion: type: string - description: Api version from url - example: - - v1beta1 + enum: [ "batch/v1beta1" ] kind: type: string - description: Kind - example: - - application + enum: [ "Application" ] spec: $ref: '#/components/schemas/BulkUpdatePayload' + BulkUpdatePayload: type: object properties: @@ -154,44 +151,41 @@ components: type: array items: type: integer - description: All Env Id's for updating dependent apps + exclusiveMinimum: 0 + description: Array of Environment Ids of dependent apps global: type: boolean - description: Global flag for updating dependent apps - DeploymentTemplate: - $ref: '#/components/schemas/Tasks' - ConfigMaps: + description: Flag for updating base Configurations of dependent apps + deploymentTemplate: + $ref: '#/components/schemas/Spec' + configMap: type: object properties: + allOf: + $ref: '#/components/schemas/Spec' names: type: array items: type: string - description : Name of All ConfigMaps to be updated - tasks: - $ref: '#/components/schemas/Spec' - Secrets: + pattern: "^[a-z]+[a-z0-9\\-\\?]*[a-z0-9]+$" + description: Name of all ConfigMaps to be updated + secret: type: object properties: + allOf: + $ref: '#/components/schemas/Spec' names: type: array items: type: string - description : Name of All Secrets to be updated - tasks: - $ref: '#/components/schemas/Spec' - Tasks: - type: object - properties: - spec: - $ref: '#/components/schemas/Spec' - description: Spec of the Task + description: Name of all Secrets to be updated + Spec: type: object properties: patchData: type: string - description: string with details of the patch to be used for updating + description: String with details of the patch to be used for updating NameIncludesExcludes: type: object @@ -200,7 +194,8 @@ components: type: array items: type: string - description: All strings of app names to be included/excluded + pattern: "^[a-z%]+[a-z0-9%\\-\\?]*[a-z0-9%]+$" + description: Array of application names to be included ImpactedObjectsResponse: type: object properties: diff --git a/specs/bulkEdit/v1beta1/example.yml b/specs/bulkEdit/v1beta1/example.yml new file mode 100644 index 0000000000..cebb138013 --- /dev/null +++ b/specs/bulkEdit/v1beta1/example.yml @@ -0,0 +1,30 @@ +apiVersion: batch/v1beta1 +kind: Application +spec: + includes: + names: + - "%abc%" + - "%xyz%" + excludes: + names: + - "%abcd%" + - "%xyza%" + envIds: + - 23 + global: false + deploymentTemplate: + spec: + patchJson: '[{ "op": "add", "path": "/MaxSurge", "value": 1 },{"op": "replace","path":"/GracePeriod","value": "30"}]' + configMap: + spec: + names: + - "configmap1" + - "configmap2" + - "configmap3" + patchJson: '[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]' + secret: + spec: + names: + - "secret1" + - "secret2" + patchJson: '[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]' \ No newline at end of file diff --git a/specs/bulkEdit/v1beta1/schema.json b/specs/bulkEdit/v1beta1/schema.json new file mode 100644 index 0000000000..fd6d253e47 --- /dev/null +++ b/specs/bulkEdit/v1beta1/schema.json @@ -0,0 +1,126 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Bulk Edit Application batch/v1beta1 Schema", + "type": "object", + "description": "Input Script for bulk edit", + "required": [ + "apiVersion", + "kind", + "spec" + ], + "properties": { + "apiVersion": { + "const": "batch/v1beta1" + }, + "kind": { + "const": "Application" + }, + "spec": { + "type": "object", + "anyOf": [ + { + "required": [ + "deploymentTemplate" + ] + }, + { + "required": [ + "configMap" + ] + }, + { + "required": [ + "secret" + ] + } + ], + "properties": { + "includes": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-z%]+[a-z0-9%\\-\\?]*[a-z0-9%]+$" + }, + "description": "Array of application names to be included" + } + } + }, + "excludes": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-z%]+[a-z0-9%\\-\\?]*[a-z0-9%]+$" + }, + "description": "Array of application names to be excluded" + } + } + }, + "envIds": { + "type": "array", + "items": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "description": "Array of Environment Ids of dependent apps" + }, + "global": { + "type": "boolean", + "description": "Flag for updating base Configurations of dependent apps" + }, + "deploymentTemplate": { + "type": "object", + "properties": { + "spec": { + "type": "object", + "properties": { + "patchData": { + "type": "string", + "description": "String with details of the patch to be used for updating" + } + } + } + } + }, + "configMap": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-z]+[a-z0-9\\-\\?]*[a-z0-9]+$" + }, + "description": "Name of all ConfigMaps to be updated" + }, + "patchData": { + "type": "string", + "description": "String with details of the patch to be used for updating" + } + } + }, + "secret": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Name of all Secrets to be updated" + }, + "patchData": { + "type": "string", + "description": "String with details of the patch to be used for updating" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/util/HttpUtil.go b/util/HttpUtil.go index afe951cfaf..154a089c29 100644 --- a/util/HttpUtil.go +++ b/util/HttpUtil.go @@ -17,7 +17,6 @@ package util import ( - "context" "crypto/tls" "errors" "fmt" @@ -158,13 +157,3 @@ func getCertFileName() string { randomName := fmt.Sprintf("%v.crt", GetRandomName()) return randomName } - -func GetTokenFromContext(ctx context.Context) string { - token, _ := ctx.Value(TokenKey).(string) - return token -} - -func GetEmailFromContext(ctx context.Context) string { - email, _ := ctx.Value(EmailId).(string) - return email -} diff --git a/util/context-utils.go b/util/context-utils.go deleted file mode 100644 index f6472b5d71..0000000000 --- a/util/context-utils.go +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2024. Devtron Inc. - * - * 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. - */ - -package util - -import ( - "context" - "fmt" - "reflect" -) - -const ( - IsSuperAdminFlag = "isSuperAdmin" - UserId = "userId" -) - -func SetSuperAdminInContext(ctx context.Context, isSuperAdmin bool) context.Context { - ctx = context.WithValue(ctx, IsSuperAdminFlag, isSuperAdmin) - return ctx -} - -func GetIsSuperAdminFromContext(ctx context.Context) (bool, error) { - flag := ctx.Value(IsSuperAdminFlag) - - if flag != nil && reflect.TypeOf(flag).Kind() == reflect.Bool { - return flag.(bool), nil - } - return false, fmt.Errorf("context not valid, isSuperAdmin flag not set correctly %v", flag) -} - -// SetTokenInContext - Set token in context -// NOTE: In OSS we don't have the token embedded in ctx already. -// TODO: Support NewRequestCtx in OSS as well. -func SetTokenInContext(ctx context.Context, token string) context.Context { - return context.WithValue(ctx, "token", token) -} diff --git a/util/contextUtils.go b/util/contextUtils.go new file mode 100644 index 0000000000..2b9a317383 --- /dev/null +++ b/util/contextUtils.go @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2024. Devtron Inc. + * + * 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. + */ + +package util + +import ( + "context" + "fmt" + "k8s.io/utils/pointer" + "reflect" +) + +const IsSuperAdminFlag = "isSuperAdmin" +const Token = "token" +const UserId = "userId" +const UserEmailId = "emailId" +const DevtronToken = "devtronToken" + +func SetSuperAdminInContext(ctx context.Context, isSuperAdmin bool) context.Context { + ctx = context.WithValue(ctx, IsSuperAdminFlag, isSuperAdmin) + return ctx +} + +func GetIsSuperAdminFromContext(ctx context.Context) (bool, error) { + flag := ctx.Value(IsSuperAdminFlag) + + if flag != nil && reflect.TypeOf(flag).Kind() == reflect.Bool { + return flag.(bool), nil + } + return false, fmt.Errorf("context not valid, isSuperAdmin flag not set correctly %v", flag) +} + +// SetTokenInContext - Set token in context +// NOTE: In OSS we don't have the token embedded in ctx already. +func SetTokenInContext(ctx context.Context, token string) context.Context { + return context.WithValue(ctx, "token", token) +} + +// GetDevtronTokenFromContext returns the devtronToken if found +// else return token from the context +func GetDevtronTokenFromContext(ctx context.Context) (string, error) { + devtronToken := ctx.Value(DevtronToken) + if devtronToken != nil && reflect.TypeOf(devtronToken).Kind() == reflect.String { + return devtronToken.(string), nil + } + + token := ctx.Value(Token) + + if token != nil && reflect.TypeOf(token).Kind() == reflect.String { + return token.(string), nil + } + return "", fmt.Errorf("context not valid, token not set correctly %v", token) +} + +type RequestCtx struct { + token *string + userId *int32 + userEmailId *string + context.Context +} + +func NewRequestCtx(ctx context.Context) *RequestCtx { + return &RequestCtx{ + Context: ctx, + } +} + +func (r *RequestCtx) GetToken() string { + if r.token != nil { + return *r.token + } + tokenVal := r.Context.Value(Token) + if tokenVal != nil { + r.token = pointer.String(tokenVal.(string)) + return *r.token + } + return "" +} + +func (r *RequestCtx) SetToken(token *string) { + r.token = token +} + +func (r *RequestCtx) GetUserId() int32 { + if r.userId != nil { + return *r.userId + } + userIdVal := r.Context.Value(UserId) + if userIdVal != nil { + r.userId = pointer.Int32(userIdVal.(int32)) + return *r.userId + } + return 0 +} + +func (r *RequestCtx) GetUserEmailId() string { + if r.userEmailId != nil { + return *r.userEmailId + } + userEmailIdVal := r.Context.Value(UserEmailId) + if userEmailIdVal != nil { + r.userEmailId = pointer.String(userEmailIdVal.(string)) + return *r.userEmailId + } + return "" +} + +func GetEmailFromContext(ctx context.Context) string { + email, _ := ctx.Value(UserEmailId).(string) + return email +} + +func GetTokenFromContext(ctx context.Context) string { + token, _ := ctx.Value(Token).(string) + return token +} diff --git a/vendor/github.com/dprotaso/go-yit/.gitignore b/vendor/github.com/dprotaso/go-yit/.gitignore new file mode 100644 index 0000000000..21b201871f --- /dev/null +++ b/vendor/github.com/dprotaso/go-yit/.gitignore @@ -0,0 +1,15 @@ +# 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 +vendor/ diff --git a/vendor/github.com/dprotaso/go-yit/LICENSE b/vendor/github.com/dprotaso/go-yit/LICENSE new file mode 100644 index 0000000000..7412f1c6d9 --- /dev/null +++ b/vendor/github.com/dprotaso/go-yit/LICENSE @@ -0,0 +1,19 @@ +Copyright 2019 David Protasowski + +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/dprotaso/go-yit/README.md b/vendor/github.com/dprotaso/go-yit/README.md new file mode 100644 index 0000000000..28ebf14ec4 --- /dev/null +++ b/vendor/github.com/dprotaso/go-yit/README.md @@ -0,0 +1,54 @@ +# go-yit - YAML Iterator + +[![GoDoc](https://godoc.org/github.com/dprotaso/go-yit?status.svg)](https://godoc.org/github.com/dprotaso/go-yit) + +## Introduction + +This library compliments [go-yaml v3](https://github.com/go-yaml/yaml/tree/v3) by adding +functional style methods for iterating over YAML documents. + +## Usage + +Import the package +```go +import "github.com/dprotaso/go-yit" +``` + + +Query your YAML document +```go +package main + +import ( + "fmt" + "log" + + "github.com/dprotaso/go-yit" + "gopkg.in/yaml.v3" +) + +var data = ` +a: b +c: d +e: f +` + +func main() { + var doc yaml.Node + err := yaml.Unmarshal([]byte(data), &doc) + + if err != nil { + log.Fatalf("error: %v", err) + } + + it := yit.FromNode(&doc). + RecurseNodes(). + Filter(yit.WithKind(yaml.MappingNode)). + MapKeys() + + for node, ok := it(); ok; node, ok = it() { + fmt.Println(node.Value) + } +} +``` + diff --git a/vendor/github.com/dprotaso/go-yit/aggregates.go b/vendor/github.com/dprotaso/go-yit/aggregates.go new file mode 100644 index 0000000000..36de3cb321 --- /dev/null +++ b/vendor/github.com/dprotaso/go-yit/aggregates.go @@ -0,0 +1,25 @@ +package yit + +import "gopkg.in/yaml.v3" + +func (next Iterator) AnyMatch(p Predicate) bool { + iterator := next.Filter(p) + _, ok := iterator() + return ok +} + +func (next Iterator) AllMatch(p Predicate) bool { + result := true + for node, ok := next(); ok && result; node, ok = next() { + result = result && p(node) + } + + return result +} + +func (next Iterator) ToArray() (result []*yaml.Node) { + for node, ok := next(); ok; node, ok = next() { + result = append(result, node) + } + return +} diff --git a/vendor/github.com/dprotaso/go-yit/iterator.go b/vendor/github.com/dprotaso/go-yit/iterator.go new file mode 100644 index 0000000000..c117361864 --- /dev/null +++ b/vendor/github.com/dprotaso/go-yit/iterator.go @@ -0,0 +1,204 @@ +package yit + +import "gopkg.in/yaml.v3" + +type ( + Iterator func() (*yaml.Node, bool) + Predicate func(*yaml.Node) bool +) + +func FromNode(node *yaml.Node) Iterator { + return FromNodes(node) +} + +func FromNodes(nodes ...*yaml.Node) Iterator { + i := 0 + + return func() (node *yaml.Node, ok bool) { + ok = i < len(nodes) + if !ok { + return + } + + node = nodes[i] + i++ + + return + } +} + +func FromIterators(its ...Iterator) Iterator { + return func() (node *yaml.Node, ok bool) { + for { + if len(its) == 0 { + return + } + + next := its[0] + node, ok = next() + + if ok { + return + } + + its = its[1:] + } + } +} + +func (next Iterator) MapKeys() Iterator { + var content []*yaml.Node + + return func() (node *yaml.Node, ok bool) { + for { + if len(content) > 0 { + node = content[0] + content = content[2:] + ok = true + return + } + + var parent *yaml.Node + for parent, ok = next(); ok; parent, ok = next() { + if parent.Kind == yaml.MappingNode && len(parent.Content) > 0 { + break + } + } + + if !ok { + return + } + + content = parent.Content + } + } +} + +func (next Iterator) MapValues() Iterator { + var content []*yaml.Node + + return func() (node *yaml.Node, ok bool) { + for { + if len(content) > 0 { + node = content[1] + content = content[2:] + ok = true + return + } + + var parent *yaml.Node + for parent, ok = next(); ok; parent, ok = next() { + if parent.Kind == yaml.MappingNode && len(parent.Content) > 0 { + break + } + } + + if !ok { + return + } + + content = parent.Content + } + } +} + +func (next Iterator) ValuesForMap(keyPredicate, valuePredicate Predicate) Iterator { + var content []*yaml.Node + + return func() (node *yaml.Node, ok bool) { + for { + for len(content) > 0 { + key := content[0] + node = content[1] + content = content[2:] + + if ok = keyPredicate(key) && valuePredicate(node); ok { + return + } + } + + var parent *yaml.Node + for parent, ok = next(); ok; parent, ok = next() { + if parent.Kind == yaml.MappingNode && len(parent.Content) > 0 { + break + } + } + + if !ok { + return + } + + content = parent.Content + } + } +} + +func (next Iterator) RecurseNodes() Iterator { + var stack []*yaml.Node + + return func() (node *yaml.Node, ok bool) { + if len(stack) > 0 { + node = stack[len(stack)-1] + stack = stack[:len(stack)-1] + ok = true + } else { + node, ok = next() + if !ok { + return + } + } + + // iterate backwards so the iteration + // is predictable (for testing) + for i := len(node.Content) - 1; i >= 0; i-- { + stack = append(stack, node.Content[i]) + } + + return + } +} + +func (next Iterator) Filter(p Predicate) Iterator { + return func() (node *yaml.Node, ok bool) { + for node, ok = next(); ok; node, ok = next() { + if p(node) { + return + } + } + return + } +} + +func (next Iterator) Values() Iterator { + var content []*yaml.Node + + return func() (node *yaml.Node, ok bool) { + if len(content) > 0 { + node = content[0] + content = content[1:] + ok = true + return + } + + var parent *yaml.Node + for parent, ok = next(); ok; parent, ok = next() { + if len(parent.Content) > 0 { + break + } + } + + if !ok { + return + } + + content = parent.Content + node = content[0] + content = content[1:] + + return + } +} + +func (next Iterator) Iterate(op func(Iterator) Iterator) Iterator { + return op(next) +} diff --git a/vendor/github.com/dprotaso/go-yit/predicates.go b/vendor/github.com/dprotaso/go-yit/predicates.go new file mode 100644 index 0000000000..10589f27bc --- /dev/null +++ b/vendor/github.com/dprotaso/go-yit/predicates.go @@ -0,0 +1,117 @@ +package yit + +import ( + "strings" + + "gopkg.in/yaml.v3" +) + +var ( + All = func(node *yaml.Node) bool { + return true + } + + None = func(node *yaml.Node) bool { + return false + } + + StringValue = Intersect( + WithKind(yaml.ScalarNode), + WithShortTag("!!str"), + ) +) + +func Intersect(ps ...Predicate) Predicate { + return func(node *yaml.Node) bool { + for _, p := range ps { + if !p(node) { + return false + } + } + return true + } +} + +func Union(ps ...Predicate) Predicate { + return func(node *yaml.Node) bool { + for _, p := range ps { + if p(node) { + return true + } + } + return false + } +} + +func Negate(p Predicate) Predicate { + return func(node *yaml.Node) bool { + return !p(node) + } +} + +func WithStringValue(value string) Predicate { + return Intersect( + StringValue, + func(node *yaml.Node) bool { + return node.Value == value + }, + ) +} + +func WithShortTag(tag string) Predicate { + return func(node *yaml.Node) bool { + return node.ShortTag() == tag + } +} + +func WithValue(value string) Predicate { + return func(node *yaml.Node) bool { + return node.Value == value + } +} + +func WithKind(kind yaml.Kind) Predicate { + return func(node *yaml.Node) bool { + return node.Kind == kind + } +} + +func WithMapKey(key string) Predicate { + return func(node *yaml.Node) bool { + return FromNode(node).MapKeys().AnyMatch(WithValue(key)) + } +} + +func WithMapValue(value string) Predicate { + return func(node *yaml.Node) bool { + return FromNode(node).MapValues().AnyMatch(WithValue(value)) + } +} + +func WithMapKeyValue(keyPredicate, valuePredicate Predicate) Predicate { + return Intersect( + WithKind(yaml.MappingNode), + func(node *yaml.Node) bool { + for i := 0; i < len(node.Content); i += 2 { + key := node.Content[i] + value := node.Content[i+1] + if keyPredicate(key) && valuePredicate(value) { + return true + } + } + return false + }, + ) +} + +func WithPrefix(prefix string) Predicate { + return func(node *yaml.Node) bool { + return strings.HasPrefix(node.Value, prefix) + } +} + +func WithSuffix(suffix string) Predicate { + return func(node *yaml.Node) bool { + return strings.HasSuffix(node.Value, suffix) + } +} diff --git a/vendor/github.com/getkin/kin-openapi/LICENSE b/vendor/github.com/getkin/kin-openapi/LICENSE new file mode 100644 index 0000000000..992b9831e0 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017-2018 the project authors. + +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/getkin/kin-openapi/openapi3/callback.go b/vendor/github.com/getkin/kin-openapi/openapi3/callback.go new file mode 100644 index 0000000000..34a6bea351 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/callback.go @@ -0,0 +1,54 @@ +package openapi3 + +import ( + "context" + "sort" +) + +// Callback is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object +type Callback struct { + Extensions map[string]any `json:"-" yaml:"-"` + + m map[string]*PathItem +} + +// NewCallback builds a Callback object with path items in insertion order. +func NewCallback(opts ...NewCallbackOption) *Callback { + Callback := NewCallbackWithCapacity(len(opts)) + for _, opt := range opts { + opt(Callback) + } + return Callback +} + +// NewCallbackOption describes options to NewCallback func +type NewCallbackOption func(*Callback) + +// WithCallback adds Callback as an option to NewCallback +func WithCallback(cb string, pathItem *PathItem) NewCallbackOption { + return func(callback *Callback) { + if p := pathItem; p != nil && cb != "" { + callback.Set(cb, p) + } + } +} + +// Validate returns an error if Callback does not comply with the OpenAPI spec. +func (callback *Callback) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + keys := make([]string, 0, callback.Len()) + for key := range callback.Map() { + keys = append(keys, key) + } + sort.Strings(keys) + for _, key := range keys { + v := callback.Value(key) + if err := v.Validate(ctx); err != nil { + return err + } + } + + return validateExtensions(ctx, callback.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/components.go b/vendor/github.com/getkin/kin-openapi/openapi3/components.go new file mode 100644 index 0000000000..98c4b96c10 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/components.go @@ -0,0 +1,370 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "fmt" + "sort" + + "github.com/go-openapi/jsonpointer" +) + +type ( + Callbacks map[string]*CallbackRef + Examples map[string]*ExampleRef + Headers map[string]*HeaderRef + Links map[string]*LinkRef + ParametersMap map[string]*ParameterRef + RequestBodies map[string]*RequestBodyRef + ResponseBodies map[string]*ResponseRef + Schemas map[string]*SchemaRef + SecuritySchemes map[string]*SecuritySchemeRef +) + +// Components is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#components-object +type Components struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Schemas Schemas `json:"schemas,omitempty" yaml:"schemas,omitempty"` + Parameters ParametersMap `json:"parameters,omitempty" yaml:"parameters,omitempty"` + Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"` + RequestBodies RequestBodies `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"` + Responses ResponseBodies `json:"responses,omitempty" yaml:"responses,omitempty"` + SecuritySchemes SecuritySchemes `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"` + Examples Examples `json:"examples,omitempty" yaml:"examples,omitempty"` + Links Links `json:"links,omitempty" yaml:"links,omitempty"` + Callbacks Callbacks `json:"callbacks,omitempty" yaml:"callbacks,omitempty"` +} + +func NewComponents() Components { + return Components{} +} + +// MarshalJSON returns the JSON encoding of Components. +func (components Components) MarshalJSON() ([]byte, error) { + x, err := components.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Components. +func (components Components) MarshalYAML() (any, error) { + m := make(map[string]any, 9+len(components.Extensions)) + for k, v := range components.Extensions { + m[k] = v + } + if x := components.Schemas; len(x) != 0 { + m["schemas"] = x + } + if x := components.Parameters; len(x) != 0 { + m["parameters"] = x + } + if x := components.Headers; len(x) != 0 { + m["headers"] = x + } + if x := components.RequestBodies; len(x) != 0 { + m["requestBodies"] = x + } + if x := components.Responses; len(x) != 0 { + m["responses"] = x + } + if x := components.SecuritySchemes; len(x) != 0 { + m["securitySchemes"] = x + } + if x := components.Examples; len(x) != 0 { + m["examples"] = x + } + if x := components.Links; len(x) != 0 { + m["links"] = x + } + if x := components.Callbacks; len(x) != 0 { + m["callbacks"] = x + } + return m, nil +} + +// UnmarshalJSON sets Components to a copy of data. +func (components *Components) UnmarshalJSON(data []byte) error { + type ComponentsBis Components + var x ComponentsBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "schemas") + delete(x.Extensions, "parameters") + delete(x.Extensions, "headers") + delete(x.Extensions, "requestBodies") + delete(x.Extensions, "responses") + delete(x.Extensions, "securitySchemes") + delete(x.Extensions, "examples") + delete(x.Extensions, "links") + delete(x.Extensions, "callbacks") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *components = Components(x) + return nil +} + +// Validate returns an error if Components does not comply with the OpenAPI spec. +func (components *Components) Validate(ctx context.Context, opts ...ValidationOption) (err error) { + ctx = WithValidationOptions(ctx, opts...) + + schemas := make([]string, 0, len(components.Schemas)) + for name := range components.Schemas { + schemas = append(schemas, name) + } + sort.Strings(schemas) + for _, k := range schemas { + v := components.Schemas[k] + if err = ValidateIdentifier(k); err != nil { + return fmt.Errorf("schema %q: %w", k, err) + } + if err = v.Validate(ctx); err != nil { + return fmt.Errorf("schema %q: %w", k, err) + } + } + + parameters := make([]string, 0, len(components.Parameters)) + for name := range components.Parameters { + parameters = append(parameters, name) + } + sort.Strings(parameters) + for _, k := range parameters { + v := components.Parameters[k] + if err = ValidateIdentifier(k); err != nil { + return fmt.Errorf("parameter %q: %w", k, err) + } + if err = v.Validate(ctx); err != nil { + return fmt.Errorf("parameter %q: %w", k, err) + } + } + + requestBodies := make([]string, 0, len(components.RequestBodies)) + for name := range components.RequestBodies { + requestBodies = append(requestBodies, name) + } + sort.Strings(requestBodies) + for _, k := range requestBodies { + v := components.RequestBodies[k] + if err = ValidateIdentifier(k); err != nil { + return fmt.Errorf("request body %q: %w", k, err) + } + if err = v.Validate(ctx); err != nil { + return fmt.Errorf("request body %q: %w", k, err) + } + } + + responses := make([]string, 0, len(components.Responses)) + for name := range components.Responses { + responses = append(responses, name) + } + sort.Strings(responses) + for _, k := range responses { + if err = ValidateIdentifier(k); err != nil { + return fmt.Errorf("response %q: %w", k, err) + } + v := components.Responses[k] + if err = v.Validate(ctx); err != nil { + return fmt.Errorf("response %q: %w", k, err) + } + } + + headers := make([]string, 0, len(components.Headers)) + for name := range components.Headers { + headers = append(headers, name) + } + sort.Strings(headers) + for _, k := range headers { + v := components.Headers[k] + if err = ValidateIdentifier(k); err != nil { + return fmt.Errorf("header %q: %w", k, err) + } + if err = v.Validate(ctx); err != nil { + return fmt.Errorf("header %q: %w", k, err) + } + } + + securitySchemes := make([]string, 0, len(components.SecuritySchemes)) + for name := range components.SecuritySchemes { + securitySchemes = append(securitySchemes, name) + } + sort.Strings(securitySchemes) + for _, k := range securitySchemes { + v := components.SecuritySchemes[k] + if err = ValidateIdentifier(k); err != nil { + return fmt.Errorf("security scheme %q: %w", k, err) + } + if err = v.Validate(ctx); err != nil { + return fmt.Errorf("security scheme %q: %w", k, err) + } + } + + examples := make([]string, 0, len(components.Examples)) + for name := range components.Examples { + examples = append(examples, name) + } + sort.Strings(examples) + for _, k := range examples { + v := components.Examples[k] + if err = ValidateIdentifier(k); err != nil { + return fmt.Errorf("example %q: %w", k, err) + } + if err = v.Validate(ctx); err != nil { + return fmt.Errorf("example %q: %w", k, err) + } + } + + links := make([]string, 0, len(components.Links)) + for name := range components.Links { + links = append(links, name) + } + sort.Strings(links) + for _, k := range links { + v := components.Links[k] + if err = ValidateIdentifier(k); err != nil { + return fmt.Errorf("link %q: %w", k, err) + } + if err = v.Validate(ctx); err != nil { + return fmt.Errorf("link %q: %w", k, err) + } + } + + callbacks := make([]string, 0, len(components.Callbacks)) + for name := range components.Callbacks { + callbacks = append(callbacks, name) + } + sort.Strings(callbacks) + for _, k := range callbacks { + v := components.Callbacks[k] + if err = ValidateIdentifier(k); err != nil { + return fmt.Errorf("callback %q: %w", k, err) + } + if err = v.Validate(ctx); err != nil { + return fmt.Errorf("callback %q: %w", k, err) + } + } + + return validateExtensions(ctx, components.Extensions) +} + +var _ jsonpointer.JSONPointable = (*Schemas)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (m Schemas) JSONLookup(token string) (any, error) { + if v, ok := m[token]; !ok || v == nil { + return nil, fmt.Errorf("no schema %q", token) + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + return v.Value, nil + } +} + +var _ jsonpointer.JSONPointable = (*ParametersMap)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (m ParametersMap) JSONLookup(token string) (any, error) { + if v, ok := m[token]; !ok || v == nil { + return nil, fmt.Errorf("no parameter %q", token) + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + return v.Value, nil + } +} + +var _ jsonpointer.JSONPointable = (*Headers)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (m Headers) JSONLookup(token string) (any, error) { + if v, ok := m[token]; !ok || v == nil { + return nil, fmt.Errorf("no header %q", token) + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + return v.Value, nil + } +} + +var _ jsonpointer.JSONPointable = (*RequestBodyRef)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (m RequestBodies) JSONLookup(token string) (any, error) { + if v, ok := m[token]; !ok || v == nil { + return nil, fmt.Errorf("no request body %q", token) + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + return v.Value, nil + } +} + +var _ jsonpointer.JSONPointable = (*ResponseRef)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (m ResponseBodies) JSONLookup(token string) (any, error) { + if v, ok := m[token]; !ok || v == nil { + return nil, fmt.Errorf("no response body %q", token) + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + return v.Value, nil + } +} + +var _ jsonpointer.JSONPointable = (*SecuritySchemes)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (m SecuritySchemes) JSONLookup(token string) (any, error) { + if v, ok := m[token]; !ok || v == nil { + return nil, fmt.Errorf("no security scheme body %q", token) + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + return v.Value, nil + } +} + +var _ jsonpointer.JSONPointable = (*Examples)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (m Examples) JSONLookup(token string) (any, error) { + if v, ok := m[token]; !ok || v == nil { + return nil, fmt.Errorf("no example body %q", token) + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + return v.Value, nil + } +} + +var _ jsonpointer.JSONPointable = (*Links)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (m Links) JSONLookup(token string) (any, error) { + if v, ok := m[token]; !ok || v == nil { + return nil, fmt.Errorf("no link body %q", token) + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + return v.Value, nil + } +} + +var _ jsonpointer.JSONPointable = (*Callbacks)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (m Callbacks) JSONLookup(token string) (any, error) { + if v, ok := m[token]; !ok || v == nil { + return nil, fmt.Errorf("no callback body %q", token) + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + return v.Value, nil + } +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/contact.go b/vendor/github.com/getkin/kin-openapi/openapi3/contact.go new file mode 100644 index 0000000000..6c76a6fb6f --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/contact.go @@ -0,0 +1,68 @@ +package openapi3 + +import ( + "context" + "encoding/json" +) + +// Contact is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#contact-object +type Contact struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + URL string `json:"url,omitempty" yaml:"url,omitempty"` + Email string `json:"email,omitempty" yaml:"email,omitempty"` +} + +// MarshalJSON returns the JSON encoding of Contact. +func (contact Contact) MarshalJSON() ([]byte, error) { + x, err := contact.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Contact. +func (contact Contact) MarshalYAML() (any, error) { + m := make(map[string]any, 3+len(contact.Extensions)) + for k, v := range contact.Extensions { + m[k] = v + } + if x := contact.Name; x != "" { + m["name"] = x + } + if x := contact.URL; x != "" { + m["url"] = x + } + if x := contact.Email; x != "" { + m["email"] = x + } + return m, nil +} + +// UnmarshalJSON sets Contact to a copy of data. +func (contact *Contact) UnmarshalJSON(data []byte) error { + type ContactBis Contact + var x ContactBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "name") + delete(x.Extensions, "url") + delete(x.Extensions, "email") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *contact = Contact(x) + return nil +} + +// Validate returns an error if Contact does not comply with the OpenAPI spec. +func (contact *Contact) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + return validateExtensions(ctx, contact.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/content.go b/vendor/github.com/getkin/kin-openapi/openapi3/content.go new file mode 100644 index 0000000000..81b070eecc --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/content.go @@ -0,0 +1,124 @@ +package openapi3 + +import ( + "context" + "sort" + "strings" +) + +// Content is specified by OpenAPI/Swagger 3.0 standard. +type Content map[string]*MediaType + +func NewContent() Content { + return make(map[string]*MediaType) +} + +func NewContentWithSchema(schema *Schema, consumes []string) Content { + if len(consumes) == 0 { + return Content{ + "*/*": NewMediaType().WithSchema(schema), + } + } + content := make(map[string]*MediaType, len(consumes)) + for _, mediaType := range consumes { + content[mediaType] = NewMediaType().WithSchema(schema) + } + return content +} + +func NewContentWithSchemaRef(schema *SchemaRef, consumes []string) Content { + if len(consumes) == 0 { + return Content{ + "*/*": NewMediaType().WithSchemaRef(schema), + } + } + content := make(map[string]*MediaType, len(consumes)) + for _, mediaType := range consumes { + content[mediaType] = NewMediaType().WithSchemaRef(schema) + } + return content +} + +func NewContentWithJSONSchema(schema *Schema) Content { + return Content{ + "application/json": NewMediaType().WithSchema(schema), + } +} +func NewContentWithJSONSchemaRef(schema *SchemaRef) Content { + return Content{ + "application/json": NewMediaType().WithSchemaRef(schema), + } +} + +func NewContentWithFormDataSchema(schema *Schema) Content { + return Content{ + "multipart/form-data": NewMediaType().WithSchema(schema), + } +} + +func NewContentWithFormDataSchemaRef(schema *SchemaRef) Content { + return Content{ + "multipart/form-data": NewMediaType().WithSchemaRef(schema), + } +} + +func (content Content) Get(mime string) *MediaType { + // If the mime is empty then short-circuit to the wildcard. + // We do this here so that we catch only the specific case of + // and empty mime rather than a present, but invalid, mime type. + if mime == "" { + return content["*/*"] + } + // Start by making the most specific match possible + // by using the mime type in full. + if v := content[mime]; v != nil { + return v + } + // If an exact match is not found then we strip all + // metadata from the mime type and only use the x/y + // portion. + i := strings.IndexByte(mime, ';') + if i < 0 { + // If there is no metadata then preserve the full mime type + // string for later wildcard searches. + i = len(mime) + } + mime = mime[:i] + if v := content[mime]; v != nil { + return v + } + // If the x/y pattern has no specific match then we + // try the x/* pattern. + i = strings.IndexByte(mime, '/') + if i < 0 { + // In the case that the given mime type is not valid because it is + // missing the subtype we return nil so that this does not accidentally + // resolve with the wildcard. + return nil + } + mime = mime[:i] + "/*" + if v := content[mime]; v != nil { + return v + } + // Finally, the most generic match of */* is returned + // as a catch-all. + return content["*/*"] +} + +// Validate returns an error if Content does not comply with the OpenAPI spec. +func (content Content) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + keys := make([]string, 0, len(content)) + for key := range content { + keys = append(keys, key) + } + sort.Strings(keys) + for _, k := range keys { + v := content[k] + if err := v.Validate(ctx); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/discriminator.go b/vendor/github.com/getkin/kin-openapi/openapi3/discriminator.go new file mode 100644 index 0000000000..e8193bd906 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/discriminator.go @@ -0,0 +1,61 @@ +package openapi3 + +import ( + "context" + "encoding/json" +) + +// Discriminator is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminator-object +type Discriminator struct { + Extensions map[string]any `json:"-" yaml:"-"` + + PropertyName string `json:"propertyName" yaml:"propertyName"` // required + Mapping map[string]string `json:"mapping,omitempty" yaml:"mapping,omitempty"` +} + +// MarshalJSON returns the JSON encoding of Discriminator. +func (discriminator Discriminator) MarshalJSON() ([]byte, error) { + x, err := discriminator.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Discriminator. +func (discriminator Discriminator) MarshalYAML() (any, error) { + m := make(map[string]any, 2+len(discriminator.Extensions)) + for k, v := range discriminator.Extensions { + m[k] = v + } + m["propertyName"] = discriminator.PropertyName + if x := discriminator.Mapping; len(x) != 0 { + m["mapping"] = x + } + return m, nil +} + +// UnmarshalJSON sets Discriminator to a copy of data. +func (discriminator *Discriminator) UnmarshalJSON(data []byte) error { + type DiscriminatorBis Discriminator + var x DiscriminatorBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "propertyName") + delete(x.Extensions, "mapping") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *discriminator = Discriminator(x) + return nil +} + +// Validate returns an error if Discriminator does not comply with the OpenAPI spec. +func (discriminator *Discriminator) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + return validateExtensions(ctx, discriminator.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/doc.go b/vendor/github.com/getkin/kin-openapi/openapi3/doc.go new file mode 100644 index 0000000000..41c9965c6d --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/doc.go @@ -0,0 +1,4 @@ +// Package openapi3 parses and writes OpenAPI 3 specification documents. +// +// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md +package openapi3 diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/encoding.go b/vendor/github.com/getkin/kin-openapi/openapi3/encoding.go new file mode 100644 index 0000000000..1bcdaea5e5 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/encoding.go @@ -0,0 +1,148 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "fmt" + "sort" +) + +// Encoding is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#encoding-object +type Encoding struct { + Extensions map[string]any `json:"-" yaml:"-"` + + ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"` + Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"` + Style string `json:"style,omitempty" yaml:"style,omitempty"` + Explode *bool `json:"explode,omitempty" yaml:"explode,omitempty"` + AllowReserved bool `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"` +} + +func NewEncoding() *Encoding { + return &Encoding{} +} + +func (encoding *Encoding) WithHeader(name string, header *Header) *Encoding { + return encoding.WithHeaderRef(name, &HeaderRef{ + Value: header, + }) +} + +func (encoding *Encoding) WithHeaderRef(name string, ref *HeaderRef) *Encoding { + headers := encoding.Headers + if headers == nil { + headers = make(map[string]*HeaderRef) + encoding.Headers = headers + } + headers[name] = ref + return encoding +} + +// MarshalJSON returns the JSON encoding of Encoding. +func (encoding Encoding) MarshalJSON() ([]byte, error) { + x, err := encoding.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Encoding. +func (encoding Encoding) MarshalYAML() (any, error) { + m := make(map[string]any, 5+len(encoding.Extensions)) + for k, v := range encoding.Extensions { + m[k] = v + } + if x := encoding.ContentType; x != "" { + m["contentType"] = x + } + if x := encoding.Headers; len(x) != 0 { + m["headers"] = x + } + if x := encoding.Style; x != "" { + m["style"] = x + } + if x := encoding.Explode; x != nil { + m["explode"] = x + } + if x := encoding.AllowReserved; x { + m["allowReserved"] = x + } + return m, nil +} + +// UnmarshalJSON sets Encoding to a copy of data. +func (encoding *Encoding) UnmarshalJSON(data []byte) error { + type EncodingBis Encoding + var x EncodingBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "contentType") + delete(x.Extensions, "headers") + delete(x.Extensions, "style") + delete(x.Extensions, "explode") + delete(x.Extensions, "allowReserved") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *encoding = Encoding(x) + return nil +} + +// SerializationMethod returns a serialization method of request body. +// When serialization method is not defined the method returns the default serialization method. +func (encoding *Encoding) SerializationMethod() *SerializationMethod { + sm := &SerializationMethod{Style: SerializationForm, Explode: true} + if encoding != nil { + if encoding.Style != "" { + sm.Style = encoding.Style + } + if encoding.Explode != nil { + sm.Explode = *encoding.Explode + } + } + return sm +} + +// Validate returns an error if Encoding does not comply with the OpenAPI spec. +func (encoding *Encoding) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if encoding == nil { + return nil + } + + headers := make([]string, 0, len(encoding.Headers)) + for k := range encoding.Headers { + headers = append(headers, k) + } + sort.Strings(headers) + for _, k := range headers { + v := encoding.Headers[k] + if err := ValidateIdentifier(k); err != nil { + return nil + } + if err := v.Validate(ctx); err != nil { + return nil + } + } + + // Validate a media types's serialization method. + sm := encoding.SerializationMethod() + switch { + case sm.Style == SerializationForm && sm.Explode, + sm.Style == SerializationForm && !sm.Explode, + sm.Style == SerializationSpaceDelimited && sm.Explode, + sm.Style == SerializationSpaceDelimited && !sm.Explode, + sm.Style == SerializationPipeDelimited && sm.Explode, + sm.Style == SerializationPipeDelimited && !sm.Explode, + sm.Style == SerializationDeepObject && sm.Explode: + default: + return fmt.Errorf("serialization method with style=%q and explode=%v is not supported by media type", sm.Style, sm.Explode) + } + + return validateExtensions(ctx, encoding.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/errors.go b/vendor/github.com/getkin/kin-openapi/openapi3/errors.go new file mode 100644 index 0000000000..010dc889aa --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/errors.go @@ -0,0 +1,59 @@ +package openapi3 + +import ( + "bytes" + "errors" +) + +// MultiError is a collection of errors, intended for when +// multiple issues need to be reported upstream +type MultiError []error + +func (me MultiError) Error() string { + return spliceErr(" | ", me) +} + +func spliceErr(sep string, errs []error) string { + buff := &bytes.Buffer{} + for i, e := range errs { + buff.WriteString(e.Error()) + if i != len(errs)-1 { + buff.WriteString(sep) + } + } + return buff.String() +} + +// Is allows you to determine if a generic error is in fact a MultiError using `errors.Is()` +// It will also return true if any of the contained errors match target +func (me MultiError) Is(target error) bool { + if _, ok := target.(MultiError); ok { + return true + } + for _, e := range me { + if errors.Is(e, target) { + return true + } + } + return false +} + +// As allows you to use `errors.As()` to set target to the first error within the multi error that matches the target type +func (me MultiError) As(target any) bool { + for _, e := range me { + if errors.As(e, target) { + return true + } + } + return false +} + +type multiErrorForOneOf MultiError + +func (meo multiErrorForOneOf) Error() string { + return spliceErr(" Or ", meo) +} + +func (meo multiErrorForOneOf) Unwrap() error { + return MultiError(meo) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/example.go b/vendor/github.com/getkin/kin-openapi/openapi3/example.go new file mode 100644 index 0000000000..f9a7a6b074 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/example.go @@ -0,0 +1,85 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" +) + +// Example is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object +type Example struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Value any `json:"value,omitempty" yaml:"value,omitempty"` + ExternalValue string `json:"externalValue,omitempty" yaml:"externalValue,omitempty"` +} + +func NewExample(value any) *Example { + return &Example{Value: value} +} + +// MarshalJSON returns the JSON encoding of Example. +func (example Example) MarshalJSON() ([]byte, error) { + x, err := example.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Example. +func (example Example) MarshalYAML() (any, error) { + m := make(map[string]any, 4+len(example.Extensions)) + for k, v := range example.Extensions { + m[k] = v + } + if x := example.Summary; x != "" { + m["summary"] = x + } + if x := example.Description; x != "" { + m["description"] = x + } + if x := example.Value; x != nil { + m["value"] = x + } + if x := example.ExternalValue; x != "" { + m["externalValue"] = x + } + return m, nil +} + +// UnmarshalJSON sets Example to a copy of data. +func (example *Example) UnmarshalJSON(data []byte) error { + type ExampleBis Example + var x ExampleBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "summary") + delete(x.Extensions, "description") + delete(x.Extensions, "value") + delete(x.Extensions, "externalValue") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *example = Example(x) + return nil +} + +// Validate returns an error if Example does not comply with the OpenAPI spec. +func (example *Example) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if example.Value != nil && example.ExternalValue != "" { + return errors.New("value and externalValue are mutually exclusive") + } + if example.Value == nil && example.ExternalValue == "" { + return errors.New("no value or externalValue field") + } + + return validateExtensions(ctx, example.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/example_validation.go b/vendor/github.com/getkin/kin-openapi/openapi3/example_validation.go new file mode 100644 index 0000000000..0d105c92db --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/example_validation.go @@ -0,0 +1,16 @@ +package openapi3 + +import "context" + +func validateExampleValue(ctx context.Context, input any, schema *Schema) error { + opts := make([]SchemaValidationOption, 0, 2) + + if vo := getValidationOptions(ctx); vo.examplesValidationAsReq { + opts = append(opts, VisitAsRequest()) + } else if vo.examplesValidationAsRes { + opts = append(opts, VisitAsResponse()) + } + opts = append(opts, MultiErrors()) + + return schema.VisitJSON(input, opts...) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/extension.go b/vendor/github.com/getkin/kin-openapi/openapi3/extension.go new file mode 100644 index 0000000000..ca86078f2f --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/extension.go @@ -0,0 +1,32 @@ +package openapi3 + +import ( + "context" + "fmt" + "sort" + "strings" +) + +func validateExtensions(ctx context.Context, extensions map[string]any) error { // FIXME: newtype + Validate(...) + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + + var unknowns []string + for k := range extensions { + if strings.HasPrefix(k, "x-") { + continue + } + if allowed != nil { + if _, ok := allowed[k]; ok { + continue + } + } + unknowns = append(unknowns, k) + } + + if len(unknowns) != 0 { + sort.Strings(unknowns) + return fmt.Errorf("extra sibling fields: %+v", unknowns) + } + + return nil +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/external_docs.go b/vendor/github.com/getkin/kin-openapi/openapi3/external_docs.go new file mode 100644 index 0000000000..bd99511a5a --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/external_docs.go @@ -0,0 +1,73 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "net/url" +) + +// ExternalDocs is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#external-documentation-object +type ExternalDocs struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + URL string `json:"url,omitempty" yaml:"url,omitempty"` +} + +// MarshalJSON returns the JSON encoding of ExternalDocs. +func (e ExternalDocs) MarshalJSON() ([]byte, error) { + x, err := e.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of ExternalDocs. +func (e ExternalDocs) MarshalYAML() (any, error) { + m := make(map[string]any, 2+len(e.Extensions)) + for k, v := range e.Extensions { + m[k] = v + } + if x := e.Description; x != "" { + m["description"] = x + } + if x := e.URL; x != "" { + m["url"] = x + } + return m, nil +} + +// UnmarshalJSON sets ExternalDocs to a copy of data. +func (e *ExternalDocs) UnmarshalJSON(data []byte) error { + type ExternalDocsBis ExternalDocs + var x ExternalDocsBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "description") + delete(x.Extensions, "url") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *e = ExternalDocs(x) + return nil +} + +// Validate returns an error if ExternalDocs does not comply with the OpenAPI spec. +func (e *ExternalDocs) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if e.URL == "" { + return errors.New("url is required") + } + if _, err := url.Parse(e.URL); err != nil { + return fmt.Errorf("url is incorrect: %w", err) + } + + return validateExtensions(ctx, e.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/header.go b/vendor/github.com/getkin/kin-openapi/openapi3/header.go new file mode 100644 index 0000000000..dc542874d1 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/header.go @@ -0,0 +1,96 @@ +package openapi3 + +import ( + "context" + "errors" + "fmt" + + "github.com/go-openapi/jsonpointer" +) + +// Header is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#header-object +type Header struct { + Parameter +} + +var _ jsonpointer.JSONPointable = (*Header)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (header Header) JSONLookup(token string) (any, error) { + return header.Parameter.JSONLookup(token) +} + +// MarshalJSON returns the JSON encoding of Header. +func (header Header) MarshalJSON() ([]byte, error) { + return header.Parameter.MarshalJSON() +} + +// UnmarshalJSON sets Header to a copy of data. +func (header *Header) UnmarshalJSON(data []byte) error { + return header.Parameter.UnmarshalJSON(data) +} + +// MarshalYAML returns the JSON encoding of Header. +func (header Header) MarshalYAML() (any, error) { + return header.Parameter, nil +} + +// SerializationMethod returns a header's serialization method. +func (header *Header) SerializationMethod() (*SerializationMethod, error) { + style := header.Style + if style == "" { + style = SerializationSimple + } + explode := false + if header.Explode != nil { + explode = *header.Explode + } + return &SerializationMethod{Style: style, Explode: explode}, nil +} + +// Validate returns an error if Header does not comply with the OpenAPI spec. +func (header *Header) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if header.Name != "" { + return errors.New("header 'name' MUST NOT be specified, it is given in the corresponding headers map") + } + if header.In != "" { + return errors.New("header 'in' MUST NOT be specified, it is implicitly in header") + } + + // Validate a parameter's serialization method. + sm, err := header.SerializationMethod() + if err != nil { + return err + } + if smSupported := false || + sm.Style == SerializationSimple && !sm.Explode || + sm.Style == SerializationSimple && sm.Explode; !smSupported { + e := fmt.Errorf("serialization method with style=%q and explode=%v is not supported by a header parameter", sm.Style, sm.Explode) + return fmt.Errorf("header schema is invalid: %w", e) + } + + if (header.Schema == nil) == (len(header.Content) == 0) { + e := fmt.Errorf("parameter must contain exactly one of content and schema: %v", header) + return fmt.Errorf("header schema is invalid: %w", e) + } + if schema := header.Schema; schema != nil { + if err := schema.Validate(ctx); err != nil { + return fmt.Errorf("header schema is invalid: %w", err) + } + } + + if content := header.Content; content != nil { + e := errors.New("parameter content must only contain one entry") + if len(content) > 1 { + return fmt.Errorf("header content is invalid: %w", e) + } + + if err := content.Validate(ctx); err != nil { + return fmt.Errorf("header content is invalid: %w", err) + } + } + return nil +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/helpers.go b/vendor/github.com/getkin/kin-openapi/openapi3/helpers.go new file mode 100644 index 0000000000..d50b3d8475 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/helpers.go @@ -0,0 +1,261 @@ +package openapi3 + +import ( + "fmt" + "net/url" + "path" + "reflect" + "regexp" + "sort" + "strings" + + "github.com/go-openapi/jsonpointer" +) + +const identifierChars = `a-zA-Z0-9._-` + +// IdentifierRegExp verifies whether Component object key matches contains just 'identifierChars', according to OpenAPI v3.x. +// InvalidIdentifierCharRegExp matches all characters not contained in 'identifierChars'. +// However, to be able supporting legacy OpenAPI v2.x, there is a need to customize above pattern in order not to fail +// converted v2-v3 validation +var ( + IdentifierRegExp = regexp.MustCompile(`^[` + identifierChars + `]+$`) + InvalidIdentifierCharRegExp = regexp.MustCompile(`[^` + identifierChars + `]`) +) + +// ValidateIdentifier returns an error if the given component name does not match [IdentifierRegExp]. +func ValidateIdentifier(value string) error { + if IdentifierRegExp.MatchString(value) { + return nil + } + return fmt.Errorf("identifier %q is not supported by OpenAPIv3 standard (charset: [%q])", value, identifierChars) +} + +// Float64Ptr is a helper for defining OpenAPI schemas. +func Float64Ptr(value float64) *float64 { + return &value +} + +// BoolPtr is a helper for defining OpenAPI schemas. +func BoolPtr(value bool) *bool { + return &value +} + +// Int64Ptr is a helper for defining OpenAPI schemas. +func Int64Ptr(value int64) *int64 { + return &value +} + +// Uint64Ptr is a helper for defining OpenAPI schemas. +func Uint64Ptr(value uint64) *uint64 { + return &value +} + +// componentNames returns the map keys in a sorted slice. +func componentNames[E any](s map[string]E) []string { + out := make([]string, 0, len(s)) + for i := range s { + out = append(out, i) + } + sort.Strings(out) + return out +} + +// copyURI makes a copy of the pointer. +func copyURI(u *url.URL) *url.URL { + if u == nil { + return nil + } + + c := *u // shallow-copy + return &c +} + +type ComponentRef interface { + RefString() string + RefPath() *url.URL + CollectionName() string +} + +// refersToSameDocument returns if the $ref refers to the same document. +// +// Documents in different directories will have distinct $ref values that resolve to +// the same document. +// For example, consider the 3 files: +// +// /records.yaml +// /root.yaml $ref: records.yaml +// /schema/other.yaml $ref: ../records.yaml +// +// The records.yaml reference in the 2 latter refers to the same document. +func refersToSameDocument(o1 ComponentRef, o2 ComponentRef) bool { + if o1 == nil || o2 == nil { + return false + } + + r1 := o1.RefPath() + r2 := o2.RefPath() + + if r1 == nil || r2 == nil { + return false + } + + // refURL is relative to the working directory & base spec file. + return referenceURIMatch(r1, r2) +} + +// referencesRootDocument returns if the $ref points to the root document of the OpenAPI spec. +// +// If the document has no location, perhaps loaded from data in memory, it always returns false. +func referencesRootDocument(doc *T, ref ComponentRef) bool { + if doc.url == nil || ref == nil || ref.RefPath() == nil { + return false + } + + refURL := *ref.RefPath() + refURL.Fragment = "" + + // Check referenced element was in the root document. + return referenceURIMatch(doc.url, &refURL) +} + +func referenceURIMatch(u1 *url.URL, u2 *url.URL) bool { + s1, s2 := *u1, *u2 + if s1.Scheme == "" { + s1.Scheme = "file" + } + if s2.Scheme == "" { + s2.Scheme = "file" + } + + return s1.String() == s2.String() +} + +// ReferencesComponentInRootDocument returns if the given component reference references +// the same document or element as another component reference in the root document's +// '#/components/'. If it does, it returns the name of it in the form +// '#/components//NameXXX' +// +// Of course given a component from the root document will always match itself. +// +// https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object +// https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#relative-references-in-urls +// +// Example. Take the spec with directory structure: +// +// openapi.yaml +// schemas/ +// ├─ record.yaml +// ├─ records.yaml +// +// In openapi.yaml we have: +// +// components: +// schemas: +// Record: +// $ref: schemas/record.yaml +// +// Case 1: records.yml references a component in the root document +// +// $ref: ../openapi.yaml#/components/schemas/Record +// +// This would return... +// +// #/components/schemas/Record +// +// Case 2: records.yml indirectly refers to the same schema +// as a schema the root document's '#/components/schemas'. +// +// $ref: ./record.yaml +// +// This would also return... +// +// #/components/schemas/Record +func ReferencesComponentInRootDocument(doc *T, ref ComponentRef) (string, bool) { + if ref == nil || ref.RefString() == "" { + return "", false + } + + // Case 1: + // Something like: ../another-folder/document.json#/myElement + if isRemoteReference(ref.RefString()) && isRootComponentReference(ref.RefString(), ref.CollectionName()) { + // Determine if it is *this* root doc. + if referencesRootDocument(doc, ref) { + _, name, _ := strings.Cut(ref.RefString(), path.Join("#/components/", ref.CollectionName())) + + return path.Join("#/components/", ref.CollectionName(), name), true + } + } + + // If there are no schemas defined in the root document return early. + if doc.Components == nil { + return "", false + } + + collection, _, err := jsonpointer.GetForToken(doc.Components, ref.CollectionName()) + if err != nil { + panic(err) // unreachable + } + + var components map[string]ComponentRef + + componentRefType := reflect.TypeOf(new(ComponentRef)).Elem() + if t := reflect.TypeOf(collection); t.Kind() == reflect.Map && + t.Key().Kind() == reflect.String && + t.Elem().AssignableTo(componentRefType) { + v := reflect.ValueOf(collection) + + components = make(map[string]ComponentRef, v.Len()) + for _, key := range v.MapKeys() { + strct := v.MapIndex(key) + // Type assertion safe, already checked via reflection above. + components[key.Interface().(string)] = strct.Interface().(ComponentRef) + } + } else { + return "", false + } + + // Case 2: + // Something like: ../openapi.yaml#/components/schemas/myElement + for name, s := range components { + // Must be a reference to a YAML file. + if !isWholeDocumentReference(s.RefString()) { + continue + } + + // Is the schema a ref to the same resource. + if !refersToSameDocument(s, ref) { + continue + } + + // Transform the remote ref to the equivalent schema in the root document. + return path.Join("#/components/", ref.CollectionName(), name), true + } + + return "", false +} + +// isElementReference takes a $ref value and checks if it references a specific element. +func isElementReference(ref string) bool { + return ref != "" && !isWholeDocumentReference(ref) +} + +// isSchemaReference takes a $ref value and checks if it references a schema element. +func isRootComponentReference(ref string, compType string) bool { + return isElementReference(ref) && strings.Contains(ref, path.Join("#/components/", compType)) +} + +// isWholeDocumentReference takes a $ref value and checks if it is whole document reference. +func isWholeDocumentReference(ref string) bool { + return ref != "" && !strings.ContainsAny(ref, "#") +} + +// isRemoteReference takes a $ref value and checks if it is remote reference. +func isRemoteReference(ref string) bool { + return ref != "" && !strings.HasPrefix(ref, "#") && !isURLReference(ref) +} + +// isURLReference takes a $ref value and checks if it is URL reference. +func isURLReference(ref string) bool { + return strings.HasPrefix(ref, "http://") || strings.HasPrefix(ref, "https://") || strings.HasPrefix(ref, "//") +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/info.go b/vendor/github.com/getkin/kin-openapi/openapi3/info.go new file mode 100644 index 0000000000..e2468285cb --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/info.go @@ -0,0 +1,103 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" +) + +// Info is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#info-object +type Info struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Title string `json:"title" yaml:"title"` // Required + Description string `json:"description,omitempty" yaml:"description,omitempty"` + TermsOfService string `json:"termsOfService,omitempty" yaml:"termsOfService,omitempty"` + Contact *Contact `json:"contact,omitempty" yaml:"contact,omitempty"` + License *License `json:"license,omitempty" yaml:"license,omitempty"` + Version string `json:"version" yaml:"version"` // Required +} + +// MarshalJSON returns the JSON encoding of Info. +func (info Info) MarshalJSON() ([]byte, error) { + x, err := info.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Info. +func (info *Info) MarshalYAML() (any, error) { + if info == nil { + return nil, nil + } + m := make(map[string]any, 6+len(info.Extensions)) + for k, v := range info.Extensions { + m[k] = v + } + m["title"] = info.Title + if x := info.Description; x != "" { + m["description"] = x + } + if x := info.TermsOfService; x != "" { + m["termsOfService"] = x + } + if x := info.Contact; x != nil { + m["contact"] = x + } + if x := info.License; x != nil { + m["license"] = x + } + m["version"] = info.Version + return m, nil +} + +// UnmarshalJSON sets Info to a copy of data. +func (info *Info) UnmarshalJSON(data []byte) error { + type InfoBis Info + var x InfoBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "title") + delete(x.Extensions, "description") + delete(x.Extensions, "termsOfService") + delete(x.Extensions, "contact") + delete(x.Extensions, "license") + delete(x.Extensions, "version") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *info = Info(x) + return nil +} + +// Validate returns an error if Info does not comply with the OpenAPI spec. +func (info *Info) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if contact := info.Contact; contact != nil { + if err := contact.Validate(ctx); err != nil { + return err + } + } + + if license := info.License; license != nil { + if err := license.Validate(ctx); err != nil { + return err + } + } + + if info.Version == "" { + return errors.New("value of version must be a non-empty string") + } + + if info.Title == "" { + return errors.New("value of title must be a non-empty string") + } + + return validateExtensions(ctx, info.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/internalize_refs.go b/vendor/github.com/getkin/kin-openapi/openapi3/internalize_refs.go new file mode 100644 index 0000000000..01f5dad88c --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/internalize_refs.go @@ -0,0 +1,546 @@ +package openapi3 + +import ( + "context" + "path" + "strings" +) + +// RefNameResolver maps a component to an name that is used as it's internalized name. +// +// The function should avoid name collisions (i.e. be a injective mapping). +// It must only contain characters valid for fixed field names: [IdentifierRegExp]. +type RefNameResolver func(*T, ComponentRef) string + +// DefaultRefResolver is a default implementation of refNameResolver for the +// InternalizeRefs function. +// +// The external reference is internalized to (hopefully) a unique name. If +// the external reference matches (by path) to another reference in the root +// document then the name of that component is used. +// +// The transformation involves: +// - Cutting the "#/components/" part. +// - Cutting the file extensions (.yaml/.json) from documents. +// - Trimming the common directory with the root spec. +// - Replace invalid characters with with underscores. +// +// This is an injective mapping over a "reasonable" amount of the possible openapi +// spec domain space but is not perfect. There might be edge cases. +func DefaultRefNameResolver(doc *T, ref ComponentRef) string { + if ref.RefString() == "" || ref.RefPath() == nil { + panic("unable to resolve reference to name") + } + + name := ref.RefPath() + + // If refering to a component in the root spec, no need to internalize just use + // the existing component. + // XXX(percivalalb): since this function call is iterating over components behind the + // scenes during an internalization call it actually starts interating over + // new & replaced internalized components. This might caused some edge cases, + // haven't found one yet but this might need to actually be used on a frozen copy + // of doc. + if nameInRoot, found := ReferencesComponentInRootDocument(doc, ref); found { + nameInRoot = strings.TrimPrefix(nameInRoot, "#") + + rootCompURI := copyURI(doc.url) + rootCompURI.Fragment = nameInRoot + name = rootCompURI + } + + filePath, componentPath := name.Path, name.Fragment + + // Cut out the "#/components/" to make the names shorter. + // XXX(percivalalb): This might cause collisions but is worth the brevity. + if b, a, ok := strings.Cut(componentPath, path.Join("components", ref.CollectionName(), "")); ok { + componentPath = path.Join(b, a) + } + + if filePath != "" { + // If the path is the same as the root doc, just remove. + if doc.url != nil && filePath == doc.url.Path { + filePath = "" + } + + // Remove the path extentions to make this JSON/YAML agnostic. + for ext := path.Ext(filePath); len(ext) > 0; ext = path.Ext(filePath) { + filePath = strings.TrimSuffix(filePath, ext) + } + + // Trim the common prefix with the root doc path. + if doc.url != nil { + commonDir := path.Dir(doc.url.Path) + for { + if commonDir == "." { // no common prefix + break + } + + if p, found := cutDirectories(filePath, commonDir); found { + filePath = p + break + } + + commonDir = path.Dir(commonDir) + } + } + } + + var internalizedName string + + // Trim .'s & slashes from start e.g. otherwise ./doc.yaml would end up as __doc + if filePath != "" { + internalizedName = strings.TrimLeft(filePath, "./") + } + + if componentPath != "" { + if internalizedName != "" { + internalizedName += "_" + } + + internalizedName += strings.TrimLeft(componentPath, "./") + } + + // Replace invalid characters in component fixed field names. + internalizedName = InvalidIdentifierCharRegExp.ReplaceAllString(internalizedName, "_") + + return internalizedName +} + +// cutDirectories removes the given directories from the start of the path if +// the path is a child. +func cutDirectories(p, dirs string) (string, bool) { + if dirs == "" || p == "" { + return p, false + } + + p = strings.TrimRight(p, "/") + dirs = strings.TrimRight(dirs, "/") + + var sb strings.Builder + sb.Grow(len(ParameterInHeader)) + for _, segments := range strings.Split(p, "/") { + sb.WriteString(segments) + + if sb.String() == p { + return strings.TrimPrefix(p, dirs), true + } + + sb.WriteRune('/') + } + + return p, false +} + +func isExternalRef(ref string, parentIsExternal bool) bool { + return ref != "" && (!strings.HasPrefix(ref, "#/components/") || parentIsExternal) +} + +func (doc *T) addSchemaToSpec(s *SchemaRef, refNameResolver RefNameResolver, parentIsExternal bool) bool { + if s == nil || !isExternalRef(s.Ref, parentIsExternal) { + return false + } + + name := refNameResolver(doc, s) + if doc.Components != nil { + if _, ok := doc.Components.Schemas[name]; ok { + s.Ref = "#/components/schemas/" + name + return true + } + } + + if doc.Components == nil { + doc.Components = &Components{} + } + if doc.Components.Schemas == nil { + doc.Components.Schemas = make(Schemas) + } + doc.Components.Schemas[name] = s.Value.NewRef() + s.Ref = "#/components/schemas/" + name + return true +} + +func (doc *T) addParameterToSpec(p *ParameterRef, refNameResolver RefNameResolver, parentIsExternal bool) bool { + if p == nil || !isExternalRef(p.Ref, parentIsExternal) { + return false + } + name := refNameResolver(doc, p) + if doc.Components != nil { + if _, ok := doc.Components.Parameters[name]; ok { + p.Ref = "#/components/parameters/" + name + return true + } + } + + if doc.Components == nil { + doc.Components = &Components{} + } + if doc.Components.Parameters == nil { + doc.Components.Parameters = make(ParametersMap) + } + doc.Components.Parameters[name] = &ParameterRef{Value: p.Value} + p.Ref = "#/components/parameters/" + name + return true +} + +func (doc *T) addHeaderToSpec(h *HeaderRef, refNameResolver RefNameResolver, parentIsExternal bool) bool { + if h == nil || !isExternalRef(h.Ref, parentIsExternal) { + return false + } + name := refNameResolver(doc, h) + if doc.Components != nil { + if _, ok := doc.Components.Headers[name]; ok { + h.Ref = "#/components/headers/" + name + return true + } + } + + if doc.Components == nil { + doc.Components = &Components{} + } + if doc.Components.Headers == nil { + doc.Components.Headers = make(Headers) + } + doc.Components.Headers[name] = &HeaderRef{Value: h.Value} + h.Ref = "#/components/headers/" + name + return true +} + +func (doc *T) addRequestBodyToSpec(r *RequestBodyRef, refNameResolver RefNameResolver, parentIsExternal bool) bool { + if r == nil || !isExternalRef(r.Ref, parentIsExternal) { + return false + } + name := refNameResolver(doc, r) + if doc.Components != nil { + if _, ok := doc.Components.RequestBodies[name]; ok { + r.Ref = "#/components/requestBodies/" + name + return true + } + } + + if doc.Components == nil { + doc.Components = &Components{} + } + if doc.Components.RequestBodies == nil { + doc.Components.RequestBodies = make(RequestBodies) + } + doc.Components.RequestBodies[name] = &RequestBodyRef{Value: r.Value} + r.Ref = "#/components/requestBodies/" + name + return true +} + +func (doc *T) addResponseToSpec(r *ResponseRef, refNameResolver RefNameResolver, parentIsExternal bool) bool { + if r == nil || !isExternalRef(r.Ref, parentIsExternal) { + return false + } + name := refNameResolver(doc, r) + if doc.Components != nil { + if _, ok := doc.Components.Responses[name]; ok { + r.Ref = "#/components/responses/" + name + return true + } + } + + if doc.Components == nil { + doc.Components = &Components{} + } + if doc.Components.Responses == nil { + doc.Components.Responses = make(ResponseBodies) + } + doc.Components.Responses[name] = &ResponseRef{Value: r.Value} + r.Ref = "#/components/responses/" + name + return true +} + +func (doc *T) addSecuritySchemeToSpec(ss *SecuritySchemeRef, refNameResolver RefNameResolver, parentIsExternal bool) { + if ss == nil || !isExternalRef(ss.Ref, parentIsExternal) { + return + } + name := refNameResolver(doc, ss) + if doc.Components != nil { + if _, ok := doc.Components.SecuritySchemes[name]; ok { + ss.Ref = "#/components/securitySchemes/" + name + return + } + } + + if doc.Components == nil { + doc.Components = &Components{} + } + if doc.Components.SecuritySchemes == nil { + doc.Components.SecuritySchemes = make(SecuritySchemes) + } + doc.Components.SecuritySchemes[name] = &SecuritySchemeRef{Value: ss.Value} + ss.Ref = "#/components/securitySchemes/" + name + +} + +func (doc *T) addExampleToSpec(e *ExampleRef, refNameResolver RefNameResolver, parentIsExternal bool) { + if e == nil || !isExternalRef(e.Ref, parentIsExternal) { + return + } + name := refNameResolver(doc, e) + if doc.Components != nil { + if _, ok := doc.Components.Examples[name]; ok { + e.Ref = "#/components/examples/" + name + return + } + } + + if doc.Components == nil { + doc.Components = &Components{} + } + if doc.Components.Examples == nil { + doc.Components.Examples = make(Examples) + } + doc.Components.Examples[name] = &ExampleRef{Value: e.Value} + e.Ref = "#/components/examples/" + name + +} + +func (doc *T) addLinkToSpec(l *LinkRef, refNameResolver RefNameResolver, parentIsExternal bool) { + if l == nil || !isExternalRef(l.Ref, parentIsExternal) { + return + } + name := refNameResolver(doc, l) + if doc.Components != nil { + if _, ok := doc.Components.Links[name]; ok { + l.Ref = "#/components/links/" + name + return + } + } + + if doc.Components == nil { + doc.Components = &Components{} + } + if doc.Components.Links == nil { + doc.Components.Links = make(Links) + } + doc.Components.Links[name] = &LinkRef{Value: l.Value} + l.Ref = "#/components/links/" + name + +} + +func (doc *T) addCallbackToSpec(c *CallbackRef, refNameResolver RefNameResolver, parentIsExternal bool) bool { + if c == nil || !isExternalRef(c.Ref, parentIsExternal) { + return false + } + name := refNameResolver(doc, c) + + if doc.Components == nil { + doc.Components = &Components{} + } + if doc.Components.Callbacks == nil { + doc.Components.Callbacks = make(Callbacks) + } + c.Ref = "#/components/callbacks/" + name + doc.Components.Callbacks[name] = &CallbackRef{Value: c.Value} + return true +} + +func (doc *T) derefSchema(s *Schema, refNameResolver RefNameResolver, parentIsExternal bool) { + if s == nil || doc.isVisitedSchema(s) { + return + } + + for _, list := range []SchemaRefs{s.AllOf, s.AnyOf, s.OneOf} { + for _, s2 := range list { + isExternal := doc.addSchemaToSpec(s2, refNameResolver, parentIsExternal) + if s2 != nil { + doc.derefSchema(s2.Value, refNameResolver, isExternal || parentIsExternal) + } + } + } + + for _, name := range componentNames(s.Properties) { + s2 := s.Properties[name] + isExternal := doc.addSchemaToSpec(s2, refNameResolver, parentIsExternal) + if s2 != nil { + doc.derefSchema(s2.Value, refNameResolver, isExternal || parentIsExternal) + } + } + for _, ref := range []*SchemaRef{s.Not, s.AdditionalProperties.Schema, s.Items} { + isExternal := doc.addSchemaToSpec(ref, refNameResolver, parentIsExternal) + if ref != nil { + doc.derefSchema(ref.Value, refNameResolver, isExternal || parentIsExternal) + } + } +} + +func (doc *T) derefHeaders(hs Headers, refNameResolver RefNameResolver, parentIsExternal bool) { + for _, name := range componentNames(hs) { + h := hs[name] + isExternal := doc.addHeaderToSpec(h, refNameResolver, parentIsExternal) + if doc.isVisitedHeader(h.Value) { + continue + } + doc.derefParameter(h.Value.Parameter, refNameResolver, parentIsExternal || isExternal) + } +} + +func (doc *T) derefExamples(es Examples, refNameResolver RefNameResolver, parentIsExternal bool) { + for _, name := range componentNames(es) { + e := es[name] + doc.addExampleToSpec(e, refNameResolver, parentIsExternal) + } +} + +func (doc *T) derefContent(c Content, refNameResolver RefNameResolver, parentIsExternal bool) { + for _, name := range componentNames(c) { + mediatype := c[name] + isExternal := doc.addSchemaToSpec(mediatype.Schema, refNameResolver, parentIsExternal) + if mediatype.Schema != nil { + doc.derefSchema(mediatype.Schema.Value, refNameResolver, isExternal || parentIsExternal) + } + doc.derefExamples(mediatype.Examples, refNameResolver, parentIsExternal) + for _, name := range componentNames(mediatype.Encoding) { + e := mediatype.Encoding[name] + doc.derefHeaders(e.Headers, refNameResolver, parentIsExternal) + } + } +} + +func (doc *T) derefLinks(ls Links, refNameResolver RefNameResolver, parentIsExternal bool) { + for _, name := range componentNames(ls) { + l := ls[name] + doc.addLinkToSpec(l, refNameResolver, parentIsExternal) + } +} + +func (doc *T) derefResponse(r *ResponseRef, refNameResolver RefNameResolver, parentIsExternal bool) { + isExternal := doc.addResponseToSpec(r, refNameResolver, parentIsExternal) + if v := r.Value; v != nil { + doc.derefHeaders(v.Headers, refNameResolver, isExternal || parentIsExternal) + doc.derefContent(v.Content, refNameResolver, isExternal || parentIsExternal) + doc.derefLinks(v.Links, refNameResolver, isExternal || parentIsExternal) + } +} + +func (doc *T) derefResponses(rs *Responses, refNameResolver RefNameResolver, parentIsExternal bool) { + doc.derefResponseBodies(rs.Map(), refNameResolver, parentIsExternal) +} + +func (doc *T) derefResponseBodies(es ResponseBodies, refNameResolver RefNameResolver, parentIsExternal bool) { + for _, name := range componentNames(es) { + e := es[name] + doc.derefResponse(e, refNameResolver, parentIsExternal) + } +} + +func (doc *T) derefParameter(p Parameter, refNameResolver RefNameResolver, parentIsExternal bool) { + isExternal := doc.addSchemaToSpec(p.Schema, refNameResolver, parentIsExternal) + doc.derefContent(p.Content, refNameResolver, parentIsExternal) + if p.Schema != nil { + doc.derefSchema(p.Schema.Value, refNameResolver, isExternal || parentIsExternal) + } +} + +func (doc *T) derefRequestBody(r RequestBody, refNameResolver RefNameResolver, parentIsExternal bool) { + doc.derefContent(r.Content, refNameResolver, parentIsExternal) +} + +func (doc *T) derefPaths(paths map[string]*PathItem, refNameResolver RefNameResolver, parentIsExternal bool) { + for _, name := range componentNames(paths) { + ops := paths[name] + pathIsExternal := isExternalRef(ops.Ref, parentIsExternal) + // inline full operations + ops.Ref = "" + + for _, param := range ops.Parameters { + isExternal := doc.addParameterToSpec(param, refNameResolver, pathIsExternal) + if param.Value != nil { + doc.derefParameter(*param.Value, refNameResolver, pathIsExternal || isExternal) + } + } + + opsWithMethod := ops.Operations() + for _, name := range componentNames(opsWithMethod) { + op := opsWithMethod[name] + isExternal := doc.addRequestBodyToSpec(op.RequestBody, refNameResolver, pathIsExternal) + if op.RequestBody != nil && op.RequestBody.Value != nil { + doc.derefRequestBody(*op.RequestBody.Value, refNameResolver, pathIsExternal || isExternal) + } + for _, name := range componentNames(op.Callbacks) { + cb := op.Callbacks[name] + isExternal := doc.addCallbackToSpec(cb, refNameResolver, pathIsExternal) + if cb.Value != nil { + cbValue := (*cb.Value).Map() + doc.derefPaths(cbValue, refNameResolver, pathIsExternal || isExternal) + } + } + doc.derefResponses(op.Responses, refNameResolver, pathIsExternal) + for _, param := range op.Parameters { + isExternal := doc.addParameterToSpec(param, refNameResolver, pathIsExternal) + if param.Value != nil { + doc.derefParameter(*param.Value, refNameResolver, pathIsExternal || isExternal) + } + } + } + } +} + +// InternalizeRefs removes all references to external files from the spec and moves them +// to the components section. +// +// refNameResolver takes in references to returns a name to store the reference under locally. +// It MUST return a unique name for each reference type. +// A default implementation is provided that will suffice for most use cases. See the function +// documentation for more details. +// +// Example: +// +// doc.InternalizeRefs(context.Background(), nil) +func (doc *T) InternalizeRefs(ctx context.Context, refNameResolver func(*T, ComponentRef) string) { + doc.resetVisited() + + if refNameResolver == nil { + refNameResolver = DefaultRefNameResolver + } + + if components := doc.Components; components != nil { + for _, name := range componentNames(components.Schemas) { + schema := components.Schemas[name] + isExternal := doc.addSchemaToSpec(schema, refNameResolver, false) + if schema != nil { + schema.Ref = "" // always dereference the top level + doc.derefSchema(schema.Value, refNameResolver, isExternal) + } + } + for _, name := range componentNames(components.Parameters) { + p := components.Parameters[name] + isExternal := doc.addParameterToSpec(p, refNameResolver, false) + if p != nil && p.Value != nil { + p.Ref = "" // always dereference the top level + doc.derefParameter(*p.Value, refNameResolver, isExternal) + } + } + doc.derefHeaders(components.Headers, refNameResolver, false) + for _, name := range componentNames(components.RequestBodies) { + req := components.RequestBodies[name] + isExternal := doc.addRequestBodyToSpec(req, refNameResolver, false) + if req != nil && req.Value != nil { + req.Ref = "" // always dereference the top level + doc.derefRequestBody(*req.Value, refNameResolver, isExternal) + } + } + doc.derefResponseBodies(components.Responses, refNameResolver, false) + for _, name := range componentNames(components.SecuritySchemes) { + ss := components.SecuritySchemes[name] + doc.addSecuritySchemeToSpec(ss, refNameResolver, false) + } + doc.derefExamples(components.Examples, refNameResolver, false) + doc.derefLinks(components.Links, refNameResolver, false) + + for _, name := range componentNames(components.Callbacks) { + cb := components.Callbacks[name] + isExternal := doc.addCallbackToSpec(cb, refNameResolver, false) + if cb != nil && cb.Value != nil { + cb.Ref = "" // always dereference the top level + cbValue := (*cb.Value).Map() + doc.derefPaths(cbValue, refNameResolver, isExternal) + } + } + } + + doc.derefPaths(doc.Paths.Map(), refNameResolver, false) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/license.go b/vendor/github.com/getkin/kin-openapi/openapi3/license.go new file mode 100644 index 0000000000..c4f6c8dc34 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/license.go @@ -0,0 +1,66 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" +) + +// License is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#license-object +type License struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Name string `json:"name" yaml:"name"` // Required + URL string `json:"url,omitempty" yaml:"url,omitempty"` +} + +// MarshalJSON returns the JSON encoding of License. +func (license License) MarshalJSON() ([]byte, error) { + x, err := license.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of License. +func (license License) MarshalYAML() (any, error) { + m := make(map[string]any, 2+len(license.Extensions)) + for k, v := range license.Extensions { + m[k] = v + } + m["name"] = license.Name + if x := license.URL; x != "" { + m["url"] = x + } + return m, nil +} + +// UnmarshalJSON sets License to a copy of data. +func (license *License) UnmarshalJSON(data []byte) error { + type LicenseBis License + var x LicenseBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "name") + delete(x.Extensions, "url") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *license = License(x) + return nil +} + +// Validate returns an error if License does not comply with the OpenAPI spec. +func (license *License) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if license.Name == "" { + return errors.New("value of license name must be a non-empty string") + } + + return validateExtensions(ctx, license.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/link.go b/vendor/github.com/getkin/kin-openapi/openapi3/link.go new file mode 100644 index 0000000000..132f678038 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/link.go @@ -0,0 +1,94 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "fmt" +) + +// Link is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#link-object +type Link struct { + Extensions map[string]any `json:"-" yaml:"-"` + + OperationRef string `json:"operationRef,omitempty" yaml:"operationRef,omitempty"` + OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Parameters map[string]any `json:"parameters,omitempty" yaml:"parameters,omitempty"` + Server *Server `json:"server,omitempty" yaml:"server,omitempty"` + RequestBody any `json:"requestBody,omitempty" yaml:"requestBody,omitempty"` +} + +// MarshalJSON returns the JSON encoding of Link. +func (link Link) MarshalJSON() ([]byte, error) { + x, err := link.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Link. +func (link Link) MarshalYAML() (any, error) { + m := make(map[string]any, 6+len(link.Extensions)) + for k, v := range link.Extensions { + m[k] = v + } + + if x := link.OperationRef; x != "" { + m["operationRef"] = x + } + if x := link.OperationID; x != "" { + m["operationId"] = x + } + if x := link.Description; x != "" { + m["description"] = x + } + if x := link.Parameters; len(x) != 0 { + m["parameters"] = x + } + if x := link.Server; x != nil { + m["server"] = x + } + if x := link.RequestBody; x != nil { + m["requestBody"] = x + } + + return m, nil +} + +// UnmarshalJSON sets Link to a copy of data. +func (link *Link) UnmarshalJSON(data []byte) error { + type LinkBis Link + var x LinkBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "operationRef") + delete(x.Extensions, "operationId") + delete(x.Extensions, "description") + delete(x.Extensions, "parameters") + delete(x.Extensions, "server") + delete(x.Extensions, "requestBody") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *link = Link(x) + return nil +} + +// Validate returns an error if Link does not comply with the OpenAPI spec. +func (link *Link) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if link.OperationID == "" && link.OperationRef == "" { + return errors.New("missing operationId or operationRef on link") + } + if link.OperationID != "" && link.OperationRef != "" { + return fmt.Errorf("operationId %q and operationRef %q are mutually exclusive", link.OperationID, link.OperationRef) + } + + return validateExtensions(ctx, link.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/loader.go b/vendor/github.com/getkin/kin-openapi/openapi3/loader.go new file mode 100644 index 0000000000..31c340761f --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/loader.go @@ -0,0 +1,1213 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/url" + "os" + "path" + "path/filepath" + "reflect" + "strconv" + "strings" +) + +func foundUnresolvedRef(ref string) error { + return fmt.Errorf("found unresolved ref: %q", ref) +} + +func failedToResolveRefFragmentPart(value, what string) error { + return fmt.Errorf("failed to resolve %q in fragment in URI: %q", what, value) +} + +// Loader helps deserialize an OpenAPIv3 document +type Loader struct { + // IsExternalRefsAllowed enables visiting other files + IsExternalRefsAllowed bool + + // ReadFromURIFunc allows overriding the any file/URL reading func + ReadFromURIFunc ReadFromURIFunc + + Context context.Context + + rootDir string + rootLocation string + + visitedPathItemRefs map[string]struct{} + + visitedDocuments map[string]*T + + visitedRefs map[string]struct{} + visitedPath []string + backtrack map[string][]func(value any) +} + +// NewLoader returns an empty Loader +func NewLoader() *Loader { + return &Loader{ + Context: context.Background(), + } +} + +func (loader *Loader) resetVisitedPathItemRefs() { + loader.visitedPathItemRefs = make(map[string]struct{}) + loader.visitedRefs = make(map[string]struct{}) + loader.visitedPath = nil + loader.backtrack = make(map[string][]func(value any)) +} + +// LoadFromURI loads a spec from a remote URL +func (loader *Loader) LoadFromURI(location *url.URL) (*T, error) { + loader.resetVisitedPathItemRefs() + return loader.loadFromURIInternal(location) +} + +// LoadFromFile loads a spec from a local file path +func (loader *Loader) LoadFromFile(location string) (*T, error) { + loader.rootDir = path.Dir(location) + return loader.LoadFromURI(&url.URL{Path: filepath.ToSlash(location)}) +} + +func (loader *Loader) loadFromURIInternal(location *url.URL) (*T, error) { + data, err := loader.readURL(location) + if err != nil { + return nil, err + } + return loader.loadFromDataWithPathInternal(data, location) +} + +func (loader *Loader) allowsExternalRefs(ref string) (err error) { + if !loader.IsExternalRefsAllowed { + err = fmt.Errorf("encountered disallowed external reference: %q", ref) + } + return +} + +func (loader *Loader) loadSingleElementFromURI(ref string, rootPath *url.URL, element any) (*url.URL, error) { + if err := loader.allowsExternalRefs(ref); err != nil { + return nil, err + } + + resolvedPath, err := resolvePathWithRef(ref, rootPath) + if err != nil { + return nil, err + } + if frag := resolvedPath.Fragment; frag != "" { + return nil, fmt.Errorf("unexpected ref fragment %q", frag) + } + + data, err := loader.readURL(resolvedPath) + if err != nil { + return nil, err + } + if err := unmarshal(data, element); err != nil { + return nil, err + } + + return resolvedPath, nil +} + +func (loader *Loader) readURL(location *url.URL) ([]byte, error) { + if f := loader.ReadFromURIFunc; f != nil { + return f(loader, location) + } + return DefaultReadFromURI(loader, location) +} + +// LoadFromStdin loads a spec from stdin +func (loader *Loader) LoadFromStdin() (*T, error) { + return loader.LoadFromIoReader(os.Stdin) +} + +// LoadFromStdin loads a spec from io.Reader +func (loader *Loader) LoadFromIoReader(reader io.Reader) (*T, error) { + if reader == nil { + return nil, fmt.Errorf("invalid reader: %v", reader) + } + + data, err := io.ReadAll(reader) + if err != nil { + return nil, err + } + return loader.LoadFromData(data) +} + +// LoadFromData loads a spec from a byte array +func (loader *Loader) LoadFromData(data []byte) (*T, error) { + loader.resetVisitedPathItemRefs() + doc := &T{} + if err := unmarshal(data, doc); err != nil { + return nil, err + } + if err := loader.ResolveRefsIn(doc, nil); err != nil { + return nil, err + } + return doc, nil +} + +// LoadFromDataWithPath takes the OpenAPI document data in bytes and a path where the resolver can find referred +// elements and returns a *T with all resolved data or an error if unable to load data or resolve refs. +func (loader *Loader) LoadFromDataWithPath(data []byte, location *url.URL) (*T, error) { + loader.resetVisitedPathItemRefs() + return loader.loadFromDataWithPathInternal(data, location) +} + +func (loader *Loader) loadFromDataWithPathInternal(data []byte, location *url.URL) (*T, error) { + if loader.visitedDocuments == nil { + loader.visitedDocuments = make(map[string]*T) + loader.rootLocation = location.Path + } + uri := location.String() + if doc, ok := loader.visitedDocuments[uri]; ok { + return doc, nil + } + + doc := &T{} + loader.visitedDocuments[uri] = doc + + if err := unmarshal(data, doc); err != nil { + return nil, err + } + + doc.url = copyURI(location) + + if err := loader.ResolveRefsIn(doc, location); err != nil { + return nil, err + } + + return doc, nil +} + +// ResolveRefsIn expands references if for instance spec was just unmarshaled +func (loader *Loader) ResolveRefsIn(doc *T, location *url.URL) (err error) { + if loader.Context == nil { + loader.Context = context.Background() + } + + if loader.visitedPathItemRefs == nil { + loader.resetVisitedPathItemRefs() + } + + if components := doc.Components; components != nil { + for _, name := range componentNames(components.Headers) { + component := components.Headers[name] + if err = loader.resolveHeaderRef(doc, component, location); err != nil { + return + } + } + for _, name := range componentNames(components.Parameters) { + component := components.Parameters[name] + if err = loader.resolveParameterRef(doc, component, location); err != nil { + return + } + } + for _, name := range componentNames(components.RequestBodies) { + component := components.RequestBodies[name] + if err = loader.resolveRequestBodyRef(doc, component, location); err != nil { + return + } + } + for _, name := range componentNames(components.Responses) { + component := components.Responses[name] + if err = loader.resolveResponseRef(doc, component, location); err != nil { + return + } + } + for _, name := range componentNames(components.Schemas) { + component := components.Schemas[name] + if err = loader.resolveSchemaRef(doc, component, location, []string{}); err != nil { + return + } + } + for _, name := range componentNames(components.SecuritySchemes) { + component := components.SecuritySchemes[name] + if err = loader.resolveSecuritySchemeRef(doc, component, location); err != nil { + return + } + } + for _, name := range componentNames(components.Examples) { + component := components.Examples[name] + if err = loader.resolveExampleRef(doc, component, location); err != nil { + return + } + } + for _, name := range componentNames(components.Callbacks) { + component := components.Callbacks[name] + if err = loader.resolveCallbackRef(doc, component, location); err != nil { + return + } + } + } + + // Visit all operations + pathItems := doc.Paths.Map() + for _, name := range componentNames(pathItems) { + pathItem := pathItems[name] + if pathItem == nil { + continue + } + if err = loader.resolvePathItemRef(doc, pathItem, location); err != nil { + return + } + } + + return +} + +func join(basePath *url.URL, relativePath *url.URL) *url.URL { + if basePath == nil { + return relativePath + } + newPath := *basePath + newPath.Path = path.Join(path.Dir(newPath.Path), relativePath.Path) + return &newPath +} + +func resolvePath(basePath *url.URL, componentPath *url.URL) *url.URL { + if is_file(componentPath) { + // support absolute paths + if filepath.IsAbs(componentPath.Path) { + return componentPath + } + return join(basePath, componentPath) + } + return componentPath +} + +func resolvePathWithRef(ref string, rootPath *url.URL) (*url.URL, error) { + parsedURL, err := url.Parse(ref) + if err != nil { + return nil, fmt.Errorf("cannot parse reference: %q: %w", ref, err) + } + + resolvedPath := resolvePath(rootPath, parsedURL) + resolvedPath.Fragment = parsedURL.Fragment + return resolvedPath, nil +} + +func (loader *Loader) resolveRefPath(ref string, path *url.URL) (*url.URL, error) { + if ref != "" && ref[0] == '#' { + path = copyURI(path) + // Resolving internal refs of a doc loaded from memory + // has no path, so just set the Fragment. + if path == nil { + path = new(url.URL) + } + + path.Fragment = ref + return path, nil + } + + if err := loader.allowsExternalRefs(ref); err != nil { + return nil, err + } + + resolvedPath, err := resolvePathWithRef(ref, path) + if err != nil { + return nil, err + } + + return resolvedPath, nil +} + +func isSingleRefElement(ref string) bool { + return !strings.Contains(ref, "#") +} + +func (loader *Loader) visitRef(ref string) { + if loader.visitedRefs == nil { + loader.visitedRefs = make(map[string]struct{}) + loader.backtrack = make(map[string][]func(value any)) + } + loader.visitedPath = append(loader.visitedPath, ref) + loader.visitedRefs[ref] = struct{}{} +} + +func (loader *Loader) unvisitRef(ref string, value any) { + if value != nil { + for _, fn := range loader.backtrack[ref] { + fn(value) + } + } + delete(loader.visitedRefs, ref) + delete(loader.backtrack, ref) + loader.visitedPath = loader.visitedPath[:len(loader.visitedPath)-1] +} + +func (loader *Loader) shouldVisitRef(ref string, fn func(value any)) bool { + if _, ok := loader.visitedRefs[ref]; ok { + loader.backtrack[ref] = append(loader.backtrack[ref], fn) + return false + } + return true +} + +func (loader *Loader) resolveComponent(doc *T, ref string, path *url.URL, resolved any) ( + componentDoc *T, + componentPath *url.URL, + err error, +) { + if componentDoc, ref, componentPath, err = loader.resolveRefAndDocument(doc, ref, path); err != nil { + return nil, nil, err + } + + parsedURL, err := url.Parse(ref) + if err != nil { + return nil, nil, fmt.Errorf("cannot parse reference: %q: %v", ref, parsedURL) + } + fragment := parsedURL.Fragment + if fragment == "" { + fragment = "/" + } + if fragment[0] != '/' { + return nil, nil, fmt.Errorf("expected fragment prefix '#/' in URI %q", ref) + } + + drill := func(cursor any) (any, error) { + for _, pathPart := range strings.Split(fragment[1:], "/") { + pathPart = unescapeRefString(pathPart) + attempted := false + + switch c := cursor.(type) { + // Special case of T + // See issue856: a ref to doc => we assume that doc is a T => things live in T.Extensions + case *T: + if pathPart == "" { + cursor = c.Extensions + attempted = true + } + + // Special case due to multijson + case *SchemaRef: + if pathPart == "additionalProperties" { + if ap := c.Value.AdditionalProperties.Has; ap != nil { + cursor = *ap + } else { + cursor = c.Value.AdditionalProperties.Schema + } + attempted = true + } + + case *Responses: + cursor = c.m // m map[string]*ResponseRef + case *Callback: + cursor = c.m // m map[string]*PathItem + case *Paths: + cursor = c.m // m map[string]*PathItem + } + + if !attempted { + if cursor, err = drillIntoField(cursor, pathPart); err != nil { + e := failedToResolveRefFragmentPart(ref, pathPart) + return nil, fmt.Errorf("%s: %w", e, err) + } + } + + if cursor == nil { + return nil, failedToResolveRefFragmentPart(ref, pathPart) + } + } + return cursor, nil + } + var cursor any + if cursor, err = drill(componentDoc); err != nil { + if path == nil { + return nil, nil, err + } + var err2 error + data, err2 := loader.readURL(path) + if err2 != nil { + return nil, nil, err + } + if err2 = unmarshal(data, &cursor); err2 != nil { + return nil, nil, err + } + if cursor, err2 = drill(cursor); err2 != nil || cursor == nil { + return nil, nil, err + } + err = nil + } + + setPathRef := func(target any) { + if i, ok := target.(interface { + setRefPath(*url.URL) + }); ok { + pathRef := copyURI(componentPath) + // Resolving internal refs of a doc loaded from memory + // has no path, so just set the Fragment. + if pathRef == nil { + pathRef = new(url.URL) + } + pathRef.Fragment = fragment + + i.setRefPath(pathRef) + } + } + + switch { + case reflect.TypeOf(cursor) == reflect.TypeOf(resolved): + setPathRef(cursor) + + reflect.ValueOf(resolved).Elem().Set(reflect.ValueOf(cursor).Elem()) + return componentDoc, componentPath, nil + + case reflect.TypeOf(cursor) == reflect.TypeOf(map[string]any{}): + codec := func(got, expect any) error { + enc, err := json.Marshal(got) + if err != nil { + return err + } + if err = json.Unmarshal(enc, expect); err != nil { + return err + } + + setPathRef(expect) + return nil + } + if err := codec(cursor, resolved); err != nil { + return nil, nil, fmt.Errorf("bad data in %q (expecting %s)", ref, readableType(resolved)) + } + return componentDoc, componentPath, nil + + default: + return nil, nil, fmt.Errorf("bad data in %q (expecting %s)", ref, readableType(resolved)) + } +} + +func readableType(x any) string { + switch x.(type) { + case *Callback: + return "callback object" + case *CallbackRef: + return "ref to callback object" + case *ExampleRef: + return "ref to example object" + case *HeaderRef: + return "ref to header object" + case *LinkRef: + return "ref to link object" + case *ParameterRef: + return "ref to parameter object" + case *PathItem: + return "pathItem object" + case *RequestBodyRef: + return "ref to requestBody object" + case *ResponseRef: + return "ref to response object" + case *SchemaRef: + return "ref to schema object" + case *SecuritySchemeRef: + return "ref to securityScheme object" + default: + panic(fmt.Sprintf("unreachable %T", x)) + } +} + +func drillIntoField(cursor any, fieldName string) (any, error) { + switch val := reflect.Indirect(reflect.ValueOf(cursor)); val.Kind() { + + case reflect.Map: + elementValue := val.MapIndex(reflect.ValueOf(fieldName)) + if !elementValue.IsValid() { + return nil, fmt.Errorf("map key %q not found", fieldName) + } + return elementValue.Interface(), nil + + case reflect.Slice: + i, err := strconv.ParseUint(fieldName, 10, 32) + if err != nil { + return nil, err + } + index := int(i) + if 0 > index || index >= val.Len() { + return nil, errors.New("slice index out of bounds") + } + return val.Index(index).Interface(), nil + + case reflect.Struct: + hasFields := false + for i := 0; i < val.NumField(); i++ { + hasFields = true + if yamlTag := val.Type().Field(i).Tag.Get("yaml"); yamlTag != "-" { + if tagName := strings.Split(yamlTag, ",")[0]; tagName != "" { + if fieldName == tagName { + return val.Field(i).Interface(), nil + } + } + } + } + + // if cursor is a "ref wrapper" struct (e.g. RequestBodyRef), + if _, ok := val.Type().FieldByName("Value"); ok { + // try digging into its Value field + return drillIntoField(val.FieldByName("Value").Interface(), fieldName) + } + if hasFields { + if ff := val.Type().Field(0); ff.PkgPath == "" && ff.Name == "Extensions" { + extensions := val.Field(0).Interface().(map[string]any) + if enc, ok := extensions[fieldName]; ok { + return enc, nil + } + } + } + return nil, fmt.Errorf("struct field %q not found", fieldName) + + default: + return nil, errors.New("not a map, slice nor struct") + } +} + +func (loader *Loader) resolveRefAndDocument(doc *T, ref string, path *url.URL) (*T, string, *url.URL, error) { + if ref != "" && ref[0] == '#' { + return doc, ref, path, nil + } + + fragment, resolvedPath, err := loader.resolveRef(ref, path) + if err != nil { + return nil, "", nil, err + } + + if doc, err = loader.loadFromURIInternal(resolvedPath); err != nil { + return nil, "", nil, fmt.Errorf("error resolving reference %q: %w", ref, err) + } + + return doc, fragment, resolvedPath, nil +} + +func (loader *Loader) resolveRef(ref string, path *url.URL) (string, *url.URL, error) { + resolvedPathRef, err := loader.resolveRefPath(ref, path) + if err != nil { + return "", nil, err + } + + fragment := "#" + resolvedPathRef.Fragment + resolvedPathRef.Fragment = "" + return fragment, resolvedPathRef, nil +} + +var ( + errMUSTCallback = errors.New("invalid callback: value MUST be an object") + errMUSTExample = errors.New("invalid example: value MUST be an object") + errMUSTHeader = errors.New("invalid header: value MUST be an object") + errMUSTLink = errors.New("invalid link: value MUST be an object") + errMUSTParameter = errors.New("invalid parameter: value MUST be an object") + errMUSTPathItem = errors.New("invalid path item: value MUST be an object") + errMUSTRequestBody = errors.New("invalid requestBody: value MUST be an object") + errMUSTResponse = errors.New("invalid response: value MUST be an object") + errMUSTSchema = errors.New("invalid schema: value MUST be an object") + errMUSTSecurityScheme = errors.New("invalid securityScheme: value MUST be an object") +) + +func (loader *Loader) resolveHeaderRef(doc *T, component *HeaderRef, documentPath *url.URL) (err error) { + if component.isEmpty() { + return errMUSTHeader + } + + if ref := component.Ref; ref != "" { + if component.Value != nil { + return nil + } + if !loader.shouldVisitRef(ref, func(value any) { + component.Value = value.(*Header) + refPath, _ := loader.resolveRefPath(ref, documentPath) + component.setRefPath(refPath) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var header Header + if documentPath, err = loader.loadSingleElementFromURI(ref, documentPath, &header); err != nil { + return err + } + component.Value = &header + component.setRefPath(documentPath) + } else { + var resolved HeaderRef + doc, componentPath, err := loader.resolveComponent(doc, ref, documentPath, &resolved) + if err != nil { + return err + } + if err := loader.resolveHeaderRef(doc, &resolved, componentPath); err != nil { + if err == errMUSTHeader { + return nil + } + return err + } + component.Value = resolved.Value + component.setRefPath(resolved.RefPath()) + } + defer loader.unvisitRef(ref, component.Value) + } + value := component.Value + if value == nil { + return nil + } + + if schema := value.Schema; schema != nil { + if err := loader.resolveSchemaRef(doc, schema, documentPath, []string{}); err != nil { + return err + } + } + return nil +} + +func (loader *Loader) resolveParameterRef(doc *T, component *ParameterRef, documentPath *url.URL) (err error) { + if component.isEmpty() { + return errMUSTParameter + } + + if ref := component.Ref; ref != "" { + if component.Value != nil { + return nil + } + if !loader.shouldVisitRef(ref, func(value any) { + component.Value = value.(*Parameter) + refPath, _ := loader.resolveRefPath(ref, documentPath) + component.setRefPath(refPath) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var param Parameter + if documentPath, err = loader.loadSingleElementFromURI(ref, documentPath, ¶m); err != nil { + return err + } + component.Value = ¶m + component.setRefPath(documentPath) + } else { + var resolved ParameterRef + doc, componentPath, err := loader.resolveComponent(doc, ref, documentPath, &resolved) + if err != nil { + return err + } + if err := loader.resolveParameterRef(doc, &resolved, componentPath); err != nil { + if err == errMUSTParameter { + return nil + } + return err + } + component.Value = resolved.Value + component.setRefPath(resolved.RefPath()) + } + defer loader.unvisitRef(ref, component.Value) + } + value := component.Value + if value == nil { + return nil + } + + if value.Content != nil && value.Schema != nil { + return errors.New("cannot contain both schema and content in a parameter") + } + for _, name := range componentNames(value.Content) { + contentType := value.Content[name] + if schema := contentType.Schema; schema != nil { + if err := loader.resolveSchemaRef(doc, schema, documentPath, []string{}); err != nil { + return err + } + } + } + if schema := value.Schema; schema != nil { + if err := loader.resolveSchemaRef(doc, schema, documentPath, []string{}); err != nil { + return err + } + } + return nil +} + +func (loader *Loader) resolveRequestBodyRef(doc *T, component *RequestBodyRef, documentPath *url.URL) (err error) { + if component.isEmpty() { + return errMUSTRequestBody + } + + if ref := component.Ref; ref != "" { + if component.Value != nil { + return nil + } + if !loader.shouldVisitRef(ref, func(value any) { + component.Value = value.(*RequestBody) + refPath, _ := loader.resolveRefPath(ref, documentPath) + component.setRefPath(refPath) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var requestBody RequestBody + if documentPath, err = loader.loadSingleElementFromURI(ref, documentPath, &requestBody); err != nil { + return err + } + component.Value = &requestBody + component.setRefPath(documentPath) + } else { + var resolved RequestBodyRef + doc, componentPath, err := loader.resolveComponent(doc, ref, documentPath, &resolved) + if err != nil { + return err + } + if err = loader.resolveRequestBodyRef(doc, &resolved, componentPath); err != nil { + if err == errMUSTRequestBody { + return nil + } + return err + } + component.Value = resolved.Value + component.setRefPath(resolved.RefPath()) + } + defer loader.unvisitRef(ref, component.Value) + } + value := component.Value + if value == nil { + return nil + } + + for _, name := range componentNames(value.Content) { + contentType := value.Content[name] + if contentType == nil { + continue + } + for _, name := range componentNames(contentType.Examples) { + example := contentType.Examples[name] + if err := loader.resolveExampleRef(doc, example, documentPath); err != nil { + return err + } + contentType.Examples[name] = example + } + if schema := contentType.Schema; schema != nil { + if err := loader.resolveSchemaRef(doc, schema, documentPath, []string{}); err != nil { + return err + } + } + } + return nil +} + +func (loader *Loader) resolveResponseRef(doc *T, component *ResponseRef, documentPath *url.URL) (err error) { + if component.isEmpty() { + return errMUSTResponse + } + + if ref := component.Ref; ref != "" { + if component.Value != nil { + return nil + } + if !loader.shouldVisitRef(ref, func(value any) { + component.Value = value.(*Response) + refPath, _ := loader.resolveRefPath(ref, documentPath) + component.setRefPath(refPath) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var resp Response + if documentPath, err = loader.loadSingleElementFromURI(ref, documentPath, &resp); err != nil { + return err + } + component.Value = &resp + component.setRefPath(documentPath) + } else { + var resolved ResponseRef + doc, componentPath, err := loader.resolveComponent(doc, ref, documentPath, &resolved) + if err != nil { + return err + } + if err := loader.resolveResponseRef(doc, &resolved, componentPath); err != nil { + if err == errMUSTResponse { + return nil + } + return err + } + component.Value = resolved.Value + component.setRefPath(resolved.RefPath()) + } + defer loader.unvisitRef(ref, component.Value) + } + value := component.Value + if value == nil { + return nil + } + + for _, name := range componentNames(value.Headers) { + header := value.Headers[name] + if err := loader.resolveHeaderRef(doc, header, documentPath); err != nil { + return err + } + } + for _, name := range componentNames(value.Content) { + contentType := value.Content[name] + if contentType == nil { + continue + } + for _, name := range componentNames(contentType.Examples) { + example := contentType.Examples[name] + if err := loader.resolveExampleRef(doc, example, documentPath); err != nil { + return err + } + contentType.Examples[name] = example + } + if schema := contentType.Schema; schema != nil { + if err := loader.resolveSchemaRef(doc, schema, documentPath, []string{}); err != nil { + return err + } + contentType.Schema = schema + } + } + for _, name := range componentNames(value.Links) { + link := value.Links[name] + if err := loader.resolveLinkRef(doc, link, documentPath); err != nil { + return err + } + } + return nil +} + +func (loader *Loader) resolveSchemaRef(doc *T, component *SchemaRef, documentPath *url.URL, visited []string) (err error) { + if component.isEmpty() { + return errMUSTSchema + } + + if ref := component.Ref; ref != "" { + if component.Value != nil { + return nil + } + if !loader.shouldVisitRef(ref, func(value any) { + component.Value = value.(*Schema) + refPath, _ := loader.resolveRefPath(ref, documentPath) + component.setRefPath(refPath) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var schema Schema + if documentPath, err = loader.loadSingleElementFromURI(ref, documentPath, &schema); err != nil { + return err + } + component.Value = &schema + component.setRefPath(documentPath) + } else { + var resolved SchemaRef + doc, componentPath, err := loader.resolveComponent(doc, ref, documentPath, &resolved) + if err != nil { + return err + } + if err := loader.resolveSchemaRef(doc, &resolved, componentPath, visited); err != nil { + if err == errMUSTSchema { + return nil + } + return err + } + component.Value = resolved.Value + component.setRefPath(resolved.RefPath()) + } + defer loader.unvisitRef(ref, component.Value) + } + value := component.Value + if value == nil { + return nil + } + + // ResolveRefs referred schemas + if v := value.Items; v != nil { + if err := loader.resolveSchemaRef(doc, v, documentPath, visited); err != nil { + return err + } + } + for _, name := range componentNames(value.Properties) { + v := value.Properties[name] + if err := loader.resolveSchemaRef(doc, v, documentPath, visited); err != nil { + return err + } + } + if v := value.AdditionalProperties.Schema; v != nil { + if err := loader.resolveSchemaRef(doc, v, documentPath, visited); err != nil { + return err + } + } + if v := value.Not; v != nil { + if err := loader.resolveSchemaRef(doc, v, documentPath, visited); err != nil { + return err + } + } + for _, v := range value.AllOf { + if err := loader.resolveSchemaRef(doc, v, documentPath, visited); err != nil { + return err + } + } + for _, v := range value.AnyOf { + if err := loader.resolveSchemaRef(doc, v, documentPath, visited); err != nil { + return err + } + } + for _, v := range value.OneOf { + if err := loader.resolveSchemaRef(doc, v, documentPath, visited); err != nil { + return err + } + } + return nil +} + +func (loader *Loader) resolveSecuritySchemeRef(doc *T, component *SecuritySchemeRef, documentPath *url.URL) (err error) { + if component.isEmpty() { + return errMUSTSecurityScheme + } + + if ref := component.Ref; ref != "" { + if component.Value != nil { + return nil + } + if !loader.shouldVisitRef(ref, func(value any) { + component.Value = value.(*SecurityScheme) + refPath, _ := loader.resolveRefPath(ref, documentPath) + component.setRefPath(refPath) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var scheme SecurityScheme + if _, err = loader.loadSingleElementFromURI(ref, documentPath, &scheme); err != nil { + return err + } + component.Value = &scheme + component.setRefPath(documentPath) + } else { + var resolved SecuritySchemeRef + doc, componentPath, err := loader.resolveComponent(doc, ref, documentPath, &resolved) + if err != nil { + return err + } + if err := loader.resolveSecuritySchemeRef(doc, &resolved, componentPath); err != nil { + if err == errMUSTSecurityScheme { + return nil + } + return err + } + component.Value = resolved.Value + component.setRefPath(resolved.RefPath()) + } + defer loader.unvisitRef(ref, component.Value) + } + return nil +} + +func (loader *Loader) resolveExampleRef(doc *T, component *ExampleRef, documentPath *url.URL) (err error) { + if ref := component.Ref; ref != "" { + if component.Value != nil { + return nil + } + if !loader.shouldVisitRef(ref, func(value any) { + component.Value = value.(*Example) + refPath, _ := loader.resolveRefPath(ref, documentPath) + component.setRefPath(refPath) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var example Example + if _, err = loader.loadSingleElementFromURI(ref, documentPath, &example); err != nil { + return err + } + component.Value = &example + component.setRefPath(documentPath) + } else { + var resolved ExampleRef + doc, componentPath, err := loader.resolveComponent(doc, ref, documentPath, &resolved) + if err != nil { + return err + } + if err := loader.resolveExampleRef(doc, &resolved, componentPath); err != nil { + if err == errMUSTExample { + return nil + } + return err + } + component.Value = resolved.Value + component.setRefPath(resolved.RefPath()) + } + defer loader.unvisitRef(ref, component.Value) + } + return nil +} + +func (loader *Loader) resolveCallbackRef(doc *T, component *CallbackRef, documentPath *url.URL) (err error) { + if component.isEmpty() { + return errMUSTCallback + } + + if ref := component.Ref; ref != "" { + if component.Value != nil { + return nil + } + if !loader.shouldVisitRef(ref, func(value any) { + component.Value = value.(*Callback) + refPath, _ := loader.resolveRefPath(ref, documentPath) + component.setRefPath(refPath) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var resolved Callback + if documentPath, err = loader.loadSingleElementFromURI(ref, documentPath, &resolved); err != nil { + return err + } + component.Value = &resolved + component.setRefPath(documentPath) + } else { + var resolved CallbackRef + doc, componentPath, err := loader.resolveComponent(doc, ref, documentPath, &resolved) + if err != nil { + return err + } + if err = loader.resolveCallbackRef(doc, &resolved, componentPath); err != nil { + if err == errMUSTCallback { + return nil + } + return err + } + component.Value = resolved.Value + component.setRefPath(resolved.RefPath()) + } + defer loader.unvisitRef(ref, component.Value) + } + value := component.Value + if value == nil { + return nil + } + + pathItems := value.Map() + for _, name := range componentNames(pathItems) { + pathItem := pathItems[name] + if err = loader.resolvePathItemRef(doc, pathItem, documentPath); err != nil { + return err + } + } + return nil +} + +func (loader *Loader) resolveLinkRef(doc *T, component *LinkRef, documentPath *url.URL) (err error) { + if component.isEmpty() { + return errMUSTLink + } + + if ref := component.Ref; ref != "" { + if component.Value != nil { + return nil + } + if !loader.shouldVisitRef(ref, func(value any) { + component.Value = value.(*Link) + refPath, _ := loader.resolveRefPath(ref, documentPath) + component.setRefPath(refPath) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var link Link + if _, err = loader.loadSingleElementFromURI(ref, documentPath, &link); err != nil { + return err + } + component.Value = &link + component.setRefPath(documentPath) + } else { + var resolved LinkRef + doc, componentPath, err := loader.resolveComponent(doc, ref, documentPath, &resolved) + if err != nil { + return err + } + if err := loader.resolveLinkRef(doc, &resolved, componentPath); err != nil { + if err == errMUSTLink { + return nil + } + return err + } + component.Value = resolved.Value + component.setRefPath(resolved.RefPath()) + } + defer loader.unvisitRef(ref, component.Value) + } + return nil +} + +func (loader *Loader) resolvePathItemRef(doc *T, pathItem *PathItem, documentPath *url.URL) (err error) { + if pathItem == nil { + err = errMUSTPathItem + return + } + + if ref := pathItem.Ref; ref != "" { + if !pathItem.isEmpty() { + return + } + if !loader.shouldVisitRef(ref, func(value any) { + *pathItem = *value.(*PathItem) + }) { + return nil + } + loader.visitRef(ref) + if isSingleRefElement(ref) { + var p PathItem + if documentPath, err = loader.loadSingleElementFromURI(ref, documentPath, &p); err != nil { + return + } + *pathItem = p + } else { + var resolved PathItem + if doc, documentPath, err = loader.resolveComponent(doc, ref, documentPath, &resolved); err != nil { + if err == errMUSTPathItem { + return nil + } + return + } + *pathItem = resolved + } + pathItem.Ref = ref + defer loader.unvisitRef(ref, pathItem) + } + + for _, parameter := range pathItem.Parameters { + if err = loader.resolveParameterRef(doc, parameter, documentPath); err != nil { + return + } + } + operations := pathItem.Operations() + for _, name := range componentNames(operations) { + operation := operations[name] + for _, parameter := range operation.Parameters { + if err = loader.resolveParameterRef(doc, parameter, documentPath); err != nil { + return + } + } + if requestBody := operation.RequestBody; requestBody != nil { + if err = loader.resolveRequestBodyRef(doc, requestBody, documentPath); err != nil { + return + } + } + responses := operation.Responses.Map() + for _, name := range componentNames(responses) { + response := responses[name] + if err = loader.resolveResponseRef(doc, response, documentPath); err != nil { + return + } + } + for _, name := range componentNames(operation.Callbacks) { + callback := operation.Callbacks[name] + if err = loader.resolveCallbackRef(doc, callback, documentPath); err != nil { + return + } + } + } + return +} + +func unescapeRefString(ref string) string { + return strings.Replace(strings.Replace(ref, "~1", "/", -1), "~0", "~", -1) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/loader_uri_reader.go b/vendor/github.com/getkin/kin-openapi/openapi3/loader_uri_reader.go new file mode 100644 index 0000000000..b023dfb294 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/loader_uri_reader.go @@ -0,0 +1,116 @@ +package openapi3 + +import ( + "errors" + "fmt" + "io" + "net/http" + "net/url" + "os" + "path/filepath" + "sync" +) + +// ReadFromURIFunc defines a function which reads the contents of a resource +// located at a URI. +type ReadFromURIFunc func(loader *Loader, url *url.URL) ([]byte, error) + +var uriMu = &sync.RWMutex{} + +// ErrURINotSupported indicates the ReadFromURIFunc does not know how to handle a +// given URI. +var ErrURINotSupported = errors.New("unsupported URI") + +// ReadFromURIs returns a ReadFromURIFunc which tries to read a URI using the +// given reader functions, in the same order. If a reader function does not +// support the URI and returns ErrURINotSupported, the next function is checked +// until a match is found, or the URI is not supported by any. +func ReadFromURIs(readers ...ReadFromURIFunc) ReadFromURIFunc { + return func(loader *Loader, url *url.URL) ([]byte, error) { + for i := range readers { + buf, err := readers[i](loader, url) + if err == ErrURINotSupported { + continue + } else if err != nil { + return nil, err + } + return buf, nil + } + return nil, ErrURINotSupported + } +} + +// DefaultReadFromURI returns a caching ReadFromURIFunc which can read remote +// HTTP URIs and local file URIs. +var DefaultReadFromURI = URIMapCache(ReadFromURIs(ReadFromHTTP(http.DefaultClient), ReadFromFile)) + +// ReadFromHTTP returns a ReadFromURIFunc which uses the given http.Client to +// read the contents from a remote HTTP URI. This client may be customized to +// implement timeouts, RFC 7234 caching, etc. +func ReadFromHTTP(cl *http.Client) ReadFromURIFunc { + return func(loader *Loader, location *url.URL) ([]byte, error) { + if location.Scheme == "" || location.Host == "" { + return nil, ErrURINotSupported + } + req, err := http.NewRequest("GET", location.String(), nil) + if err != nil { + return nil, err + } + resp, err := cl.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode > 399 { + return nil, fmt.Errorf("error loading %q: request returned status code %d", location.String(), resp.StatusCode) + } + return io.ReadAll(resp.Body) + } +} + +func is_file(location *url.URL) bool { + return location.Path != "" && + location.Host == "" && + (location.Scheme == "" || location.Scheme == "file") +} + +// ReadFromFile is a ReadFromURIFunc which reads local file URIs. +func ReadFromFile(loader *Loader, location *url.URL) ([]byte, error) { + if !is_file(location) { + return nil, ErrURINotSupported + } + return os.ReadFile(filepath.FromSlash(location.Path)) +} + +// URIMapCache returns a ReadFromURIFunc that caches the contents read from URI +// locations in a simple map. This cache implementation is suitable for +// short-lived processes such as command-line tools which process OpenAPI +// documents. +func URIMapCache(reader ReadFromURIFunc) ReadFromURIFunc { + cache := map[string][]byte{} + return func(loader *Loader, location *url.URL) (buf []byte, err error) { + if location.Scheme == "" || location.Scheme == "file" { + if !filepath.IsAbs(location.Path) { + // Do not cache relative file paths; this can cause trouble if + // the current working directory changes when processing + // multiple top-level documents. + return reader(loader, location) + } + } + uri := location.String() + var ok bool + uriMu.RLock() + if buf, ok = cache[uri]; ok { + uriMu.RUnlock() + return + } + uriMu.RUnlock() + if buf, err = reader(loader, location); err != nil { + return + } + uriMu.Lock() + defer uriMu.Unlock() + cache[uri] = buf + return + } +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/maplike.go b/vendor/github.com/getkin/kin-openapi/openapi3/maplike.go new file mode 100644 index 0000000000..7b8045c674 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/maplike.go @@ -0,0 +1,402 @@ +package openapi3 + +import ( + "encoding/json" + "sort" + "strings" + + "github.com/go-openapi/jsonpointer" +) + +// NewResponsesWithCapacity builds a responses object of the given capacity. +func NewResponsesWithCapacity(cap int) *Responses { + if cap == 0 { + return &Responses{m: make(map[string]*ResponseRef)} + } + return &Responses{m: make(map[string]*ResponseRef, cap)} +} + +// Value returns the responses for key or nil +func (responses *Responses) Value(key string) *ResponseRef { + if responses.Len() == 0 { + return nil + } + return responses.m[key] +} + +// Set adds or replaces key 'key' of 'responses' with 'value'. +// Note: 'responses' MUST be non-nil +func (responses *Responses) Set(key string, value *ResponseRef) { + if responses.m == nil { + responses.m = make(map[string]*ResponseRef) + } + responses.m[key] = value +} + +// Len returns the amount of keys in responses excluding responses.Extensions. +func (responses *Responses) Len() int { + if responses == nil || responses.m == nil { + return 0 + } + return len(responses.m) +} + +// Delete removes the entry associated with key 'key' from 'responses'. +func (responses *Responses) Delete(key string) { + if responses != nil && responses.m != nil { + delete(responses.m, key) + } +} + +// Map returns responses as a 'map'. +// Note: iteration on Go maps is not ordered. +func (responses *Responses) Map() (m map[string]*ResponseRef) { + if responses == nil || len(responses.m) == 0 { + return make(map[string]*ResponseRef) + } + m = make(map[string]*ResponseRef, len(responses.m)) + for k, v := range responses.m { + m[k] = v + } + return +} + +var _ jsonpointer.JSONPointable = (*Responses)(nil) + +// JSONLookup implements https://github.com/go-openapi/jsonpointer#JSONPointable +func (responses Responses) JSONLookup(token string) (any, error) { + if v := responses.Value(token); v == nil { + vv, _, err := jsonpointer.GetForToken(responses.Extensions, token) + return vv, err + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + var vv *Response = v.Value + return vv, nil + } +} + +// MarshalYAML returns the YAML encoding of Responses. +func (responses *Responses) MarshalYAML() (any, error) { + if responses == nil { + return nil, nil + } + m := make(map[string]any, responses.Len()+len(responses.Extensions)) + for k, v := range responses.Extensions { + m[k] = v + } + for k, v := range responses.Map() { + m[k] = v + } + return m, nil +} + +// MarshalJSON returns the JSON encoding of Responses. +func (responses *Responses) MarshalJSON() ([]byte, error) { + responsesYaml, err := responses.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(responsesYaml) +} + +// UnmarshalJSON sets Responses to a copy of data. +func (responses *Responses) UnmarshalJSON(data []byte) (err error) { + var m map[string]any + if err = json.Unmarshal(data, &m); err != nil { + return + } + + ks := make([]string, 0, len(m)) + for k := range m { + ks = append(ks, k) + } + sort.Strings(ks) + + x := Responses{ + Extensions: make(map[string]any), + m: make(map[string]*ResponseRef, len(m)), + } + + for _, k := range ks { + v := m[k] + if strings.HasPrefix(k, "x-") { + x.Extensions[k] = v + continue + } + + var data []byte + if data, err = json.Marshal(v); err != nil { + return + } + var vv ResponseRef + if err = vv.UnmarshalJSON(data); err != nil { + return + } + x.m[k] = &vv + } + *responses = x + return +} + +// NewCallbackWithCapacity builds a callback object of the given capacity. +func NewCallbackWithCapacity(cap int) *Callback { + if cap == 0 { + return &Callback{m: make(map[string]*PathItem)} + } + return &Callback{m: make(map[string]*PathItem, cap)} +} + +// Value returns the callback for key or nil +func (callback *Callback) Value(key string) *PathItem { + if callback.Len() == 0 { + return nil + } + return callback.m[key] +} + +// Set adds or replaces key 'key' of 'callback' with 'value'. +// Note: 'callback' MUST be non-nil +func (callback *Callback) Set(key string, value *PathItem) { + if callback.m == nil { + callback.m = make(map[string]*PathItem) + } + callback.m[key] = value +} + +// Len returns the amount of keys in callback excluding callback.Extensions. +func (callback *Callback) Len() int { + if callback == nil || callback.m == nil { + return 0 + } + return len(callback.m) +} + +// Delete removes the entry associated with key 'key' from 'callback'. +func (callback *Callback) Delete(key string) { + if callback != nil && callback.m != nil { + delete(callback.m, key) + } +} + +// Map returns callback as a 'map'. +// Note: iteration on Go maps is not ordered. +func (callback *Callback) Map() (m map[string]*PathItem) { + if callback == nil || len(callback.m) == 0 { + return make(map[string]*PathItem) + } + m = make(map[string]*PathItem, len(callback.m)) + for k, v := range callback.m { + m[k] = v + } + return +} + +var _ jsonpointer.JSONPointable = (*Callback)(nil) + +// JSONLookup implements https://github.com/go-openapi/jsonpointer#JSONPointable +func (callback Callback) JSONLookup(token string) (any, error) { + if v := callback.Value(token); v == nil { + vv, _, err := jsonpointer.GetForToken(callback.Extensions, token) + return vv, err + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + var vv *PathItem = v + return vv, nil + } +} + +// MarshalYAML returns the YAML encoding of Callback. +func (callback *Callback) MarshalYAML() (any, error) { + if callback == nil { + return nil, nil + } + m := make(map[string]any, callback.Len()+len(callback.Extensions)) + for k, v := range callback.Extensions { + m[k] = v + } + for k, v := range callback.Map() { + m[k] = v + } + return m, nil +} + +// MarshalJSON returns the JSON encoding of Callback. +func (callback *Callback) MarshalJSON() ([]byte, error) { + callbackYaml, err := callback.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(callbackYaml) +} + +// UnmarshalJSON sets Callback to a copy of data. +func (callback *Callback) UnmarshalJSON(data []byte) (err error) { + var m map[string]any + if err = json.Unmarshal(data, &m); err != nil { + return + } + + ks := make([]string, 0, len(m)) + for k := range m { + ks = append(ks, k) + } + sort.Strings(ks) + + x := Callback{ + Extensions: make(map[string]any), + m: make(map[string]*PathItem, len(m)), + } + + for _, k := range ks { + v := m[k] + if strings.HasPrefix(k, "x-") { + x.Extensions[k] = v + continue + } + + var data []byte + if data, err = json.Marshal(v); err != nil { + return + } + var vv PathItem + if err = vv.UnmarshalJSON(data); err != nil { + return + } + x.m[k] = &vv + } + *callback = x + return +} + +// NewPathsWithCapacity builds a paths object of the given capacity. +func NewPathsWithCapacity(cap int) *Paths { + if cap == 0 { + return &Paths{m: make(map[string]*PathItem)} + } + return &Paths{m: make(map[string]*PathItem, cap)} +} + +// Value returns the paths for key or nil +func (paths *Paths) Value(key string) *PathItem { + if paths.Len() == 0 { + return nil + } + return paths.m[key] +} + +// Set adds or replaces key 'key' of 'paths' with 'value'. +// Note: 'paths' MUST be non-nil +func (paths *Paths) Set(key string, value *PathItem) { + if paths.m == nil { + paths.m = make(map[string]*PathItem) + } + paths.m[key] = value +} + +// Len returns the amount of keys in paths excluding paths.Extensions. +func (paths *Paths) Len() int { + if paths == nil || paths.m == nil { + return 0 + } + return len(paths.m) +} + +// Delete removes the entry associated with key 'key' from 'paths'. +func (paths *Paths) Delete(key string) { + if paths != nil && paths.m != nil { + delete(paths.m, key) + } +} + +// Map returns paths as a 'map'. +// Note: iteration on Go maps is not ordered. +func (paths *Paths) Map() (m map[string]*PathItem) { + if paths == nil || len(paths.m) == 0 { + return make(map[string]*PathItem) + } + m = make(map[string]*PathItem, len(paths.m)) + for k, v := range paths.m { + m[k] = v + } + return +} + +var _ jsonpointer.JSONPointable = (*Paths)(nil) + +// JSONLookup implements https://github.com/go-openapi/jsonpointer#JSONPointable +func (paths Paths) JSONLookup(token string) (any, error) { + if v := paths.Value(token); v == nil { + vv, _, err := jsonpointer.GetForToken(paths.Extensions, token) + return vv, err + } else if ref := v.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } else { + var vv *PathItem = v + return vv, nil + } +} + +// MarshalYAML returns the YAML encoding of Paths. +func (paths *Paths) MarshalYAML() (any, error) { + if paths == nil { + return nil, nil + } + m := make(map[string]any, paths.Len()+len(paths.Extensions)) + for k, v := range paths.Extensions { + m[k] = v + } + for k, v := range paths.Map() { + m[k] = v + } + return m, nil +} + +// MarshalJSON returns the JSON encoding of Paths. +func (paths *Paths) MarshalJSON() ([]byte, error) { + pathsYaml, err := paths.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(pathsYaml) +} + +// UnmarshalJSON sets Paths to a copy of data. +func (paths *Paths) UnmarshalJSON(data []byte) (err error) { + var m map[string]any + if err = json.Unmarshal(data, &m); err != nil { + return + } + + ks := make([]string, 0, len(m)) + for k := range m { + ks = append(ks, k) + } + sort.Strings(ks) + + x := Paths{ + Extensions: make(map[string]any), + m: make(map[string]*PathItem, len(m)), + } + + for _, k := range ks { + v := m[k] + if strings.HasPrefix(k, "x-") { + x.Extensions[k] = v + continue + } + + var data []byte + if data, err = json.Marshal(v); err != nil { + return + } + var vv PathItem + if err = vv.UnmarshalJSON(data); err != nil { + return + } + x.m[k] = &vv + } + *paths = x + return +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/marsh.go b/vendor/github.com/getkin/kin-openapi/openapi3/marsh.go new file mode 100644 index 0000000000..daa937551c --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/marsh.go @@ -0,0 +1,34 @@ +package openapi3 + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/invopop/yaml" +) + +func unmarshalError(jsonUnmarshalErr error) error { + if before, after, found := strings.Cut(jsonUnmarshalErr.Error(), "Bis"); found && before != "" && after != "" { + before = strings.ReplaceAll(before, " Go struct ", " ") + return fmt.Errorf("%s%s", before, strings.ReplaceAll(after, "Bis", "")) + } + return jsonUnmarshalErr +} + +func unmarshal(data []byte, v any) error { + var jsonErr, yamlErr error + + // See https://github.com/getkin/kin-openapi/issues/680 + if jsonErr = json.Unmarshal(data, v); jsonErr == nil { + return nil + } + + // UnmarshalStrict(data, v) TODO: investigate how ymlv3 handles duplicate map keys + if yamlErr = yaml.Unmarshal(data, v); yamlErr == nil { + return nil + } + + // If both unmarshaling attempts fail, return a new error that includes both errors + return fmt.Errorf("failed to unmarshal data: json error: %v, yaml error: %v", jsonErr, yamlErr) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/media_type.go b/vendor/github.com/getkin/kin-openapi/openapi3/media_type.go new file mode 100644 index 0000000000..d4466bcf59 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/media_type.go @@ -0,0 +1,179 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "sort" + + "github.com/go-openapi/jsonpointer" +) + +// MediaType is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#media-type-object +type MediaType struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"` + Example any `json:"example,omitempty" yaml:"example,omitempty"` + Examples Examples `json:"examples,omitempty" yaml:"examples,omitempty"` + Encoding map[string]*Encoding `json:"encoding,omitempty" yaml:"encoding,omitempty"` +} + +var _ jsonpointer.JSONPointable = (*MediaType)(nil) + +func NewMediaType() *MediaType { + return &MediaType{} +} + +func (mediaType *MediaType) WithSchema(schema *Schema) *MediaType { + if schema == nil { + mediaType.Schema = nil + } else { + mediaType.Schema = &SchemaRef{Value: schema} + } + return mediaType +} + +func (mediaType *MediaType) WithSchemaRef(schema *SchemaRef) *MediaType { + mediaType.Schema = schema + return mediaType +} + +func (mediaType *MediaType) WithExample(name string, value any) *MediaType { + example := mediaType.Examples + if example == nil { + example = make(map[string]*ExampleRef) + mediaType.Examples = example + } + example[name] = &ExampleRef{ + Value: NewExample(value), + } + return mediaType +} + +func (mediaType *MediaType) WithEncoding(name string, enc *Encoding) *MediaType { + encoding := mediaType.Encoding + if encoding == nil { + encoding = make(map[string]*Encoding) + mediaType.Encoding = encoding + } + encoding[name] = enc + return mediaType +} + +// MarshalJSON returns the JSON encoding of MediaType. +func (mediaType MediaType) MarshalJSON() ([]byte, error) { + x, err := mediaType.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of MediaType. +func (mediaType MediaType) MarshalYAML() (any, error) { + m := make(map[string]any, 4+len(mediaType.Extensions)) + for k, v := range mediaType.Extensions { + m[k] = v + } + if x := mediaType.Schema; x != nil { + m["schema"] = x + } + if x := mediaType.Example; x != nil { + m["example"] = x + } + if x := mediaType.Examples; len(x) != 0 { + m["examples"] = x + } + if x := mediaType.Encoding; len(x) != 0 { + m["encoding"] = x + } + return m, nil +} + +// UnmarshalJSON sets MediaType to a copy of data. +func (mediaType *MediaType) UnmarshalJSON(data []byte) error { + type MediaTypeBis MediaType + var x MediaTypeBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "schema") + delete(x.Extensions, "example") + delete(x.Extensions, "examples") + delete(x.Extensions, "encoding") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *mediaType = MediaType(x) + return nil +} + +// Validate returns an error if MediaType does not comply with the OpenAPI spec. +func (mediaType *MediaType) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if mediaType == nil { + return nil + } + if schema := mediaType.Schema; schema != nil { + if err := schema.Validate(ctx); err != nil { + return err + } + + if mediaType.Example != nil && mediaType.Examples != nil { + return errors.New("example and examples are mutually exclusive") + } + + if vo := getValidationOptions(ctx); !vo.examplesValidationDisabled { + if example := mediaType.Example; example != nil { + if err := validateExampleValue(ctx, example, schema.Value); err != nil { + return fmt.Errorf("invalid example: %w", err) + } + } + + if examples := mediaType.Examples; examples != nil { + names := make([]string, 0, len(examples)) + for name := range examples { + names = append(names, name) + } + sort.Strings(names) + for _, k := range names { + v := examples[k] + if err := v.Validate(ctx); err != nil { + return fmt.Errorf("example %s: %w", k, err) + } + if err := validateExampleValue(ctx, v.Value.Value, schema.Value); err != nil { + return fmt.Errorf("example %s: %w", k, err) + } + } + } + } + } + + return validateExtensions(ctx, mediaType.Extensions) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (mediaType MediaType) JSONLookup(token string) (any, error) { + switch token { + case "schema": + if mediaType.Schema != nil { + if mediaType.Schema.Ref != "" { + return &Ref{Ref: mediaType.Schema.Ref}, nil + } + return mediaType.Schema.Value, nil + } + case "example": + return mediaType.Example, nil + case "examples": + return mediaType.Examples, nil + case "encoding": + return mediaType.Encoding, nil + } + v, _, err := jsonpointer.GetForToken(mediaType.Extensions, token) + return v, err +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/openapi3.go b/vendor/github.com/getkin/kin-openapi/openapi3/openapi3.go new file mode 100644 index 0000000000..ef1592e8c3 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/openapi3.go @@ -0,0 +1,205 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "net/url" + + "github.com/go-openapi/jsonpointer" +) + +// T is the root of an OpenAPI v3 document +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-object +type T struct { + Extensions map[string]any `json:"-" yaml:"-"` + + OpenAPI string `json:"openapi" yaml:"openapi"` // Required + Components *Components `json:"components,omitempty" yaml:"components,omitempty"` + Info *Info `json:"info" yaml:"info"` // Required + Paths *Paths `json:"paths" yaml:"paths"` // Required + Security SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"` + Servers Servers `json:"servers,omitempty" yaml:"servers,omitempty"` + Tags Tags `json:"tags,omitempty" yaml:"tags,omitempty"` + ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` + + visited visitedComponent + url *url.URL +} + +var _ jsonpointer.JSONPointable = (*T)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (doc *T) JSONLookup(token string) (any, error) { + switch token { + case "openapi": + return doc.OpenAPI, nil + case "components": + return doc.Components, nil + case "info": + return doc.Info, nil + case "paths": + return doc.Paths, nil + case "security": + return doc.Security, nil + case "servers": + return doc.Servers, nil + case "tags": + return doc.Tags, nil + case "externalDocs": + return doc.ExternalDocs, nil + } + + v, _, err := jsonpointer.GetForToken(doc.Extensions, token) + return v, err +} + +// MarshalJSON returns the JSON encoding of T. +func (doc *T) MarshalJSON() ([]byte, error) { + x, err := doc.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of T. +func (doc *T) MarshalYAML() (any, error) { + if doc == nil { + return nil, nil + } + m := make(map[string]any, 4+len(doc.Extensions)) + for k, v := range doc.Extensions { + m[k] = v + } + m["openapi"] = doc.OpenAPI + if x := doc.Components; x != nil { + m["components"] = x + } + m["info"] = doc.Info + m["paths"] = doc.Paths + if x := doc.Security; len(x) != 0 { + m["security"] = x + } + if x := doc.Servers; len(x) != 0 { + m["servers"] = x + } + if x := doc.Tags; len(x) != 0 { + m["tags"] = x + } + if x := doc.ExternalDocs; x != nil { + m["externalDocs"] = x + } + return m, nil +} + +// UnmarshalJSON sets T to a copy of data. +func (doc *T) UnmarshalJSON(data []byte) error { + type TBis T + var x TBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "openapi") + delete(x.Extensions, "components") + delete(x.Extensions, "info") + delete(x.Extensions, "paths") + delete(x.Extensions, "security") + delete(x.Extensions, "servers") + delete(x.Extensions, "tags") + delete(x.Extensions, "externalDocs") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *doc = T(x) + return nil +} + +func (doc *T) AddOperation(path string, method string, operation *Operation) { + if doc.Paths == nil { + doc.Paths = NewPaths() + } + pathItem := doc.Paths.Value(path) + if pathItem == nil { + pathItem = &PathItem{} + doc.Paths.Set(path, pathItem) + } + pathItem.SetOperation(method, operation) +} + +func (doc *T) AddServer(server *Server) { + doc.Servers = append(doc.Servers, server) +} + +func (doc *T) AddServers(servers ...*Server) { + doc.Servers = append(doc.Servers, servers...) +} + +// Validate returns an error if T does not comply with the OpenAPI spec. +// Validations Options can be provided to modify the validation behavior. +func (doc *T) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if doc.OpenAPI == "" { + return errors.New("value of openapi must be a non-empty string") + } + + var wrap func(error) error + + wrap = func(e error) error { return fmt.Errorf("invalid components: %w", e) } + if v := doc.Components; v != nil { + if err := v.Validate(ctx); err != nil { + return wrap(err) + } + } + + wrap = func(e error) error { return fmt.Errorf("invalid info: %w", e) } + if v := doc.Info; v != nil { + if err := v.Validate(ctx); err != nil { + return wrap(err) + } + } else { + return wrap(errors.New("must be an object")) + } + + wrap = func(e error) error { return fmt.Errorf("invalid paths: %w", e) } + if v := doc.Paths; v != nil { + if err := v.Validate(ctx); err != nil { + return wrap(err) + } + } else { + return wrap(errors.New("must be an object")) + } + + wrap = func(e error) error { return fmt.Errorf("invalid security: %w", e) } + if v := doc.Security; v != nil { + if err := v.Validate(ctx); err != nil { + return wrap(err) + } + } + + wrap = func(e error) error { return fmt.Errorf("invalid servers: %w", e) } + if v := doc.Servers; v != nil { + if err := v.Validate(ctx); err != nil { + return wrap(err) + } + } + + wrap = func(e error) error { return fmt.Errorf("invalid tags: %w", e) } + if v := doc.Tags; v != nil { + if err := v.Validate(ctx); err != nil { + return wrap(err) + } + } + + wrap = func(e error) error { return fmt.Errorf("invalid external docs: %w", e) } + if v := doc.ExternalDocs; v != nil { + if err := v.Validate(ctx); err != nil { + return wrap(err) + } + } + + return validateExtensions(ctx, doc.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/operation.go b/vendor/github.com/getkin/kin-openapi/openapi3/operation.go new file mode 100644 index 0000000000..40abf73c01 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/operation.go @@ -0,0 +1,222 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "strconv" + + "github.com/go-openapi/jsonpointer" +) + +// Operation represents "operation" specified by" OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object +type Operation struct { + Extensions map[string]any `json:"-" yaml:"-"` + + // Optional tags for documentation. + Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` + + // Optional short summary. + Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` + + // Optional description. Should use CommonMark syntax. + Description string `json:"description,omitempty" yaml:"description,omitempty"` + + // Optional operation ID. + OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"` + + // Optional parameters. + Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"` + + // Optional body parameter. + RequestBody *RequestBodyRef `json:"requestBody,omitempty" yaml:"requestBody,omitempty"` + + // Responses. + Responses *Responses `json:"responses" yaml:"responses"` // Required + + // Optional callbacks + Callbacks Callbacks `json:"callbacks,omitempty" yaml:"callbacks,omitempty"` + + Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` + + // Optional security requirements that overrides top-level security. + Security *SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"` + + // Optional servers that overrides top-level servers. + Servers *Servers `json:"servers,omitempty" yaml:"servers,omitempty"` + + ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` +} + +var _ jsonpointer.JSONPointable = (*Operation)(nil) + +func NewOperation() *Operation { + return &Operation{} +} + +// MarshalJSON returns the JSON encoding of Operation. +func (operation Operation) MarshalJSON() ([]byte, error) { + x, err := operation.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Operation. +func (operation Operation) MarshalYAML() (any, error) { + m := make(map[string]any, 12+len(operation.Extensions)) + for k, v := range operation.Extensions { + m[k] = v + } + if x := operation.Tags; len(x) != 0 { + m["tags"] = x + } + if x := operation.Summary; x != "" { + m["summary"] = x + } + if x := operation.Description; x != "" { + m["description"] = x + } + if x := operation.OperationID; x != "" { + m["operationId"] = x + } + if x := operation.Parameters; len(x) != 0 { + m["parameters"] = x + } + if x := operation.RequestBody; x != nil { + m["requestBody"] = x + } + m["responses"] = operation.Responses + if x := operation.Callbacks; len(x) != 0 { + m["callbacks"] = x + } + if x := operation.Deprecated; x { + m["deprecated"] = x + } + if x := operation.Security; x != nil { + m["security"] = x + } + if x := operation.Servers; x != nil { + m["servers"] = x + } + if x := operation.ExternalDocs; x != nil { + m["externalDocs"] = x + } + return m, nil +} + +// UnmarshalJSON sets Operation to a copy of data. +func (operation *Operation) UnmarshalJSON(data []byte) error { + type OperationBis Operation + var x OperationBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "tags") + delete(x.Extensions, "summary") + delete(x.Extensions, "description") + delete(x.Extensions, "operationId") + delete(x.Extensions, "parameters") + delete(x.Extensions, "requestBody") + delete(x.Extensions, "responses") + delete(x.Extensions, "callbacks") + delete(x.Extensions, "deprecated") + delete(x.Extensions, "security") + delete(x.Extensions, "servers") + delete(x.Extensions, "externalDocs") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *operation = Operation(x) + return nil +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (operation Operation) JSONLookup(token string) (any, error) { + switch token { + case "requestBody": + if operation.RequestBody != nil { + if operation.RequestBody.Ref != "" { + return &Ref{Ref: operation.RequestBody.Ref}, nil + } + return operation.RequestBody.Value, nil + } + case "tags": + return operation.Tags, nil + case "summary": + return operation.Summary, nil + case "description": + return operation.Description, nil + case "operationID": + return operation.OperationID, nil + case "parameters": + return operation.Parameters, nil + case "responses": + return operation.Responses, nil + case "callbacks": + return operation.Callbacks, nil + case "deprecated": + return operation.Deprecated, nil + case "security": + return operation.Security, nil + case "servers": + return operation.Servers, nil + case "externalDocs": + return operation.ExternalDocs, nil + } + + v, _, err := jsonpointer.GetForToken(operation.Extensions, token) + return v, err +} + +func (operation *Operation) AddParameter(p *Parameter) { + operation.Parameters = append(operation.Parameters, &ParameterRef{Value: p}) +} + +func (operation *Operation) AddResponse(status int, response *Response) { + code := "default" + if 0 < status && status < 1000 { + code = strconv.FormatInt(int64(status), 10) + } + if operation.Responses == nil { + operation.Responses = NewResponses() + } + operation.Responses.Set(code, &ResponseRef{Value: response}) +} + +// Validate returns an error if Operation does not comply with the OpenAPI spec. +func (operation *Operation) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if v := operation.Parameters; v != nil { + if err := v.Validate(ctx); err != nil { + return err + } + } + + if v := operation.RequestBody; v != nil { + if err := v.Validate(ctx); err != nil { + return err + } + } + + if v := operation.Responses; v != nil { + if err := v.Validate(ctx); err != nil { + return err + } + } else { + return errors.New("value of responses must be an object") + } + + if v := operation.ExternalDocs; v != nil { + if err := v.Validate(ctx); err != nil { + return fmt.Errorf("invalid external docs: %w", err) + } + } + + return validateExtensions(ctx, operation.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/parameter.go b/vendor/github.com/getkin/kin-openapi/openapi3/parameter.go new file mode 100644 index 0000000000..34fe291189 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/parameter.go @@ -0,0 +1,416 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "sort" + "strconv" + + "github.com/go-openapi/jsonpointer" +) + +// Parameters is specified by OpenAPI/Swagger 3.0 standard. +type Parameters []*ParameterRef + +var _ jsonpointer.JSONPointable = (*Parameters)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (p Parameters) JSONLookup(token string) (any, error) { + index, err := strconv.Atoi(token) + if err != nil { + return nil, err + } + if index < 0 || index >= len(p) { + return nil, fmt.Errorf("index %d out of bounds of array of length %d", index, len(p)) + } + + ref := p[index] + if ref != nil && ref.Ref != "" { + return &Ref{Ref: ref.Ref}, nil + } + return ref.Value, nil +} + +func NewParameters() Parameters { + return make(Parameters, 0, 4) +} + +func (parameters Parameters) GetByInAndName(in string, name string) *Parameter { + for _, item := range parameters { + if v := item.Value; v != nil { + if v.Name == name && v.In == in { + return v + } + } + } + return nil +} + +// Validate returns an error if Parameters does not comply with the OpenAPI spec. +func (parameters Parameters) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + dupes := make(map[string]struct{}) + for _, parameterRef := range parameters { + if v := parameterRef.Value; v != nil { + key := v.In + ":" + v.Name + if _, ok := dupes[key]; ok { + return fmt.Errorf("more than one %q parameter has name %q", v.In, v.Name) + } + dupes[key] = struct{}{} + } + + if err := parameterRef.Validate(ctx); err != nil { + return err + } + } + return nil +} + +// Parameter is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object +type Parameter struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + In string `json:"in,omitempty" yaml:"in,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Style string `json:"style,omitempty" yaml:"style,omitempty"` + Explode *bool `json:"explode,omitempty" yaml:"explode,omitempty"` + AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"` + AllowReserved bool `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"` + Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` + Required bool `json:"required,omitempty" yaml:"required,omitempty"` + Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"` + Example any `json:"example,omitempty" yaml:"example,omitempty"` + Examples Examples `json:"examples,omitempty" yaml:"examples,omitempty"` + Content Content `json:"content,omitempty" yaml:"content,omitempty"` +} + +var _ jsonpointer.JSONPointable = (*Parameter)(nil) + +const ( + ParameterInPath = "path" + ParameterInQuery = "query" + ParameterInHeader = "header" + ParameterInCookie = "cookie" +) + +func NewPathParameter(name string) *Parameter { + return &Parameter{ + Name: name, + In: ParameterInPath, + Required: true, + } +} + +func NewQueryParameter(name string) *Parameter { + return &Parameter{ + Name: name, + In: ParameterInQuery, + } +} + +func NewHeaderParameter(name string) *Parameter { + return &Parameter{ + Name: name, + In: ParameterInHeader, + } +} + +func NewCookieParameter(name string) *Parameter { + return &Parameter{ + Name: name, + In: ParameterInCookie, + } +} + +func (parameter *Parameter) WithDescription(value string) *Parameter { + parameter.Description = value + return parameter +} + +func (parameter *Parameter) WithRequired(value bool) *Parameter { + parameter.Required = value + return parameter +} + +func (parameter *Parameter) WithSchema(value *Schema) *Parameter { + if value == nil { + parameter.Schema = nil + } else { + parameter.Schema = &SchemaRef{ + Value: value, + } + } + return parameter +} + +// MarshalJSON returns the JSON encoding of Parameter. +func (parameter Parameter) MarshalJSON() ([]byte, error) { + x, err := parameter.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Parameter. +func (parameter Parameter) MarshalYAML() (any, error) { + m := make(map[string]any, 13+len(parameter.Extensions)) + for k, v := range parameter.Extensions { + m[k] = v + } + + if x := parameter.Name; x != "" { + m["name"] = x + } + if x := parameter.In; x != "" { + m["in"] = x + } + if x := parameter.Description; x != "" { + m["description"] = x + } + if x := parameter.Style; x != "" { + m["style"] = x + } + if x := parameter.Explode; x != nil { + m["explode"] = x + } + if x := parameter.AllowEmptyValue; x { + m["allowEmptyValue"] = x + } + if x := parameter.AllowReserved; x { + m["allowReserved"] = x + } + if x := parameter.Deprecated; x { + m["deprecated"] = x + } + if x := parameter.Required; x { + m["required"] = x + } + if x := parameter.Schema; x != nil { + m["schema"] = x + } + if x := parameter.Example; x != nil { + m["example"] = x + } + if x := parameter.Examples; len(x) != 0 { + m["examples"] = x + } + if x := parameter.Content; len(x) != 0 { + m["content"] = x + } + + return m, nil +} + +// UnmarshalJSON sets Parameter to a copy of data. +func (parameter *Parameter) UnmarshalJSON(data []byte) error { + type ParameterBis Parameter + var x ParameterBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + + delete(x.Extensions, "name") + delete(x.Extensions, "in") + delete(x.Extensions, "description") + delete(x.Extensions, "style") + delete(x.Extensions, "explode") + delete(x.Extensions, "allowEmptyValue") + delete(x.Extensions, "allowReserved") + delete(x.Extensions, "deprecated") + delete(x.Extensions, "required") + delete(x.Extensions, "schema") + delete(x.Extensions, "example") + delete(x.Extensions, "examples") + delete(x.Extensions, "content") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + + *parameter = Parameter(x) + return nil +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (parameter Parameter) JSONLookup(token string) (any, error) { + switch token { + case "schema": + if parameter.Schema != nil { + if parameter.Schema.Ref != "" { + return &Ref{Ref: parameter.Schema.Ref}, nil + } + return parameter.Schema.Value, nil + } + case "name": + return parameter.Name, nil + case "in": + return parameter.In, nil + case "description": + return parameter.Description, nil + case "style": + return parameter.Style, nil + case "explode": + return parameter.Explode, nil + case "allowEmptyValue": + return parameter.AllowEmptyValue, nil + case "allowReserved": + return parameter.AllowReserved, nil + case "deprecated": + return parameter.Deprecated, nil + case "required": + return parameter.Required, nil + case "example": + return parameter.Example, nil + case "examples": + return parameter.Examples, nil + case "content": + return parameter.Content, nil + } + + v, _, err := jsonpointer.GetForToken(parameter.Extensions, token) + return v, err +} + +// SerializationMethod returns a parameter's serialization method. +// When a parameter's serialization method is not defined the method returns +// the default serialization method corresponding to a parameter's location. +func (parameter *Parameter) SerializationMethod() (*SerializationMethod, error) { + switch parameter.In { + case ParameterInPath, ParameterInHeader: + style := parameter.Style + if style == "" { + style = SerializationSimple + } + explode := false + if parameter.Explode != nil { + explode = *parameter.Explode + } + return &SerializationMethod{Style: style, Explode: explode}, nil + case ParameterInQuery, ParameterInCookie: + style := parameter.Style + if style == "" { + style = SerializationForm + } + explode := true + if parameter.Explode != nil { + explode = *parameter.Explode + } + return &SerializationMethod{Style: style, Explode: explode}, nil + default: + return nil, fmt.Errorf("unexpected parameter's 'in': %q", parameter.In) + } +} + +// Validate returns an error if Parameter does not comply with the OpenAPI spec. +func (parameter *Parameter) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if parameter.Name == "" { + return errors.New("parameter name can't be blank") + } + in := parameter.In + switch in { + case + ParameterInPath, + ParameterInQuery, + ParameterInHeader, + ParameterInCookie: + default: + return fmt.Errorf("parameter can't have 'in' value %q", parameter.In) + } + + if in == ParameterInPath && !parameter.Required { + return fmt.Errorf("path parameter %q must be required", parameter.Name) + } + + // Validate a parameter's serialization method. + sm, err := parameter.SerializationMethod() + if err != nil { + return err + } + var smSupported bool + switch { + case parameter.In == ParameterInPath && sm.Style == SerializationSimple && !sm.Explode, + parameter.In == ParameterInPath && sm.Style == SerializationSimple && sm.Explode, + parameter.In == ParameterInPath && sm.Style == SerializationLabel && !sm.Explode, + parameter.In == ParameterInPath && sm.Style == SerializationLabel && sm.Explode, + parameter.In == ParameterInPath && sm.Style == SerializationMatrix && !sm.Explode, + parameter.In == ParameterInPath && sm.Style == SerializationMatrix && sm.Explode, + + parameter.In == ParameterInQuery && sm.Style == SerializationForm && sm.Explode, + parameter.In == ParameterInQuery && sm.Style == SerializationForm && !sm.Explode, + parameter.In == ParameterInQuery && sm.Style == SerializationSpaceDelimited && sm.Explode, + parameter.In == ParameterInQuery && sm.Style == SerializationSpaceDelimited && !sm.Explode, + parameter.In == ParameterInQuery && sm.Style == SerializationPipeDelimited && sm.Explode, + parameter.In == ParameterInQuery && sm.Style == SerializationPipeDelimited && !sm.Explode, + parameter.In == ParameterInQuery && sm.Style == SerializationDeepObject && sm.Explode, + + parameter.In == ParameterInHeader && sm.Style == SerializationSimple && !sm.Explode, + parameter.In == ParameterInHeader && sm.Style == SerializationSimple && sm.Explode, + + parameter.In == ParameterInCookie && sm.Style == SerializationForm && !sm.Explode, + parameter.In == ParameterInCookie && sm.Style == SerializationForm && sm.Explode: + smSupported = true + } + if !smSupported { + e := fmt.Errorf("serialization method with style=%q and explode=%v is not supported by a %s parameter", sm.Style, sm.Explode, in) + return fmt.Errorf("parameter %q schema is invalid: %w", parameter.Name, e) + } + + if (parameter.Schema == nil) == (len(parameter.Content) == 0) { + e := errors.New("parameter must contain exactly one of content and schema") + return fmt.Errorf("parameter %q schema is invalid: %w", parameter.Name, e) + } + + if content := parameter.Content; content != nil { + e := errors.New("parameter content must only contain one entry") + if len(content) > 1 { + return fmt.Errorf("parameter %q content is invalid: %w", parameter.Name, e) + } + + if err := content.Validate(ctx); err != nil { + return fmt.Errorf("parameter %q content is invalid: %w", parameter.Name, err) + } + } + + if schema := parameter.Schema; schema != nil { + if err := schema.Validate(ctx); err != nil { + return fmt.Errorf("parameter %q schema is invalid: %w", parameter.Name, err) + } + if parameter.Example != nil && parameter.Examples != nil { + return fmt.Errorf("parameter %q example and examples are mutually exclusive", parameter.Name) + } + + if vo := getValidationOptions(ctx); vo.examplesValidationDisabled { + return nil + } + if example := parameter.Example; example != nil { + if err := validateExampleValue(ctx, example, schema.Value); err != nil { + return fmt.Errorf("invalid example: %w", err) + } + } else if examples := parameter.Examples; examples != nil { + names := make([]string, 0, len(examples)) + for name := range examples { + names = append(names, name) + } + sort.Strings(names) + for _, k := range names { + v := examples[k] + if err := v.Validate(ctx); err != nil { + return fmt.Errorf("%s: %w", k, err) + } + if err := validateExampleValue(ctx, v.Value.Value, schema.Value); err != nil { + return fmt.Errorf("%s: %w", k, err) + } + } + } + } + + return validateExtensions(ctx, parameter.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/path_item.go b/vendor/github.com/getkin/kin-openapi/openapi3/path_item.go new file mode 100644 index 0000000000..859634fe6c --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/path_item.go @@ -0,0 +1,248 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "sort" +) + +// PathItem is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-item-object +type PathItem struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` + Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Connect *Operation `json:"connect,omitempty" yaml:"connect,omitempty"` + Delete *Operation `json:"delete,omitempty" yaml:"delete,omitempty"` + Get *Operation `json:"get,omitempty" yaml:"get,omitempty"` + Head *Operation `json:"head,omitempty" yaml:"head,omitempty"` + Options *Operation `json:"options,omitempty" yaml:"options,omitempty"` + Patch *Operation `json:"patch,omitempty" yaml:"patch,omitempty"` + Post *Operation `json:"post,omitempty" yaml:"post,omitempty"` + Put *Operation `json:"put,omitempty" yaml:"put,omitempty"` + Trace *Operation `json:"trace,omitempty" yaml:"trace,omitempty"` + Servers Servers `json:"servers,omitempty" yaml:"servers,omitempty"` + Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"` +} + +// MarshalJSON returns the JSON encoding of PathItem. +func (pathItem PathItem) MarshalJSON() ([]byte, error) { + x, err := pathItem.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of PathItem. +func (pathItem PathItem) MarshalYAML() (any, error) { + if ref := pathItem.Ref; ref != "" { + return Ref{Ref: ref}, nil + } + + m := make(map[string]any, 13+len(pathItem.Extensions)) + for k, v := range pathItem.Extensions { + m[k] = v + } + if x := pathItem.Summary; x != "" { + m["summary"] = x + } + if x := pathItem.Description; x != "" { + m["description"] = x + } + if x := pathItem.Connect; x != nil { + m["connect"] = x + } + if x := pathItem.Delete; x != nil { + m["delete"] = x + } + if x := pathItem.Get; x != nil { + m["get"] = x + } + if x := pathItem.Head; x != nil { + m["head"] = x + } + if x := pathItem.Options; x != nil { + m["options"] = x + } + if x := pathItem.Patch; x != nil { + m["patch"] = x + } + if x := pathItem.Post; x != nil { + m["post"] = x + } + if x := pathItem.Put; x != nil { + m["put"] = x + } + if x := pathItem.Trace; x != nil { + m["trace"] = x + } + if x := pathItem.Servers; len(x) != 0 { + m["servers"] = x + } + if x := pathItem.Parameters; len(x) != 0 { + m["parameters"] = x + } + return m, nil +} + +// UnmarshalJSON sets PathItem to a copy of data. +func (pathItem *PathItem) UnmarshalJSON(data []byte) error { + type PathItemBis PathItem + var x PathItemBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "$ref") + delete(x.Extensions, "summary") + delete(x.Extensions, "description") + delete(x.Extensions, "connect") + delete(x.Extensions, "delete") + delete(x.Extensions, "get") + delete(x.Extensions, "head") + delete(x.Extensions, "options") + delete(x.Extensions, "patch") + delete(x.Extensions, "post") + delete(x.Extensions, "put") + delete(x.Extensions, "trace") + delete(x.Extensions, "servers") + delete(x.Extensions, "parameters") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *pathItem = PathItem(x) + return nil +} + +func (pathItem *PathItem) Operations() map[string]*Operation { + operations := make(map[string]*Operation) + if v := pathItem.Connect; v != nil { + operations[http.MethodConnect] = v + } + if v := pathItem.Delete; v != nil { + operations[http.MethodDelete] = v + } + if v := pathItem.Get; v != nil { + operations[http.MethodGet] = v + } + if v := pathItem.Head; v != nil { + operations[http.MethodHead] = v + } + if v := pathItem.Options; v != nil { + operations[http.MethodOptions] = v + } + if v := pathItem.Patch; v != nil { + operations[http.MethodPatch] = v + } + if v := pathItem.Post; v != nil { + operations[http.MethodPost] = v + } + if v := pathItem.Put; v != nil { + operations[http.MethodPut] = v + } + if v := pathItem.Trace; v != nil { + operations[http.MethodTrace] = v + } + return operations +} + +func (pathItem *PathItem) GetOperation(method string) *Operation { + switch method { + case http.MethodConnect: + return pathItem.Connect + case http.MethodDelete: + return pathItem.Delete + case http.MethodGet: + return pathItem.Get + case http.MethodHead: + return pathItem.Head + case http.MethodOptions: + return pathItem.Options + case http.MethodPatch: + return pathItem.Patch + case http.MethodPost: + return pathItem.Post + case http.MethodPut: + return pathItem.Put + case http.MethodTrace: + return pathItem.Trace + default: + panic(fmt.Errorf("unsupported HTTP method %q", method)) + } +} + +func (pathItem *PathItem) SetOperation(method string, operation *Operation) { + switch method { + case http.MethodConnect: + pathItem.Connect = operation + case http.MethodDelete: + pathItem.Delete = operation + case http.MethodGet: + pathItem.Get = operation + case http.MethodHead: + pathItem.Head = operation + case http.MethodOptions: + pathItem.Options = operation + case http.MethodPatch: + pathItem.Patch = operation + case http.MethodPost: + pathItem.Post = operation + case http.MethodPut: + pathItem.Put = operation + case http.MethodTrace: + pathItem.Trace = operation + default: + panic(fmt.Errorf("unsupported HTTP method %q", method)) + } +} + +// Validate returns an error if PathItem does not comply with the OpenAPI spec. +func (pathItem *PathItem) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + operations := pathItem.Operations() + + methods := make([]string, 0, len(operations)) + for method := range operations { + methods = append(methods, method) + } + sort.Strings(methods) + for _, method := range methods { + operation := operations[method] + if err := operation.Validate(ctx); err != nil { + return fmt.Errorf("invalid operation %s: %v", method, err) + } + } + + if v := pathItem.Parameters; v != nil { + if err := v.Validate(ctx); err != nil { + return err + } + } + + return validateExtensions(ctx, pathItem.Extensions) +} + +// isEmpty's introduced in 546590b1 +func (pathItem *PathItem) isEmpty() bool { + // NOTE: ignores pathItem.Extensions + // NOTE: ignores pathItem.Ref + return pathItem.Summary == "" && + pathItem.Description == "" && + pathItem.Connect == nil && + pathItem.Delete == nil && + pathItem.Get == nil && + pathItem.Head == nil && + pathItem.Options == nil && + pathItem.Patch == nil && + pathItem.Post == nil && + pathItem.Put == nil && + pathItem.Trace == nil && + len(pathItem.Servers) == 0 && + len(pathItem.Parameters) == 0 +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/paths.go b/vendor/github.com/getkin/kin-openapi/openapi3/paths.go new file mode 100644 index 0000000000..76747412be --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/paths.go @@ -0,0 +1,268 @@ +package openapi3 + +import ( + "context" + "fmt" + "sort" + "strings" +) + +// Paths is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#paths-object +type Paths struct { + Extensions map[string]any `json:"-" yaml:"-"` + + m map[string]*PathItem +} + +// NewPaths builds a paths object with path items in insertion order. +func NewPaths(opts ...NewPathsOption) *Paths { + paths := NewPathsWithCapacity(len(opts)) + for _, opt := range opts { + opt(paths) + } + return paths +} + +// NewPathsOption describes options to NewPaths func +type NewPathsOption func(*Paths) + +// WithPath adds a named path item +func WithPath(path string, pathItem *PathItem) NewPathsOption { + return func(paths *Paths) { + if p := pathItem; p != nil && path != "" { + paths.Set(path, p) + } + } +} + +// Validate returns an error if Paths does not comply with the OpenAPI spec. +func (paths *Paths) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + normalizedPaths := make(map[string]string, paths.Len()) + + keys := make([]string, 0, paths.Len()) + for key := range paths.Map() { + keys = append(keys, key) + } + sort.Strings(keys) + for _, path := range keys { + pathItem := paths.Value(path) + if path == "" || path[0] != '/' { + return fmt.Errorf("path %q does not start with a forward slash (/)", path) + } + + if pathItem == nil { + pathItem = &PathItem{} + paths.Set(path, pathItem) + } + + normalizedPath, _, varsInPath := normalizeTemplatedPath(path) + if oldPath, ok := normalizedPaths[normalizedPath]; ok { + return fmt.Errorf("conflicting paths %q and %q", path, oldPath) + } + normalizedPaths[path] = path + + var commonParams []string + for _, parameterRef := range pathItem.Parameters { + if parameterRef != nil { + if parameter := parameterRef.Value; parameter != nil && parameter.In == ParameterInPath { + commonParams = append(commonParams, parameter.Name) + } + } + } + operations := pathItem.Operations() + methods := make([]string, 0, len(operations)) + for method := range operations { + methods = append(methods, method) + } + sort.Strings(methods) + for _, method := range methods { + operation := operations[method] + var setParams []string + for _, parameterRef := range operation.Parameters { + if parameterRef != nil { + if parameter := parameterRef.Value; parameter != nil && parameter.In == ParameterInPath { + setParams = append(setParams, parameter.Name) + } + } + } + if expected := len(setParams) + len(commonParams); expected != len(varsInPath) { + expected -= len(varsInPath) + if expected < 0 { + expected *= -1 + } + missing := make(map[string]struct{}, expected) + definedParams := append(setParams, commonParams...) + for _, name := range definedParams { + if _, ok := varsInPath[name]; !ok { + missing[name] = struct{}{} + } + } + for name := range varsInPath { + got := false + for _, othername := range definedParams { + if othername == name { + got = true + break + } + } + if !got { + missing[name] = struct{}{} + } + } + if len(missing) != 0 { + missings := make([]string, 0, len(missing)) + for name := range missing { + missings = append(missings, name) + } + return fmt.Errorf("operation %s %s must define exactly all path parameters (missing: %v)", method, path, missings) + } + } + } + + if err := pathItem.Validate(ctx); err != nil { + return fmt.Errorf("invalid path %s: %v", path, err) + } + } + + if err := paths.validateUniqueOperationIDs(); err != nil { + return err + } + + return validateExtensions(ctx, paths.Extensions) +} + +// InMatchingOrder returns paths in the order they are matched against URLs. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#paths-object +// When matching URLs, concrete (non-templated) paths would be matched +// before their templated counterparts. +func (paths *Paths) InMatchingOrder() []string { + // NOTE: sorting by number of variables ASC then by descending lexicographical + // order seems to be a good heuristic. + if paths.Len() == 0 { + return nil + } + + vars := make(map[int][]string) + max := 0 + for path := range paths.Map() { + count := strings.Count(path, "}") + vars[count] = append(vars[count], path) + if count > max { + max = count + } + } + + ordered := make([]string, 0, paths.Len()) + for c := 0; c <= max; c++ { + if ps, ok := vars[c]; ok { + sort.Sort(sort.Reverse(sort.StringSlice(ps))) + ordered = append(ordered, ps...) + } + } + return ordered +} + +// Find returns a path that matches the key. +// +// The method ignores differences in template variable names (except possible "*" suffix). +// +// For example: +// +// paths := openapi3.Paths { +// "/person/{personName}": &openapi3.PathItem{}, +// } +// pathItem := path.Find("/person/{name}") +// +// would return the correct path item. +func (paths *Paths) Find(key string) *PathItem { + // Try directly access the map + pathItem := paths.Value(key) + if pathItem != nil { + return pathItem + } + + normalizedPath, expected, _ := normalizeTemplatedPath(key) + for path, pathItem := range paths.Map() { + pathNormalized, got, _ := normalizeTemplatedPath(path) + if got == expected && pathNormalized == normalizedPath { + return pathItem + } + } + return nil +} + +func (paths *Paths) validateUniqueOperationIDs() error { + operationIDs := make(map[string]string) + for urlPath, pathItem := range paths.Map() { + if pathItem == nil { + continue + } + for httpMethod, operation := range pathItem.Operations() { + if operation == nil || operation.OperationID == "" { + continue + } + endpoint := httpMethod + " " + urlPath + if endpointDup, ok := operationIDs[operation.OperationID]; ok { + if endpoint > endpointDup { // For make error message a bit more deterministic. May be useful for tests. + endpoint, endpointDup = endpointDup, endpoint + } + return fmt.Errorf("operations %q and %q have the same operation id %q", + endpoint, endpointDup, operation.OperationID) + } + operationIDs[operation.OperationID] = endpoint + } + } + return nil +} + +func normalizeTemplatedPath(path string) (string, uint, map[string]struct{}) { + if strings.IndexByte(path, '{') < 0 { + return path, 0, nil + } + + var buffTpl strings.Builder + buffTpl.Grow(len(path)) + + var ( + cc rune + count uint + isVariable bool + vars = make(map[string]struct{}) + buffVar strings.Builder + ) + for i, c := range path { + if isVariable { + if c == '}' { + // End path variable + isVariable = false + + vars[buffVar.String()] = struct{}{} + buffVar = strings.Builder{} + + // First append possible '*' before this character + // The character '}' will be appended + if i > 0 && cc == '*' { + buffTpl.WriteRune(cc) + } + } else { + buffVar.WriteRune(c) + continue + } + + } else if c == '{' { + // Begin path variable + isVariable = true + + // The character '{' will be appended + count++ + } + + // Append the character + buffTpl.WriteRune(c) + cc = c + } + return buffTpl.String(), count, vars +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/ref.go b/vendor/github.com/getkin/kin-openapi/openapi3/ref.go new file mode 100644 index 0000000000..07060731f4 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/ref.go @@ -0,0 +1,9 @@ +package openapi3 + +//go:generate go run refsgenerator.go + +// Ref is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object +type Ref struct { + Ref string `json:"$ref" yaml:"$ref"` +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/refs.go b/vendor/github.com/getkin/kin-openapi/openapi3/refs.go new file mode 100644 index 0000000000..d337b0e3df --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/refs.go @@ -0,0 +1,1238 @@ +// Code generated by go generate; DO NOT EDIT. +package openapi3 + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "sort" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/perimeterx/marshmallow" +) + +// CallbackRef represents either a Callback or a $ref to a Callback. +// When serializing and both fields are set, Ref is preferred over Value. +type CallbackRef struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *Callback + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*CallbackRef)(nil) + +func (x *CallbackRef) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *CallbackRef) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *CallbackRef) CollectionName() string { return "callbacks" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *CallbackRef) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *CallbackRef) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of CallbackRef. +func (x CallbackRef) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of CallbackRef. +func (x CallbackRef) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets CallbackRef to a copy of data. +func (x *CallbackRef) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if CallbackRef does not comply with the OpenAPI spec. +func (x *CallbackRef) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *CallbackRef) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} + +// ExampleRef represents either a Example or a $ref to a Example. +// When serializing and both fields are set, Ref is preferred over Value. +type ExampleRef struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *Example + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*ExampleRef)(nil) + +func (x *ExampleRef) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *ExampleRef) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *ExampleRef) CollectionName() string { return "examples" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *ExampleRef) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *ExampleRef) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of ExampleRef. +func (x ExampleRef) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of ExampleRef. +func (x ExampleRef) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets ExampleRef to a copy of data. +func (x *ExampleRef) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if ExampleRef does not comply with the OpenAPI spec. +func (x *ExampleRef) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *ExampleRef) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} + +// HeaderRef represents either a Header or a $ref to a Header. +// When serializing and both fields are set, Ref is preferred over Value. +type HeaderRef struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *Header + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*HeaderRef)(nil) + +func (x *HeaderRef) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *HeaderRef) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *HeaderRef) CollectionName() string { return "headers" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *HeaderRef) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *HeaderRef) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of HeaderRef. +func (x HeaderRef) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of HeaderRef. +func (x HeaderRef) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets HeaderRef to a copy of data. +func (x *HeaderRef) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if HeaderRef does not comply with the OpenAPI spec. +func (x *HeaderRef) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *HeaderRef) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} + +// LinkRef represents either a Link or a $ref to a Link. +// When serializing and both fields are set, Ref is preferred over Value. +type LinkRef struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *Link + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*LinkRef)(nil) + +func (x *LinkRef) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *LinkRef) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *LinkRef) CollectionName() string { return "links" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *LinkRef) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *LinkRef) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of LinkRef. +func (x LinkRef) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of LinkRef. +func (x LinkRef) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets LinkRef to a copy of data. +func (x *LinkRef) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if LinkRef does not comply with the OpenAPI spec. +func (x *LinkRef) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *LinkRef) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} + +// ParameterRef represents either a Parameter or a $ref to a Parameter. +// When serializing and both fields are set, Ref is preferred over Value. +type ParameterRef struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *Parameter + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*ParameterRef)(nil) + +func (x *ParameterRef) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *ParameterRef) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *ParameterRef) CollectionName() string { return "parameters" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *ParameterRef) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *ParameterRef) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of ParameterRef. +func (x ParameterRef) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of ParameterRef. +func (x ParameterRef) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets ParameterRef to a copy of data. +func (x *ParameterRef) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if ParameterRef does not comply with the OpenAPI spec. +func (x *ParameterRef) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *ParameterRef) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} + +// RequestBodyRef represents either a RequestBody or a $ref to a RequestBody. +// When serializing and both fields are set, Ref is preferred over Value. +type RequestBodyRef struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *RequestBody + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*RequestBodyRef)(nil) + +func (x *RequestBodyRef) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *RequestBodyRef) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *RequestBodyRef) CollectionName() string { return "requestBodies" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *RequestBodyRef) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *RequestBodyRef) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of RequestBodyRef. +func (x RequestBodyRef) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of RequestBodyRef. +func (x RequestBodyRef) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets RequestBodyRef to a copy of data. +func (x *RequestBodyRef) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if RequestBodyRef does not comply with the OpenAPI spec. +func (x *RequestBodyRef) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *RequestBodyRef) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} + +// ResponseRef represents either a Response or a $ref to a Response. +// When serializing and both fields are set, Ref is preferred over Value. +type ResponseRef struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *Response + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*ResponseRef)(nil) + +func (x *ResponseRef) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *ResponseRef) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *ResponseRef) CollectionName() string { return "responses" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *ResponseRef) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *ResponseRef) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of ResponseRef. +func (x ResponseRef) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of ResponseRef. +func (x ResponseRef) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets ResponseRef to a copy of data. +func (x *ResponseRef) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if ResponseRef does not comply with the OpenAPI spec. +func (x *ResponseRef) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *ResponseRef) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} + +// SchemaRef represents either a Schema or a $ref to a Schema. +// When serializing and both fields are set, Ref is preferred over Value. +type SchemaRef struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *Schema + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*SchemaRef)(nil) + +func (x *SchemaRef) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *SchemaRef) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *SchemaRef) CollectionName() string { return "schemas" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *SchemaRef) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *SchemaRef) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of SchemaRef. +func (x SchemaRef) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of SchemaRef. +func (x SchemaRef) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets SchemaRef to a copy of data. +func (x *SchemaRef) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if SchemaRef does not comply with the OpenAPI spec. +func (x *SchemaRef) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *SchemaRef) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} + +// SecuritySchemeRef represents either a SecurityScheme or a $ref to a SecurityScheme. +// When serializing and both fields are set, Ref is preferred over Value. +type SecuritySchemeRef struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *SecurityScheme + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*SecuritySchemeRef)(nil) + +func (x *SecuritySchemeRef) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *SecuritySchemeRef) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *SecuritySchemeRef) CollectionName() string { return "securitySchemes" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *SecuritySchemeRef) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *SecuritySchemeRef) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of SecuritySchemeRef. +func (x SecuritySchemeRef) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of SecuritySchemeRef. +func (x SecuritySchemeRef) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets SecuritySchemeRef to a copy of data. +func (x *SecuritySchemeRef) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if SecuritySchemeRef does not comply with the OpenAPI spec. +func (x *SecuritySchemeRef) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *SecuritySchemeRef) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/refs.tmpl b/vendor/github.com/getkin/kin-openapi/openapi3/refs.tmpl new file mode 100644 index 0000000000..a3f5bdab7b --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/refs.tmpl @@ -0,0 +1,151 @@ +// Code generated by go generate; DO NOT EDIT. +package {{ .Package }} + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "sort" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/perimeterx/marshmallow" +) +{{ range $type := .Types }} +// {{ $type.Name }}Ref represents either a {{ $type.Name }} or a $ref to a {{ $type.Name }}. +// When serializing and both fields are set, Ref is preferred over Value. +type {{ $type.Name }}Ref struct { + // Extensions only captures fields starting with 'x-' as no other fields + // are allowed by the openapi spec. + Extensions map[string]any + + Ref string + Value *{{ $type.Name }} + extra []string + + refPath *url.URL +} + +var _ jsonpointer.JSONPointable = (*{{ $type.Name }}Ref)(nil) + +func (x *{{ $type.Name }}Ref) isEmpty() bool { return x == nil || x.Ref == "" && x.Value == nil } + +// RefString returns the $ref value. +func (x *{{ $type.Name }}Ref) RefString() string { return x.Ref } + +// CollectionName returns the JSON string used for a collection of these components. +func (x *{{ $type.Name }}Ref) CollectionName() string { return "{{ $type.CollectionName }}" } + +// RefPath returns the path of the $ref relative to the root document. +func (x *{{ $type.Name }}Ref) RefPath() *url.URL { return copyURI(x.refPath) } + +func (x *{{ $type.Name }}Ref) setRefPath(u *url.URL) { + // Once the refPath is set don't override. References can be loaded + // multiple times not all with access to the correct path info. + if x.refPath != nil { + return + } + + x.refPath = copyURI(u) +} + +// MarshalYAML returns the YAML encoding of {{ $type.Name }}Ref. +func (x {{ $type.Name }}Ref) MarshalYAML() (any, error) { + if ref := x.Ref; ref != "" { + return &Ref{Ref: ref}, nil + } + return x.Value.MarshalYAML() +} + +// MarshalJSON returns the JSON encoding of {{ $type.Name }}Ref. +func (x {{ $type.Name }}Ref) MarshalJSON() ([]byte, error) { + y, err := x.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(y) +} + +// UnmarshalJSON sets {{ $type.Name }}Ref to a copy of data. +func (x *{{ $type.Name }}Ref) UnmarshalJSON(data []byte) error { + var refOnly Ref + if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { + x.Ref = refOnly.Ref + if len(extra) != 0 { + x.extra = make([]string, 0, len(extra)) + for key := range extra { + x.extra = append(x.extra, key) + } + sort.Strings(x.extra) + for k := range extra { + if !strings.HasPrefix(k, "x-") { + delete(extra, k) + } + } + if len(extra) != 0 { + x.Extensions = extra + } + } + return nil + } + return json.Unmarshal(data, &x.Value) +} + +// Validate returns an error if {{ $type.Name }}Ref does not comply with the OpenAPI spec. +func (x *{{ $type.Name }}Ref) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + exProhibited := getValidationOptions(ctx).schemaExtensionsInRefProhibited + var extras []string + if extra := x.extra; len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for _, ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + // extras in the Extensions checked below + if _, ok := x.Extensions[ex]; !ok { + extras = append(extras, ex) + } + } + } + + if extra := x.Extensions; exProhibited && len(extra) != 0 { + allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed + for ex := range extra { + if allowed != nil { + if _, ok := allowed[ex]; ok { + continue + } + } + extras = append(extras, ex) + } + } + + if len(extras) != 0 { + return fmt.Errorf("extra sibling fields: %+v", extras) + } + + if v := x.Value; v != nil { + return v.Validate(ctx) + } + + return foundUnresolvedRef(x.Ref) +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (x *{{ $type.Name }}Ref) JSONLookup(token string) (any, error) { + if token == "$ref" { + return x.Ref, nil + } + + if v, ok := x.Extensions[token]; ok { + return v, nil + } + + ptr, _, err := jsonpointer.GetForToken(x.Value, token) + return ptr, err +} +{{ end -}} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/refs_test.tmpl b/vendor/github.com/getkin/kin-openapi/openapi3/refs_test.tmpl new file mode 100644 index 0000000000..634fccf6f6 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/refs_test.tmpl @@ -0,0 +1,54 @@ +// Code generated by go generate; DO NOT EDIT. +package {{ .Package }} + +import ( + "context" + "encoding/json" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) +{{ range $type := .Types }} +func Test{{ $type.Name }}Ref_Extensions(t *testing.T) { + data := []byte(`{"$ref":"#/components/schemas/Pet","something":"integer","x-order":1}`) + + ref := {{ $type.Name }}Ref{} + err := json.Unmarshal(data, &ref) + assert.NoError(t, err) + + // captures extension + assert.Equal(t, "#/components/schemas/Pet", ref.Ref) + assert.Equal(t, float64(1), ref.Extensions["x-order"]) + + // does not capture non-extensions + assert.Nil(t, ref.Extensions["something"]) + + // validation + err = ref.Validate(context.Background()) + require.EqualError(t, err, "extra sibling fields: [something]") + + err = ref.Validate(context.Background(), ProhibitExtensionsWithRef()) + require.EqualError(t, err, "extra sibling fields: [something x-order]") + + err = ref.Validate(context.Background(), AllowExtraSiblingFields("something")) + assert.ErrorContains(t, err, "found unresolved ref") // expected since value not defined + + // non-extension not json lookable + _, err = ref.JSONLookup("something") + assert.Error(t, err) +{{ if ne $type.Name "Header" }} + t.Run("extentions in value", func(t *testing.T) { + ref.Value = &{{ $type.Name }}{Extensions: map[string]any{}} + ref.Value.Extensions["x-order"] = 2.0 + + // prefers the value next to the \$ref over the one in the \$ref. + v, err := ref.JSONLookup("x-order") + assert.NoError(t, err) + assert.Equal(t, float64(1), v) + }) +{{ else }} + // Header does not have its own extensions. +{{ end -}} +} +{{ end -}} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/request_body.go b/vendor/github.com/getkin/kin-openapi/openapi3/request_body.go new file mode 100644 index 0000000000..6d4b8185e2 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/request_body.go @@ -0,0 +1,138 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" +) + +// RequestBody is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#request-body-object +type RequestBody struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Required bool `json:"required,omitempty" yaml:"required,omitempty"` + Content Content `json:"content" yaml:"content"` +} + +func NewRequestBody() *RequestBody { + return &RequestBody{} +} + +func (requestBody *RequestBody) WithDescription(value string) *RequestBody { + requestBody.Description = value + return requestBody +} + +func (requestBody *RequestBody) WithRequired(value bool) *RequestBody { + requestBody.Required = value + return requestBody +} + +func (requestBody *RequestBody) WithContent(content Content) *RequestBody { + requestBody.Content = content + return requestBody +} + +func (requestBody *RequestBody) WithSchemaRef(value *SchemaRef, consumes []string) *RequestBody { + requestBody.Content = NewContentWithSchemaRef(value, consumes) + return requestBody +} + +func (requestBody *RequestBody) WithSchema(value *Schema, consumes []string) *RequestBody { + requestBody.Content = NewContentWithSchema(value, consumes) + return requestBody +} + +func (requestBody *RequestBody) WithJSONSchemaRef(value *SchemaRef) *RequestBody { + requestBody.Content = NewContentWithJSONSchemaRef(value) + return requestBody +} + +func (requestBody *RequestBody) WithJSONSchema(value *Schema) *RequestBody { + requestBody.Content = NewContentWithJSONSchema(value) + return requestBody +} + +func (requestBody *RequestBody) WithFormDataSchemaRef(value *SchemaRef) *RequestBody { + requestBody.Content = NewContentWithFormDataSchemaRef(value) + return requestBody +} + +func (requestBody *RequestBody) WithFormDataSchema(value *Schema) *RequestBody { + requestBody.Content = NewContentWithFormDataSchema(value) + return requestBody +} + +func (requestBody *RequestBody) GetMediaType(mediaType string) *MediaType { + m := requestBody.Content + if m == nil { + return nil + } + return m[mediaType] +} + +// MarshalJSON returns the JSON encoding of RequestBody. +func (requestBody RequestBody) MarshalJSON() ([]byte, error) { + x, err := requestBody.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of RequestBody. +func (requestBody RequestBody) MarshalYAML() (any, error) { + m := make(map[string]any, 3+len(requestBody.Extensions)) + for k, v := range requestBody.Extensions { + m[k] = v + } + if x := requestBody.Description; x != "" { + m["description"] = requestBody.Description + } + if x := requestBody.Required; x { + m["required"] = x + } + if x := requestBody.Content; true { + m["content"] = x + } + return m, nil +} + +// UnmarshalJSON sets RequestBody to a copy of data. +func (requestBody *RequestBody) UnmarshalJSON(data []byte) error { + type RequestBodyBis RequestBody + var x RequestBodyBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "description") + delete(x.Extensions, "required") + delete(x.Extensions, "content") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *requestBody = RequestBody(x) + return nil +} + +// Validate returns an error if RequestBody does not comply with the OpenAPI spec. +func (requestBody *RequestBody) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if requestBody.Content == nil { + return errors.New("content of the request body is required") + } + + if vo := getValidationOptions(ctx); !vo.examplesValidationDisabled { + vo.examplesValidationAsReq, vo.examplesValidationAsRes = true, false + } + + if err := requestBody.Content.Validate(ctx); err != nil { + return err + } + + return validateExtensions(ctx, requestBody.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/response.go b/vendor/github.com/getkin/kin-openapi/openapi3/response.go new file mode 100644 index 0000000000..af8fda6f74 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/response.go @@ -0,0 +1,227 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "sort" + "strconv" +) + +// Responses is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responses-object +type Responses struct { + Extensions map[string]any `json:"-" yaml:"-"` + + m map[string]*ResponseRef +} + +// NewResponses builds a responses object with response objects in insertion order. +// Given no arguments, NewResponses returns a valid responses object containing a default match-all reponse. +func NewResponses(opts ...NewResponsesOption) *Responses { + if len(opts) == 0 { + return NewResponses(WithName("default", NewResponse().WithDescription(""))) + } + responses := NewResponsesWithCapacity(len(opts)) + for _, opt := range opts { + opt(responses) + } + return responses +} + +// NewResponsesOption describes options to NewResponses func +type NewResponsesOption func(*Responses) + +// WithStatus adds a status code keyed ResponseRef +func WithStatus(status int, responseRef *ResponseRef) NewResponsesOption { + return func(responses *Responses) { + if r := responseRef; r != nil { + code := strconv.FormatInt(int64(status), 10) + responses.Set(code, r) + } + } +} + +// WithName adds a name-keyed Response +func WithName(name string, response *Response) NewResponsesOption { + return func(responses *Responses) { + if r := response; r != nil && name != "" { + responses.Set(name, &ResponseRef{Value: r}) + } + } +} + +// Default returns the default response +func (responses *Responses) Default() *ResponseRef { + return responses.Value("default") +} + +// Status returns a ResponseRef for the given status +// If an exact match isn't initially found a patterned field is checked using +// the first digit to determine the range (eg: 201 to 2XX) +// See https://spec.openapis.org/oas/v3.0.3#patterned-fields-0 +func (responses *Responses) Status(status int) *ResponseRef { + st := strconv.FormatInt(int64(status), 10) + if rref := responses.Value(st); rref != nil { + return rref + } + if 99 < status && status < 600 { + st = string(st[0]) + "XX" + switch st { + case "1XX", "2XX", "3XX", "4XX", "5XX": + return responses.Value(st) + } + } + return nil +} + +// Validate returns an error if Responses does not comply with the OpenAPI spec. +func (responses *Responses) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if responses.Len() == 0 { + return errors.New("the responses object MUST contain at least one response code") + } + + keys := make([]string, 0, responses.Len()) + for key := range responses.Map() { + keys = append(keys, key) + } + sort.Strings(keys) + for _, key := range keys { + v := responses.Value(key) + if err := v.Validate(ctx); err != nil { + return err + } + } + + return validateExtensions(ctx, responses.Extensions) +} + +// Response is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object +type Response struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Description *string `json:"description,omitempty" yaml:"description,omitempty"` + Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"` + Content Content `json:"content,omitempty" yaml:"content,omitempty"` + Links Links `json:"links,omitempty" yaml:"links,omitempty"` +} + +func NewResponse() *Response { + return &Response{} +} + +func (response *Response) WithDescription(value string) *Response { + response.Description = &value + return response +} + +func (response *Response) WithContent(content Content) *Response { + response.Content = content + return response +} + +func (response *Response) WithJSONSchema(schema *Schema) *Response { + response.Content = NewContentWithJSONSchema(schema) + return response +} + +func (response *Response) WithJSONSchemaRef(schema *SchemaRef) *Response { + response.Content = NewContentWithJSONSchemaRef(schema) + return response +} + +// MarshalJSON returns the JSON encoding of Response. +func (response Response) MarshalJSON() ([]byte, error) { + x, err := response.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Response. +func (response Response) MarshalYAML() (any, error) { + m := make(map[string]any, 4+len(response.Extensions)) + for k, v := range response.Extensions { + m[k] = v + } + if x := response.Description; x != nil { + m["description"] = x + } + if x := response.Headers; len(x) != 0 { + m["headers"] = x + } + if x := response.Content; len(x) != 0 { + m["content"] = x + } + if x := response.Links; len(x) != 0 { + m["links"] = x + } + return m, nil +} + +// UnmarshalJSON sets Response to a copy of data. +func (response *Response) UnmarshalJSON(data []byte) error { + type ResponseBis Response + var x ResponseBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "description") + delete(x.Extensions, "headers") + delete(x.Extensions, "content") + delete(x.Extensions, "links") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *response = Response(x) + return nil +} + +// Validate returns an error if Response does not comply with the OpenAPI spec. +func (response *Response) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if response.Description == nil { + return errors.New("a short description of the response is required") + } + if vo := getValidationOptions(ctx); !vo.examplesValidationDisabled { + vo.examplesValidationAsReq, vo.examplesValidationAsRes = false, true + } + + if content := response.Content; content != nil { + if err := content.Validate(ctx); err != nil { + return err + } + } + + headers := make([]string, 0, len(response.Headers)) + for name := range response.Headers { + headers = append(headers, name) + } + sort.Strings(headers) + for _, name := range headers { + header := response.Headers[name] + if err := header.Validate(ctx); err != nil { + return err + } + } + + links := make([]string, 0, len(response.Links)) + for name := range response.Links { + links = append(links, name) + } + sort.Strings(links) + for _, name := range links { + link := response.Links[name] + if err := link.Validate(ctx); err != nil { + return err + } + } + + return validateExtensions(ctx, response.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/schema.go b/vendor/github.com/getkin/kin-openapi/openapi3/schema.go new file mode 100644 index 0000000000..f81196066a --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/schema.go @@ -0,0 +1,2246 @@ +package openapi3 + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "math" + "math/big" + "reflect" + "sort" + "strconv" + "strings" + "sync" + "unicode/utf16" + + "github.com/go-openapi/jsonpointer" + "github.com/mohae/deepcopy" +) + +const ( + TypeArray = "array" + TypeBoolean = "boolean" + TypeInteger = "integer" + TypeNumber = "number" + TypeObject = "object" + TypeString = "string" + TypeNull = "null" +) + +var ( + // SchemaErrorDetailsDisabled disables printing of details about schema errors. + SchemaErrorDetailsDisabled = false + + errSchema = errors.New("input does not match the schema") + + // ErrOneOfConflict is the SchemaError Origin when data matches more than one oneOf schema + ErrOneOfConflict = errors.New("input matches more than one oneOf schemas") + + // ErrSchemaInputNaN may be returned when validating a number + ErrSchemaInputNaN = errors.New("floating point NaN is not allowed") + // ErrSchemaInputInf may be returned when validating a number + ErrSchemaInputInf = errors.New("floating point Inf is not allowed") + + compiledPatterns sync.Map +) + +// NewSchemaRef simply builds a SchemaRef +func NewSchemaRef(ref string, value *Schema) *SchemaRef { + return &SchemaRef{ + Ref: ref, + Value: value, + } +} + +type SchemaRefs []*SchemaRef + +var _ jsonpointer.JSONPointable = (*SchemaRefs)(nil) + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (s SchemaRefs) JSONLookup(token string) (any, error) { + i, err := strconv.ParseUint(token, 10, 64) + if err != nil { + return nil, err + } + + if i >= uint64(len(s)) { + return nil, fmt.Errorf("index out of range: %d", i) + } + + ref := s[i] + + if ref == nil || ref.Ref != "" { + return &Ref{Ref: ref.Ref}, nil + } + return ref.Value, nil +} + +// Schema is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object +type Schema struct { + Extensions map[string]any `json:"-" yaml:"-"` + + OneOf SchemaRefs `json:"oneOf,omitempty" yaml:"oneOf,omitempty"` + AnyOf SchemaRefs `json:"anyOf,omitempty" yaml:"anyOf,omitempty"` + AllOf SchemaRefs `json:"allOf,omitempty" yaml:"allOf,omitempty"` + Not *SchemaRef `json:"not,omitempty" yaml:"not,omitempty"` + Type *Types `json:"type,omitempty" yaml:"type,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` + Format string `json:"format,omitempty" yaml:"format,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Enum []any `json:"enum,omitempty" yaml:"enum,omitempty"` + Default any `json:"default,omitempty" yaml:"default,omitempty"` + Example any `json:"example,omitempty" yaml:"example,omitempty"` + ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` + + // Array-related, here for struct compactness + UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"` + // Number-related, here for struct compactness + ExclusiveMin bool `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"` + ExclusiveMax bool `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"` + // Properties + Nullable bool `json:"nullable,omitempty" yaml:"nullable,omitempty"` + ReadOnly bool `json:"readOnly,omitempty" yaml:"readOnly,omitempty"` + WriteOnly bool `json:"writeOnly,omitempty" yaml:"writeOnly,omitempty"` + AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"` + Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` + XML *XML `json:"xml,omitempty" yaml:"xml,omitempty"` + + // Number + Min *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"` + Max *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"` + MultipleOf *float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"` + + // String + MinLength uint64 `json:"minLength,omitempty" yaml:"minLength,omitempty"` + MaxLength *uint64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"` + Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"` + + // Array + MinItems uint64 `json:"minItems,omitempty" yaml:"minItems,omitempty"` + MaxItems *uint64 `json:"maxItems,omitempty" yaml:"maxItems,omitempty"` + Items *SchemaRef `json:"items,omitempty" yaml:"items,omitempty"` + + // Object + Required []string `json:"required,omitempty" yaml:"required,omitempty"` + Properties Schemas `json:"properties,omitempty" yaml:"properties,omitempty"` + MinProps uint64 `json:"minProperties,omitempty" yaml:"minProperties,omitempty"` + MaxProps *uint64 `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"` + AdditionalProperties AdditionalProperties `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"` + Discriminator *Discriminator `json:"discriminator,omitempty" yaml:"discriminator,omitempty"` +} + +type Types []string + +func (types *Types) Is(typ string) bool { + return types != nil && len(*types) == 1 && (*types)[0] == typ +} + +func (types *Types) Slice() []string { + if types == nil { + return nil + } + return *types +} + +func (pTypes *Types) Includes(typ string) bool { + if pTypes == nil { + return false + } + types := *pTypes + for _, candidate := range types { + if candidate == typ { + return true + } + } + return false +} + +func (types *Types) Permits(typ string) bool { + if types == nil { + return true + } + return types.Includes(typ) +} + +func (pTypes *Types) MarshalJSON() ([]byte, error) { + x, err := pTypes.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +func (pTypes *Types) MarshalYAML() (any, error) { + if pTypes == nil { + return nil, nil + } + types := *pTypes + switch len(types) { + case 0: + return nil, nil + case 1: + return types[0], nil + default: + return []string(types), nil + } +} + +func (types *Types) UnmarshalJSON(data []byte) error { + var strings []string + if err := json.Unmarshal(data, &strings); err != nil { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return unmarshalError(err) + } + strings = []string{s} + } + *types = strings + return nil +} + +type AdditionalProperties struct { + Has *bool + Schema *SchemaRef +} + +// MarshalYAML returns the YAML encoding of AdditionalProperties. +func (addProps AdditionalProperties) MarshalYAML() (any, error) { + if x := addProps.Has; x != nil { + if *x { + return true, nil + } + return false, nil + } + if x := addProps.Schema; x != nil { + return x.MarshalYAML() + } + return nil, nil +} + +// MarshalJSON returns the JSON encoding of AdditionalProperties. +func (addProps AdditionalProperties) MarshalJSON() ([]byte, error) { + x, err := addProps.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// UnmarshalJSON sets AdditionalProperties to a copy of data. +func (addProps *AdditionalProperties) UnmarshalJSON(data []byte) error { + var x any + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + switch y := x.(type) { + case nil: + case bool: + addProps.Has = &y + case map[string]any: + if len(y) == 0 { + addProps.Schema = &SchemaRef{Value: &Schema{}} + } else { + buf := new(bytes.Buffer) + json.NewEncoder(buf).Encode(y) + if err := json.NewDecoder(buf).Decode(&addProps.Schema); err != nil { + return err + } + } + default: + return errors.New("cannot unmarshal additionalProperties: value must be either a schema object or a boolean") + } + return nil +} + +var _ jsonpointer.JSONPointable = (*Schema)(nil) + +func NewSchema() *Schema { + return &Schema{} +} + +// MarshalJSON returns the JSON encoding of Schema. +func (schema Schema) MarshalJSON() ([]byte, error) { + m, err := schema.MarshalYAML() + if err != nil { + return nil, err + } + + return json.Marshal(m) +} + +// MarshalYAML returns the YAML encoding of Schema. +func (schema Schema) MarshalYAML() (any, error) { + m := make(map[string]any, 36+len(schema.Extensions)) + for k, v := range schema.Extensions { + m[k] = v + } + + if x := schema.OneOf; len(x) != 0 { + m["oneOf"] = x + } + if x := schema.AnyOf; len(x) != 0 { + m["anyOf"] = x + } + if x := schema.AllOf; len(x) != 0 { + m["allOf"] = x + } + if x := schema.Not; x != nil { + m["not"] = x + } + if x := schema.Type; x != nil { + m["type"] = x + } + if x := schema.Title; len(x) != 0 { + m["title"] = x + } + if x := schema.Format; len(x) != 0 { + m["format"] = x + } + if x := schema.Description; len(x) != 0 { + m["description"] = x + } + if x := schema.Enum; len(x) != 0 { + m["enum"] = x + } + if x := schema.Default; x != nil { + m["default"] = x + } + if x := schema.Example; x != nil { + m["example"] = x + } + if x := schema.ExternalDocs; x != nil { + m["externalDocs"] = x + } + + // Array-related + if x := schema.UniqueItems; x { + m["uniqueItems"] = x + } + // Number-related + if x := schema.ExclusiveMin; x { + m["exclusiveMinimum"] = x + } + if x := schema.ExclusiveMax; x { + m["exclusiveMaximum"] = x + } + // Properties + if x := schema.Nullable; x { + m["nullable"] = x + } + if x := schema.ReadOnly; x { + m["readOnly"] = x + } + if x := schema.WriteOnly; x { + m["writeOnly"] = x + } + if x := schema.AllowEmptyValue; x { + m["allowEmptyValue"] = x + } + if x := schema.Deprecated; x { + m["deprecated"] = x + } + if x := schema.XML; x != nil { + m["xml"] = x + } + + // Number + if x := schema.Min; x != nil { + m["minimum"] = x + } + if x := schema.Max; x != nil { + m["maximum"] = x + } + if x := schema.MultipleOf; x != nil { + m["multipleOf"] = x + } + + // String + if x := schema.MinLength; x != 0 { + m["minLength"] = x + } + if x := schema.MaxLength; x != nil { + m["maxLength"] = x + } + if x := schema.Pattern; x != "" { + m["pattern"] = x + } + + // Array + if x := schema.MinItems; x != 0 { + m["minItems"] = x + } + if x := schema.MaxItems; x != nil { + m["maxItems"] = x + } + if x := schema.Items; x != nil { + m["items"] = x + } + + // Object + if x := schema.Required; len(x) != 0 { + m["required"] = x + } + if x := schema.Properties; len(x) != 0 { + m["properties"] = x + } + if x := schema.MinProps; x != 0 { + m["minProperties"] = x + } + if x := schema.MaxProps; x != nil { + m["maxProperties"] = x + } + if x := schema.AdditionalProperties; x.Has != nil || x.Schema != nil { + m["additionalProperties"] = &x + } + if x := schema.Discriminator; x != nil { + m["discriminator"] = x + } + + return m, nil +} + +// UnmarshalJSON sets Schema to a copy of data. +func (schema *Schema) UnmarshalJSON(data []byte) error { + type SchemaBis Schema + var x SchemaBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + + delete(x.Extensions, "oneOf") + delete(x.Extensions, "anyOf") + delete(x.Extensions, "allOf") + delete(x.Extensions, "not") + delete(x.Extensions, "type") + delete(x.Extensions, "title") + delete(x.Extensions, "format") + delete(x.Extensions, "description") + delete(x.Extensions, "enum") + delete(x.Extensions, "default") + delete(x.Extensions, "example") + delete(x.Extensions, "externalDocs") + + // Array-related + delete(x.Extensions, "uniqueItems") + // Number-related + delete(x.Extensions, "exclusiveMinimum") + delete(x.Extensions, "exclusiveMaximum") + // Properties + delete(x.Extensions, "nullable") + delete(x.Extensions, "readOnly") + delete(x.Extensions, "writeOnly") + delete(x.Extensions, "allowEmptyValue") + delete(x.Extensions, "deprecated") + delete(x.Extensions, "xml") + + // Number + delete(x.Extensions, "minimum") + delete(x.Extensions, "maximum") + delete(x.Extensions, "multipleOf") + + // String + delete(x.Extensions, "minLength") + delete(x.Extensions, "maxLength") + delete(x.Extensions, "pattern") + + // Array + delete(x.Extensions, "minItems") + delete(x.Extensions, "maxItems") + delete(x.Extensions, "items") + + // Object + delete(x.Extensions, "required") + delete(x.Extensions, "properties") + delete(x.Extensions, "minProperties") + delete(x.Extensions, "maxProperties") + delete(x.Extensions, "additionalProperties") + delete(x.Extensions, "discriminator") + + if len(x.Extensions) == 0 { + x.Extensions = nil + } + + *schema = Schema(x) + + if schema.Format == "date" { + // This is a fix for: https://github.com/getkin/kin-openapi/issues/697 + if eg, ok := schema.Example.(string); ok { + schema.Example = strings.TrimSuffix(eg, "T00:00:00Z") + } + } + return nil +} + +// JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (schema Schema) JSONLookup(token string) (any, error) { + switch token { + case "additionalProperties": + if addProps := schema.AdditionalProperties.Has; addProps != nil { + return *addProps, nil + } + if addProps := schema.AdditionalProperties.Schema; addProps != nil { + if addProps.Ref != "" { + return &Ref{Ref: addProps.Ref}, nil + } + return addProps.Value, nil + } + case "not": + if schema.Not != nil { + if schema.Not.Ref != "" { + return &Ref{Ref: schema.Not.Ref}, nil + } + return schema.Not.Value, nil + } + case "items": + if schema.Items != nil { + if schema.Items.Ref != "" { + return &Ref{Ref: schema.Items.Ref}, nil + } + return schema.Items.Value, nil + } + case "oneOf": + return schema.OneOf, nil + case "anyOf": + return schema.AnyOf, nil + case "allOf": + return schema.AllOf, nil + case "type": + return schema.Type, nil + case "title": + return schema.Title, nil + case "format": + return schema.Format, nil + case "description": + return schema.Description, nil + case "enum": + return schema.Enum, nil + case "default": + return schema.Default, nil + case "example": + return schema.Example, nil + case "externalDocs": + return schema.ExternalDocs, nil + case "uniqueItems": + return schema.UniqueItems, nil + case "exclusiveMin": + return schema.ExclusiveMin, nil + case "exclusiveMax": + return schema.ExclusiveMax, nil + case "nullable": + return schema.Nullable, nil + case "readOnly": + return schema.ReadOnly, nil + case "writeOnly": + return schema.WriteOnly, nil + case "allowEmptyValue": + return schema.AllowEmptyValue, nil + case "xml": + return schema.XML, nil + case "deprecated": + return schema.Deprecated, nil + case "min": + return schema.Min, nil + case "max": + return schema.Max, nil + case "multipleOf": + return schema.MultipleOf, nil + case "minLength": + return schema.MinLength, nil + case "maxLength": + return schema.MaxLength, nil + case "pattern": + return schema.Pattern, nil + case "minItems": + return schema.MinItems, nil + case "maxItems": + return schema.MaxItems, nil + case "required": + return schema.Required, nil + case "properties": + return schema.Properties, nil + case "minProps": + return schema.MinProps, nil + case "maxProps": + return schema.MaxProps, nil + case "discriminator": + return schema.Discriminator, nil + } + + v, _, err := jsonpointer.GetForToken(schema.Extensions, token) + return v, err +} + +func (schema *Schema) NewRef() *SchemaRef { + return &SchemaRef{ + Value: schema, + } +} + +func NewOneOfSchema(schemas ...*Schema) *Schema { + refs := make([]*SchemaRef, 0, len(schemas)) + for _, schema := range schemas { + refs = append(refs, &SchemaRef{Value: schema}) + } + return &Schema{ + OneOf: refs, + } +} + +func NewAnyOfSchema(schemas ...*Schema) *Schema { + refs := make([]*SchemaRef, 0, len(schemas)) + for _, schema := range schemas { + refs = append(refs, &SchemaRef{Value: schema}) + } + return &Schema{ + AnyOf: refs, + } +} + +func NewAllOfSchema(schemas ...*Schema) *Schema { + refs := make([]*SchemaRef, 0, len(schemas)) + for _, schema := range schemas { + refs = append(refs, &SchemaRef{Value: schema}) + } + return &Schema{ + AllOf: refs, + } +} + +func NewBoolSchema() *Schema { + return &Schema{ + Type: &Types{TypeBoolean}, + } +} + +func NewFloat64Schema() *Schema { + return &Schema{ + Type: &Types{TypeNumber}, + } +} + +func NewIntegerSchema() *Schema { + return &Schema{ + Type: &Types{TypeInteger}, + } +} + +func NewInt32Schema() *Schema { + return &Schema{ + Type: &Types{TypeInteger}, + Format: "int32", + } +} + +func NewInt64Schema() *Schema { + return &Schema{ + Type: &Types{TypeInteger}, + Format: "int64", + } +} + +func NewStringSchema() *Schema { + return &Schema{ + Type: &Types{TypeString}, + } +} + +func NewDateTimeSchema() *Schema { + return &Schema{ + Type: &Types{TypeString}, + Format: "date-time", + } +} + +func NewUUIDSchema() *Schema { + return &Schema{ + Type: &Types{TypeString}, + Format: "uuid", + } +} + +func NewBytesSchema() *Schema { + return &Schema{ + Type: &Types{TypeString}, + Format: "byte", + } +} + +func NewArraySchema() *Schema { + return &Schema{ + Type: &Types{TypeArray}, + } +} + +func NewObjectSchema() *Schema { + return &Schema{ + Type: &Types{TypeObject}, + Properties: make(Schemas), + } +} + +func (schema *Schema) WithNullable() *Schema { + schema.Nullable = true + return schema +} + +func (schema *Schema) WithMin(value float64) *Schema { + schema.Min = &value + return schema +} + +func (schema *Schema) WithMax(value float64) *Schema { + schema.Max = &value + return schema +} + +func (schema *Schema) WithExclusiveMin(value bool) *Schema { + schema.ExclusiveMin = value + return schema +} + +func (schema *Schema) WithExclusiveMax(value bool) *Schema { + schema.ExclusiveMax = value + return schema +} + +func (schema *Schema) WithEnum(values ...any) *Schema { + schema.Enum = values + return schema +} + +func (schema *Schema) WithDefault(defaultValue any) *Schema { + schema.Default = defaultValue + return schema +} + +func (schema *Schema) WithFormat(value string) *Schema { + schema.Format = value + return schema +} + +func (schema *Schema) WithLength(i int64) *Schema { + n := uint64(i) + schema.MinLength = n + schema.MaxLength = &n + return schema +} + +func (schema *Schema) WithMinLength(i int64) *Schema { + n := uint64(i) + schema.MinLength = n + return schema +} + +func (schema *Schema) WithMaxLength(i int64) *Schema { + n := uint64(i) + schema.MaxLength = &n + return schema +} + +func (schema *Schema) WithLengthDecodedBase64(i int64) *Schema { + n := uint64(i) + v := (n*8 + 5) / 6 + schema.MinLength = v + schema.MaxLength = &v + return schema +} + +func (schema *Schema) WithMinLengthDecodedBase64(i int64) *Schema { + n := uint64(i) + schema.MinLength = (n*8 + 5) / 6 + return schema +} + +func (schema *Schema) WithMaxLengthDecodedBase64(i int64) *Schema { + n := uint64(i) + schema.MinLength = (n*8 + 5) / 6 + return schema +} + +func (schema *Schema) WithPattern(pattern string) *Schema { + schema.Pattern = pattern + return schema +} + +func (schema *Schema) WithItems(value *Schema) *Schema { + schema.Items = &SchemaRef{ + Value: value, + } + return schema +} + +func (schema *Schema) WithMinItems(i int64) *Schema { + n := uint64(i) + schema.MinItems = n + return schema +} + +func (schema *Schema) WithMaxItems(i int64) *Schema { + n := uint64(i) + schema.MaxItems = &n + return schema +} + +func (schema *Schema) WithUniqueItems(unique bool) *Schema { + schema.UniqueItems = unique + return schema +} + +func (schema *Schema) WithProperty(name string, propertySchema *Schema) *Schema { + return schema.WithPropertyRef(name, &SchemaRef{ + Value: propertySchema, + }) +} + +func (schema *Schema) WithPropertyRef(name string, ref *SchemaRef) *Schema { + properties := schema.Properties + if properties == nil { + properties = make(Schemas) + schema.Properties = properties + } + properties[name] = ref + return schema +} + +func (schema *Schema) WithProperties(properties map[string]*Schema) *Schema { + result := make(Schemas, len(properties)) + for k, v := range properties { + result[k] = &SchemaRef{ + Value: v, + } + } + schema.Properties = result + return schema +} + +func (schema *Schema) WithRequired(required []string) *Schema { + schema.Required = required + return schema +} + +func (schema *Schema) WithMinProperties(i int64) *Schema { + n := uint64(i) + schema.MinProps = n + return schema +} + +func (schema *Schema) WithMaxProperties(i int64) *Schema { + n := uint64(i) + schema.MaxProps = &n + return schema +} + +func (schema *Schema) WithAnyAdditionalProperties() *Schema { + schema.AdditionalProperties = AdditionalProperties{Has: BoolPtr(true)} + return schema +} + +func (schema *Schema) WithoutAdditionalProperties() *Schema { + schema.AdditionalProperties = AdditionalProperties{Has: BoolPtr(false)} + return schema +} + +func (schema *Schema) WithAdditionalProperties(v *Schema) *Schema { + schema.AdditionalProperties = AdditionalProperties{} + if v != nil { + schema.AdditionalProperties.Schema = &SchemaRef{Value: v} + } + return schema +} + +func (schema *Schema) PermitsNull() bool { + return schema.Nullable || schema.Type.Includes("null") +} + +// IsEmpty tells whether schema is equivalent to the empty schema `{}`. +func (schema *Schema) IsEmpty() bool { + if schema.Type != nil || schema.Format != "" || len(schema.Enum) != 0 || + schema.UniqueItems || schema.ExclusiveMin || schema.ExclusiveMax || + schema.Nullable || schema.ReadOnly || schema.WriteOnly || schema.AllowEmptyValue || + schema.Min != nil || schema.Max != nil || schema.MultipleOf != nil || + schema.MinLength != 0 || schema.MaxLength != nil || schema.Pattern != "" || + schema.MinItems != 0 || schema.MaxItems != nil || + len(schema.Required) != 0 || + schema.MinProps != 0 || schema.MaxProps != nil { + return false + } + if n := schema.Not; n != nil && n.Value != nil && !n.Value.IsEmpty() { + return false + } + if ap := schema.AdditionalProperties.Schema; ap != nil && ap.Value != nil && !ap.Value.IsEmpty() { + return false + } + if apa := schema.AdditionalProperties.Has; apa != nil && !*apa { + return false + } + if items := schema.Items; items != nil && items.Value != nil && !items.Value.IsEmpty() { + return false + } + for _, s := range schema.Properties { + if ss := s.Value; ss != nil && !ss.IsEmpty() { + return false + } + } + for _, s := range schema.OneOf { + if ss := s.Value; ss != nil && !ss.IsEmpty() { + return false + } + } + for _, s := range schema.AnyOf { + if ss := s.Value; ss != nil && !ss.IsEmpty() { + return false + } + } + for _, s := range schema.AllOf { + if ss := s.Value; ss != nil && !ss.IsEmpty() { + return false + } + } + return true +} + +// Validate returns an error if Schema does not comply with the OpenAPI spec. +func (schema *Schema) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + _, err := schema.validate(ctx, []*Schema{}) + return err +} + +// returns the updated stack and an error if Schema does not comply with the OpenAPI spec. +func (schema *Schema) validate(ctx context.Context, stack []*Schema) ([]*Schema, error) { + validationOpts := getValidationOptions(ctx) + + for _, existing := range stack { + if existing == schema { + return stack, nil + } + } + stack = append(stack, schema) + + if schema.ReadOnly && schema.WriteOnly { + return stack, errors.New("a property MUST NOT be marked as both readOnly and writeOnly being true") + } + + for _, item := range schema.OneOf { + v := item.Value + if v == nil { + return stack, foundUnresolvedRef(item.Ref) + } + + var err error + if stack, err = v.validate(ctx, stack); err != nil { + return stack, err + } + } + + for _, item := range schema.AnyOf { + v := item.Value + if v == nil { + return stack, foundUnresolvedRef(item.Ref) + } + + var err error + if stack, err = v.validate(ctx, stack); err != nil { + return stack, err + } + } + + for _, item := range schema.AllOf { + v := item.Value + if v == nil { + return stack, foundUnresolvedRef(item.Ref) + } + + var err error + if stack, err = v.validate(ctx, stack); err != nil { + return stack, err + } + } + + if ref := schema.Not; ref != nil { + v := ref.Value + if v == nil { + return stack, foundUnresolvedRef(ref.Ref) + } + + var err error + if stack, err = v.validate(ctx, stack); err != nil { + return stack, err + } + } + + for _, schemaType := range schema.Type.Slice() { + switch schemaType { + case TypeBoolean: + case TypeNumber: + if format := schema.Format; len(format) > 0 { + switch format { + case "float", "double": + default: + if _, ok := SchemaNumberFormats[format]; !ok && validationOpts.schemaFormatValidationEnabled { + return stack, unsupportedFormat(format) + } + } + } + case TypeInteger: + if format := schema.Format; len(format) > 0 { + switch format { + case "int32", "int64": + default: + if _, ok := SchemaIntegerFormats[format]; !ok && validationOpts.schemaFormatValidationEnabled { + return stack, unsupportedFormat(format) + } + } + } + case TypeString: + if format := schema.Format; len(format) > 0 { + switch format { + // Supported by OpenAPIv3.0.3: + // https://spec.openapis.org/oas/v3.0.3 + case "byte", "binary", "date", "date-time", "password": + // In JSON Draft-07 (not validated yet though): + // https://json-schema.org/draft-07/json-schema-release-notes.html#formats + case "iri", "iri-reference", "uri-template", "idn-email", "idn-hostname": + case "json-pointer", "relative-json-pointer", "regex", "time": + // In JSON Draft 2019-09 (not validated yet though): + // https://json-schema.org/draft/2019-09/release-notes.html#format-vocabulary + case "duration", "uuid": + // Defined in some other specification + case "email", "hostname", "ipv4", "ipv6", "uri", "uri-reference": + default: + if _, ok := SchemaStringFormats[format]; !ok && validationOpts.schemaFormatValidationEnabled { + return stack, unsupportedFormat(format) + } + } + } + if !validationOpts.schemaPatternValidationDisabled && schema.Pattern != "" { + if _, err := schema.compilePattern(validationOpts.regexCompilerFunc); err != nil { + return stack, err + } + } + case TypeArray: + if schema.Items == nil { + return stack, errors.New("when schema type is 'array', schema 'items' must be non-null") + } + case TypeObject: + default: + return stack, fmt.Errorf("unsupported 'type' value %q", schemaType) + } + } + + if ref := schema.Items; ref != nil { + v := ref.Value + if v == nil { + return stack, foundUnresolvedRef(ref.Ref) + } + + var err error + if stack, err = v.validate(ctx, stack); err != nil { + return stack, err + } + } + + properties := make([]string, 0, len(schema.Properties)) + for name := range schema.Properties { + properties = append(properties, name) + } + sort.Strings(properties) + for _, name := range properties { + ref := schema.Properties[name] + v := ref.Value + if v == nil { + return stack, foundUnresolvedRef(ref.Ref) + } + + var err error + if stack, err = v.validate(ctx, stack); err != nil { + return stack, err + } + } + + if schema.AdditionalProperties.Has != nil && schema.AdditionalProperties.Schema != nil { + return stack, errors.New("additionalProperties are set to both boolean and schema") + } + if ref := schema.AdditionalProperties.Schema; ref != nil { + v := ref.Value + if v == nil { + return stack, foundUnresolvedRef(ref.Ref) + } + + var err error + if stack, err = v.validate(ctx, stack); err != nil { + return stack, err + } + } + + if v := schema.ExternalDocs; v != nil { + if err := v.Validate(ctx); err != nil { + return stack, fmt.Errorf("invalid external docs: %w", err) + } + } + + if v := schema.Default; v != nil && !validationOpts.schemaDefaultsValidationDisabled { + if err := schema.VisitJSON(v); err != nil { + return stack, fmt.Errorf("invalid default: %w", err) + } + } + + if x := schema.Example; x != nil && !validationOpts.examplesValidationDisabled { + if err := validateExampleValue(ctx, x, schema); err != nil { + return stack, fmt.Errorf("invalid example: %w", err) + } + } + + return stack, validateExtensions(ctx, schema.Extensions) +} + +func (schema *Schema) IsMatching(value any) bool { + settings := newSchemaValidationSettings(FailFast()) + return schema.visitJSON(settings, value) == nil +} + +func (schema *Schema) IsMatchingJSONBoolean(value bool) bool { + settings := newSchemaValidationSettings(FailFast()) + return schema.visitJSON(settings, value) == nil +} + +func (schema *Schema) IsMatchingJSONNumber(value float64) bool { + settings := newSchemaValidationSettings(FailFast()) + return schema.visitJSON(settings, value) == nil +} + +func (schema *Schema) IsMatchingJSONString(value string) bool { + settings := newSchemaValidationSettings(FailFast()) + return schema.visitJSON(settings, value) == nil +} + +func (schema *Schema) IsMatchingJSONArray(value []any) bool { + settings := newSchemaValidationSettings(FailFast()) + return schema.visitJSON(settings, value) == nil +} + +func (schema *Schema) IsMatchingJSONObject(value map[string]any) bool { + settings := newSchemaValidationSettings(FailFast()) + return schema.visitJSON(settings, value) == nil +} + +func (schema *Schema) VisitJSON(value any, opts ...SchemaValidationOption) error { + settings := newSchemaValidationSettings(opts...) + return schema.visitJSON(settings, value) +} + +func (schema *Schema) visitJSON(settings *schemaValidationSettings, value any) (err error) { + switch value := value.(type) { + case nil: + // Don't use VisitJSONNull, as we still want to reach 'visitXOFOperations', since + // those could allow for a nullable value even though this one doesn't + if schema.PermitsNull() { + return + } + case float64: + if math.IsNaN(value) { + return ErrSchemaInputNaN + } + if math.IsInf(value, 0) { + return ErrSchemaInputInf + } + } + + if schema.IsEmpty() { + switch value.(type) { + case nil: + return schema.visitJSONNull(settings) + default: + return + } + } + + if err = schema.visitNotOperation(settings, value); err != nil { + return + } + var run bool + if err, run = schema.visitXOFOperations(settings, value); err != nil || !run { + return + } + if err = schema.visitEnumOperation(settings, value); err != nil { + return + } + + switch value := value.(type) { + case nil: + return schema.visitJSONNull(settings) + case bool: + return schema.visitJSONBoolean(settings, value) + case json.Number: + valueFloat64, err := value.Float64() + if err != nil { + return &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "type", + Reason: "cannot convert json.Number to float64", + customizeMessageError: settings.customizeMessageError, + Origin: err, + } + } + return schema.visitJSONNumber(settings, valueFloat64) + case int: + return schema.visitJSONNumber(settings, float64(value)) + case int32: + return schema.visitJSONNumber(settings, float64(value)) + case int64: + return schema.visitJSONNumber(settings, float64(value)) + case float64: + return schema.visitJSONNumber(settings, value) + case string: + return schema.visitJSONString(settings, value) + case []any: + return schema.visitJSONArray(settings, value) + case map[string]any: + return schema.visitJSONObject(settings, value) + case map[any]any: // for YAML cf. issue https://github.com/getkin/kin-openapi/issues/444 + values := make(map[string]any, len(value)) + for key, v := range value { + if k, ok := key.(string); ok { + values[k] = v + } + } + if len(value) == len(values) { + return schema.visitJSONObject(settings, values) + } + } + + // Catch slice of non-empty interface type + if reflect.TypeOf(value).Kind() == reflect.Slice { + valueR := reflect.ValueOf(value) + newValue := make([]any, 0, valueR.Len()) + for i := 0; i < valueR.Len(); i++ { + newValue = append(newValue, valueR.Index(i).Interface()) + } + return schema.visitJSONArray(settings, newValue) + } + + return &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "type", + Reason: fmt.Sprintf("unhandled value of type %T", value), + customizeMessageError: settings.customizeMessageError, + } +} + +func (schema *Schema) visitEnumOperation(settings *schemaValidationSettings, value any) (err error) { + if enum := schema.Enum; len(enum) != 0 { + for _, v := range enum { + switch c := value.(type) { + case json.Number: + var f float64 + if f, err = strconv.ParseFloat(c.String(), 64); err != nil { + return err + } + if v == f { + return + } + case int64: + if v == float64(c) { + return + } + default: + if reflect.DeepEqual(v, value) { + return + } + } + } + if settings.failfast { + return errSchema + } + allowedValues, _ := json.Marshal(enum) + return &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "enum", + Reason: fmt.Sprintf("value is not one of the allowed values %s", string(allowedValues)), + customizeMessageError: settings.customizeMessageError, + } + } + return +} + +func (schema *Schema) visitNotOperation(settings *schemaValidationSettings, value any) (err error) { + if ref := schema.Not; ref != nil { + v := ref.Value + if v == nil { + return foundUnresolvedRef(ref.Ref) + } + if err := v.visitJSON(settings, value); err == nil { + if settings.failfast { + return errSchema + } + return &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "not", + customizeMessageError: settings.customizeMessageError, + } + } + } + return +} + +// If the XOF operations pass successfully, abort further run of validation, as they will already be satisfied (unless the schema +// itself is badly specified +func (schema *Schema) visitXOFOperations(settings *schemaValidationSettings, value any) (err error, run bool) { + var visitedOneOf, visitedAnyOf, visitedAllOf bool + if v := schema.OneOf; len(v) > 0 { + var discriminatorRef string + if schema.Discriminator != nil { + pn := schema.Discriminator.PropertyName + if valuemap, okcheck := value.(map[string]any); okcheck { + discriminatorVal, okcheck := valuemap[pn] + if !okcheck { + return &SchemaError{ + Schema: schema, + SchemaField: "discriminator", + Reason: fmt.Sprintf("input does not contain the discriminator property %q", pn), + }, false + } + + discriminatorValString, okcheck := discriminatorVal.(string) + if !okcheck { + return &SchemaError{ + Value: discriminatorVal, + Schema: schema, + SchemaField: "discriminator", + Reason: fmt.Sprintf("value of discriminator property %q is not a string", pn), + }, false + } + + if discriminatorRef, okcheck = schema.Discriminator.Mapping[discriminatorValString]; len(schema.Discriminator.Mapping) > 0 && !okcheck { + return &SchemaError{ + Value: discriminatorVal, + Schema: schema, + SchemaField: "discriminator", + Reason: fmt.Sprintf("discriminator property %q has invalid value", pn), + }, false + } + } + } + + var ( + ok = 0 + validationErrors = multiErrorForOneOf{} + matchedOneOfIndices = make([]int, 0) + tempValue = value + ) + for idx, item := range v { + v := item.Value + if v == nil { + return foundUnresolvedRef(item.Ref), false + } + + if discriminatorRef != "" && discriminatorRef != item.Ref { + continue + } + + // make a deep copy to protect origin value from being injected default value that defined in mismatched oneOf schema + if settings.asreq || settings.asrep { + tempValue = deepcopy.Copy(value) + } + + if err := v.visitJSON(settings, tempValue); err != nil { + validationErrors = append(validationErrors, err) + continue + } + + matchedOneOfIndices = append(matchedOneOfIndices, idx) + ok++ + } + + if ok != 1 { + if settings.failfast { + return errSchema, false + } + e := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "oneOf", + customizeMessageError: settings.customizeMessageError, + } + if ok > 1 { + e.Origin = ErrOneOfConflict + e.Reason = fmt.Sprintf(`value matches more than one schema from "oneOf" (matches schemas at indices %v)`, matchedOneOfIndices) + } else { + e.Origin = fmt.Errorf("doesn't match schema due to: %w", validationErrors) + e.Reason = `value doesn't match any schema from "oneOf"` + } + + return e, false + } + + // run again to inject default value that defined in matched oneOf schema + if settings.asreq || settings.asrep { + _ = v[matchedOneOfIndices[0]].Value.visitJSON(settings, value) + } + visitedOneOf = true + } + + if v := schema.AnyOf; len(v) > 0 { + var ( + ok = false + matchedAnyOfIdx = 0 + tempValue = value + ) + for idx, item := range v { + v := item.Value + if v == nil { + return foundUnresolvedRef(item.Ref), false + } + // make a deep copy to protect origin value from being injected default value that defined in mismatched anyOf schema + if settings.asreq || settings.asrep { + tempValue = deepcopy.Copy(value) + } + if err := v.visitJSON(settings, tempValue); err == nil { + ok = true + matchedAnyOfIdx = idx + break + } + } + if !ok { + if settings.failfast { + return errSchema, false + } + return &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "anyOf", + Reason: `doesn't match any schema from "anyOf"`, + customizeMessageError: settings.customizeMessageError, + }, false + } + + _ = v[matchedAnyOfIdx].Value.visitJSON(settings, value) + visitedAnyOf = true + } + + for _, item := range schema.AllOf { + v := item.Value + if v == nil { + return foundUnresolvedRef(item.Ref), false + } + if err := v.visitJSON(settings, value); err != nil { + if settings.failfast { + return errSchema, false + } + return &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "allOf", + Reason: `doesn't match all schemas from "allOf"`, + Origin: err, + customizeMessageError: settings.customizeMessageError, + }, false + } + visitedAllOf = true + } + + run = !((visitedOneOf || visitedAnyOf || visitedAllOf) && value == nil) + return +} + +// The value is not considered in visitJSONNull because according to the spec +// "null is not supported as a type" unless `nullable` is also set to true +// https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#data-types +// https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object +func (schema *Schema) visitJSONNull(settings *schemaValidationSettings) (err error) { + if schema.PermitsNull() { + return + } + if settings.failfast { + return errSchema + } + return &SchemaError{ + Value: nil, + Schema: schema, + SchemaField: "nullable", + Reason: "Value is not nullable", + customizeMessageError: settings.customizeMessageError, + } +} + +func (schema *Schema) VisitJSONBoolean(value bool) error { + settings := newSchemaValidationSettings() + return schema.visitJSONBoolean(settings, value) +} + +func (schema *Schema) visitJSONBoolean(settings *schemaValidationSettings, value bool) (err error) { + if !schema.Type.Permits(TypeBoolean) { + return schema.expectedType(settings, value) + } + return +} + +func (schema *Schema) VisitJSONNumber(value float64) error { + settings := newSchemaValidationSettings() + return schema.visitJSONNumber(settings, value) +} + +func (schema *Schema) visitJSONNumber(settings *schemaValidationSettings, value float64) error { + var me MultiError + schemaType := schema.Type + requireInteger := false + if schemaType.Permits(TypeInteger) && !schemaType.Permits(TypeNumber) { + requireInteger = true + if bigFloat := big.NewFloat(value); !bigFloat.IsInt() { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "type", + Reason: "value must be an integer", + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + } else if !(schemaType.Permits(TypeInteger) || schemaType.Permits(TypeNumber)) { + return schema.expectedType(settings, value) + } + + // formats + var formatStrErr string + var formatErr error + format := schema.Format + if format != "" { + if requireInteger { + if f, ok := SchemaIntegerFormats[format]; ok { + if err := f.Validate(int64(value)); err != nil { + var reason string + schemaErr := &SchemaError{} + if errors.As(err, &schemaErr) { + reason = schemaErr.Reason + } else { + reason = err.Error() + } + formatStrErr = fmt.Sprintf(`integer doesn't match the format %q (%v)`, format, reason) + formatErr = fmt.Errorf("integer doesn't match the format %q: %w", format, err) + } + } + } else { + if f, ok := SchemaNumberFormats[format]; ok { + if err := f.Validate(value); err != nil { + var reason string + schemaErr := &SchemaError{} + if errors.As(err, &schemaErr) { + reason = schemaErr.Reason + } else { + reason = err.Error() + } + formatStrErr = fmt.Sprintf(`number doesn't match the format %q (%v)`, format, reason) + formatErr = fmt.Errorf("number doesn't match the format %q: %w", format, err) + } + } + } + } + + if formatStrErr != "" || formatErr != nil { + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "format", + Reason: formatStrErr, + Origin: formatErr, + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "exclusiveMinimum" + if v := schema.ExclusiveMin; v && !(*schema.Min < value) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "exclusiveMinimum", + Reason: fmt.Sprintf("number must be more than %g", *schema.Min), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "exclusiveMaximum" + if v := schema.ExclusiveMax; v && !(*schema.Max > value) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "exclusiveMaximum", + Reason: fmt.Sprintf("number must be less than %g", *schema.Max), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "minimum" + if v := schema.Min; v != nil && !(*v <= value) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "minimum", + Reason: fmt.Sprintf("number must be at least %g", *v), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "maximum" + if v := schema.Max; v != nil && !(*v >= value) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "maximum", + Reason: fmt.Sprintf("number must be at most %g", *v), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "multipleOf" + if v := schema.MultipleOf; v != nil { + // "A numeric instance is valid only if division by this keyword's + // value results in an integer." + if bigFloat := big.NewFloat(value / *v); !bigFloat.IsInt() { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "multipleOf", + Reason: fmt.Sprintf("number must be a multiple of %g", *v), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + } + + if len(me) > 0 { + return me + } + + return nil +} + +func (schema *Schema) VisitJSONString(value string) error { + settings := newSchemaValidationSettings() + return schema.visitJSONString(settings, value) +} + +func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value string) error { + if !schema.Type.Permits(TypeString) { + return schema.expectedType(settings, value) + } + + var me MultiError + + // "minLength" and "maxLength" + minLength := schema.MinLength + maxLength := schema.MaxLength + if minLength != 0 || maxLength != nil { + // JSON schema string lengths are UTF-16, not UTF-8! + length := int64(0) + for _, r := range value { + if utf16.IsSurrogate(r) { + length += 2 + } else { + length++ + } + } + if minLength != 0 && length < int64(minLength) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "minLength", + Reason: fmt.Sprintf("minimum string length is %d", minLength), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + if maxLength != nil && length > int64(*maxLength) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "maxLength", + Reason: fmt.Sprintf("maximum string length is %d", *maxLength), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + } + + // "pattern" + if !settings.patternValidationDisabled && schema.Pattern != "" { + cpiface, _ := compiledPatterns.Load(schema.Pattern) + cp, _ := cpiface.(RegexMatcher) + if cp == nil { + var err error + if cp, err = schema.compilePattern(settings.regexCompiler); err != nil { + if !settings.multiError { + return err + } + me = append(me, err) + } + } + if !cp.MatchString(value) { + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "pattern", + Reason: fmt.Sprintf(`string doesn't match the regular expression "%s"`, schema.Pattern), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + } + + // "format" + var formatStrErr string + var formatErr error + if format := schema.Format; format != "" { + if f, ok := SchemaStringFormats[format]; ok { + if err := f.Validate(value); err != nil { + var reason string + schemaErr := &SchemaError{} + if errors.As(err, &schemaErr) { + reason = schemaErr.Reason + } else { + reason = err.Error() + } + formatStrErr = fmt.Sprintf(`string doesn't match the format %q (%v)`, format, reason) + formatErr = fmt.Errorf("string doesn't match the format %q: %w", format, err) + } + } + } + if formatStrErr != "" || formatErr != nil { + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "format", + Reason: formatStrErr, + Origin: formatErr, + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + + } + + if len(me) > 0 { + return me + } + + return nil +} + +func (schema *Schema) VisitJSONArray(value []any) error { + settings := newSchemaValidationSettings() + return schema.visitJSONArray(settings, value) +} + +func (schema *Schema) visitJSONArray(settings *schemaValidationSettings, value []any) error { + if !schema.Type.Permits(TypeArray) { + return schema.expectedType(settings, value) + } + + var me MultiError + + lenValue := int64(len(value)) + + // "minItems" + if v := schema.MinItems; v != 0 && lenValue < int64(v) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "minItems", + Reason: fmt.Sprintf("minimum number of items is %d", v), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "maxItems" + if v := schema.MaxItems; v != nil && lenValue > int64(*v) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "maxItems", + Reason: fmt.Sprintf("maximum number of items is %d", *v), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "uniqueItems" + if sliceUniqueItemsChecker == nil { + sliceUniqueItemsChecker = isSliceOfUniqueItems + } + if v := schema.UniqueItems; v && !sliceUniqueItemsChecker(value) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "uniqueItems", + Reason: "duplicate items found", + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "items" + if itemSchemaRef := schema.Items; itemSchemaRef != nil { + itemSchema := itemSchemaRef.Value + if itemSchema == nil { + return foundUnresolvedRef(itemSchemaRef.Ref) + } + for i, item := range value { + if err := itemSchema.visitJSON(settings, item); err != nil { + err = markSchemaErrorIndex(err, i) + if !settings.multiError { + return err + } + if itemMe, ok := err.(MultiError); ok { + me = append(me, itemMe...) + } else { + me = append(me, err) + } + } + } + } + + if len(me) > 0 { + return me + } + + return nil +} + +func (schema *Schema) VisitJSONObject(value map[string]any) error { + settings := newSchemaValidationSettings() + return schema.visitJSONObject(settings, value) +} + +func (schema *Schema) visitJSONObject(settings *schemaValidationSettings, value map[string]any) error { + if !schema.Type.Permits(TypeObject) { + return schema.expectedType(settings, value) + } + + var me MultiError + + if settings.asreq || settings.asrep { + properties := make([]string, 0, len(schema.Properties)) + for propName := range schema.Properties { + properties = append(properties, propName) + } + sort.Strings(properties) + for _, propName := range properties { + propSchema := schema.Properties[propName] + reqRO := settings.asreq && propSchema.Value.ReadOnly && !settings.readOnlyValidationDisabled + repWO := settings.asrep && propSchema.Value.WriteOnly && !settings.writeOnlyValidationDisabled + + if f := settings.defaultsSet; f != nil && value[propName] == nil { + if dflt := propSchema.Value.Default; dflt != nil && !reqRO && !repWO { + value[propName] = dflt + settings.onceSettingDefaults.Do(f) + } + } + + if value[propName] != nil { + if reqRO { + me = append(me, fmt.Errorf("readOnly property %q in request", propName)) + } else if repWO { + me = append(me, fmt.Errorf("writeOnly property %q in response", propName)) + } + } + } + } + + // "properties" + properties := schema.Properties + lenValue := int64(len(value)) + + // "minProperties" + if v := schema.MinProps; v != 0 && lenValue < int64(v) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "minProperties", + Reason: fmt.Sprintf("there must be at least %d properties", v), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "maxProperties" + if v := schema.MaxProps; v != nil && lenValue > int64(*v) { + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "maxProperties", + Reason: fmt.Sprintf("there must be at most %d properties", *v), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "additionalProperties" + var additionalProperties *Schema + if ref := schema.AdditionalProperties.Schema; ref != nil { + additionalProperties = ref.Value + } + keys := make([]string, 0, len(value)) + for k := range value { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + v := value[k] + if properties != nil { + propertyRef := properties[k] + if propertyRef != nil { + p := propertyRef.Value + if p == nil { + return foundUnresolvedRef(propertyRef.Ref) + } + if err := p.visitJSON(settings, v); err != nil { + if settings.failfast { + return errSchema + } + err = markSchemaErrorKey(err, k) + if !settings.multiError { + return err + } + if v, ok := err.(MultiError); ok { + me = append(me, v...) + continue + } + me = append(me, err) + } + continue + } + } + if allowed := schema.AdditionalProperties.Has; allowed == nil || *allowed { + if additionalProperties != nil { + if err := additionalProperties.visitJSON(settings, v); err != nil { + if settings.failfast { + return errSchema + } + err = markSchemaErrorKey(err, k) + if !settings.multiError { + return err + } + if v, ok := err.(MultiError); ok { + me = append(me, v...) + continue + } + me = append(me, err) + } + } + continue + } + if settings.failfast { + return errSchema + } + err := &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "properties", + Reason: fmt.Sprintf("property %q is unsupported", k), + customizeMessageError: settings.customizeMessageError, + } + if !settings.multiError { + return err + } + me = append(me, err) + } + + // "required" + for _, k := range schema.Required { + if _, ok := value[k]; !ok { + if s := schema.Properties[k]; s != nil && s.Value.ReadOnly && settings.asreq { + continue + } + if s := schema.Properties[k]; s != nil && s.Value.WriteOnly && settings.asrep { + continue + } + if settings.failfast { + return errSchema + } + err := markSchemaErrorKey(&SchemaError{ + Value: value, + Schema: schema, + SchemaField: "required", + Reason: fmt.Sprintf("property %q is missing", k), + customizeMessageError: settings.customizeMessageError, + }, k) + if !settings.multiError { + return err + } + me = append(me, err) + } + } + + if len(me) > 0 { + return me + } + + return nil +} + +func (schema *Schema) expectedType(settings *schemaValidationSettings, value any) error { + if settings.failfast { + return errSchema + } + + a := "a" + var x string + schemaTypes := (*schema.Type) + if len(schemaTypes) == 1 { + x = schemaTypes[0] + switch x { + case TypeArray, TypeObject, TypeInteger: + a = "an" + } + } else { + a = "one of" + x = strings.Join(schemaTypes, ", ") + } + return &SchemaError{ + Value: value, + Schema: schema, + SchemaField: "type", + Reason: fmt.Sprintf("value must be %s %s", a, x), + customizeMessageError: settings.customizeMessageError, + } +} + +// SchemaError is an error that occurs during schema validation. +type SchemaError struct { + // Value is the value that failed validation. + Value any + // reversePath is the path to the value that failed validation. + reversePath []string + // Schema is the schema that failed validation. + Schema *Schema + // SchemaField is the field of the schema that failed validation. + SchemaField string + // Reason is a human-readable message describing the error. + // The message should never include the original value to prevent leakage of potentially sensitive inputs in error messages. + Reason string + // Origin is the original error that caused this error. + Origin error + // customizeMessageError is a function that can be used to customize the error message. + customizeMessageError func(err *SchemaError) string +} + +var _ interface{ Unwrap() error } = SchemaError{} + +func markSchemaErrorKey(err error, key string) error { + + if v, ok := err.(*SchemaError); ok { + v.reversePath = append(v.reversePath, key) + if v.Origin != nil { + if unwrapped := errors.Unwrap(v.Origin); unwrapped != nil { + if me, ok := unwrapped.(multiErrorForOneOf); ok { + _ = markSchemaErrorKey(MultiError(me), key) + } + } + } + return v + } + if v, ok := err.(MultiError); ok { + for _, e := range v { + _ = markSchemaErrorKey(e, key) + } + return v + } + return err +} + +func markSchemaErrorIndex(err error, index int) error { + return markSchemaErrorKey(err, strconv.FormatInt(int64(index), 10)) +} + +func (err *SchemaError) JSONPointer() []string { + reversePath := err.reversePath + path := append([]string(nil), reversePath...) + for left, right := 0, len(path)-1; left < right; left, right = left+1, right-1 { + path[left], path[right] = path[right], path[left] + } + return path +} + +func (err *SchemaError) Error() string { + if err.customizeMessageError != nil { + if msg := err.customizeMessageError(err); msg != "" { + return msg + } + } + + buf := bytes.NewBuffer(make([]byte, 0, 256)) + + if len(err.reversePath) > 0 { + buf.WriteString(`Error at "`) + reversePath := err.reversePath + for i := len(reversePath) - 1; i >= 0; i-- { + buf.WriteByte('/') + buf.WriteString(reversePath[i]) + } + buf.WriteString(`": `) + } + + if err.Origin != nil { + buf.WriteString(err.Origin.Error()) + + return buf.String() + } + + reason := err.Reason + if reason == "" { + buf.WriteString(`Doesn't match schema "`) + buf.WriteString(err.SchemaField) + buf.WriteString(`"`) + } else { + buf.WriteString(reason) + } + + if !SchemaErrorDetailsDisabled { + buf.WriteString("\nSchema:\n ") + encoder := json.NewEncoder(buf) + encoder.SetIndent(" ", " ") + if err := encoder.Encode(err.Schema); err != nil { + panic(err) + } + buf.WriteString("\nValue:\n ") + if err := encoder.Encode(err.Value); err != nil { + panic(err) + } + } + + return buf.String() +} + +func (err SchemaError) Unwrap() error { + return err.Origin +} + +func isSliceOfUniqueItems(xs []any) bool { + s := len(xs) + m := make(map[string]struct{}, s) + for _, x := range xs { + // The input slice is converted from a JSON string, there shall + // have no error when convert it back. + key, _ := json.Marshal(&x) + m[string(key)] = struct{}{} + } + return s == len(m) +} + +// SliceUniqueItemsChecker is an function used to check if an given slice +// have unique items. +type SliceUniqueItemsChecker func(items []any) bool + +// By default using predefined func isSliceOfUniqueItems which make use of +// json.Marshal to generate a key for map used to check if a given slice +// have unique items. +var sliceUniqueItemsChecker SliceUniqueItemsChecker = isSliceOfUniqueItems + +// RegisterArrayUniqueItemsChecker is used to register a customized function +// used to check if JSON array have unique items. +func RegisterArrayUniqueItemsChecker(fn SliceUniqueItemsChecker) { + sliceUniqueItemsChecker = fn +} + +func unsupportedFormat(format string) error { + return fmt.Errorf("unsupported 'format' value %q", format) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/schema_formats.go b/vendor/github.com/getkin/kin-openapi/openapi3/schema_formats.go new file mode 100644 index 0000000000..023c2669e3 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/schema_formats.go @@ -0,0 +1,169 @@ +package openapi3 + +import ( + "fmt" + "math" + "net/netip" + "regexp" +) + +type ( + // FormatValidator is an interface for custom format validators. + FormatValidator[T any] interface { + Validate(value T) error + } + // StringFormatValidator is a type alias for FormatValidator[string] + StringFormatValidator = FormatValidator[string] + // NumberFormatValidator is a type alias for FormatValidator[float64] + NumberFormatValidator = FormatValidator[float64] + // IntegerFormatValidator is a type alias for FormatValidator[int64] + IntegerFormatValidator = FormatValidator[int64] +) + +var ( + // SchemaStringFormats is a map of custom string format validators. + SchemaStringFormats = make(map[string]StringFormatValidator) + // SchemaNumberFormats is a map of custom number format validators. + SchemaNumberFormats = make(map[string]NumberFormatValidator) + // SchemaIntegerFormats is a map of custom integer format validators. + SchemaIntegerFormats = make(map[string]IntegerFormatValidator) +) + +const ( + // FormatOfStringForUUIDOfRFC4122 is an optional predefined format for UUID v1-v5 as specified by RFC4122 + FormatOfStringForUUIDOfRFC4122 = `^(?:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$` + + // FormatOfStringForEmail pattern catches only some suspiciously wrong-looking email addresses. + // Use DefineStringFormat(...) if you need something stricter. + FormatOfStringForEmail = `^[^@]+@[^@<>",\s]+$` + + // FormatOfStringByte is a regexp for base64-encoded characters, for example, "U3dhZ2dlciByb2Nrcw==" + FormatOfStringByte = `(^$|^[a-zA-Z0-9+/\-_]*=*$)` + + // FormatOfStringDate is a RFC3339 date format regexp, for example "2017-07-21". + FormatOfStringDate = `^[0-9]{4}-(0[0-9]|10|11|12)-([0-2][0-9]|30|31)$` + + // FormatOfStringDateTime is a RFC3339 date-time format regexp, for example "2017-07-21T17:32:28Z". + FormatOfStringDateTime = `^[0-9]{4}-(0[0-9]|10|11|12)-([0-2][0-9]|30|31)T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(Z|(\+|-)[0-9]{2}:[0-9]{2})?$` +) + +func init() { + DefineStringFormatValidator("byte", NewRegexpFormatValidator(FormatOfStringByte)) + DefineStringFormatValidator("date", NewRegexpFormatValidator(FormatOfStringDate)) + DefineStringFormatValidator("date-time", NewRegexpFormatValidator(FormatOfStringDateTime)) + DefineIntegerFormatValidator("int32", NewRangeFormatValidator(int64(math.MinInt32), int64(math.MaxInt32))) + DefineIntegerFormatValidator("int64", NewRangeFormatValidator(int64(math.MinInt64), int64(math.MaxInt64))) +} + +// DefineIPv4Format opts in ipv4 format validation on top of OAS 3 spec +func DefineIPv4Format() { + DefineStringFormatValidator("ipv4", NewIPValidator(true)) +} + +// DefineIPv6Format opts in ipv6 format validation on top of OAS 3 spec +func DefineIPv6Format() { + DefineStringFormatValidator("ipv6", NewIPValidator(false)) +} + +type stringRegexpFormatValidator struct { + re *regexp.Regexp +} + +func (s stringRegexpFormatValidator) Validate(value string) error { + if !s.re.MatchString(value) { + return fmt.Errorf(`string doesn't match pattern "%s"`, s.re.String()) + } + return nil +} + +type callbackValidator[T any] struct { + fn func(T) error +} + +func (c callbackValidator[T]) Validate(value T) error { + return c.fn(value) +} + +type rangeFormat[T int64 | float64] struct { + min, max T +} + +func (r rangeFormat[T]) Validate(value T) error { + if value < r.min || value > r.max { + return fmt.Errorf("value should be between %v and %v", r.min, r.max) + } + return nil +} + +// NewRangeFormatValidator creates a new FormatValidator that validates the value is within a given range. +func NewRangeFormatValidator[T int64 | float64](min, max T) FormatValidator[T] { + return rangeFormat[T]{min: min, max: max} +} + +// NewRegexpFormatValidator creates a new FormatValidator that uses a regular expression to validate the value. +func NewRegexpFormatValidator(pattern string) StringFormatValidator { + re, err := regexp.Compile(pattern) + if err != nil { + err := fmt.Errorf("string regexp format has invalid pattern %q: %w", pattern, err) + panic(err) + } + return stringRegexpFormatValidator{re: re} +} + +// NewCallbackValidator creates a new FormatValidator that uses a callback function to validate the value. +func NewCallbackValidator[T any](fn func(T) error) FormatValidator[T] { + return callbackValidator[T]{fn: fn} +} + +// DefineStringFormatValidator defines a custom format validator for a given string format. +func DefineStringFormatValidator(name string, validator StringFormatValidator) { + SchemaStringFormats[name] = validator +} + +// DefineNumberFormatValidator defines a custom format validator for a given number format. +func DefineNumberFormatValidator(name string, validator NumberFormatValidator) { + SchemaNumberFormats[name] = validator +} + +// DefineIntegerFormatValidator defines a custom format validator for a given integer format. +func DefineIntegerFormatValidator(name string, validator IntegerFormatValidator) { + SchemaIntegerFormats[name] = validator +} + +// DefineStringFormat defines a regexp pattern for a given string format +// Deprecated: Use openapi3.DefineStringFormatValidator(name, NewRegexpFormatValidator(pattern)) instead. +func DefineStringFormat(name string, pattern string) { + DefineStringFormatValidator(name, NewRegexpFormatValidator(pattern)) +} + +// DefineStringFormatCallback defines a callback function for a given string format +// Deprecated: Use openapi3.DefineStringFormatValidator(name, NewCallbackValidator(fn)) instead. +func DefineStringFormatCallback(name string, callback func(string) error) { + DefineStringFormatValidator(name, NewCallbackValidator(callback)) +} + +// NewIPValidator creates a new FormatValidator that validates the value is an IP address. +func NewIPValidator(isIPv4 bool) FormatValidator[string] { + return callbackValidator[string]{fn: func(ip string) error { + addr, err := netip.ParseAddr(ip) + if err != nil { + return &SchemaError{ + Value: ip, + Reason: "Not an IP address", + } + } + if isIPv4 && !addr.Is4() { + return &SchemaError{ + Value: ip, + Reason: "Not an IPv4 address (it's IPv6)", + } + } + if !isIPv4 && !addr.Is6() { + return &SchemaError{ + Value: ip, + Reason: "Not an IPv6 address (it's IPv4)", + } + } + return nil + }} +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/schema_pattern.go b/vendor/github.com/getkin/kin-openapi/openapi3/schema_pattern.go new file mode 100644 index 0000000000..5819713780 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/schema_pattern.go @@ -0,0 +1,35 @@ +package openapi3 + +import ( + "fmt" + "regexp" +) + +var patRewriteCodepoints = regexp.MustCompile(`(?P\\u)(?P[0-9A-F]{4})`) + +// See https://pkg.go.dev/regexp/syntax +func intoGoRegexp(re string) string { + return patRewriteCodepoints.ReplaceAllString(re, `\x{${code}}`) +} + +// NOTE: racey WRT [writes to schema.Pattern] vs [reads schema.Pattern then writes to compiledPatterns] +func (schema *Schema) compilePattern(c RegexCompilerFunc) (cp RegexMatcher, err error) { + pattern := schema.Pattern + if c != nil { + cp, err = c(pattern) + } else { + cp, err = regexp.Compile(intoGoRegexp(pattern)) + } + if err != nil { + err = &SchemaError{ + Schema: schema, + SchemaField: "pattern", + Origin: err, + Reason: fmt.Sprintf("cannot compile pattern %q: %v", pattern, err), + } + return + } + + var _ bool = compiledPatterns.CompareAndSwap(pattern, nil, cp) + return +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/schema_validation_settings.go b/vendor/github.com/getkin/kin-openapi/openapi3/schema_validation_settings.go new file mode 100644 index 0000000000..e9c1422bd8 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/schema_validation_settings.go @@ -0,0 +1,92 @@ +package openapi3 + +import ( + "sync" +) + +// SchemaValidationOption describes options a user has when validating request / response bodies. +type SchemaValidationOption func(*schemaValidationSettings) + +type RegexCompilerFunc func(expr string) (RegexMatcher, error) + +type RegexMatcher interface { + MatchString(s string) bool +} + +type schemaValidationSettings struct { + failfast bool + multiError bool + asreq, asrep bool // exclusive (XOR) fields + formatValidationEnabled bool + patternValidationDisabled bool + readOnlyValidationDisabled bool + writeOnlyValidationDisabled bool + + regexCompiler RegexCompilerFunc + + onceSettingDefaults sync.Once + defaultsSet func() + + customizeMessageError func(err *SchemaError) string +} + +// FailFast returns schema validation errors quicker. +func FailFast() SchemaValidationOption { + return func(s *schemaValidationSettings) { s.failfast = true } +} + +func MultiErrors() SchemaValidationOption { + return func(s *schemaValidationSettings) { s.multiError = true } +} + +func VisitAsRequest() SchemaValidationOption { + return func(s *schemaValidationSettings) { s.asreq, s.asrep = true, false } +} + +func VisitAsResponse() SchemaValidationOption { + return func(s *schemaValidationSettings) { s.asreq, s.asrep = false, true } +} + +// EnableFormatValidation setting makes Validate not return an error when validating documents that mention schema formats that are not defined by the OpenAPIv3 specification. +func EnableFormatValidation() SchemaValidationOption { + return func(s *schemaValidationSettings) { s.formatValidationEnabled = true } +} + +// DisablePatternValidation setting makes Validate not return an error when validating patterns that are not supported by the Go regexp engine. +func DisablePatternValidation() SchemaValidationOption { + return func(s *schemaValidationSettings) { s.patternValidationDisabled = true } +} + +// DisableReadOnlyValidation setting makes Validate not return an error when validating properties marked as read-only +func DisableReadOnlyValidation() SchemaValidationOption { + return func(s *schemaValidationSettings) { s.readOnlyValidationDisabled = true } +} + +// DisableWriteOnlyValidation setting makes Validate not return an error when validating properties marked as write-only +func DisableWriteOnlyValidation() SchemaValidationOption { + return func(s *schemaValidationSettings) { s.writeOnlyValidationDisabled = true } +} + +// DefaultsSet executes the given callback (once) IFF schema validation set default values. +func DefaultsSet(f func()) SchemaValidationOption { + return func(s *schemaValidationSettings) { s.defaultsSet = f } +} + +// SetSchemaErrorMessageCustomizer allows to override the schema error message. +// If the passed function returns an empty string, it returns to the previous Error() implementation. +func SetSchemaErrorMessageCustomizer(f func(err *SchemaError) string) SchemaValidationOption { + return func(s *schemaValidationSettings) { s.customizeMessageError = f } +} + +// SetSchemaRegexCompiler allows to override the regex implementation used to validate field "pattern". +func SetSchemaRegexCompiler(c RegexCompilerFunc) SchemaValidationOption { + return func(s *schemaValidationSettings) { s.regexCompiler = c } +} + +func newSchemaValidationSettings(opts ...SchemaValidationOption) *schemaValidationSettings { + settings := &schemaValidationSettings{} + for _, opt := range opts { + opt(settings) + } + return settings +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/security_requirements.go b/vendor/github.com/getkin/kin-openapi/openapi3/security_requirements.go new file mode 100644 index 0000000000..87891c954c --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/security_requirements.go @@ -0,0 +1,51 @@ +package openapi3 + +import ( + "context" +) + +type SecurityRequirements []SecurityRequirement + +func NewSecurityRequirements() *SecurityRequirements { + return &SecurityRequirements{} +} + +func (srs *SecurityRequirements) With(securityRequirement SecurityRequirement) *SecurityRequirements { + *srs = append(*srs, securityRequirement) + return srs +} + +// Validate returns an error if SecurityRequirements does not comply with the OpenAPI spec. +func (srs SecurityRequirements) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + for _, security := range srs { + if err := security.Validate(ctx); err != nil { + return err + } + } + return nil +} + +// SecurityRequirement is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object +type SecurityRequirement map[string][]string + +func NewSecurityRequirement() SecurityRequirement { + return make(SecurityRequirement) +} + +func (security SecurityRequirement) Authenticate(provider string, scopes ...string) SecurityRequirement { + if len(scopes) == 0 { + scopes = []string{} // Forces the variable to be encoded as an array instead of null + } + security[provider] = scopes + return security +} + +// Validate returns an error if SecurityRequirement does not comply with the OpenAPI spec. +func (security *SecurityRequirement) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + return nil +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/security_scheme.go b/vendor/github.com/getkin/kin-openapi/openapi3/security_scheme.go new file mode 100644 index 0000000000..b5c94b6183 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/security_scheme.go @@ -0,0 +1,429 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "net/url" +) + +// SecurityScheme is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-scheme-object +type SecurityScheme struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Type string `json:"type,omitempty" yaml:"type,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + In string `json:"in,omitempty" yaml:"in,omitempty"` + Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` + BearerFormat string `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty"` + Flows *OAuthFlows `json:"flows,omitempty" yaml:"flows,omitempty"` + OpenIdConnectUrl string `json:"openIdConnectUrl,omitempty" yaml:"openIdConnectUrl,omitempty"` +} + +func NewSecurityScheme() *SecurityScheme { + return &SecurityScheme{} +} + +func NewCSRFSecurityScheme() *SecurityScheme { + return &SecurityScheme{ + Type: "apiKey", + In: "header", + Name: "X-XSRF-TOKEN", + } +} + +func NewOIDCSecurityScheme(oidcUrl string) *SecurityScheme { + return &SecurityScheme{ + Type: "openIdConnect", + OpenIdConnectUrl: oidcUrl, + } +} + +func NewJWTSecurityScheme() *SecurityScheme { + return &SecurityScheme{ + Type: "http", + Scheme: "bearer", + BearerFormat: "JWT", + } +} + +// MarshalJSON returns the JSON encoding of SecurityScheme. +func (ss SecurityScheme) MarshalJSON() ([]byte, error) { + x, err := ss.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of SecurityScheme. +func (ss SecurityScheme) MarshalYAML() (any, error) { + m := make(map[string]any, 8+len(ss.Extensions)) + for k, v := range ss.Extensions { + m[k] = v + } + if x := ss.Type; x != "" { + m["type"] = x + } + if x := ss.Description; x != "" { + m["description"] = x + } + if x := ss.Name; x != "" { + m["name"] = x + } + if x := ss.In; x != "" { + m["in"] = x + } + if x := ss.Scheme; x != "" { + m["scheme"] = x + } + if x := ss.BearerFormat; x != "" { + m["bearerFormat"] = x + } + if x := ss.Flows; x != nil { + m["flows"] = x + } + if x := ss.OpenIdConnectUrl; x != "" { + m["openIdConnectUrl"] = x + } + return m, nil +} + +// UnmarshalJSON sets SecurityScheme to a copy of data. +func (ss *SecurityScheme) UnmarshalJSON(data []byte) error { + type SecuritySchemeBis SecurityScheme + var x SecuritySchemeBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "type") + delete(x.Extensions, "description") + delete(x.Extensions, "name") + delete(x.Extensions, "in") + delete(x.Extensions, "scheme") + delete(x.Extensions, "bearerFormat") + delete(x.Extensions, "flows") + delete(x.Extensions, "openIdConnectUrl") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *ss = SecurityScheme(x) + return nil +} + +func (ss *SecurityScheme) WithType(value string) *SecurityScheme { + ss.Type = value + return ss +} + +func (ss *SecurityScheme) WithDescription(value string) *SecurityScheme { + ss.Description = value + return ss +} + +func (ss *SecurityScheme) WithName(value string) *SecurityScheme { + ss.Name = value + return ss +} + +func (ss *SecurityScheme) WithIn(value string) *SecurityScheme { + ss.In = value + return ss +} + +func (ss *SecurityScheme) WithScheme(value string) *SecurityScheme { + ss.Scheme = value + return ss +} + +func (ss *SecurityScheme) WithBearerFormat(value string) *SecurityScheme { + ss.BearerFormat = value + return ss +} + +// Validate returns an error if SecurityScheme does not comply with the OpenAPI spec. +func (ss *SecurityScheme) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + hasIn := false + hasBearerFormat := false + hasFlow := false + switch ss.Type { + case "apiKey": + hasIn = true + case "http": + scheme := ss.Scheme + switch scheme { + case "bearer": + hasBearerFormat = true + case "basic", "negotiate", "digest": + default: + return fmt.Errorf("security scheme of type 'http' has invalid 'scheme' value %q", scheme) + } + case "oauth2": + hasFlow = true + case "openIdConnect": + if ss.OpenIdConnectUrl == "" { + return fmt.Errorf("no OIDC URL found for openIdConnect security scheme %q", ss.Name) + } + default: + return fmt.Errorf("security scheme 'type' can't be %q", ss.Type) + } + + // Validate "in" and "name" + if hasIn { + switch ss.In { + case "query", "header", "cookie": + default: + return fmt.Errorf("security scheme of type 'apiKey' should have 'in'. It can be 'query', 'header' or 'cookie', not %q", ss.In) + } + if ss.Name == "" { + return errors.New("security scheme of type 'apiKey' should have 'name'") + } + } else if len(ss.In) > 0 { + return fmt.Errorf("security scheme of type %q can't have 'in'", ss.Type) + } else if len(ss.Name) > 0 { + return fmt.Errorf("security scheme of type %q can't have 'name'", ss.Type) + } + + // Validate "format" + // "bearerFormat" is an arbitrary string so we only check if the scheme supports it + if !hasBearerFormat && len(ss.BearerFormat) > 0 { + return fmt.Errorf("security scheme of type %q can't have 'bearerFormat'", ss.Type) + } + + // Validate "flow" + if hasFlow { + flow := ss.Flows + if flow == nil { + return fmt.Errorf("security scheme of type %q should have 'flows'", ss.Type) + } + if err := flow.Validate(ctx); err != nil { + return fmt.Errorf("security scheme 'flow' is invalid: %w", err) + } + } else if ss.Flows != nil { + return fmt.Errorf("security scheme of type %q can't have 'flows'", ss.Type) + } + + return validateExtensions(ctx, ss.Extensions) +} + +// OAuthFlows is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauth-flows-object +type OAuthFlows struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Implicit *OAuthFlow `json:"implicit,omitempty" yaml:"implicit,omitempty"` + Password *OAuthFlow `json:"password,omitempty" yaml:"password,omitempty"` + ClientCredentials *OAuthFlow `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty"` + AuthorizationCode *OAuthFlow `json:"authorizationCode,omitempty" yaml:"authorizationCode,omitempty"` +} + +type oAuthFlowType int + +const ( + oAuthFlowTypeImplicit oAuthFlowType = iota + oAuthFlowTypePassword + oAuthFlowTypeClientCredentials + oAuthFlowAuthorizationCode +) + +// MarshalJSON returns the JSON encoding of OAuthFlows. +func (flows OAuthFlows) MarshalJSON() ([]byte, error) { + x, err := flows.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of OAuthFlows. +func (flows OAuthFlows) MarshalYAML() (any, error) { + m := make(map[string]any, 4+len(flows.Extensions)) + for k, v := range flows.Extensions { + m[k] = v + } + if x := flows.Implicit; x != nil { + m["implicit"] = x + } + if x := flows.Password; x != nil { + m["password"] = x + } + if x := flows.ClientCredentials; x != nil { + m["clientCredentials"] = x + } + if x := flows.AuthorizationCode; x != nil { + m["authorizationCode"] = x + } + return m, nil +} + +// UnmarshalJSON sets OAuthFlows to a copy of data. +func (flows *OAuthFlows) UnmarshalJSON(data []byte) error { + type OAuthFlowsBis OAuthFlows + var x OAuthFlowsBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "implicit") + delete(x.Extensions, "password") + delete(x.Extensions, "clientCredentials") + delete(x.Extensions, "authorizationCode") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *flows = OAuthFlows(x) + return nil +} + +// Validate returns an error if OAuthFlows does not comply with the OpenAPI spec. +func (flows *OAuthFlows) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if v := flows.Implicit; v != nil { + if err := v.validate(ctx, oAuthFlowTypeImplicit, opts...); err != nil { + return fmt.Errorf("the OAuth flow 'implicit' is invalid: %w", err) + } + } + + if v := flows.Password; v != nil { + if err := v.validate(ctx, oAuthFlowTypePassword, opts...); err != nil { + return fmt.Errorf("the OAuth flow 'password' is invalid: %w", err) + } + } + + if v := flows.ClientCredentials; v != nil { + if err := v.validate(ctx, oAuthFlowTypeClientCredentials, opts...); err != nil { + return fmt.Errorf("the OAuth flow 'clientCredentials' is invalid: %w", err) + } + } + + if v := flows.AuthorizationCode; v != nil { + if err := v.validate(ctx, oAuthFlowAuthorizationCode, opts...); err != nil { + return fmt.Errorf("the OAuth flow 'authorizationCode' is invalid: %w", err) + } + } + + return validateExtensions(ctx, flows.Extensions) +} + +// OAuthFlow is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauth-flow-object +type OAuthFlow struct { + Extensions map[string]any `json:"-" yaml:"-"` + + AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` + TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"` + RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"` + Scopes map[string]string `json:"scopes" yaml:"scopes"` // required +} + +// MarshalJSON returns the JSON encoding of OAuthFlow. +func (flow OAuthFlow) MarshalJSON() ([]byte, error) { + x, err := flow.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of OAuthFlow. +func (flow OAuthFlow) MarshalYAML() (any, error) { + m := make(map[string]any, 4+len(flow.Extensions)) + for k, v := range flow.Extensions { + m[k] = v + } + if x := flow.AuthorizationURL; x != "" { + m["authorizationUrl"] = x + } + if x := flow.TokenURL; x != "" { + m["tokenUrl"] = x + } + if x := flow.RefreshURL; x != "" { + m["refreshUrl"] = x + } + m["scopes"] = flow.Scopes + return m, nil +} + +// UnmarshalJSON sets OAuthFlow to a copy of data. +func (flow *OAuthFlow) UnmarshalJSON(data []byte) error { + type OAuthFlowBis OAuthFlow + var x OAuthFlowBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "authorizationUrl") + delete(x.Extensions, "tokenUrl") + delete(x.Extensions, "refreshUrl") + delete(x.Extensions, "scopes") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *flow = OAuthFlow(x) + return nil +} + +// Validate returns an error if OAuthFlows does not comply with the OpenAPI spec. +func (flow *OAuthFlow) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if v := flow.RefreshURL; v != "" { + if _, err := url.Parse(v); err != nil { + return fmt.Errorf("field 'refreshUrl' is invalid: %w", err) + } + } + + if flow.Scopes == nil { + return errors.New("field 'scopes' is missing") + } + + return validateExtensions(ctx, flow.Extensions) +} + +func (flow *OAuthFlow) validate(ctx context.Context, typ oAuthFlowType, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + typeIn := func(types ...oAuthFlowType) bool { + for _, ty := range types { + if ty == typ { + return true + } + } + return false + } + + if in := typeIn(oAuthFlowTypeImplicit, oAuthFlowAuthorizationCode); true { + switch { + case flow.AuthorizationURL == "" && in: + return errors.New("field 'authorizationUrl' is empty or missing") + case flow.AuthorizationURL != "" && !in: + return errors.New("field 'authorizationUrl' should not be set") + case flow.AuthorizationURL != "": + if _, err := url.Parse(flow.AuthorizationURL); err != nil { + return fmt.Errorf("field 'authorizationUrl' is invalid: %w", err) + } + } + } + + if in := typeIn(oAuthFlowTypePassword, oAuthFlowTypeClientCredentials, oAuthFlowAuthorizationCode); true { + switch { + case flow.TokenURL == "" && in: + return errors.New("field 'tokenUrl' is empty or missing") + case flow.TokenURL != "" && !in: + return errors.New("field 'tokenUrl' should not be set") + case flow.TokenURL != "": + if _, err := url.Parse(flow.TokenURL); err != nil { + return fmt.Errorf("field 'tokenUrl' is invalid: %w", err) + } + } + } + + return flow.Validate(ctx, opts...) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/serialization_method.go b/vendor/github.com/getkin/kin-openapi/openapi3/serialization_method.go new file mode 100644 index 0000000000..2ec8bd2db8 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/serialization_method.go @@ -0,0 +1,17 @@ +package openapi3 + +const ( + SerializationSimple = "simple" + SerializationLabel = "label" + SerializationMatrix = "matrix" + SerializationForm = "form" + SerializationSpaceDelimited = "spaceDelimited" + SerializationPipeDelimited = "pipeDelimited" + SerializationDeepObject = "deepObject" +) + +// SerializationMethod describes a serialization method of HTTP request's parameters and body. +type SerializationMethod struct { + Style string + Explode bool +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/server.go b/vendor/github.com/getkin/kin-openapi/openapi3/server.go new file mode 100644 index 0000000000..7a2007f20f --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/server.go @@ -0,0 +1,302 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "math" + "net/url" + "sort" + "strings" +) + +// Servers is specified by OpenAPI/Swagger standard version 3. +type Servers []*Server + +// Validate returns an error if Servers does not comply with the OpenAPI spec. +func (servers Servers) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + for _, v := range servers { + if err := v.Validate(ctx); err != nil { + return err + } + } + return nil +} + +// BasePath returns the base path of the first server in the list, or /. +func (servers Servers) BasePath() (string, error) { + for _, server := range servers { + return server.BasePath() + } + return "/", nil +} + +func (servers Servers) MatchURL(parsedURL *url.URL) (*Server, []string, string) { + rawURL := parsedURL.String() + if i := strings.IndexByte(rawURL, '?'); i >= 0 { + rawURL = rawURL[:i] + } + for _, server := range servers { + pathParams, remaining, ok := server.MatchRawURL(rawURL) + if ok { + return server, pathParams, remaining + } + } + return nil, nil, "" +} + +// Server is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-object +type Server struct { + Extensions map[string]any `json:"-" yaml:"-"` + + URL string `json:"url" yaml:"url"` // Required + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Variables map[string]*ServerVariable `json:"variables,omitempty" yaml:"variables,omitempty"` +} + +// BasePath returns the base path extracted from the default values of variables, if any. +// Assumes a valid struct (per Validate()). +func (server *Server) BasePath() (string, error) { + if server == nil { + return "/", nil + } + + uri := server.URL + for name, svar := range server.Variables { + uri = strings.ReplaceAll(uri, "{"+name+"}", svar.Default) + } + + u, err := url.ParseRequestURI(uri) + if err != nil { + return "", err + } + + if bp := u.Path; bp != "" { + return bp, nil + } + + return "/", nil +} + +// MarshalJSON returns the JSON encoding of Server. +func (server Server) MarshalJSON() ([]byte, error) { + x, err := server.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Server. +func (server Server) MarshalYAML() (any, error) { + m := make(map[string]any, 3+len(server.Extensions)) + for k, v := range server.Extensions { + m[k] = v + } + m["url"] = server.URL + if x := server.Description; x != "" { + m["description"] = x + } + if x := server.Variables; len(x) != 0 { + m["variables"] = x + } + return m, nil +} + +// UnmarshalJSON sets Server to a copy of data. +func (server *Server) UnmarshalJSON(data []byte) error { + type ServerBis Server + var x ServerBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "url") + delete(x.Extensions, "description") + delete(x.Extensions, "variables") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *server = Server(x) + return nil +} + +func (server Server) ParameterNames() ([]string, error) { + pattern := server.URL + var params []string + for len(pattern) > 0 { + i := strings.IndexByte(pattern, '{') + if i < 0 { + break + } + pattern = pattern[i+1:] + i = strings.IndexByte(pattern, '}') + if i < 0 { + return nil, errors.New("missing '}'") + } + params = append(params, strings.TrimSpace(pattern[:i])) + pattern = pattern[i+1:] + } + return params, nil +} + +func (server Server) MatchRawURL(input string) ([]string, string, bool) { + pattern := server.URL + var params []string + for len(pattern) > 0 { + c := pattern[0] + if len(pattern) == 1 && c == '/' { + break + } + if c == '{' { + // Find end of pattern + i := strings.IndexByte(pattern, '}') + if i < 0 { + return nil, "", false + } + pattern = pattern[i+1:] + + // Find next matching pattern character or next '/' whichever comes first + np := -1 + if len(pattern) > 0 { + np = strings.IndexByte(input, pattern[0]) + } + ns := strings.IndexByte(input, '/') + + if np < 0 { + i = ns + } else if ns < 0 { + i = np + } else { + i = int(math.Min(float64(np), float64(ns))) + } + if i < 0 { + i = len(input) + } + params = append(params, input[:i]) + input = input[i:] + continue + } + if len(input) == 0 || input[0] != c { + return nil, "", false + } + pattern = pattern[1:] + input = input[1:] + } + if input == "" { + input = "/" + } + if input[0] != '/' { + return nil, "", false + } + return params, input, true +} + +// Validate returns an error if Server does not comply with the OpenAPI spec. +func (server *Server) Validate(ctx context.Context, opts ...ValidationOption) (err error) { + ctx = WithValidationOptions(ctx, opts...) + + if server.URL == "" { + return errors.New("value of url must be a non-empty string") + } + + opening, closing := strings.Count(server.URL, "{"), strings.Count(server.URL, "}") + if opening != closing { + return errors.New("server URL has mismatched { and }") + } + + if opening != len(server.Variables) { + return errors.New("server has undeclared variables") + } + + variables := make([]string, 0, len(server.Variables)) + for name := range server.Variables { + variables = append(variables, name) + } + sort.Strings(variables) + for _, name := range variables { + v := server.Variables[name] + if !strings.Contains(server.URL, "{"+name+"}") { + return errors.New("server has undeclared variables") + } + if err = v.Validate(ctx); err != nil { + return + } + } + + return validateExtensions(ctx, server.Extensions) +} + +// ServerVariable is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-variable-object +type ServerVariable struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Enum []string `json:"enum,omitempty" yaml:"enum,omitempty"` + Default string `json:"default,omitempty" yaml:"default,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` +} + +// MarshalJSON returns the JSON encoding of ServerVariable. +func (serverVariable ServerVariable) MarshalJSON() ([]byte, error) { + x, err := serverVariable.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of ServerVariable. +func (serverVariable ServerVariable) MarshalYAML() (any, error) { + m := make(map[string]any, 4+len(serverVariable.Extensions)) + for k, v := range serverVariable.Extensions { + m[k] = v + } + if x := serverVariable.Enum; len(x) != 0 { + m["enum"] = x + } + if x := serverVariable.Default; x != "" { + m["default"] = x + } + if x := serverVariable.Description; x != "" { + m["description"] = x + } + return m, nil +} + +// UnmarshalJSON sets ServerVariable to a copy of data. +func (serverVariable *ServerVariable) UnmarshalJSON(data []byte) error { + type ServerVariableBis ServerVariable + var x ServerVariableBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "enum") + delete(x.Extensions, "default") + delete(x.Extensions, "description") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *serverVariable = ServerVariable(x) + return nil +} + +// Validate returns an error if ServerVariable does not comply with the OpenAPI spec. +func (serverVariable *ServerVariable) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if serverVariable.Default == "" { + data, err := serverVariable.MarshalJSON() + if err != nil { + return err + } + return fmt.Errorf("field default is required in %s", data) + } + + return validateExtensions(ctx, serverVariable.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/tag.go b/vendor/github.com/getkin/kin-openapi/openapi3/tag.go new file mode 100644 index 0000000000..182d0502a8 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/tag.go @@ -0,0 +1,99 @@ +package openapi3 + +import ( + "context" + "encoding/json" + "fmt" +) + +// Tags is specified by OpenAPI/Swagger 3.0 standard. +type Tags []*Tag + +func (tags Tags) Get(name string) *Tag { + for _, tag := range tags { + if tag.Name == name { + return tag + } + } + return nil +} + +// Validate returns an error if Tags does not comply with the OpenAPI spec. +func (tags Tags) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + for _, v := range tags { + if err := v.Validate(ctx); err != nil { + return err + } + } + return nil +} + +// Tag is specified by OpenAPI/Swagger 3.0 standard. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tag-object +type Tag struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` +} + +// MarshalJSON returns the JSON encoding of Tag. +func (t Tag) MarshalJSON() ([]byte, error) { + x, err := t.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of Tag. +func (t Tag) MarshalYAML() (any, error) { + m := make(map[string]any, 3+len(t.Extensions)) + for k, v := range t.Extensions { + m[k] = v + } + if x := t.Name; x != "" { + m["name"] = x + } + if x := t.Description; x != "" { + m["description"] = x + } + if x := t.ExternalDocs; x != nil { + m["externalDocs"] = x + } + return m, nil +} + +// UnmarshalJSON sets Tag to a copy of data. +func (t *Tag) UnmarshalJSON(data []byte) error { + type TagBis Tag + var x TagBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "name") + delete(x.Extensions, "description") + delete(x.Extensions, "externalDocs") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *t = Tag(x) + return nil +} + +// Validate returns an error if Tag does not comply with the OpenAPI spec. +func (t *Tag) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + if v := t.ExternalDocs; v != nil { + if err := v.Validate(ctx); err != nil { + return fmt.Errorf("invalid external docs: %w", err) + } + } + + return validateExtensions(ctx, t.Extensions) +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/validation_options.go b/vendor/github.com/getkin/kin-openapi/openapi3/validation_options.go new file mode 100644 index 0000000000..1d141d40a3 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/validation_options.go @@ -0,0 +1,142 @@ +package openapi3 + +import "context" + +// ValidationOption allows the modification of how the OpenAPI document is validated. +type ValidationOption func(options *ValidationOptions) + +// ValidationOptions provides configuration for validating OpenAPI documents. +type ValidationOptions struct { + examplesValidationAsReq, examplesValidationAsRes bool + examplesValidationDisabled bool + schemaDefaultsValidationDisabled bool + schemaFormatValidationEnabled bool + schemaPatternValidationDisabled bool + schemaExtensionsInRefProhibited bool + regexCompilerFunc RegexCompilerFunc + extraSiblingFieldsAllowed map[string]struct{} +} + +type validationOptionsKey struct{} + +// AllowExtraSiblingFields called as AllowExtraSiblingFields("description") makes Validate not return an error when said field appears next to a $ref. +func AllowExtraSiblingFields(fields ...string) ValidationOption { + return func(options *ValidationOptions) { + if options.extraSiblingFieldsAllowed == nil && len(fields) != 0 { + options.extraSiblingFieldsAllowed = make(map[string]struct{}, len(fields)) + } + for _, field := range fields { + options.extraSiblingFieldsAllowed[field] = struct{}{} + } + } +} + +// EnableSchemaFormatValidation makes Validate not return an error when validating documents that mention schema formats that are not defined by the OpenAPIv3 specification. +// By default, schema format validation is disabled. +func EnableSchemaFormatValidation() ValidationOption { + return func(options *ValidationOptions) { + options.schemaFormatValidationEnabled = true + } +} + +// DisableSchemaFormatValidation does the opposite of EnableSchemaFormatValidation. +// By default, schema format validation is disabled. +func DisableSchemaFormatValidation() ValidationOption { + return func(options *ValidationOptions) { + options.schemaFormatValidationEnabled = false + } +} + +// EnableSchemaPatternValidation does the opposite of DisableSchemaPatternValidation. +// By default, schema pattern validation is enabled. +func EnableSchemaPatternValidation() ValidationOption { + return func(options *ValidationOptions) { + options.schemaPatternValidationDisabled = false + } +} + +// DisableSchemaPatternValidation makes Validate not return an error when validating patterns that are not supported by the Go regexp engine. +func DisableSchemaPatternValidation() ValidationOption { + return func(options *ValidationOptions) { + options.schemaPatternValidationDisabled = true + } +} + +// EnableSchemaDefaultsValidation does the opposite of DisableSchemaDefaultsValidation. +// By default, schema default values are validated against their schema. +func EnableSchemaDefaultsValidation() ValidationOption { + return func(options *ValidationOptions) { + options.schemaDefaultsValidationDisabled = false + } +} + +// DisableSchemaDefaultsValidation disables schemas' default field validation. +// By default, schema default values are validated against their schema. +func DisableSchemaDefaultsValidation() ValidationOption { + return func(options *ValidationOptions) { + options.schemaDefaultsValidationDisabled = true + } +} + +// EnableExamplesValidation does the opposite of DisableExamplesValidation. +// By default, all schema examples are validated. +func EnableExamplesValidation() ValidationOption { + return func(options *ValidationOptions) { + options.examplesValidationDisabled = false + } +} + +// DisableExamplesValidation disables all example schema validation. +// By default, all schema examples are validated. +func DisableExamplesValidation() ValidationOption { + return func(options *ValidationOptions) { + options.examplesValidationDisabled = true + } +} + +// AllowExtensionsWithRef allows extensions (fields starting with 'x-') +// as siblings for $ref fields. This is the default. +// Non-extension fields are prohibited unless allowed explicitly with the +// AllowExtraSiblingFields option. +func AllowExtensionsWithRef() ValidationOption { + return func(options *ValidationOptions) { + options.schemaExtensionsInRefProhibited = false + } +} + +// ProhibitExtensionsWithRef causes the validation to return an +// error if extensions (fields starting with 'x-') are found as +// siblings for $ref fields. Non-extension fields are prohibited +// unless allowed explicitly with the AllowExtraSiblingFields option. +func ProhibitExtensionsWithRef() ValidationOption { + return func(options *ValidationOptions) { + options.schemaExtensionsInRefProhibited = true + } +} + +// SetRegexCompiler allows to override the regex implementation used to validate +// field "pattern". +func SetRegexCompiler(c RegexCompilerFunc) ValidationOption { + return func(options *ValidationOptions) { + options.regexCompilerFunc = c + } +} + +// WithValidationOptions allows adding validation options to a context object that can be used when validating any OpenAPI type. +func WithValidationOptions(ctx context.Context, opts ...ValidationOption) context.Context { + if len(opts) == 0 { + return ctx + } + options := &ValidationOptions{} + for _, opt := range opts { + opt(options) + } + return context.WithValue(ctx, validationOptionsKey{}, options) +} + +func getValidationOptions(ctx context.Context) *ValidationOptions { + if options, ok := ctx.Value(validationOptionsKey{}).(*ValidationOptions); ok { + return options + } + return &ValidationOptions{} +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/visited.go b/vendor/github.com/getkin/kin-openapi/openapi3/visited.go new file mode 100644 index 0000000000..67f970e36a --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/visited.go @@ -0,0 +1,41 @@ +package openapi3 + +func newVisited() visitedComponent { + return visitedComponent{ + header: make(map[*Header]struct{}), + schema: make(map[*Schema]struct{}), + } +} + +type visitedComponent struct { + header map[*Header]struct{} + schema map[*Schema]struct{} +} + +// resetVisited clears visitedComponent map +// should be called before recursion over doc *T +func (doc *T) resetVisited() { + doc.visited = newVisited() +} + +// isVisitedHeader returns `true` if the *Header pointer was already visited +// otherwise it returns `false` +func (doc *T) isVisitedHeader(h *Header) bool { + if _, ok := doc.visited.header[h]; ok { + return true + } + + doc.visited.header[h] = struct{}{} + return false +} + +// isVisitedHeader returns `true` if the *Schema pointer was already visited +// otherwise it returns `false` +func (doc *T) isVisitedSchema(s *Schema) bool { + if _, ok := doc.visited.schema[s]; ok { + return true + } + + doc.visited.schema[s] = struct{}{} + return false +} diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/xml.go b/vendor/github.com/getkin/kin-openapi/openapi3/xml.go new file mode 100644 index 0000000000..69d1b34839 --- /dev/null +++ b/vendor/github.com/getkin/kin-openapi/openapi3/xml.go @@ -0,0 +1,78 @@ +package openapi3 + +import ( + "context" + "encoding/json" +) + +// XML is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#xml-object +type XML struct { + Extensions map[string]any `json:"-" yaml:"-"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"` + Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty"` + Attribute bool `json:"attribute,omitempty" yaml:"attribute,omitempty"` + Wrapped bool `json:"wrapped,omitempty" yaml:"wrapped,omitempty"` +} + +// MarshalJSON returns the JSON encoding of XML. +func (xml XML) MarshalJSON() ([]byte, error) { + x, err := xml.MarshalYAML() + if err != nil { + return nil, err + } + return json.Marshal(x) +} + +// MarshalYAML returns the YAML encoding of XML. +func (xml XML) MarshalYAML() (any, error) { + m := make(map[string]any, 5+len(xml.Extensions)) + for k, v := range xml.Extensions { + m[k] = v + } + if x := xml.Name; x != "" { + m["name"] = x + } + if x := xml.Namespace; x != "" { + m["namespace"] = x + } + if x := xml.Prefix; x != "" { + m["prefix"] = x + } + if x := xml.Attribute; x { + m["attribute"] = x + } + if x := xml.Wrapped; x { + m["wrapped"] = x + } + return m, nil +} + +// UnmarshalJSON sets XML to a copy of data. +func (xml *XML) UnmarshalJSON(data []byte) error { + type XMLBis XML + var x XMLBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "name") + delete(x.Extensions, "namespace") + delete(x.Extensions, "prefix") + delete(x.Extensions, "attribute") + delete(x.Extensions, "wrapped") + if len(x.Extensions) == 0 { + x.Extensions = nil + } + *xml = XML(x) + return nil +} + +// Validate returns an error if XML does not comply with the OpenAPI spec. +func (xml *XML) Validate(ctx context.Context, opts ...ValidationOption) error { + ctx = WithValidationOptions(ctx, opts...) + + return validateExtensions(ctx, xml.Extensions) +} diff --git a/vendor/github.com/invopop/yaml/.gitignore b/vendor/github.com/invopop/yaml/.gitignore new file mode 100644 index 0000000000..e256a31e00 --- /dev/null +++ b/vendor/github.com/invopop/yaml/.gitignore @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 0000000000..61b2b79a2f --- /dev/null +++ b/vendor/github.com/invopop/yaml/.golangci.toml @@ -0,0 +1,16 @@ +[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 new file mode 100644 index 0000000000..7805d36de7 --- /dev/null +++ b/vendor/github.com/invopop/yaml/LICENSE @@ -0,0 +1,50 @@ +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 new file mode 100644 index 0000000000..2c33dfe59c --- /dev/null +++ b/vendor/github.com/invopop/yaml/README.md @@ -0,0 +1,128 @@ +# YAML marshaling and unmarshaling support for Go + +[![Lint](https://github.com/invopop/yaml/actions/workflows/lint.yaml/badge.svg)](https://github.com/invopop/yaml/actions/workflows/lint.yaml) +[![Test Go](https://github.com/invopop/yaml/actions/workflows/test.yaml/badge.svg)](https://github.com/invopop/yaml/actions/workflows/test.yaml) +[![Go Report Card](https://goreportcard.com/badge/github.com/invopop/yaml)](https://goreportcard.com/report/github.com/invopop/yaml) +![Latest Tag](https://img.shields.io/github/v/tag/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 new file mode 100644 index 0000000000..3fe5f12fd0 --- /dev/null +++ b/vendor/github.com/invopop/yaml/fields.go @@ -0,0 +1,499 @@ +// 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 new file mode 100644 index 0000000000..d57dfb10bb --- /dev/null +++ b/vendor/github.com/invopop/yaml/yaml.go @@ -0,0 +1,312 @@ +// 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/mohae/deepcopy/.gitignore b/vendor/github.com/mohae/deepcopy/.gitignore new file mode 100644 index 0000000000..5846dd1531 --- /dev/null +++ b/vendor/github.com/mohae/deepcopy/.gitignore @@ -0,0 +1,26 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*~ +*.out +*.log diff --git a/vendor/github.com/mohae/deepcopy/.travis.yml b/vendor/github.com/mohae/deepcopy/.travis.yml new file mode 100644 index 0000000000..fd47a8cf78 --- /dev/null +++ b/vendor/github.com/mohae/deepcopy/.travis.yml @@ -0,0 +1,11 @@ +language: go + +go: + - tip + +matrix: + allow_failures: + - go: tip + +script: + - go test ./... diff --git a/vendor/github.com/mohae/deepcopy/LICENSE b/vendor/github.com/mohae/deepcopy/LICENSE new file mode 100644 index 0000000000..419673f005 --- /dev/null +++ b/vendor/github.com/mohae/deepcopy/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Joel + +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/mohae/deepcopy/README.md b/vendor/github.com/mohae/deepcopy/README.md new file mode 100644 index 0000000000..f81841885b --- /dev/null +++ b/vendor/github.com/mohae/deepcopy/README.md @@ -0,0 +1,8 @@ +deepCopy +======== +[![GoDoc](https://godoc.org/github.com/mohae/deepcopy?status.svg)](https://godoc.org/github.com/mohae/deepcopy)[![Build Status](https://travis-ci.org/mohae/deepcopy.png)](https://travis-ci.org/mohae/deepcopy) + +DeepCopy makes deep copies of things: unexported field values are not copied. + +## Usage + cpy := deepcopy.Copy(orig) diff --git a/vendor/github.com/mohae/deepcopy/deepcopy.go b/vendor/github.com/mohae/deepcopy/deepcopy.go new file mode 100644 index 0000000000..ba763ad091 --- /dev/null +++ b/vendor/github.com/mohae/deepcopy/deepcopy.go @@ -0,0 +1,125 @@ +// deepcopy makes deep copies of things. A standard copy will copy the +// pointers: deep copy copies the values pointed to. Unexported field +// values are not copied. +// +// Copyright (c)2014-2016, Joel Scoble (github.com/mohae), all rights reserved. +// License: MIT, for more details check the included LICENSE file. +package deepcopy + +import ( + "reflect" + "time" +) + +// Interface for delegating copy process to type +type Interface interface { + DeepCopy() interface{} +} + +// Iface is an alias to Copy; this exists for backwards compatibility reasons. +func Iface(iface interface{}) interface{} { + return Copy(iface) +} + +// Copy creates a deep copy of whatever is passed to it and returns the copy +// in an interface{}. The returned value will need to be asserted to the +// correct type. +func Copy(src interface{}) interface{} { + if src == nil { + return nil + } + + // Make the interface a reflect.Value + original := reflect.ValueOf(src) + + // Make a copy of the same type as the original. + cpy := reflect.New(original.Type()).Elem() + + // Recursively copy the original. + copyRecursive(original, cpy) + + // Return the copy as an interface. + return cpy.Interface() +} + +// copyRecursive does the actual copying of the interface. It currently has +// limited support for what it can handle. Add as needed. +func copyRecursive(original, cpy reflect.Value) { + // check for implement deepcopy.Interface + if original.CanInterface() { + if copier, ok := original.Interface().(Interface); ok { + cpy.Set(reflect.ValueOf(copier.DeepCopy())) + return + } + } + + // handle according to original's Kind + switch original.Kind() { + case reflect.Ptr: + // Get the actual value being pointed to. + originalValue := original.Elem() + + // if it isn't valid, return. + if !originalValue.IsValid() { + return + } + cpy.Set(reflect.New(originalValue.Type())) + copyRecursive(originalValue, cpy.Elem()) + + case reflect.Interface: + // If this is a nil, don't do anything + if original.IsNil() { + return + } + // Get the value for the interface, not the pointer. + originalValue := original.Elem() + + // Get the value by calling Elem(). + copyValue := reflect.New(originalValue.Type()).Elem() + copyRecursive(originalValue, copyValue) + cpy.Set(copyValue) + + case reflect.Struct: + t, ok := original.Interface().(time.Time) + if ok { + cpy.Set(reflect.ValueOf(t)) + return + } + // Go through each field of the struct and copy it. + for i := 0; i < original.NumField(); i++ { + // The Type's StructField for a given field is checked to see if StructField.PkgPath + // is set to determine if the field is exported or not because CanSet() returns false + // for settable fields. I'm not sure why. -mohae + if original.Type().Field(i).PkgPath != "" { + continue + } + copyRecursive(original.Field(i), cpy.Field(i)) + } + + case reflect.Slice: + if original.IsNil() { + return + } + // Make a new slice and copy each element. + cpy.Set(reflect.MakeSlice(original.Type(), original.Len(), original.Cap())) + for i := 0; i < original.Len(); i++ { + copyRecursive(original.Index(i), cpy.Index(i)) + } + + case reflect.Map: + if original.IsNil() { + return + } + cpy.Set(reflect.MakeMap(original.Type())) + for _, key := range original.MapKeys() { + originalValue := original.MapIndex(key) + copyValue := reflect.New(originalValue.Type()).Elem() + copyRecursive(originalValue, copyValue) + copyKey := Copy(key.Interface()) + cpy.SetMapIndex(reflect.ValueOf(copyKey), copyValue) + } + + default: + cpy.Set(original) + } +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/LICENSE b/vendor/github.com/oapi-codegen/oapi-codegen/v2/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/LICENSE @@ -0,0 +1,201 @@ + 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/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen/oapi-codegen.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen/oapi-codegen.go new file mode 100644 index 0000000000..c41f3718d3 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen/oapi-codegen.go @@ -0,0 +1,571 @@ +// Copyright 2019 DeepMap, Inc. +// +// 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. +package main + +import ( + "flag" + "fmt" + "os" + "os/exec" + "path" + "path/filepath" + "runtime/debug" + "strings" + + "gopkg.in/yaml.v2" + + "github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen" + "github.com/oapi-codegen/oapi-codegen/v2/pkg/util" +) + +func errExit(format string, args ...interface{}) { + if !strings.HasSuffix(format, "\n") { + format = format + "\n" + } + _, _ = fmt.Fprintf(os.Stderr, format, args...) + os.Exit(1) +} + +var ( + flagOutputFile string + flagConfigFile string + flagOldConfigStyle bool + flagOutputConfig bool + flagPrintVersion bool + flagPackageName string + flagPrintUsage bool + flagGenerate string + flagTemplatesDir string + + // Deprecated: The options below will be removed in a future + // release. Please use the new config file format. + flagIncludeTags string + flagExcludeTags string + flagIncludeOperationIDs string + flagExcludeOperationIDs string + flagImportMapping string + flagExcludeSchemas string + flagResponseTypeSuffix string + flagAliasTypes bool + flagInitialismOverrides bool +) + +type configuration struct { + codegen.Configuration `yaml:",inline"` + + // OutputFile is the filename to output. + OutputFile string `yaml:"output,omitempty"` +} + +// oldConfiguration is deprecated. Please add no more flags here. It is here +// for backwards compatibility, and it will be removed in the future. +type oldConfiguration struct { + PackageName string `yaml:"package"` + GenerateTargets []string `yaml:"generate"` + OutputFile string `yaml:"output"` + IncludeTags []string `yaml:"include-tags"` + ExcludeTags []string `yaml:"exclude-tags"` + IncludeOperationIDs []string `yaml:"include-operation-ids"` + ExcludeOperationIDs []string `yaml:"exclude-operation-ids"` + TemplatesDir string `yaml:"templates"` + ImportMapping map[string]string `yaml:"import-mapping"` + ExcludeSchemas []string `yaml:"exclude-schemas"` + ResponseTypeSuffix string `yaml:"response-type-suffix"` + Compatibility codegen.CompatibilityOptions `yaml:"compatibility"` +} + +// noVCSVersionOverride allows overriding the version of the application for cases where no Version Control System (VCS) is available when building, for instance when using a Nix derivation. +// See documentation for how to use it in examples/no-vcs-version-override/README.md +var noVCSVersionOverride string + +func main() { + flag.StringVar(&flagOutputFile, "o", "", "Where to output generated code, stdout is default.") + flag.BoolVar(&flagOldConfigStyle, "old-config-style", false, "Whether to use the older style config file format.") + flag.BoolVar(&flagOutputConfig, "output-config", false, "When true, outputs a configuration file for oapi-codegen using current settings.") + flag.StringVar(&flagConfigFile, "config", "", "A YAML config file that controls oapi-codegen behavior.") + flag.BoolVar(&flagPrintVersion, "version", false, "When specified, print version and exit.") + flag.StringVar(&flagPackageName, "package", "", "The package name for generated code.") + flag.BoolVar(&flagPrintUsage, "help", false, "Show this help and exit.") + flag.BoolVar(&flagPrintUsage, "h", false, "Same as -help.") + + // All flags below are deprecated, and will be removed in a future release. Please do not + // update their behavior. + flag.StringVar(&flagGenerate, "generate", "types,client,server,spec", + `Comma-separated list of code to generate; valid options: "types", "client", "chi-server", "server", "gin", "gorilla", "spec", "skip-fmt", "skip-prune", "fiber", "iris", "std-http".`) + flag.StringVar(&flagIncludeTags, "include-tags", "", "Only include operations with the given tags. Comma-separated list of tags.") + flag.StringVar(&flagExcludeTags, "exclude-tags", "", "Exclude operations that are tagged with the given tags. Comma-separated list of tags.") + flag.StringVar(&flagIncludeOperationIDs, "include-operation-ids", "", "Only include operations with the given operation-ids. Comma-separated list of operation-ids.") + flag.StringVar(&flagExcludeOperationIDs, "exclude-operation-ids", "", "Exclude operations with the given operation-ids. Comma-separated list of operation-ids.") + flag.StringVar(&flagTemplatesDir, "templates", "", "Path to directory containing user templates.") + flag.StringVar(&flagImportMapping, "import-mapping", "", "A dict from the external reference to golang package path.") + flag.StringVar(&flagExcludeSchemas, "exclude-schemas", "", "A comma separated list of schemas which must be excluded from generation.") + flag.StringVar(&flagResponseTypeSuffix, "response-type-suffix", "", "The suffix used for responses types.") + flag.BoolVar(&flagAliasTypes, "alias-types", false, "Alias type declarations if possible.") + flag.BoolVar(&flagInitialismOverrides, "initialism-overrides", false, "Use initialism overrides.") + + flag.Parse() + + if flagPrintUsage { + flag.Usage() + os.Exit(0) + } + + if flagPrintVersion { + bi, ok := debug.ReadBuildInfo() + if !ok { + fmt.Fprintln(os.Stderr, "error reading build info") + os.Exit(1) + } + fmt.Println(bi.Main.Path + "/cmd/oapi-codegen") + version := bi.Main.Version + if len(noVCSVersionOverride) > 0 { + version = noVCSVersionOverride + } + fmt.Println(version) + return + } + + if flag.NArg() < 1 { + errExit("Please specify a path to a OpenAPI 3.0 spec file\n") + } else if flag.NArg() > 1 { + errExit("Only one OpenAPI 3.0 spec file is accepted and it must be the last CLI argument\n") + } + + // We will try to infer whether the user has an old-style config, or a new + // style. Start with the command line argument. If it's true, we know it's + // old config style. + var oldConfigStyle *bool + if flagOldConfigStyle { + oldConfigStyle = &flagOldConfigStyle + } + + // We don't know yet, so keep looking. Try to parse the configuration file, + // if given. + if oldConfigStyle == nil && (flagConfigFile != "") { + configFile, err := os.ReadFile(flagConfigFile) + if err != nil { + errExit("error reading config file '%s': %v\n", flagConfigFile, err) + } + var oldConfig oldConfiguration + oldErr := yaml.UnmarshalStrict(configFile, &oldConfig) + + var newConfig configuration + newErr := yaml.UnmarshalStrict(configFile, &newConfig) + + // If one of the two files parses, but the other fails, we know the + // answer. + if oldErr != nil && newErr == nil { + f := false + oldConfigStyle = &f + } else if oldErr == nil && newErr != nil { + t := true + oldConfigStyle = &t + } else if oldErr != nil && newErr != nil { + errExit("error parsing configuration style as old version or new version\n\nerror when parsing using old config version:\n%v\n\nerror when parsing using new config version:\n%v\n", oldErr, newErr) + } + // Else we fall through, and we still don't know, so we need to infer it from flags. + } + + if oldConfigStyle == nil { + // If any deprecated flag is present, and config file structure is unknown, + // the presence of the deprecated flag means we must be using the old + // config style. It should work correctly if we go down the old path, + // even if we have a simple config file readable as both types. + deprecatedFlagNames := map[string]bool{ + "include-tags": true, + "exclude-tags": true, + "import-mapping": true, + "exclude-schemas": true, + "response-type-suffix": true, + "alias-types": true, + } + hasDeprecatedFlag := false + flag.Visit(func(f *flag.Flag) { + if deprecatedFlagNames[f.Name] { + hasDeprecatedFlag = true + } + }) + if hasDeprecatedFlag { + t := true + oldConfigStyle = &t + } else { + f := false + oldConfigStyle = &f + } + } + + var opts configuration + if !*oldConfigStyle { + // We simply read the configuration from disk. + if flagConfigFile != "" { + buf, err := os.ReadFile(flagConfigFile) + if err != nil { + errExit("error reading config file '%s': %v\n", flagConfigFile, err) + } + err = yaml.Unmarshal(buf, &opts) + if err != nil { + errExit("error parsing'%s' as YAML: %v\n", flagConfigFile, err) + } + } else { + // In the case where no config file is provided, we assume some + // defaults, so that when this is invoked very simply, it's similar + // to old behavior. + opts = configuration{ + Configuration: codegen.Configuration{ + Generate: codegen.GenerateOptions{ + EchoServer: true, + Client: true, + Models: true, + EmbeddedSpec: true, + }, + }, + OutputFile: flagOutputFile, + } + } + + if err := updateConfigFromFlags(&opts); err != nil { + errExit("error processing flags: %v\n", err) + } + } else { + var oldConfig oldConfiguration + if flagConfigFile != "" { + buf, err := os.ReadFile(flagConfigFile) + if err != nil { + errExit("error reading config file '%s': %v\n", flagConfigFile, err) + } + err = yaml.Unmarshal(buf, &oldConfig) + if err != nil { + errExit("error parsing'%s' as YAML: %v\n", flagConfigFile, err) + } + } + var err error + opts, err = newConfigFromOldConfig(oldConfig) + if err != nil { + flag.PrintDefaults() + errExit("error creating new config from old config: %v\n", err) + } + + } + + // Ensure default values are set if user hasn't specified some needed + // fields. + opts.Configuration = opts.UpdateDefaults() + + if err := detectPackageName(&opts); err != nil { + errExit("%s\n", err) + } + + // Now, ensure that the config options are valid. + if err := opts.Validate(); err != nil { + errExit("configuration error: %v\n", err) + } + + if warnings := opts.Generate.Warnings(); len(warnings) > 0 { + out := "WARNING: A number of warning(s) were returned when validating the GenerateOptions:" + for k, v := range warnings { + out += "\n- " + k + ": " + v + } + + _, _ = fmt.Fprint(os.Stderr, out) + } + + // If the user asked to output configuration, output it to stdout and exit + if flagOutputConfig { + buf, err := yaml.Marshal(opts) + if err != nil { + errExit("error YAML marshaling configuration: %v\n", err) + } + fmt.Print(string(buf)) + return + } + + overlayOpts := util.LoadSwaggerWithOverlayOpts{ + Path: opts.OutputOptions.Overlay.Path, + // default to strict, but can be overridden + Strict: true, + } + + if opts.OutputOptions.Overlay.Strict != nil { + overlayOpts.Strict = *opts.OutputOptions.Overlay.Strict + } + + swagger, err := util.LoadSwaggerWithOverlay(flag.Arg(0), overlayOpts) + if err != nil { + errExit("error loading swagger spec in %s\n: %s\n", flag.Arg(0), err) + } + + if strings.HasPrefix(swagger.OpenAPI, "3.1.") { + fmt.Fprintln(os.Stderr, "WARNING: You are using an OpenAPI 3.1.x specification, which is not yet supported by oapi-codegen (https://github.com/oapi-codegen/oapi-codegen/issues/373) and so some functionality may not be available. Until oapi-codegen supports OpenAPI 3.1, it is recommended to downgrade your spec to 3.0.x") + } + + if len(noVCSVersionOverride) > 0 { + opts.NoVCSVersionOverride = &noVCSVersionOverride + } + + code, err := codegen.Generate(swagger, opts.Configuration) + if err != nil { + errExit("error generating code: %s\n", err) + } + + if opts.OutputFile != "" { + err = os.WriteFile(opts.OutputFile, []byte(code), 0o644) + if err != nil { + errExit("error writing generated code to file: %s\n", err) + } + } else { + fmt.Print(code) + } +} + +func loadTemplateOverrides(templatesDir string) (map[string]string, error) { + templates := make(map[string]string) + + if templatesDir == "" { + return templates, nil + } + + files, err := os.ReadDir(templatesDir) + if err != nil { + return nil, err + } + + for _, f := range files { + // Recursively load subdirectory files, using the path relative to the templates + // directory as the key. This allows for overriding the files in the service-specific + // directories (e.g. echo, chi, fiber, etc.). + if f.IsDir() { + subFiles, err := loadTemplateOverrides(path.Join(templatesDir, f.Name())) + if err != nil { + return nil, err + } + for subDir, subFile := range subFiles { + templates[path.Join(f.Name(), subDir)] = subFile + } + continue + } + data, err := os.ReadFile(path.Join(templatesDir, f.Name())) + if err != nil { + return nil, err + } + templates[f.Name()] = string(data) + } + + return templates, nil +} + +// detectPackageName detects and sets PackageName if not already set. +func detectPackageName(cfg *configuration) error { + if cfg.PackageName != "" { + return nil + } + + if cfg.OutputFile != "" { + // Determine from the package name of the output file. + dir := filepath.Dir(cfg.PackageName) + cmd := exec.Command("go", "list", "-f", "{{.Name}}", dir) + out, err := cmd.CombinedOutput() + if err != nil { + outStr := string(out) + switch { + case strings.Contains(outStr, "expected 'package', found 'EOF'"): + // Redirecting the output to current directory which hasn't + // written anything yet, ignore. + case strings.HasPrefix(outStr, "no Go files in"): + // No go files yet, ignore. + default: + // Unexpected failure report. + return fmt.Errorf("detect package name for %q output: %q: %w", dir, string(out), err) + } + } else { + cfg.PackageName = string(out) + return nil + } + } + + // Fallback to determining from the spec file name. + parts := strings.Split(filepath.Base(flag.Arg(0)), ".") + cfg.PackageName = codegen.LowercaseFirstCharacter(codegen.ToCamelCase(parts[0])) + + return nil +} + +// updateConfigFromFlags updates a loaded configuration from flags. Flags +// override anything in the file. We generate errors for any unsupported +// command line flags. +func updateConfigFromFlags(cfg *configuration) error { + if flagPackageName != "" { + cfg.PackageName = flagPackageName + } + + if flagGenerate != "types,client,server,spec" { + // Override generation and output options from generate command line flag. + if err := generationTargets(&cfg.Configuration, util.ParseCommandLineList(flagGenerate)); err != nil { + return err + } + } + if flagIncludeTags != "" { + cfg.OutputOptions.IncludeTags = util.ParseCommandLineList(flagIncludeTags) + } + if flagExcludeTags != "" { + cfg.OutputOptions.ExcludeTags = util.ParseCommandLineList(flagExcludeTags) + } + if flagIncludeOperationIDs != "" { + cfg.OutputOptions.IncludeOperationIDs = util.ParseCommandLineList(flagIncludeOperationIDs) + } + if flagExcludeOperationIDs != "" { + cfg.OutputOptions.ExcludeOperationIDs = util.ParseCommandLineList(flagExcludeOperationIDs) + } + + if flagTemplatesDir != "" { + templates, err := loadTemplateOverrides(flagTemplatesDir) + if err != nil { + return fmt.Errorf("load templates from %q: %w", flagTemplatesDir, err) + } + cfg.OutputOptions.UserTemplates = templates + } + if flagImportMapping != "" { + var err error + cfg.ImportMapping, err = util.ParseCommandlineMap(flagImportMapping) + if err != nil { + return err + } + } + if flagExcludeSchemas != "" { + cfg.OutputOptions.ExcludeSchemas = util.ParseCommandLineList(flagExcludeSchemas) + } + if flagResponseTypeSuffix != "" { + cfg.OutputOptions.ResponseTypeSuffix = flagResponseTypeSuffix + } + if flagAliasTypes { + return fmt.Errorf("--alias-types isn't supported any more") + } + + if cfg.OutputFile == "" { + cfg.OutputFile = flagOutputFile + } + + cfg.OutputOptions.InitialismOverrides = flagInitialismOverrides + + return nil +} + +// updateOldConfigFromFlags parses the flags and the config file. Anything which is +// a zerovalue in the configuration file will be replaced with the flag +// value, this means that the config file overrides flag values. +func updateOldConfigFromFlags(cfg oldConfiguration) oldConfiguration { + if cfg.PackageName == "" { + cfg.PackageName = flagPackageName + } + if cfg.GenerateTargets == nil { + cfg.GenerateTargets = util.ParseCommandLineList(flagGenerate) + } + if cfg.IncludeTags == nil { + cfg.IncludeTags = util.ParseCommandLineList(flagIncludeTags) + } + if cfg.ExcludeTags == nil { + cfg.ExcludeTags = util.ParseCommandLineList(flagExcludeTags) + } + if cfg.TemplatesDir == "" { + cfg.TemplatesDir = flagTemplatesDir + } + if cfg.ImportMapping == nil && flagImportMapping != "" { + var err error + cfg.ImportMapping, err = util.ParseCommandlineMap(flagImportMapping) + if err != nil { + errExit("error parsing import-mapping: %s\n", err) + } + } + if cfg.ExcludeSchemas == nil { + cfg.ExcludeSchemas = util.ParseCommandLineList(flagExcludeSchemas) + } + if cfg.OutputFile == "" { + cfg.OutputFile = flagOutputFile + } + return cfg +} + +// generationTargets sets cfg options based on the generation targets. +func generationTargets(cfg *codegen.Configuration, targets []string) error { + opts := codegen.GenerateOptions{} // Blank to start with. + for _, opt := range targets { + switch opt { + case "iris", "iris-server": + opts.IrisServer = true + case "chi-server", "chi": + opts.ChiServer = true + case "fiber-server", "fiber": + opts.FiberServer = true + case "server", "echo-server", "echo": + opts.EchoServer = true + case "gin", "gin-server": + opts.GinServer = true + case "gorilla", "gorilla-server": + opts.GorillaServer = true + case "std-http", "std-http-server": + opts.StdHTTPServer = true + case "strict-server": + opts.Strict = true + case "client": + opts.Client = true + case "types", "models": + opts.Models = true + case "spec", "embedded-spec": + opts.EmbeddedSpec = true + case "skip-fmt": + cfg.OutputOptions.SkipFmt = true + case "skip-prune": + cfg.OutputOptions.SkipPrune = true + default: + return fmt.Errorf("unknown generate option %q", opt) + } + } + cfg.Generate = opts + + return nil +} + +func newConfigFromOldConfig(c oldConfiguration) (configuration, error) { + // Take flags into account. + cfg := updateOldConfigFromFlags(c) + + // Now, copy over field by field, translating flags and old values as + // necessary. + opts := codegen.Configuration{ + PackageName: cfg.PackageName, + } + opts.OutputOptions.ResponseTypeSuffix = flagResponseTypeSuffix + + if err := generationTargets(&opts, cfg.GenerateTargets); err != nil { + return configuration{}, fmt.Errorf("generation targets: %w", err) + } + + opts.OutputOptions.IncludeTags = cfg.IncludeTags + opts.OutputOptions.ExcludeTags = cfg.ExcludeTags + opts.OutputOptions.ExcludeSchemas = cfg.ExcludeSchemas + + templates, err := loadTemplateOverrides(cfg.TemplatesDir) + if err != nil { + return configuration{}, fmt.Errorf("loading template overrides: %w", err) + } + opts.OutputOptions.UserTemplates = templates + + opts.ImportMapping = cfg.ImportMapping + + opts.Compatibility = cfg.Compatibility + + return configuration{ + Configuration: opts, + OutputFile: cfg.OutputFile, + }, nil +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/codegen.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/codegen.go new file mode 100644 index 0000000000..facddb914d --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/codegen.go @@ -0,0 +1,1204 @@ +// Copyright 2019 DeepMap, Inc. +// +// 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. + +package codegen + +import ( + "bufio" + "bytes" + "context" + "embed" + "fmt" + "io" + "io/fs" + "net/http" + "os" + "runtime/debug" + "sort" + "strings" + "text/template" + "time" + + "github.com/getkin/kin-openapi/openapi3" + "golang.org/x/tools/imports" + + "github.com/oapi-codegen/oapi-codegen/v2/pkg/util" +) + +// Embed the templates directory +// +//go:embed templates +var templates embed.FS + +// globalState stores all global state. Please don't put global state anywhere +// else so that we can easily track it. +var globalState struct { + options Configuration + spec *openapi3.T + importMapping importMap + // initialismsMap stores initialisms as "lower(initialism) -> initialism" map. + // List of initialisms was taken from https://staticcheck.io/docs/configuration/options/#initialisms. + initialismsMap map[string]string +} + +// goImport represents a go package to be imported in the generated code +type goImport struct { + Name string // package name + Path string // package path +} + +// String returns a go import statement +func (gi goImport) String() string { + if gi.Name != "" { + return fmt.Sprintf("%s %q", gi.Name, gi.Path) + } + return fmt.Sprintf("%q", gi.Path) +} + +// importMap maps external OpenAPI specifications files/urls to external go packages +type importMap map[string]goImport + +// importMappingCurrentPackage allows an Import Mapping to map to the current package, rather than an external package. +// This allows users to split their OpenAPI specification across multiple files, but keep them in the same package, which can reduce a bit of the overhead for users. +// We use `-` to indicate that this is a bit of a special case +const importMappingCurrentPackage = "-" + +// GoImports returns a slice of go import statements +func (im importMap) GoImports() []string { + goImports := make([]string, 0, len(im)) + for _, v := range im { + if v.Path == importMappingCurrentPackage { + continue + } + goImports = append(goImports, v.String()) + } + return goImports +} + +func constructImportMapping(importMapping map[string]string) importMap { + var ( + pathToName = map[string]string{} + result = importMap{} + ) + + { + var packagePaths []string + for _, packageName := range importMapping { + packagePaths = append(packagePaths, packageName) + } + sort.Strings(packagePaths) + + for _, packagePath := range packagePaths { + if _, ok := pathToName[packagePath]; !ok && packagePath != importMappingCurrentPackage { + pathToName[packagePath] = fmt.Sprintf("externalRef%d", len(pathToName)) + } + } + } + for specPath, packagePath := range importMapping { + result[specPath] = goImport{Name: pathToName[packagePath], Path: packagePath} + } + return result +} + +// Generate uses the Go templating engine to generate all of our server wrappers from +// the descriptions we've built up above from the schema objects. +// opts defines +func Generate(spec *openapi3.T, opts Configuration) (string, error) { + // This is global state + globalState.options = opts + globalState.spec = spec + globalState.importMapping = constructImportMapping(opts.ImportMapping) + + filterOperationsByTag(spec, opts) + filterOperationsByOperationID(spec, opts) + if !opts.OutputOptions.SkipPrune { + pruneUnusedComponents(spec) + } + + // if we are provided an override for the response type suffix update it + if opts.OutputOptions.ResponseTypeSuffix != "" { + responseTypeSuffix = opts.OutputOptions.ResponseTypeSuffix + } + + if globalState.options.OutputOptions.ClientTypeName == "" { + globalState.options.OutputOptions.ClientTypeName = defaultClientTypeName + } + + nameNormalizerFunction := NameNormalizerFunction(opts.OutputOptions.NameNormalizer) + nameNormalizer = NameNormalizers[nameNormalizerFunction] + if nameNormalizer == nil { + return "", fmt.Errorf(`the name-normalizer option %v could not be found among options %q`, + opts.OutputOptions.NameNormalizer, NameNormalizers.Options()) + } + + if nameNormalizerFunction != NameNormalizerFunctionToCamelCaseWithInitialisms && len(opts.OutputOptions.AdditionalInitialisms) > 0 { + return "", fmt.Errorf("you have specified `additional-initialisms`, but the `name-normalizer` is not set to `ToCamelCaseWithInitialisms`. Please specify `name-normalizer: ToCamelCaseWithInitialisms` or remove the `additional-initialisms` configuration") + } + + globalState.initialismsMap = makeInitialismsMap(opts.OutputOptions.AdditionalInitialisms) + + // This creates the golang templates text package + TemplateFunctions["opts"] = func() Configuration { return globalState.options } + t := template.New("oapi-codegen").Funcs(TemplateFunctions) + // This parses all of our own template files into the template object + // above + err := LoadTemplates(templates, t) + if err != nil { + return "", fmt.Errorf("error parsing oapi-codegen templates: %w", err) + } + + // load user-provided templates. Will Override built-in versions. + for name, template := range opts.OutputOptions.UserTemplates { + utpl := t.New(name) + + txt, err := GetUserTemplateText(template) + if err != nil { + return "", fmt.Errorf("error loading user-provided template %q: %w", name, err) + } + + _, err = utpl.Parse(txt) + if err != nil { + return "", fmt.Errorf("error parsing user-provided template %q: %w", name, err) + } + } + + ops, err := OperationDefinitions(spec, opts.OutputOptions.InitialismOverrides) + if err != nil { + return "", fmt.Errorf("error creating operation definitions: %w", err) + } + + xGoTypeImports, err := OperationImports(ops) + if err != nil { + return "", fmt.Errorf("error getting operation imports: %w", err) + } + + var typeDefinitions, constantDefinitions string + if opts.Generate.Models { + typeDefinitions, err = GenerateTypeDefinitions(t, spec, ops, opts.OutputOptions.ExcludeSchemas) + if err != nil { + return "", fmt.Errorf("error generating type definitions: %w", err) + } + + constantDefinitions, err = GenerateConstants(t, ops) + if err != nil { + return "", fmt.Errorf("error generating constants: %w", err) + } + + imprts, err := GetTypeDefinitionsImports(spec, opts.OutputOptions.ExcludeSchemas) + if err != nil { + return "", fmt.Errorf("error getting type definition imports: %w", err) + } + MergeImports(xGoTypeImports, imprts) + } + + var irisServerOut string + if opts.Generate.IrisServer { + irisServerOut, err = GenerateIrisServer(t, ops) + if err != nil { + return "", fmt.Errorf("error generating Go handlers for Paths: %w", err) + } + } + + var echoServerOut string + if opts.Generate.EchoServer { + echoServerOut, err = GenerateEchoServer(t, ops) + if err != nil { + return "", fmt.Errorf("error generating Go handlers for Paths: %w", err) + } + } + + var chiServerOut string + if opts.Generate.ChiServer { + chiServerOut, err = GenerateChiServer(t, ops) + if err != nil { + return "", fmt.Errorf("error generating Go handlers for Paths: %w", err) + } + } + + var fiberServerOut string + if opts.Generate.FiberServer { + fiberServerOut, err = GenerateFiberServer(t, ops) + if err != nil { + return "", fmt.Errorf("error generating Go handlers for Paths: %w", err) + } + } + + var ginServerOut string + if opts.Generate.GinServer { + ginServerOut, err = GenerateGinServer(t, ops) + if err != nil { + return "", fmt.Errorf("error generating Go handlers for Paths: %w", err) + } + } + + var gorillaServerOut string + if opts.Generate.GorillaServer { + gorillaServerOut, err = GenerateGorillaServer(t, ops) + if err != nil { + return "", fmt.Errorf("error generating Go handlers for Paths: %w", err) + } + } + + var stdHTTPServerOut string + if opts.Generate.StdHTTPServer { + stdHTTPServerOut, err = GenerateStdHTTPServer(t, ops) + if err != nil { + return "", fmt.Errorf("error generating Go handlers for Paths: %w", err) + } + } + + var strictServerOut string + if opts.Generate.Strict { + var responses []ResponseDefinition + if spec.Components != nil { + responses, err = GenerateResponseDefinitions("", spec.Components.Responses) + if err != nil { + return "", fmt.Errorf("error generation response definitions for schema: %w", err) + } + } + strictServerResponses, err := GenerateStrictResponses(t, responses) + if err != nil { + return "", fmt.Errorf("error generation response definitions for schema: %w", err) + } + strictServerOut, err = GenerateStrictServer(t, ops, opts) + if err != nil { + return "", fmt.Errorf("error generating Go handlers for Paths: %w", err) + } + strictServerOut = strictServerResponses + strictServerOut + } + + var clientOut string + if opts.Generate.Client { + clientOut, err = GenerateClient(t, ops) + if err != nil { + return "", fmt.Errorf("error generating client: %w", err) + } + } + + var clientWithResponsesOut string + if opts.Generate.Client { + clientWithResponsesOut, err = GenerateClientWithResponses(t, ops) + if err != nil { + return "", fmt.Errorf("error generating client with responses: %w", err) + } + } + + var inlinedSpec string + if opts.Generate.EmbeddedSpec { + inlinedSpec, err = GenerateInlinedSpec(t, globalState.importMapping, spec) + if err != nil { + return "", fmt.Errorf("error generating Go handlers for Paths: %w", err) + } + } + + var buf bytes.Buffer + w := bufio.NewWriter(&buf) + + externalImports := append(globalState.importMapping.GoImports(), importMap(xGoTypeImports).GoImports()...) + importsOut, err := GenerateImports( + t, + externalImports, + opts.PackageName, + opts.NoVCSVersionOverride, + ) + if err != nil { + return "", fmt.Errorf("error generating imports: %w", err) + } + + _, err = w.WriteString(importsOut) + if err != nil { + return "", fmt.Errorf("error writing imports: %w", err) + } + + _, err = w.WriteString(constantDefinitions) + if err != nil { + return "", fmt.Errorf("error writing constants: %w", err) + } + + _, err = w.WriteString(typeDefinitions) + if err != nil { + return "", fmt.Errorf("error writing type definitions: %w", err) + } + + if opts.Generate.Client { + _, err = w.WriteString(clientOut) + if err != nil { + return "", fmt.Errorf("error writing client: %w", err) + } + _, err = w.WriteString(clientWithResponsesOut) + if err != nil { + return "", fmt.Errorf("error writing client: %w", err) + } + } + + if opts.Generate.IrisServer { + _, err = w.WriteString(irisServerOut) + if err != nil { + return "", fmt.Errorf("error writing server path handlers: %w", err) + } + + } + + if opts.Generate.EchoServer { + _, err = w.WriteString(echoServerOut) + if err != nil { + return "", fmt.Errorf("error writing server path handlers: %w", err) + } + } + + if opts.Generate.ChiServer { + _, err = w.WriteString(chiServerOut) + if err != nil { + return "", fmt.Errorf("error writing server path handlers: %w", err) + } + } + + if opts.Generate.FiberServer { + _, err = w.WriteString(fiberServerOut) + if err != nil { + return "", fmt.Errorf("error writing server path handlers: %w", err) + } + } + + if opts.Generate.GinServer { + _, err = w.WriteString(ginServerOut) + if err != nil { + return "", fmt.Errorf("error writing server path handlers: %w", err) + } + } + + if opts.Generate.GorillaServer { + _, err = w.WriteString(gorillaServerOut) + if err != nil { + return "", fmt.Errorf("error writing server path handlers: %w", err) + } + } + + if opts.Generate.StdHTTPServer { + _, err = w.WriteString(stdHTTPServerOut) + if err != nil { + return "", fmt.Errorf("error writing server path handlers: %w", err) + } + } + + if opts.Generate.Strict { + _, err = w.WriteString(strictServerOut) + if err != nil { + return "", fmt.Errorf("error writing server path handlers: %w", err) + } + } + + if opts.Generate.EmbeddedSpec { + _, err = w.WriteString(inlinedSpec) + if err != nil { + return "", fmt.Errorf("error writing inlined spec: %w", err) + } + } + + err = w.Flush() + if err != nil { + return "", fmt.Errorf("error flushing output buffer: %w", err) + } + + // remove any byte-order-marks which break Go-Code + goCode := SanitizeCode(buf.String()) + + // The generation code produces unindented horrors. Use the Go Imports + // to make it all pretty. + if opts.OutputOptions.SkipFmt { + return goCode, nil + } + + outBytes, err := imports.Process(opts.PackageName+".go", []byte(goCode), nil) + if err != nil { + return "", fmt.Errorf("error formatting Go code %s: %w", goCode, err) + } + return string(outBytes), nil +} + +func GenerateTypeDefinitions(t *template.Template, swagger *openapi3.T, ops []OperationDefinition, excludeSchemas []string) (string, error) { + var allTypes []TypeDefinition + if swagger.Components != nil { + schemaTypes, err := GenerateTypesForSchemas(t, swagger.Components.Schemas, excludeSchemas) + if err != nil { + return "", fmt.Errorf("error generating Go types for component schemas: %w", err) + } + + paramTypes, err := GenerateTypesForParameters(t, swagger.Components.Parameters) + if err != nil { + return "", fmt.Errorf("error generating Go types for component parameters: %w", err) + } + allTypes = append(schemaTypes, paramTypes...) + + responseTypes, err := GenerateTypesForResponses(t, swagger.Components.Responses) + if err != nil { + return "", fmt.Errorf("error generating Go types for component responses: %w", err) + } + allTypes = append(allTypes, responseTypes...) + + bodyTypes, err := GenerateTypesForRequestBodies(t, swagger.Components.RequestBodies) + if err != nil { + return "", fmt.Errorf("error generating Go types for component request bodies: %w", err) + } + allTypes = append(allTypes, bodyTypes...) + } + + // Go through all operations, and add their types to allTypes, so that we can + // scan all of them for enums. Operation definitions are handled differently + // from the rest, so let's keep track of enumTypes separately, which will contain + // all types needed to be scanned for enums, which includes those within operations. + enumTypes := allTypes + for _, op := range ops { + enumTypes = append(enumTypes, op.TypeDefinitions...) + } + + operationsOut, err := GenerateTypesForOperations(t, ops) + if err != nil { + return "", fmt.Errorf("error generating Go types for component request bodies: %w", err) + } + + enumsOut, err := GenerateEnums(t, enumTypes) + if err != nil { + return "", fmt.Errorf("error generating code for type enums: %w", err) + } + + typesOut, err := GenerateTypes(t, allTypes) + if err != nil { + return "", fmt.Errorf("error generating code for type definitions: %w", err) + } + + allOfBoilerplate, err := GenerateAdditionalPropertyBoilerplate(t, allTypes) + if err != nil { + return "", fmt.Errorf("error generating allOf boilerplate: %w", err) + } + + unionBoilerplate, err := GenerateUnionBoilerplate(t, allTypes) + if err != nil { + return "", fmt.Errorf("error generating union boilerplate: %w", err) + } + + unionAndAdditionalBoilerplate, err := GenerateUnionAndAdditionalProopertiesBoilerplate(t, allTypes) + if err != nil { + return "", fmt.Errorf("error generating boilerplate for union types with additionalProperties: %w", err) + } + + typeDefinitions := strings.Join([]string{enumsOut, typesOut, operationsOut, allOfBoilerplate, unionBoilerplate, unionAndAdditionalBoilerplate}, "") + return typeDefinitions, nil +} + +// GenerateConstants generates operation ids, context keys, paths, etc. to be exported as constants +func GenerateConstants(t *template.Template, ops []OperationDefinition) (string, error) { + constants := Constants{ + SecuritySchemeProviderNames: []string{}, + } + + providerNameMap := map[string]struct{}{} + for _, op := range ops { + for _, def := range op.SecurityDefinitions { + providerName := SanitizeGoIdentity(def.ProviderName) + providerNameMap[providerName] = struct{}{} + } + } + + var providerNames []string + for providerName := range providerNameMap { + providerNames = append(providerNames, providerName) + } + + sort.Strings(providerNames) + + constants.SecuritySchemeProviderNames = append(constants.SecuritySchemeProviderNames, providerNames...) + + return GenerateTemplates([]string{"constants.tmpl"}, t, constants) +} + +// GenerateTypesForSchemas generates type definitions for any custom types defined in the +// components/schemas section of the Swagger spec. +func GenerateTypesForSchemas(t *template.Template, schemas map[string]*openapi3.SchemaRef, excludeSchemas []string) ([]TypeDefinition, error) { + excludeSchemasMap := make(map[string]bool) + for _, schema := range excludeSchemas { + excludeSchemasMap[schema] = true + } + types := make([]TypeDefinition, 0) + // We're going to define Go types for every object under components/schemas + for _, schemaName := range SortedSchemaKeys(schemas) { + if _, ok := excludeSchemasMap[schemaName]; ok { + continue + } + schemaRef := schemas[schemaName] + + goSchema, err := GenerateGoSchema(schemaRef, []string{schemaName}) + if err != nil { + return nil, fmt.Errorf("error converting Schema %s to Go type: %w", schemaName, err) + } + + goTypeName, err := renameSchema(schemaName, schemaRef) + if err != nil { + return nil, fmt.Errorf("error making name for components/schemas/%s: %w", schemaName, err) + } + + types = append(types, TypeDefinition{ + JsonName: schemaName, + TypeName: goTypeName, + Schema: goSchema, + }) + + types = append(types, goSchema.AdditionalTypes...) + } + return types, nil +} + +// GenerateTypesForParameters generates type definitions for any custom types defined in the +// components/parameters section of the Swagger spec. +func GenerateTypesForParameters(t *template.Template, params map[string]*openapi3.ParameterRef) ([]TypeDefinition, error) { + var types []TypeDefinition + for _, paramName := range SortedMapKeys(params) { + paramOrRef := params[paramName] + + goType, err := paramToGoType(paramOrRef.Value, nil) + if err != nil { + return nil, fmt.Errorf("error generating Go type for schema in parameter %s: %w", paramName, err) + } + + goTypeName, err := renameParameter(paramName, paramOrRef) + if err != nil { + return nil, fmt.Errorf("error making name for components/parameters/%s: %w", paramName, err) + } + + typeDef := TypeDefinition{ + JsonName: paramName, + Schema: goType, + TypeName: goTypeName, + } + + if paramOrRef.Ref != "" { + // Generate a reference type for referenced parameters + refType, err := RefPathToGoType(paramOrRef.Ref) + if err != nil { + return nil, fmt.Errorf("error generating Go type for (%s) in parameter %s: %w", paramOrRef.Ref, paramName, err) + } + typeDef.TypeName = SchemaNameToTypeName(refType) + } + + types = append(types, typeDef) + } + return types, nil +} + +// GenerateTypesForResponses generates type definitions for any custom types defined in the +// components/responses section of the Swagger spec. +func GenerateTypesForResponses(t *template.Template, responses openapi3.ResponseBodies) ([]TypeDefinition, error) { + var types []TypeDefinition + + for _, responseName := range SortedMapKeys(responses) { + responseOrRef := responses[responseName] + + // We have to generate the response object. We're only going to + // handle media types that conform to JSON. Other responses should + // simply be specified as strings or byte arrays. + response := responseOrRef.Value + + jsonCount := 0 + for mediaType := range response.Content { + if util.IsMediaTypeJson(mediaType) { + jsonCount++ + } + } + + SortedMapKeys := SortedMapKeys(response.Content) + for _, mediaType := range SortedMapKeys { + response := response.Content[mediaType] + if !util.IsMediaTypeJson(mediaType) { + continue + } + + goType, err := GenerateGoSchema(response.Schema, []string{responseName}) + if err != nil { + return nil, fmt.Errorf("error generating Go type for schema in response %s: %w", responseName, err) + } + + goTypeName, err := renameResponse(responseName, responseOrRef) + if err != nil { + return nil, fmt.Errorf("error making name for components/responses/%s: %w", responseName, err) + } + + typeDef := TypeDefinition{ + JsonName: responseName, + Schema: goType, + TypeName: goTypeName, + } + + if responseOrRef.Ref != "" { + // Generate a reference type for referenced parameters + refType, err := RefPathToGoType(responseOrRef.Ref) + if err != nil { + return nil, fmt.Errorf("error generating Go type for (%s) in parameter %s: %w", responseOrRef.Ref, responseName, err) + } + typeDef.TypeName = SchemaNameToTypeName(refType) + } + + if jsonCount > 1 { + typeDef.TypeName = typeDef.TypeName + mediaTypeToCamelCase(mediaType) + } + + types = append(types, typeDef) + } + } + return types, nil +} + +// GenerateTypesForRequestBodies generates type definitions for any custom types defined in the +// components/requestBodies section of the Swagger spec. +func GenerateTypesForRequestBodies(t *template.Template, bodies map[string]*openapi3.RequestBodyRef) ([]TypeDefinition, error) { + var types []TypeDefinition + + for _, requestBodyName := range SortedMapKeys(bodies) { + requestBodyRef := bodies[requestBodyName] + + // As for responses, we will only generate Go code for JSON bodies, + // the other body formats are up to the user. + response := requestBodyRef.Value + for mediaType, body := range response.Content { + if !util.IsMediaTypeJson(mediaType) { + continue + } + + goType, err := GenerateGoSchema(body.Schema, []string{requestBodyName}) + if err != nil { + return nil, fmt.Errorf("error generating Go type for schema in body %s: %w", requestBodyName, err) + } + + goTypeName, err := renameRequestBody(requestBodyName, requestBodyRef) + if err != nil { + return nil, fmt.Errorf("error making name for components/schemas/%s: %w", requestBodyName, err) + } + + typeDef := TypeDefinition{ + JsonName: requestBodyName, + Schema: goType, + TypeName: goTypeName, + } + + if requestBodyRef.Ref != "" { + // Generate a reference type for referenced bodies + refType, err := RefPathToGoType(requestBodyRef.Ref) + if err != nil { + return nil, fmt.Errorf("error generating Go type for (%s) in body %s: %w", requestBodyRef.Ref, requestBodyName, err) + } + typeDef.TypeName = SchemaNameToTypeName(refType) + } + types = append(types, typeDef) + } + } + return types, nil +} + +// GenerateTypes passes a bunch of types to the template engine, and buffers +// its output into a string. +func GenerateTypes(t *template.Template, types []TypeDefinition) (string, error) { + m := map[string]TypeDefinition{} + var ts []TypeDefinition + + for _, typ := range types { + if prevType, found := m[typ.TypeName]; found { + // If type names collide, we need to see if they refer to the same + // exact type definition, in which case, we can de-dupe. If they don't + // match, we error out. + if TypeDefinitionsEquivalent(prevType, typ) { + continue + } + // We want to create an error when we try to define the same type twice. + return "", fmt.Errorf("duplicate typename '%s' detected, can't auto-rename, "+ + "please use x-go-name to specify your own name for one of them", typ.TypeName) + } + + m[typ.TypeName] = typ + + ts = append(ts, typ) + } + + context := struct { + Types []TypeDefinition + }{ + Types: ts, + } + + return GenerateTemplates([]string{"typedef.tmpl"}, t, context) +} + +func GenerateEnums(t *template.Template, types []TypeDefinition) (string, error) { + enums := []EnumDefinition{} + + // Keep track of which enums we've generated + m := map[string]bool{} + + // These are all types defined globally + for _, tp := range types { + if found := m[tp.TypeName]; found { + continue + } + + m[tp.TypeName] = true + + if len(tp.Schema.EnumValues) > 0 { + wrapper := "" + if tp.Schema.GoType == "string" { + wrapper = `"` + } + enums = append(enums, EnumDefinition{ + Schema: tp.Schema, + TypeName: tp.TypeName, + ValueWrapper: wrapper, + PrefixTypeName: globalState.options.Compatibility.AlwaysPrefixEnumValues, + }) + } + } + + // Now, go through all the enums, and figure out if we have conflicts with + // any others. + for i := range enums { + // Look through all other enums not compared so far. Make sure we don't + // compare against self. + e1 := enums[i] + for j := i + 1; j < len(enums); j++ { + e2 := enums[j] + + for e1key := range e1.GetValues() { + _, found := e2.GetValues()[e1key] + if found { + e1.PrefixTypeName = true + e2.PrefixTypeName = true + enums[i] = e1 + enums[j] = e2 + break + } + } + } + + // now see if this enum conflicts with any global type names. + for _, tp := range types { + // Skip over enums, since we've handled those above. + if len(tp.Schema.EnumValues) > 0 { + continue + } + _, found := e1.Schema.EnumValues[tp.TypeName] + if found { + e1.PrefixTypeName = true + enums[i] = e1 + } + } + + // Another edge case is that an enum value can conflict with its own + // type name. + _, found := e1.GetValues()[e1.TypeName] + if found { + e1.PrefixTypeName = true + enums[i] = e1 + } + } + + // Now see if enums conflict with any non-enum typenames + + return GenerateTemplates([]string{"constants.tmpl"}, t, Constants{EnumDefinitions: enums}) +} + +// GenerateImports generates our import statements and package definition. +func GenerateImports(t *template.Template, externalImports []string, packageName string, versionOverride *string) (string, error) { + // Read build version for incorporating into generated files + // Unit tests have ok=false, so we'll just use "unknown" for the + // version if we can't read this. + + modulePath := "unknown module path" + moduleVersion := "unknown version" + if bi, ok := debug.ReadBuildInfo(); ok { + if bi.Main.Path != "" { + modulePath = bi.Main.Path + } + if bi.Main.Version != "" { + moduleVersion = bi.Main.Version + } + if versionOverride != nil { + moduleVersion = *versionOverride + } + } + + context := struct { + ExternalImports []string + PackageName string + ModuleName string + Version string + AdditionalImports []AdditionalImport + }{ + ExternalImports: externalImports, + PackageName: packageName, + ModuleName: modulePath, + Version: moduleVersion, + AdditionalImports: globalState.options.AdditionalImports, + } + + return GenerateTemplates([]string{"imports.tmpl"}, t, context) +} + +// GenerateAdditionalPropertyBoilerplate generates all the glue code which provides +// the API for interacting with additional properties and JSON-ification +func GenerateAdditionalPropertyBoilerplate(t *template.Template, typeDefs []TypeDefinition) (string, error) { + var filteredTypes []TypeDefinition + + m := map[string]bool{} + + for _, t := range typeDefs { + if found := m[t.TypeName]; found { + continue + } + + m[t.TypeName] = true + + if t.Schema.HasAdditionalProperties { + filteredTypes = append(filteredTypes, t) + } + } + + context := struct { + Types []TypeDefinition + }{ + Types: filteredTypes, + } + + return GenerateTemplates([]string{"additional-properties.tmpl"}, t, context) +} + +func GenerateUnionBoilerplate(t *template.Template, typeDefs []TypeDefinition) (string, error) { + var filteredTypes []TypeDefinition + for _, t := range typeDefs { + if len(t.Schema.UnionElements) != 0 { + filteredTypes = append(filteredTypes, t) + } + } + + if len(filteredTypes) == 0 { + return "", nil + } + + context := struct { + Types []TypeDefinition + }{ + Types: filteredTypes, + } + + return GenerateTemplates([]string{"union.tmpl"}, t, context) +} + +func GenerateUnionAndAdditionalProopertiesBoilerplate(t *template.Template, typeDefs []TypeDefinition) (string, error) { + var filteredTypes []TypeDefinition + for _, t := range typeDefs { + if len(t.Schema.UnionElements) != 0 && t.Schema.HasAdditionalProperties { + filteredTypes = append(filteredTypes, t) + } + } + + if len(filteredTypes) == 0 { + return "", nil + } + context := struct { + Types []TypeDefinition + }{ + Types: filteredTypes, + } + + return GenerateTemplates([]string{"union-and-additional-properties.tmpl"}, t, context) +} + +// SanitizeCode runs sanitizers across the generated Go code to ensure the +// generated code will be able to compile. +func SanitizeCode(goCode string) string { + // remove any byte-order-marks which break Go-Code + // See: https://groups.google.com/forum/#!topic/golang-nuts/OToNIPdfkks + return strings.ReplaceAll(goCode, "\uFEFF", "") +} + +// GetUserTemplateText attempts to retrieve the template text from a passed in URL or file +// path when inputData is more than one line. +// This function will attempt to load a file first, and if it fails, will try to get the +// data from the remote endpoint. +// The timeout for remote download file is 30 seconds. +func GetUserTemplateText(inputData string) (template string, err error) { + // if the input data is more than one line, assume its a template and return that data. + if strings.Contains(inputData, "\n") { + return inputData, nil + } + + // load data from file + data, err := os.ReadFile(inputData) + // return data if found and loaded + if err == nil { + return string(data), nil + } + + // check for non "not found" errors + if !os.IsNotExist(err) { + return "", fmt.Errorf("failed to open file %s: %w", inputData, err) + } + + // attempt to get data from url with timeout + const downloadTimeout = 30 * time.Second + ctx, cancel := context.WithTimeout(context.Background(), downloadTimeout) + defer cancel() + + req, err := http.NewRequestWithContext(ctx, http.MethodGet, inputData, http.NoBody) + if err != nil { + return "", fmt.Errorf("failed to create request GET %s: %w", inputData, err) + } + resp, err := http.DefaultClient.Do(req) + if err != nil { + return "", fmt.Errorf("failed to execute GET request data from %s: %w", inputData, err) + } + if resp != nil { + defer func() { + _ = resp.Body.Close() + }() + } + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + return "", fmt.Errorf("got non %d status code on GET %s", resp.StatusCode, inputData) + } + data, err = io.ReadAll(resp.Body) + if err != nil { + return "", fmt.Errorf("failed to read response body from GET %s: %w", inputData, err) + } + + return string(data), nil +} + +// LoadTemplates loads all of our template files into a text/template. The +// path of template is relative to the templates directory. +func LoadTemplates(src embed.FS, t *template.Template) error { + return fs.WalkDir(src, "templates", func(path string, d fs.DirEntry, err error) error { + if err != nil { + return fmt.Errorf("error walking directory %s: %w", path, err) + } + if d.IsDir() { + return nil + } + + buf, err := src.ReadFile(path) + if err != nil { + return fmt.Errorf("error reading file '%s': %w", path, err) + } + + templateName := strings.TrimPrefix(path, "templates/") + tmpl := t.New(templateName) + _, err = tmpl.Parse(string(buf)) + if err != nil { + return fmt.Errorf("parsing template '%s': %w", path, err) + } + return nil + }) +} + +func OperationSchemaImports(s *Schema) (map[string]goImport, error) { + res := map[string]goImport{} + + for _, p := range s.Properties { + imprts, err := GoSchemaImports(&openapi3.SchemaRef{Value: p.Schema.OAPISchema}) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + + imprts, err := GoSchemaImports(&openapi3.SchemaRef{Value: s.OAPISchema}) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + return res, nil +} + +func OperationImports(ops []OperationDefinition) (map[string]goImport, error) { + res := map[string]goImport{} + for _, op := range ops { + for _, pd := range [][]ParameterDefinition{op.PathParams, op.QueryParams} { + for _, p := range pd { + imprts, err := OperationSchemaImports(&p.Schema) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + } + + for _, b := range op.Bodies { + imprts, err := OperationSchemaImports(&b.Schema) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + + for _, b := range op.Responses { + for _, c := range b.Contents { + imprts, err := OperationSchemaImports(&c.Schema) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + } + + } + return res, nil +} + +func GetTypeDefinitionsImports(swagger *openapi3.T, excludeSchemas []string) (map[string]goImport, error) { + res := map[string]goImport{} + if swagger.Components == nil { + return res, nil + } + + schemaImports, err := GetSchemaImports(swagger.Components.Schemas, excludeSchemas) + if err != nil { + return nil, err + } + + reqBodiesImports, err := GetRequestBodiesImports(swagger.Components.RequestBodies) + if err != nil { + return nil, err + } + + responsesImports, err := GetResponsesImports(swagger.Components.Responses) + if err != nil { + return nil, err + } + + parametersImports, err := GetParametersImports(swagger.Components.Parameters) + if err != nil { + return nil, err + } + + for _, imprts := range []map[string]goImport{schemaImports, reqBodiesImports, responsesImports, parametersImports} { + MergeImports(res, imprts) + } + return res, nil +} + +func GoSchemaImports(schemas ...*openapi3.SchemaRef) (map[string]goImport, error) { + res := map[string]goImport{} + for _, sref := range schemas { + if sref == nil || sref.Value == nil || IsGoTypeReference(sref.Ref) { + return nil, nil + } + if gi, err := ParseGoImportExtension(sref); err != nil { + return nil, err + } else { + if gi != nil { + res[gi.String()] = *gi + } + } + schemaVal := sref.Value + + t := schemaVal.Type + if t.Slice() == nil || t.Is("object") { + for _, v := range schemaVal.Properties { + imprts, err := GoSchemaImports(v) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + } else if t.Is("array") { + imprts, err := GoSchemaImports(schemaVal.Items) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + } + return res, nil +} + +func GetSchemaImports(schemas map[string]*openapi3.SchemaRef, excludeSchemas []string) (map[string]goImport, error) { + res := map[string]goImport{} + excludeSchemasMap := make(map[string]bool) + for _, schema := range excludeSchemas { + excludeSchemasMap[schema] = true + } + for schemaName, schema := range schemas { + if _, ok := excludeSchemasMap[schemaName]; ok { + continue + } + + imprts, err := GoSchemaImports(schema) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + return res, nil +} + +func GetRequestBodiesImports(bodies map[string]*openapi3.RequestBodyRef) (map[string]goImport, error) { + res := map[string]goImport{} + for _, r := range bodies { + response := r.Value + for mediaType, body := range response.Content { + if !util.IsMediaTypeJson(mediaType) { + continue + } + + imprts, err := GoSchemaImports(body.Schema) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + } + return res, nil +} + +func GetResponsesImports(responses map[string]*openapi3.ResponseRef) (map[string]goImport, error) { + res := map[string]goImport{} + for _, r := range responses { + response := r.Value + for mediaType, body := range response.Content { + if !util.IsMediaTypeJson(mediaType) { + continue + } + + imprts, err := GoSchemaImports(body.Schema) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + } + return res, nil +} + +func GetParametersImports(params map[string]*openapi3.ParameterRef) (map[string]goImport, error) { + res := map[string]goImport{} + for _, param := range params { + if param.Value == nil { + continue + } + imprts, err := GoSchemaImports(param.Value.Schema) + if err != nil { + return nil, err + } + MergeImports(res, imprts) + } + return res, nil +} + +func SetGlobalStateSpec(spec *openapi3.T) { + globalState.spec = spec +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/configuration.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/configuration.go new file mode 100644 index 0000000000..5608e227cd --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/configuration.go @@ -0,0 +1,313 @@ +package codegen + +import ( + "errors" + "fmt" + "reflect" +) + +type AdditionalImport struct { + Alias string `yaml:"alias,omitempty"` + Package string `yaml:"package"` +} + +// Configuration defines code generation customizations +type Configuration struct { + // PackageName to generate the code under + PackageName string `yaml:"package"` + // Generate specifies which supported output formats to generate + Generate GenerateOptions `yaml:"generate,omitempty"` + // CompatibilityOptions specifies backward compatibility settings for the code generator + Compatibility CompatibilityOptions `yaml:"compatibility,omitempty"` + // OutputOptions are used to modify the output code in some way. + OutputOptions OutputOptions `yaml:"output-options,omitempty"` + // ImportMapping specifies the golang package path for each external reference + ImportMapping map[string]string `yaml:"import-mapping,omitempty"` + // AdditionalImports defines any additional Go imports to add to the generated code + AdditionalImports []AdditionalImport `yaml:"additional-imports,omitempty"` + // NoVCSVersionOverride allows overriding the version of the application for cases where no Version Control System (VCS) is available when building, for instance when using a Nix derivation. + // See documentation for how to use it in examples/no-vcs-version-override/README.md + NoVCSVersionOverride *string `yaml:"-"` +} + +// Validate checks whether Configuration represent a valid configuration +func (o Configuration) Validate() error { + if o.PackageName == "" { + return errors.New("package name must be specified") + } + + // Only one server type should be specified at a time. + nServers := 0 + if o.Generate.IrisServer { + nServers++ + } + if o.Generate.ChiServer { + nServers++ + } + if o.Generate.FiberServer { + nServers++ + } + if o.Generate.EchoServer { + nServers++ + } + if o.Generate.GorillaServer { + nServers++ + } + if o.Generate.StdHTTPServer { + nServers++ + } + if o.Generate.GinServer { + nServers++ + } + if nServers > 1 { + return errors.New("only one server type is supported at a time") + } + + var errs []error + if problems := o.Generate.Validate(); problems != nil { + for k, v := range problems { + errs = append(errs, fmt.Errorf("`generate` configuration for %v was incorrect: %v", k, v)) + } + } + + if problems := o.Compatibility.Validate(); problems != nil { + for k, v := range problems { + errs = append(errs, fmt.Errorf("`compatibility-options` configuration for %v was incorrect: %v", k, v)) + } + } + + if problems := o.OutputOptions.Validate(); problems != nil { + for k, v := range problems { + errs = append(errs, fmt.Errorf("`output-options` configuration for %v was incorrect: %v", k, v)) + } + } + + err := errors.Join(errs...) + if err != nil { + return fmt.Errorf("failed to validate configuration: %w", err) + } + + return nil +} + +// UpdateDefaults sets reasonable default values for unset fields in Configuration +func (o Configuration) UpdateDefaults() Configuration { + if reflect.ValueOf(o.Generate).IsZero() { + o.Generate = GenerateOptions{ + EchoServer: true, + Models: true, + EmbeddedSpec: true, + } + } + return o +} + +// GenerateOptions specifies which supported output formats to generate. +type GenerateOptions struct { + // IrisServer specifies whether to generate iris server boilerplate + IrisServer bool `yaml:"iris-server,omitempty"` + // ChiServer specifies whether to generate chi server boilerplate + ChiServer bool `yaml:"chi-server,omitempty"` + // FiberServer specifies whether to generate fiber server boilerplate + FiberServer bool `yaml:"fiber-server,omitempty"` + // EchoServer specifies whether to generate echo server boilerplate + EchoServer bool `yaml:"echo-server,omitempty"` + // GinServer specifies whether to generate gin server boilerplate + GinServer bool `yaml:"gin-server,omitempty"` + // GorillaServer specifies whether to generate Gorilla server boilerplate + GorillaServer bool `yaml:"gorilla-server,omitempty"` + // StdHTTPServer specifies whether to generate stdlib http server boilerplate + StdHTTPServer bool `yaml:"std-http-server,omitempty"` + // Strict specifies whether to generate strict server wrapper + Strict bool `yaml:"strict-server,omitempty"` + // Client specifies whether to generate client boilerplate + Client bool `yaml:"client,omitempty"` + // Models specifies whether to generate type definitions + Models bool `yaml:"models,omitempty"` + // EmbeddedSpec indicates whether to embed the swagger spec in the generated code + EmbeddedSpec bool `yaml:"embedded-spec,omitempty"` +} + +func (oo GenerateOptions) Validate() map[string]string { + return nil +} + +func (oo GenerateOptions) Warnings() map[string]string { + warnings := make(map[string]string) + + if oo.StdHTTPServer { + if warning := oo.warningForStdHTTP(); warning != "" { + warnings["std-http-server"] = warning + } + } + + return warnings +} + +func (oo GenerateOptions) warningForStdHTTP() string { + pathToGoMod, mod, err := findAndParseGoModuleForDepth(".", maximumDepthToSearchForGoMod) + if err != nil { + return fmt.Sprintf("Encountered an error while trying to find a `go.mod` or a `tools.mod` in this directory, or %d levels above it: %v", maximumDepthToSearchForGoMod, err) + } + + if mod == nil { + return fmt.Sprintf("Failed to find a `go.mod` or a `tools.mod` in this directory, or %d levels above it, so unable to validate that you're using Go 1.22+. If you start seeing API interactions resulting in a `404 page not found`, the Go directive (implying source compatibility for this module) needs to be bumped. See also: https://www.jvt.me/posts/2024/03/04/go-net-http-why-404/", maximumDepthToSearchForGoMod) + } + + if !hasMinimalMinorGoDirective(minimumGoVersionForGenerateStdHTTPServer, mod) { + return fmt.Sprintf("Found a `go.mod` or a `tools.mod` at path %v, but it only had a version of %v, whereas the minimum required is 1.%d. It's very likely API interactions will result in a `404 page not found`. The Go directive (implying source compatibility for this module) needs to be bumped. See also: https://www.jvt.me/posts/2024/03/04/go-net-http-why-404/", pathToGoMod, mod.Go.Version, minimumGoVersionForGenerateStdHTTPServer) + } + + return "" +} + +// CompatibilityOptions specifies backward compatibility settings for the +// code generator. +type CompatibilityOptions struct { + // In the past, we merged schemas for `allOf` by inlining each schema + // within the schema list. This approach, though, is incorrect because + // `allOf` merges at the schema definition level, not at the resulting model + // level. So, new behavior merges OpenAPI specs but generates different code + // than we have in the past. Set OldMergeSchemas to true for the old behavior. + // Please see https://github.com/oapi-codegen/oapi-codegen/issues/531 + OldMergeSchemas bool `yaml:"old-merge-schemas,omitempty"` + // Enum values can generate conflicting typenames, so we've updated the + // code for enum generation to avoid these conflicts, but it will result + // in some enum types being renamed in existing code. Set OldEnumConflicts to true + // to revert to old behavior. Please see: + // Please see https://github.com/oapi-codegen/oapi-codegen/issues/549 + OldEnumConflicts bool `yaml:"old-enum-conflicts,omitempty"` + // It was a mistake to generate a go type definition for every $ref in + // the OpenAPI schema. New behavior uses type aliases where possible, but + // this can generate code which breaks existing builds. Set OldAliasing to true + // for old behavior. + // Please see https://github.com/oapi-codegen/oapi-codegen/issues/549 + OldAliasing bool `yaml:"old-aliasing,omitempty"` + // When an object contains no members, and only an additionalProperties specification, + // it is flattened to a map + DisableFlattenAdditionalProperties bool `yaml:"disable-flatten-additional-properties,omitempty"` + // When an object property is both required and readOnly the go model is generated + // as a pointer. Set DisableRequiredReadOnlyAsPointer to true to mark them as non pointer. + // Please see https://github.com/oapi-codegen/oapi-codegen/issues/604 + DisableRequiredReadOnlyAsPointer bool `yaml:"disable-required-readonly-as-pointer,omitempty"` + // When set to true, always prefix enum values with their type name instead of only + // when typenames would be conflicting. + AlwaysPrefixEnumValues bool `yaml:"always-prefix-enum-values,omitempty"` + // Our generated code for Chi has historically inverted the order in which Chi middleware is + // applied such that the last invoked middleware ends up executing first in the Chi chain + // This resolves the behavior such that middlewares are chained in the order they are invoked. + // Please see https://github.com/oapi-codegen/oapi-codegen/issues/786 + ApplyChiMiddlewareFirstToLast bool `yaml:"apply-chi-middleware-first-to-last,omitempty"` + // Our generated code for gorilla/mux has historically inverted the order in which gorilla/mux middleware is + // applied such that the last invoked middleware ends up executing first in the middlewares chain + // This resolves the behavior such that middlewares are chained in the order they are invoked. + // Please see https://github.com/oapi-codegen/oapi-codegen/issues/841 + ApplyGorillaMiddlewareFirstToLast bool `yaml:"apply-gorilla-middleware-first-to-last,omitempty"` + // CircularReferenceLimit allows controlling the limit for circular reference checking. + // In some OpenAPI specifications, we have a higher number of circular + // references than is allowed out-of-the-box, but can be tuned to allow + // traversing them. + // Deprecated: In kin-openapi v0.126.0 (https://github.com/getkin/kin-openapi/tree/v0.126.0?tab=readme-ov-file#v01260) the Circular Reference Counter functionality was removed, instead resolving all references with backtracking, to avoid needing to provide a limit to reference counts. + CircularReferenceLimit int `yaml:"circular-reference-limit"` + // AllowUnexportedStructFieldNames makes it possible to output structs that have fields that are unexported. + // + // This is expected to be used in conjunction with `x-go-name` and `x-oapi-codegen-only-honour-go-name` to override the resulting output field name, and `x-oapi-codegen-extra-tags` to not produce JSON tags for `encoding/json`, such as: + // + // ```yaml + // id: + // type: string + // x-go-name: accountIdentifier + // x-oapi-codegen-extra-tags: + // json: "-" + // x-oapi-codegen-only-honour-go-name: true + // ``` + // + // NOTE that this can be confusing to users of your OpenAPI specification, who may see a field present and therefore be expecting to see/use it in the request/response, without understanding the nuance of how `oapi-codegen` generates the code. + AllowUnexportedStructFieldNames bool `yaml:"allow-unexported-struct-field-names"` + + // PreserveOriginalOperationIdCasingInEmbeddedSpec ensures that the `operationId` from the source spec is kept intact in case when embedding it into the Embedded Spec output. + // When `oapi-codegen` parses the original OpenAPI specification, it will apply the configured `output-options.name-normalizer` to each operation's `operationId` before that is used to generate code from. + // However, this is also applied to the copy of the `operationId`s in the `embedded-spec` generation, which means that the embedded OpenAPI specification is then out-of-sync with the input specificiation. + // To ensure that the `operationId` in the embedded spec is preserved as-is from the input specification, set this. + // NOTE that this will not impact generated code. + // NOTE that if you're using `include-operation-ids` or `exclude-operation-ids` you may want to ensure that the `operationId`s used are correct. + PreserveOriginalOperationIdCasingInEmbeddedSpec bool `yaml:"preserve-original-operation-id-casing-in-embedded-spec"` +} + +func (co CompatibilityOptions) Validate() map[string]string { + return nil +} + +// OutputOptions are used to modify the output code in some way. +type OutputOptions struct { + // Whether to skip go imports on the generated code + SkipFmt bool `yaml:"skip-fmt,omitempty"` + // Whether to skip pruning unused components on the generated code + SkipPrune bool `yaml:"skip-prune,omitempty"` + // Only include operations that have one of these tags. Ignored when empty. + IncludeTags []string `yaml:"include-tags,omitempty"` + // Exclude operations that have one of these tags. Ignored when empty. + ExcludeTags []string `yaml:"exclude-tags,omitempty"` + // Only include operations that have one of these operation-ids. Ignored when empty. + IncludeOperationIDs []string `yaml:"include-operation-ids,omitempty"` + // Exclude operations that have one of these operation-ids. Ignored when empty. + ExcludeOperationIDs []string `yaml:"exclude-operation-ids,omitempty"` + // Override built-in templates from user-provided files + UserTemplates map[string]string `yaml:"user-templates,omitempty"` + + // Exclude from generation schemas with given names. Ignored when empty. + ExcludeSchemas []string `yaml:"exclude-schemas,omitempty"` + // The suffix used for responses types + ResponseTypeSuffix string `yaml:"response-type-suffix,omitempty"` + // Override the default generated client type with the value + ClientTypeName string `yaml:"client-type-name,omitempty"` + // Whether to use the initialism overrides + InitialismOverrides bool `yaml:"initialism-overrides,omitempty"` + // AdditionalInitialisms is a list of additional initialisms to use when generating names. + // NOTE that this has no effect unless the `name-normalizer` is set to `ToCamelCaseWithInitialisms` + AdditionalInitialisms []string `yaml:"additional-initialisms,omitempty"` + // Whether to generate nullable type for nullable fields + NullableType bool `yaml:"nullable-type,omitempty"` + + // DisableTypeAliasesForType allows defining which OpenAPI `type`s will explicitly not use type aliases + // Currently supports: + // "array" + DisableTypeAliasesForType []string `yaml:"disable-type-aliases-for-type"` + + // NameNormalizer is the method used to normalize Go names and types, for instance converting the text `MyApi` to `MyAPI`. Corresponds with the constants defined for `codegen.NameNormalizerFunction` + NameNormalizer string `yaml:"name-normalizer,omitempty"` + + // Overlay defines configuration for the OpenAPI Overlay (https://github.com/OAI/Overlay-Specification) to manipulate the OpenAPI specification before generation. This allows modifying the specification without needing to apply changes directly to it, making it easier to keep it up-to-date. + Overlay OutputOptionsOverlay `yaml:"overlay"` + + // EnableYamlTags adds YAML tags to generated structs, in addition to default JSON ones + EnableYamlTags bool `yaml:"yaml-tags,omitempty"` + + // ClientResponseBytesFunction decides whether to enable the generation of a `Bytes()` method on response objects for `ClientWithResponses` + ClientResponseBytesFunction bool `yaml:"client-response-bytes-function,omitempty"` + + // PreferSkipOptionalPointer allows defining at a global level whether to omit the pointer for a type to indicate that the field/type is optional. + // This is the same as adding `x-go-type-skip-optional-pointer` to each field (manually, or using an OpenAPI Overlay) + PreferSkipOptionalPointer bool `yaml:"prefer-skip-optional-pointer,omitempty"` + + // PreferSkipOptionalPointerOnContainerTypes allows disabling the generation of an "optional pointer" for an optional field that is a container type (such as a slice or a map), which ends up requiring an additional, unnecessary, `... != nil` check + PreferSkipOptionalPointerOnContainerTypes bool `yaml:"prefer-skip-optional-pointer-on-container-types,omitempty"` +} + +func (oo OutputOptions) Validate() map[string]string { + if NameNormalizerFunction(oo.NameNormalizer) != NameNormalizerFunctionToCamelCaseWithInitialisms && len(oo.AdditionalInitialisms) > 0 { + return map[string]string{ + "additional-initialisms": "You have specified `additional-initialisms`, but the `name-normalizer` is not set to `ToCamelCaseWithInitialisms`. Please specify `name-normalizer: ToCamelCaseWithInitialisms` or remove the `additional-initialisms` configuration", + } + } + + return nil +} + +type OutputOptionsOverlay struct { + Path string `yaml:"path"` + + // Strict defines whether the Overlay should be applied in a strict way, highlighting any actions that will not take any effect. This can, however, lead to more work when testing new actions in an Overlay, so can be turned off with this setting. + // Defaults to true. + Strict *bool `yaml:"strict,omitempty"` +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/extension.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/extension.go new file mode 100644 index 0000000000..f5ef5ef4d2 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/extension.go @@ -0,0 +1,113 @@ +package codegen + +import ( + "fmt" +) + +const ( + // extPropGoType overrides the generated type definition. + extPropGoType = "x-go-type" + // extPropGoTypeSkipOptionalPointer specifies that optional fields should + // be the type itself instead of a pointer to the type. + extPropGoTypeSkipOptionalPointer = "x-go-type-skip-optional-pointer" + // extPropGoImport specifies the module to import which provides above type + extPropGoImport = "x-go-type-import" + // extGoName is used to override a field name + extGoName = "x-go-name" + // extGoTypeName is used to override a generated typename for something. + extGoTypeName = "x-go-type-name" + extPropGoJsonIgnore = "x-go-json-ignore" + extPropOmitEmpty = "x-omitempty" + extPropExtraTags = "x-oapi-codegen-extra-tags" + extEnumVarNames = "x-enum-varnames" + extEnumNames = "x-enumNames" + extDeprecationReason = "x-deprecated-reason" + extOrder = "x-order" + // extOapiCodegenOnlyHonourGoName is to be used to explicitly enforce the generation of a field as the `x-go-name` extension has describe it. + // This is intended to be used alongside the `allow-unexported-struct-field-names` Compatibility option + extOapiCodegenOnlyHonourGoName = "x-oapi-codegen-only-honour-go-name" +) + +func extString(extPropValue interface{}) (string, error) { + str, ok := extPropValue.(string) + if !ok { + return "", fmt.Errorf("failed to convert type: %T", extPropValue) + } + return str, nil +} + +func extTypeName(extPropValue interface{}) (string, error) { + return extString(extPropValue) +} + +func extParsePropGoTypeSkipOptionalPointer(extPropValue interface{}) (bool, error) { + goTypeSkipOptionalPointer, ok := extPropValue.(bool) + if !ok { + return false, fmt.Errorf("failed to convert type: %T", extPropValue) + } + return goTypeSkipOptionalPointer, nil +} + +func extParseGoFieldName(extPropValue interface{}) (string, error) { + return extString(extPropValue) +} + +func extParseOmitEmpty(extPropValue interface{}) (bool, error) { + omitEmpty, ok := extPropValue.(bool) + if !ok { + return false, fmt.Errorf("failed to convert type: %T", extPropValue) + } + return omitEmpty, nil +} + +func extExtraTags(extPropValue interface{}) (map[string]string, error) { + tagsI, ok := extPropValue.(map[string]interface{}) + if !ok { + return nil, fmt.Errorf("failed to convert type: %T", extPropValue) + } + tags := make(map[string]string, len(tagsI)) + for k, v := range tagsI { + vs, ok := v.(string) + if !ok { + return nil, fmt.Errorf("failed to convert type: %T", v) + } + tags[k] = vs + } + return tags, nil +} + +func extParseGoJsonIgnore(extPropValue interface{}) (bool, error) { + goJsonIgnore, ok := extPropValue.(bool) + if !ok { + return false, fmt.Errorf("failed to convert type: %T", extPropValue) + } + return goJsonIgnore, nil +} + +func extParseEnumVarNames(extPropValue interface{}) ([]string, error) { + namesI, ok := extPropValue.([]interface{}) + if !ok { + return nil, fmt.Errorf("failed to convert type: %T", extPropValue) + } + names := make([]string, len(namesI)) + for i, v := range namesI { + vs, ok := v.(string) + if !ok { + return nil, fmt.Errorf("failed to convert type: %T", v) + } + names[i] = vs + } + return names, nil +} + +func extParseDeprecationReason(extPropValue interface{}) (string, error) { + return extString(extPropValue) +} + +func extParseOapiCodegenOnlyHonourGoName(extPropValue interface{}) (bool, error) { + onlyHonourGoName, ok := extPropValue.(bool) + if !ok { + return false, fmt.Errorf("failed to convert type: %T", extPropValue) + } + return onlyHonourGoName, nil +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/externalref.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/externalref.go new file mode 100644 index 0000000000..a48b3d4e1e --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/externalref.go @@ -0,0 +1,80 @@ +package codegen + +import ( + "fmt" + "strings" +) + +// ensureExternalRefsInRequestBodyDefinitions ensures that when an externalRef (`$ref` that points to a file that isn't the current spec) is encountered, we make sure we update our underlying `RefType` to make sure that we point to that type. +// This only happens if we have a non-empty `ref` passed in, and that `ref` isn't pointing to something in our file +// NOTE that the pointer here allows us to pass in a reference and edit in-place +func ensureExternalRefsInRequestBodyDefinitions(defs *[]RequestBodyDefinition, ref string) { + if ref == "" { + return + } + + for i, rbd := range *defs { + ensureExternalRefsInSchema(&rbd.Schema, ref) + + // make sure we then update it in-place + (*defs)[i] = rbd + } +} + +// ensureExternalRefsInResponseDefinitions ensures that when an externalRef (`$ref` that points to a file that isn't the current spec) is encountered, we make sure we update our underlying `RefType` to make sure that we point to that type. +// This only happens if we have a non-empty `ref` passed in, and that `ref` isn't pointing to something in our file +// NOTE that the pointer here allows us to pass in a reference and edit in-place +func ensureExternalRefsInResponseDefinitions(defs *[]ResponseDefinition, ref string) { + if ref == "" { + return + } + + for i, rd := range *defs { + for j, rcd := range rd.Contents { + ensureExternalRefsInSchema(&rcd.Schema, ref) + + // make sure we then update it in-place + rd.Contents[j] = rcd + } + + // make sure we then update it in-place + (*defs)[i] = rd + } +} + +// ensureExternalRefsInParameterDefinitions ensures that when an externalRef (`$ref` that points to a file that isn't the current spec) is encountered, we make sure we update our underlying `RefType` to make sure that we point to that type. +// This only happens if we have a non-empty `ref` passed in, and that `ref` isn't pointing to something in our file +// NOTE that the pointer here allows us to pass in a reference and edit in-place +func ensureExternalRefsInParameterDefinitions(defs *[]ParameterDefinition, ref string) { + if ref == "" { + return + } + + for i, pd := range *defs { + ensureExternalRefsInSchema(&pd.Schema, ref) + + // make sure we then update it in-place + (*defs)[i] = pd + } +} + +// ensureExternalRefsInSchema ensures that when an externalRef (`$ref` that points to a file that isn't the current spec) is encountered, we make sure we update our underlying `RefType` to make sure that we point to that type. +// +// This only happens if we have a non-empty `ref` passed in, and that `ref` isn't pointing to something in our file +// +// NOTE that the pointer here allows us to pass in a reference and edit in-place +func ensureExternalRefsInSchema(schema *Schema, ref string) { + if ref == "" { + return + } + + // if this is already defined as the start of a struct, we shouldn't inject **??** + if strings.HasPrefix(schema.GoType, "struct {") { + return + } + + parts := strings.SplitN(ref, "#", 2) + if pack, ok := globalState.importMapping[parts[0]]; ok { + schema.RefType = fmt.Sprintf("%s.%s", pack.Name, schema.GoType) + } +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/filter.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/filter.go new file mode 100644 index 0000000000..435968a379 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/filter.go @@ -0,0 +1,88 @@ +package codegen + +import "github.com/getkin/kin-openapi/openapi3" + +func sliceToMap(items []string) map[string]bool { + m := make(map[string]bool, len(items)) + for _, item := range items { + m[item] = true + } + return m +} + +func filterOperationsByTag(swagger *openapi3.T, opts Configuration) { + if len(opts.OutputOptions.ExcludeTags) > 0 { + operationsWithTags(swagger.Paths, sliceToMap(opts.OutputOptions.ExcludeTags), true) + } + if len(opts.OutputOptions.IncludeTags) > 0 { + operationsWithTags(swagger.Paths, sliceToMap(opts.OutputOptions.IncludeTags), false) + } +} + +func operationsWithTags(paths *openapi3.Paths, tags map[string]bool, exclude bool) { + if paths == nil { + return + } + + for _, pathItem := range paths.Map() { + ops := pathItem.Operations() + names := make([]string, 0, len(ops)) + for name, op := range ops { + if operationHasTag(op, tags) == exclude { + names = append(names, name) + } + } + for _, name := range names { + pathItem.SetOperation(name, nil) + } + } +} + +// operationHasTag returns true if the operation is tagged with any of tags +func operationHasTag(op *openapi3.Operation, tags map[string]bool) bool { + if op == nil { + return false + } + for _, hasTag := range op.Tags { + if tags[hasTag] { + return true + } + } + return false +} + +func filterOperationsByOperationID(swagger *openapi3.T, opts Configuration) { + if len(opts.OutputOptions.ExcludeOperationIDs) > 0 { + operationsWithOperationIDs(swagger.Paths, sliceToMap(opts.OutputOptions.ExcludeOperationIDs), true) + } + if len(opts.OutputOptions.IncludeOperationIDs) > 0 { + operationsWithOperationIDs(swagger.Paths, sliceToMap(opts.OutputOptions.IncludeOperationIDs), false) + } +} + +func operationsWithOperationIDs(paths *openapi3.Paths, operationIDs map[string]bool, exclude bool) { + if paths == nil { + return + } + + for _, pathItem := range paths.Map() { + ops := pathItem.Operations() + names := make([]string, 0, len(ops)) + for name, op := range ops { + if operationHasOperationID(op, operationIDs) == exclude { + names = append(names, name) + } + } + for _, name := range names { + pathItem.SetOperation(name, nil) + } + } +} + +// operationHasOperationID returns true if the operation has operation id is included in operation ids +func operationHasOperationID(op *openapi3.Operation, operationIDs map[string]bool) bool { + if op == nil { + return false + } + return operationIDs[op.OperationID] +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/inline.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/inline.go new file mode 100644 index 0000000000..459255c05f --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/inline.go @@ -0,0 +1,77 @@ +// Copyright 2019 DeepMap, Inc. +// +// 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. +package codegen + +import ( + "bytes" + "compress/gzip" + "context" + "encoding/base64" + "fmt" + "text/template" + + "github.com/getkin/kin-openapi/openapi3" +) + +// GenerateInlinedSpec generates a gzipped, base64 encoded JSON representation of the +// swagger definition, which we embed inside the generated code. +func GenerateInlinedSpec(t *template.Template, importMapping importMap, swagger *openapi3.T) (string, error) { + // ensure that any external file references are embedded into the embedded spec + swagger.InternalizeRefs(context.Background(), nil) + // Marshal to json + encoded, err := swagger.MarshalJSON() + if err != nil { + return "", fmt.Errorf("error marshaling swagger: %w", err) + } + + // gzip + var buf bytes.Buffer + zw, err := gzip.NewWriterLevel(&buf, gzip.BestCompression) + if err != nil { + return "", fmt.Errorf("error creating gzip compressor: %w", err) + } + _, err = zw.Write(encoded) + if err != nil { + return "", fmt.Errorf("error gzipping swagger file: %w", err) + } + err = zw.Close() + if err != nil { + return "", fmt.Errorf("error gzipping swagger file: %w", err) + } + str := base64.StdEncoding.EncodeToString(buf.Bytes()) + + var parts []string + const width = 80 + + // Chop up the string into an array of strings. + for len(str) > width { + part := str[0:width] + parts = append(parts, part) + str = str[width:] + } + if len(str) > 0 { + parts = append(parts, str) + } + + return GenerateTemplates( + []string{"inline.tmpl"}, + t, + struct { + SpecParts []string + ImportMapping importMap + }{ + SpecParts: parts, + ImportMapping: importMapping, + }) +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/merge_schemas.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/merge_schemas.go new file mode 100644 index 0000000000..04e7b2fa2b --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/merge_schemas.go @@ -0,0 +1,249 @@ +package codegen + +import ( + "errors" + "fmt" + "strings" + + "github.com/getkin/kin-openapi/openapi3" +) + +// MergeSchemas merges all the fields in the schemas supplied into one giant schema. +// The idea is that we merge all fields together into one schema. +func MergeSchemas(allOf []*openapi3.SchemaRef, path []string) (Schema, error) { + // If someone asked for the old way, for backward compatibility, return the + // old style result. + if globalState.options.Compatibility.OldMergeSchemas { + return mergeSchemasV1(allOf, path) + } + return mergeSchemas(allOf, path) +} + +func mergeSchemas(allOf []*openapi3.SchemaRef, path []string) (Schema, error) { + n := len(allOf) + + if n == 1 { + return GenerateGoSchema(allOf[0], path) + } + + schema, err := valueWithPropagatedRef(allOf[0]) + if err != nil { + return Schema{}, err + } + + for i := 1; i < n; i++ { + var err error + oneOfSchema, err := valueWithPropagatedRef(allOf[i]) + if err != nil { + return Schema{}, err + } + schema, err = mergeOpenapiSchemas(schema, oneOfSchema, true) + if err != nil { + return Schema{}, fmt.Errorf("error merging schemas for AllOf: %w", err) + } + } + return GenerateGoSchema(openapi3.NewSchemaRef("", &schema), path) +} + +// valueWithPropagatedRef returns a copy of ref schema with its Properties refs +// updated if ref itself is external. Otherwise, return ref.Value as-is. +func valueWithPropagatedRef(ref *openapi3.SchemaRef) (openapi3.Schema, error) { + if len(ref.Ref) == 0 || ref.Ref[0] == '#' { + return *ref.Value, nil + } + + pathParts := strings.Split(ref.Ref, "#") + if len(pathParts) < 1 || len(pathParts) > 2 { + return openapi3.Schema{}, fmt.Errorf("unsupported reference: %s", ref.Ref) + } + remoteComponent := pathParts[0] + + // remote ref + schema := *ref.Value + for _, value := range schema.Properties { + if len(value.Ref) > 0 && value.Ref[0] == '#' { + // local reference, should propagate remote + value.Ref = remoteComponent + value.Ref + } + } + + return schema, nil +} + +func mergeAllOf(allOf []*openapi3.SchemaRef) (openapi3.Schema, error) { + var schema openapi3.Schema + for _, schemaRef := range allOf { + var err error + schema, err = mergeOpenapiSchemas(schema, *schemaRef.Value, true) + if err != nil { + return openapi3.Schema{}, fmt.Errorf("error merging schemas for AllOf: %w", err) + } + } + return schema, nil +} + +// mergeOpenapiSchemas merges two openAPI schemas and returns the schema +// all of whose fields are composed. +func mergeOpenapiSchemas(s1, s2 openapi3.Schema, allOf bool) (openapi3.Schema, error) { + var result openapi3.Schema + + result.Extensions = make(map[string]interface{}) + for k, v := range s1.Extensions { + result.Extensions[k] = v + } + for k, v := range s2.Extensions { + // TODO: Check for collisions + result.Extensions[k] = v + } + + result.OneOf = append(s1.OneOf, s2.OneOf...) + + // We are going to make AllOf transitive, so that merging an AllOf that + // contains AllOf's will result in a flat object. + var err error + if s1.AllOf != nil { + var merged openapi3.Schema + merged, err = mergeAllOf(s1.AllOf) + if err != nil { + return openapi3.Schema{}, fmt.Errorf("error transitive merging AllOf on schema 1") + } + s1 = merged + } + if s2.AllOf != nil { + var merged openapi3.Schema + merged, err = mergeAllOf(s2.AllOf) + if err != nil { + return openapi3.Schema{}, fmt.Errorf("error transitive merging AllOf on schema 2") + } + s2 = merged + } + + result.AllOf = append(s1.AllOf, s2.AllOf...) + + if s1.Type.Slice() != nil && s2.Type.Slice() != nil && !equalTypes(s1.Type, s2.Type) { + return openapi3.Schema{}, fmt.Errorf("can not merge incompatible types: %v, %v", s1.Type.Slice(), s2.Type.Slice()) + } + result.Type = s1.Type + + if s1.Format != s2.Format { + return openapi3.Schema{}, errors.New("can not merge incompatible formats") + } + result.Format = s1.Format + + // For Enums, do we union, or intersect? This is a bit vague. I choose + // to be more permissive and union. + result.Enum = append(s1.Enum, s2.Enum...) + + // I don't know how to handle two different defaults. + if s1.Default != nil || s2.Default != nil { + return openapi3.Schema{}, errors.New("merging two sets of defaults is undefined") + } + if s1.Default != nil { + result.Default = s1.Default + } + if s2.Default != nil { + result.Default = s2.Default + } + + // We skip Example + // We skip ExternalDocs + + // If two schemas disagree on any of these flags, we error out. + if s1.UniqueItems != s2.UniqueItems { + return openapi3.Schema{}, errors.New("merging two schemas with different UniqueItems") + + } + result.UniqueItems = s1.UniqueItems + + if s1.ExclusiveMin != s2.ExclusiveMin { + return openapi3.Schema{}, errors.New("merging two schemas with different ExclusiveMin") + + } + result.ExclusiveMin = s1.ExclusiveMin + + if s1.ExclusiveMax != s2.ExclusiveMax { + return openapi3.Schema{}, errors.New("merging two schemas with different ExclusiveMax") + + } + result.ExclusiveMax = s1.ExclusiveMax + + if s1.Nullable != s2.Nullable { + return openapi3.Schema{}, errors.New("merging two schemas with different Nullable") + + } + result.Nullable = s1.Nullable + + if s1.ReadOnly != s2.ReadOnly { + return openapi3.Schema{}, errors.New("merging two schemas with different ReadOnly") + + } + result.ReadOnly = s1.ReadOnly + + if s1.WriteOnly != s2.WriteOnly { + return openapi3.Schema{}, errors.New("merging two schemas with different WriteOnly") + + } + result.WriteOnly = s1.WriteOnly + + if s1.AllowEmptyValue != s2.AllowEmptyValue { + return openapi3.Schema{}, errors.New("merging two schemas with different AllowEmptyValue") + + } + result.AllowEmptyValue = s1.AllowEmptyValue + + // Required. We merge these. + result.Required = append(s1.Required, s2.Required...) + + // We merge all properties + result.Properties = make(map[string]*openapi3.SchemaRef) + for k, v := range s1.Properties { + result.Properties[k] = v + } + for k, v := range s2.Properties { + // TODO: detect conflicts + result.Properties[k] = v + } + + if isAdditionalPropertiesExplicitFalse(&s1) || isAdditionalPropertiesExplicitFalse(&s2) { + result.WithoutAdditionalProperties() + } else if s1.AdditionalProperties.Schema != nil { + if s2.AdditionalProperties.Schema != nil { + return openapi3.Schema{}, errors.New("merging two schemas with additional properties, this is unhandled") + } else { + result.AdditionalProperties.Schema = s1.AdditionalProperties.Schema + } + } else { + if s2.AdditionalProperties.Schema != nil { + result.AdditionalProperties.Schema = s2.AdditionalProperties.Schema + } else { + if s1.AdditionalProperties.Has != nil || s2.AdditionalProperties.Has != nil { + result.WithAnyAdditionalProperties() + } + } + } + + // Allow discriminators for allOf merges, but disallow for one/anyOfs. + if !allOf && (s1.Discriminator != nil || s2.Discriminator != nil) { + return openapi3.Schema{}, errors.New("merging two schemas with discriminators is not supported") + } + + return result, nil +} + +func equalTypes(t1 *openapi3.Types, t2 *openapi3.Types) bool { + s1 := t1.Slice() + s2 := t2.Slice() + + if len(s1) != len(s2) { + return false + } + + // NOTE that ideally we'd use `slices.Equal` but as we're currently supporting Go 1.20+, we can't use it (yet https://github.com/oapi-codegen/oapi-codegen/issues/1634) + for i := range s1 { + if s1[i] != s2[i] { + return false + } + } + + return true +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/merge_schemas_v1.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/merge_schemas_v1.go new file mode 100644 index 0000000000..af83582381 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/merge_schemas_v1.go @@ -0,0 +1,111 @@ +package codegen + +import ( + "errors" + "fmt" + "strings" + + "github.com/getkin/kin-openapi/openapi3" +) + +func mergeSchemasV1(allOf []*openapi3.SchemaRef, path []string) (Schema, error) { + var outSchema Schema + for _, schemaOrRef := range allOf { + ref := schemaOrRef.Ref + + var refType string + var err error + if IsGoTypeReference(ref) { + refType, err = RefPathToGoType(ref) + if err != nil { + return Schema{}, fmt.Errorf("error converting reference path to a go type: %w", err) + } + } + + schema, err := GenerateGoSchema(schemaOrRef, path) + if err != nil { + return Schema{}, fmt.Errorf("error generating Go schema in allOf: %w", err) + } + schema.RefType = refType + + for _, p := range schema.Properties { + err = outSchema.AddProperty(p) + if err != nil { + return Schema{}, fmt.Errorf("error merging properties: %w", err) + } + } + + if schema.HasAdditionalProperties { + if outSchema.HasAdditionalProperties { + // Both this schema, and the aggregate schema have additional + // properties, they must match. + if schema.AdditionalPropertiesType.TypeDecl() != outSchema.AdditionalPropertiesType.TypeDecl() { + return Schema{}, errors.New("additional properties in allOf have incompatible types") + } + } else { + // We're switching from having no additional properties to having + // them + outSchema.HasAdditionalProperties = true + outSchema.AdditionalPropertiesType = schema.AdditionalPropertiesType + } + } + } + + // Now, we generate the struct which merges together all the fields. + var err error + outSchema.GoType, err = GenStructFromAllOf(allOf, path) + if err != nil { + return Schema{}, fmt.Errorf("unable to generate aggregate type for AllOf: %w", err) + } + return outSchema, nil +} + +// GenStructFromAllOf generates an object that is the union of the objects in the +// input array. In the case of Ref objects, we use an embedded struct, otherwise, +// we inline the fields. +func GenStructFromAllOf(allOf []*openapi3.SchemaRef, path []string) (string, error) { + // Start out with struct { + objectParts := []string{"struct {"} + for _, schemaOrRef := range allOf { + ref := schemaOrRef.Ref + if IsGoTypeReference(ref) { + // We have a referenced type, we will generate an inlined struct + // member. + // struct { + // InlinedMember + // ... + // } + goType, err := RefPathToGoType(ref) + if err != nil { + return "", err + } + objectParts = append(objectParts, + fmt.Sprintf(" // Embedded struct due to allOf(%s)", ref)) + objectParts = append(objectParts, + fmt.Sprintf(" %s `yaml:\",inline\"`", goType)) + } else { + // Inline all the fields from the schema into the output struct, + // just like in the simple case of generating an object. + goSchema, err := GenerateGoSchema(schemaOrRef, path) + if err != nil { + return "", err + } + objectParts = append(objectParts, " // Embedded fields due to inline allOf schema") + objectParts = append(objectParts, GenFieldsFromProperties(goSchema.Properties)...) + + if goSchema.HasAdditionalProperties { + addPropsType := goSchema.AdditionalPropertiesType.GoType + if goSchema.AdditionalPropertiesType.RefType != "" { + addPropsType = goSchema.AdditionalPropertiesType.RefType + } + + additionalPropertiesPart := fmt.Sprintf("AdditionalProperties map[string]%s `json:\"-\"`", addPropsType) + if !StringInArray(additionalPropertiesPart, objectParts) { + objectParts = append(objectParts, additionalPropertiesPart) + } + } + } + } + objectParts = append(objectParts, "}") + return strings.Join(objectParts, "\n"), nil +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/minimum_go_version.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/minimum_go_version.go new file mode 100644 index 0000000000..4f4f70fe7b --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/minimum_go_version.go @@ -0,0 +1,91 @@ +package codegen + +import ( + "fmt" + "os" + "path/filepath" + "strconv" + "strings" + + "golang.org/x/mod/modfile" +) + +const maximumDepthToSearchForGoMod = 5 + +// minimumGoVersionForGenerateStdHTTPServer indicates the Go 1.x minor version that the module the std-http-server is being generated into needs. +// If the version is lower, a warning should be logged. +const minimumGoVersionForGenerateStdHTTPServer = 22 + +func findAndParseGoModuleForDepth(dir string, maxDepth int) (string, *modfile.File, error) { + absDir, err := filepath.Abs(dir) + if err != nil { + return "", nil, fmt.Errorf("failed to determine absolute path for %v: %w", dir, err) + } + currentDir := absDir + + for i := 0; i <= maxDepth; i++ { + goModPath := filepath.Join(currentDir, "go.mod") + if _, err := os.Stat(goModPath); err == nil { + goModContent, err := os.ReadFile(goModPath) + if err != nil { + return "", nil, fmt.Errorf("failed to read `go.mod`: %w", err) + } + + mod, err := modfile.ParseLax("go.mod", goModContent, nil) + if err != nil { + return "", nil, fmt.Errorf("failed to parse `go.mod`: %w", err) + } + + return goModPath, mod, nil + } + + goModPath = filepath.Join(currentDir, "tools.mod") + if _, err := os.Stat(goModPath); err == nil { + goModContent, err := os.ReadFile(goModPath) + if err != nil { + return "", nil, fmt.Errorf("failed to read `tools.mod`: %w", err) + } + + parsedModFile, err := modfile.ParseLax("tools.mod", goModContent, nil) + if err != nil { + return "", nil, fmt.Errorf("failed to parse `tools.mod`: %w", err) + } + + return goModPath, parsedModFile, nil + } + + parentDir := filepath.Dir(currentDir) + // NOTE that this may not work particularly well on Windows + if parentDir == "/" { + break + } + + currentDir = parentDir + } + + return "", nil, fmt.Errorf("no `go.mod` or `tools.mod` file found within %d levels upwards from %s", maxDepth, absDir) +} + +// hasMinimalMinorGoDirective indicates that the Go module (`mod`) has a minor version greater than or equal to the `expected`'s +// This only applies to the `go` directive: +// +// go 1.23 +// go 1.22.1 +func hasMinimalMinorGoDirective(expected int, mod *modfile.File) bool { + parts := strings.Split(mod.Go.Version, ".") + + if len(parts) < 2 { + return false + } + + actual, err := strconv.Atoi(parts[1]) + if err != nil { + return false + } + + if actual < expected { + return false + } + + return true +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/operations.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/operations.go new file mode 100644 index 0000000000..e4d9784702 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/operations.go @@ -0,0 +1,1116 @@ +// Copyright 2019 DeepMap, Inc. +// +// 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. +package codegen + +import ( + "bufio" + "bytes" + "fmt" + "sort" + "strconv" + "strings" + "text/template" + "unicode" + + "github.com/getkin/kin-openapi/openapi3" + + "github.com/oapi-codegen/oapi-codegen/v2/pkg/util" +) + +type ParameterDefinition struct { + ParamName string // The original json parameter name, eg param_name + In string // Where the parameter is defined - path, header, cookie, query + Required bool // Is this a required parameter? + Spec *openapi3.Parameter + Schema Schema +} + +// TypeDef is here as an adapter after a large refactoring so that I don't +// have to update all the templates. It returns the type definition for a parameter, +// without the leading '*' for optional ones. +func (pd ParameterDefinition) TypeDef() string { + typeDecl := pd.Schema.TypeDecl() + return typeDecl +} + +// JsonTag generates the JSON annotation to map GoType to json type name. If Parameter +// Foo is marshaled to json as "foo", this will create the annotation +// 'json:"foo"' +func (pd *ParameterDefinition) JsonTag() string { + if pd.Required { + return fmt.Sprintf("`json:\"%s\"`", pd.ParamName) + } else { + return fmt.Sprintf("`json:\"%s,omitempty\"`", pd.ParamName) + } +} + +func (pd *ParameterDefinition) IsJson() bool { + p := pd.Spec + if len(p.Content) == 1 { + for k := range p.Content { + if util.IsMediaTypeJson(k) { + return true + } + } + } + return false +} + +func (pd *ParameterDefinition) IsPassThrough() bool { + p := pd.Spec + if len(p.Content) > 1 { + return true + } + if len(p.Content) == 1 { + return !pd.IsJson() + } + return false +} + +func (pd *ParameterDefinition) IsStyled() bool { + p := pd.Spec + return p.Schema != nil +} + +func (pd *ParameterDefinition) Style() string { + style := pd.Spec.Style + if style == "" { + in := pd.Spec.In + switch in { + case "path", "header": + return "simple" + case "query", "cookie": + return "form" + default: + panic("unknown parameter format") + } + } + return style +} + +func (pd *ParameterDefinition) Explode() bool { + if pd.Spec.Explode == nil { + in := pd.Spec.In + switch in { + case "path", "header": + return false + case "query", "cookie": + return true + default: + panic("unknown parameter format") + } + } + return *pd.Spec.Explode +} + +func (pd ParameterDefinition) GoVariableName() string { + name := LowercaseFirstCharacters(pd.GoName()) + if IsGoKeyword(name) { + name = "p" + UppercaseFirstCharacter(name) + } + if unicode.IsNumber([]rune(name)[0]) { + name = "n" + name + } + return name +} + +func (pd ParameterDefinition) GoName() string { + goName := pd.ParamName + if extension, ok := pd.Spec.Extensions[extGoName]; ok { + if extGoFieldName, err := extParseGoFieldName(extension); err == nil { + goName = extGoFieldName + } + } + return SchemaNameToTypeName(goName) +} + +// Deprecated: Use HasOptionalPointer, as it is clearer what the intent is. +func (pd ParameterDefinition) IndirectOptional() bool { + return !pd.Required && !pd.Schema.SkipOptionalPointer +} + +// HasOptionalPointer indicates whether the generated property has an optional pointer associated with it. +// This takes into account the `x-go-type-skip-optional-pointer` extension, allowing a parameter definition to control whether the pointer should be skipped. +func (pd ParameterDefinition) HasOptionalPointer() bool { + return pd.Required == false && pd.Schema.SkipOptionalPointer == false //nolint:staticcheck +} + +type ParameterDefinitions []ParameterDefinition + +func (p ParameterDefinitions) FindByName(name string) *ParameterDefinition { + for _, param := range p { + if param.ParamName == name { + return ¶m + } + } + return nil +} + +// DescribeParameters walks the given parameters dictionary, and generates the above +// descriptors into a flat list. This makes it a lot easier to traverse the +// data in the template engine. +func DescribeParameters(params openapi3.Parameters, path []string) ([]ParameterDefinition, error) { + outParams := make([]ParameterDefinition, 0) + for _, paramOrRef := range params { + param := paramOrRef.Value + + goType, err := paramToGoType(param, append(path, param.Name)) + if err != nil { + return nil, fmt.Errorf("error generating type for param (%s): %s", + param.Name, err) + } + + pd := ParameterDefinition{ + ParamName: param.Name, + In: param.In, + Required: param.Required, + Spec: param, + Schema: goType, + } + + // If this is a reference to a predefined type, simply use the reference + // name as the type. $ref: "#/components/schemas/custom_type" becomes + // "CustomType". + if IsGoTypeReference(paramOrRef.Ref) { + goType, err := RefPathToGoType(paramOrRef.Ref) + if err != nil { + return nil, fmt.Errorf("error dereferencing (%s) for param (%s): %s", + paramOrRef.Ref, param.Name, err) + } + pd.Schema.GoType = goType + } + outParams = append(outParams, pd) + } + return outParams, nil +} + +type SecurityDefinition struct { + ProviderName string + Scopes []string +} + +func DescribeSecurityDefinition(securityRequirements openapi3.SecurityRequirements) []SecurityDefinition { + outDefs := make([]SecurityDefinition, 0) + + for _, sr := range securityRequirements { + for _, k := range SortedMapKeys(sr) { + v := sr[k] + outDefs = append(outDefs, SecurityDefinition{ProviderName: k, Scopes: v}) + } + } + + return outDefs +} + +// OperationDefinition describes an Operation +type OperationDefinition struct { + // OperationId is the `operationId` field from the OpenAPI Specification, after going through a `nameNormalizer`, and will be used to generate function names + OperationId string + + PathParams []ParameterDefinition // Parameters in the path, eg, /path/:param + HeaderParams []ParameterDefinition // Parameters in HTTP headers + QueryParams []ParameterDefinition // Parameters in the query, /path?param + CookieParams []ParameterDefinition // Parameters in cookies + TypeDefinitions []TypeDefinition // These are all the types we need to define for this operation + SecurityDefinitions []SecurityDefinition // These are the security providers + BodyRequired bool + Bodies []RequestBodyDefinition // The list of bodies for which to generate handlers. + Responses []ResponseDefinition // The list of responses that can be accepted by handlers. + Summary string // Summary string from Swagger, used to generate a comment + Method string // GET, POST, DELETE, etc. + Path string // The Swagger path for the operation, like /resource/{id} + Spec *openapi3.Operation +} + +// Params returns the list of all parameters except Path parameters. Path parameters +// are handled differently from the rest, since they're mandatory. +func (o *OperationDefinition) Params() []ParameterDefinition { + result := append(o.QueryParams, o.HeaderParams...) + result = append(result, o.CookieParams...) + return result +} + +// AllParams returns all parameters +func (o *OperationDefinition) AllParams() []ParameterDefinition { + result := append(o.QueryParams, o.HeaderParams...) + result = append(result, o.CookieParams...) + result = append(result, o.PathParams...) + return result +} + +// If we have parameters other than path parameters, they're bundled into an +// object. Returns true if we have any of those. This is used from the template +// engine. +func (o *OperationDefinition) RequiresParamObject() bool { + return len(o.Params()) > 0 +} + +// HasBody is called by the template engine to determine whether to generate body +// marshaling code on the client. This is true for all body types, whether +// we generate types for them. +func (o *OperationDefinition) HasBody() bool { + return o.Spec.RequestBody != nil +} + +// SummaryAsComment returns the Operations summary as a multi line comment +func (o *OperationDefinition) SummaryAsComment() string { + if o.Summary == "" { + return "" + } + trimmed := strings.TrimSuffix(o.Summary, "\n") + parts := strings.Split(trimmed, "\n") + for i, p := range parts { + parts[i] = "// " + p + } + return strings.Join(parts, "\n") +} + +// GetResponseTypeDefinitions produces a list of type definitions for a given Operation for the response +// types which we know how to parse. These will be turned into fields on a +// response object for automatic deserialization of responses in the generated +// Client code. See "client-with-responses.tmpl". +func (o *OperationDefinition) GetResponseTypeDefinitions() ([]ResponseTypeDefinition, error) { + var tds []ResponseTypeDefinition + + if o.Spec == nil || o.Spec.Responses == nil { + return tds, nil + } + + sortedResponsesKeys := SortedMapKeys(o.Spec.Responses.Map()) + for _, responseName := range sortedResponsesKeys { + responseRef := o.Spec.Responses.Value(responseName) + + // We can only generate a type if we have a value: + if responseRef.Value != nil { + jsonCount := 0 + for mediaType := range responseRef.Value.Content { + if util.IsMediaTypeJson(mediaType) { + jsonCount++ + } + } + + sortedContentKeys := SortedMapKeys(responseRef.Value.Content) + for _, contentTypeName := range sortedContentKeys { + contentType := responseRef.Value.Content[contentTypeName] + // We can only generate a type if we have a schema: + if contentType.Schema != nil { + responseSchema, err := GenerateGoSchema(contentType.Schema, []string{o.OperationId, responseName}) + if err != nil { + return nil, fmt.Errorf("unable to determine Go type for %s.%s: %w", o.OperationId, contentTypeName, err) + } + + var typeName string + switch { + + // HAL+JSON: + case StringInArray(contentTypeName, contentTypesHalJSON): + typeName = fmt.Sprintf("HALJSON%s", nameNormalizer(responseName)) + case contentTypeName == "application/json": + // if it's the standard application/json + typeName = fmt.Sprintf("JSON%s", nameNormalizer(responseName)) + // Vendored JSON + case StringInArray(contentTypeName, contentTypesJSON) || util.IsMediaTypeJson(contentTypeName): + baseTypeName := fmt.Sprintf("%s%s", nameNormalizer(contentTypeName), nameNormalizer(responseName)) + + typeName = strings.ReplaceAll(baseTypeName, "Json", "JSON") + // YAML: + case StringInArray(contentTypeName, contentTypesYAML): + typeName = fmt.Sprintf("YAML%s", nameNormalizer(responseName)) + // XML: + case StringInArray(contentTypeName, contentTypesXML): + typeName = fmt.Sprintf("XML%s", nameNormalizer(responseName)) + default: + continue + } + + td := ResponseTypeDefinition{ + TypeDefinition: TypeDefinition{ + TypeName: typeName, + Schema: responseSchema, + }, + ResponseName: responseName, + ContentTypeName: contentTypeName, + AdditionalTypeDefinitions: responseSchema.GetAdditionalTypeDefs(), + } + if IsGoTypeReference(responseRef.Ref) { + refType, err := RefPathToGoType(responseRef.Ref) + if err != nil { + return nil, fmt.Errorf("error dereferencing response Ref: %w", err) + } + if jsonCount > 1 && util.IsMediaTypeJson(contentTypeName) { + refType += mediaTypeToCamelCase(contentTypeName) + } + td.Schema.RefType = refType + } + tds = append(tds, td) + } + } + } + } + return tds, nil +} + +func (o OperationDefinition) HasMaskedRequestContentTypes() bool { + for _, body := range o.Bodies { + if !body.IsFixedContentType() { + return true + } + } + return false +} + +// RequestBodyDefinition describes a request body +type RequestBodyDefinition struct { + // Is this body required, or optional? + Required bool + + // This is the schema describing this body + Schema Schema + + // When we generate type names, we need a Tag for it, such as JSON, in + // which case we will produce "JSONBody". + NameTag string + + // This is the content type corresponding to the body, eg, application/json + ContentType string + + // Whether this is the default body type. For an operation named OpFoo, we + // will not add suffixes like OpFooJSONBody for this one. + Default bool + + // Contains encoding options for formdata + Encoding map[string]RequestBodyEncoding +} + +// TypeDef returns the Go type definition for a request body +func (r RequestBodyDefinition) TypeDef(opID string) *TypeDefinition { + return &TypeDefinition{ + TypeName: fmt.Sprintf("%s%sRequestBody", opID, r.NameTag), + Schema: r.Schema, + } +} + +// CustomType returns whether the body is a custom inline type, or pre-defined. This is +// poorly named, but it's here for compatibility reasons post-refactoring +// TODO: clean up the templates code, it can be simpler. +func (r RequestBodyDefinition) CustomType() bool { + return r.Schema.RefType == "" +} + +// When we're generating multiple functions which relate to request bodies, +// this generates the suffix. Such as Operation DoFoo would be suffixed with +// DoFooWithXMLBody. +func (r RequestBodyDefinition) Suffix() string { + // The default response is never suffixed. + if r.Default { + return "" + } + return "With" + r.NameTag + "Body" +} + +// IsSupportedByClient returns true if we support this content type for client. Otherwise only generic method will ge generated +func (r RequestBodyDefinition) IsSupportedByClient() bool { + return r.IsJSON() || r.NameTag == "Formdata" || r.NameTag == "Text" +} + +// IsJSON returns whether this is a JSON media type, for instance: +// - application/json +// - application/vnd.api+json +// - application/*+json +func (r RequestBodyDefinition) IsJSON() bool { + return util.IsMediaTypeJson(r.ContentType) +} + +// IsSupported returns true if we support this content type for server. Otherwise io.Reader will be generated +func (r RequestBodyDefinition) IsSupported() bool { + return r.NameTag != "" +} + +// IsFixedContentType returns true if content type has fixed content type, i.e. contains no "*" symbol +func (r RequestBodyDefinition) IsFixedContentType() bool { + return !strings.Contains(r.ContentType, "*") +} + +type RequestBodyEncoding struct { + ContentType string + Style string + Explode *bool +} + +type ResponseDefinition struct { + StatusCode string + Description string + Contents []ResponseContentDefinition + Headers []ResponseHeaderDefinition + Ref string +} + +func (r ResponseDefinition) HasFixedStatusCode() bool { + _, err := strconv.Atoi(r.StatusCode) + return err == nil +} + +func (r ResponseDefinition) GoName() string { + return SchemaNameToTypeName(r.StatusCode) +} + +func (r ResponseDefinition) IsRef() bool { + return r.Ref != "" +} + +func (r ResponseDefinition) IsExternalRef() bool { + if !r.IsRef() { + return false + } + return strings.Contains(r.Ref, ".") +} + +type ResponseContentDefinition struct { + // This is the schema describing this content + Schema Schema + + // This is the content type corresponding to the body, eg, application/json + ContentType string + + // When we generate type names, we need a Tag for it, such as JSON, in + // which case we will produce "Response200JSONContent". + NameTag string +} + +// TypeDef returns the Go type definition for a request body +func (r ResponseContentDefinition) TypeDef(opID string, statusCode int) *TypeDefinition { + return &TypeDefinition{ + TypeName: fmt.Sprintf("%s%v%sResponse", opID, statusCode, r.NameTagOrContentType()), + Schema: r.Schema, + } +} + +func (r ResponseContentDefinition) IsSupported() bool { + return r.NameTag != "" +} + +// HasFixedContentType returns true if content type has fixed content type, i.e. contains no "*" symbol +func (r ResponseContentDefinition) HasFixedContentType() bool { + return !strings.Contains(r.ContentType, "*") +} + +func (r ResponseContentDefinition) NameTagOrContentType() string { + if r.NameTag != "" { + return r.NameTag + } + return SchemaNameToTypeName(r.ContentType) +} + +// IsJSON returns whether this is a JSON media type, for instance: +// - application/json +// - application/vnd.api+json +// - application/*+json +func (r ResponseContentDefinition) IsJSON() bool { + return util.IsMediaTypeJson(r.ContentType) +} + +type ResponseHeaderDefinition struct { + Name string + GoName string + Schema Schema +} + +// FilterParameterDefinitionByType returns the subset of the specified parameters which are of the +// specified type. +func FilterParameterDefinitionByType(params []ParameterDefinition, in string) []ParameterDefinition { + var out []ParameterDefinition + for _, p := range params { + if p.In == in { + out = append(out, p) + } + } + return out +} + +// OperationDefinitions returns all operations for a swagger definition. +func OperationDefinitions(swagger *openapi3.T, initialismOverrides bool) ([]OperationDefinition, error) { + var operations []OperationDefinition + + var toCamelCaseFunc func(string) string + if initialismOverrides { + toCamelCaseFunc = ToCamelCaseWithInitialism + } else { + toCamelCaseFunc = ToCamelCase + } + + if swagger == nil || swagger.Paths == nil { + return operations, nil + } + + for _, requestPath := range SortedMapKeys(swagger.Paths.Map()) { + pathItem := swagger.Paths.Value(requestPath) + // These are parameters defined for all methods on a given path. They + // are shared by all methods. + globalParams, err := DescribeParameters(pathItem.Parameters, nil) + if err != nil { + return nil, fmt.Errorf("error describing global parameters for %s: %s", + requestPath, err) + } + + // Each path can have a number of operations, POST, GET, OPTIONS, etc. + pathOps := pathItem.Operations() + for _, opName := range SortedMapKeys(pathOps) { + // NOTE that this is a reference to the existing copy of the Operation, so any modifications will modify our shared copy of the spec + op := pathOps[opName] + + if pathItem.Servers != nil { + op.Servers = &pathItem.Servers + } + // take a copy of operationId, so we don't modify the underlying spec + operationId := op.OperationID + // We rely on OperationID to generate function names, it's required + if operationId == "" { + operationId, err = generateDefaultOperationID(opName, requestPath, toCamelCaseFunc) + if err != nil { + return nil, fmt.Errorf("error generating default OperationID for %s/%s: %s", + opName, requestPath, err) + } + } else { + operationId = nameNormalizer(operationId) + } + operationId = typeNamePrefix(operationId) + operationId + + if !globalState.options.Compatibility.PreserveOriginalOperationIdCasingInEmbeddedSpec { + // update the existing, shared, copy of the spec if we're not wanting to preserve it + op.OperationID = operationId + } + + // These are parameters defined for the specific path method that + // we're iterating over. + localParams, err := DescribeParameters(op.Parameters, []string{operationId + "Params"}) + if err != nil { + return nil, fmt.Errorf("error describing global parameters for %s/%s: %s", + opName, requestPath, err) + } + // All the parameters required by a handler are the union of the + // global parameters and the local parameters. + allParams, err := CombineOperationParameters(globalParams, localParams) + if err != nil { + return nil, err + } + + ensureExternalRefsInParameterDefinitions(&allParams, pathItem.Ref) + + // Order the path parameters to match the order as specified in + // the path, not in the swagger spec, and validate that the parameter + // names match, as downstream code depends on that. + pathParams := FilterParameterDefinitionByType(allParams, "path") + pathParams, err = SortParamsByPath(requestPath, pathParams) + if err != nil { + return nil, err + } + + bodyDefinitions, typeDefinitions, err := GenerateBodyDefinitions(operationId, op.RequestBody) + if err != nil { + return nil, fmt.Errorf("error generating body definitions: %w", err) + } + + ensureExternalRefsInRequestBodyDefinitions(&bodyDefinitions, pathItem.Ref) + + responseDefinitions, err := GenerateResponseDefinitions(operationId, op.Responses.Map()) + if err != nil { + return nil, fmt.Errorf("error generating response definitions: %w", err) + } + + ensureExternalRefsInResponseDefinitions(&responseDefinitions, pathItem.Ref) + + opDef := OperationDefinition{ + PathParams: pathParams, + HeaderParams: FilterParameterDefinitionByType(allParams, "header"), + QueryParams: FilterParameterDefinitionByType(allParams, "query"), + CookieParams: FilterParameterDefinitionByType(allParams, "cookie"), + OperationId: nameNormalizer(operationId), + // Replace newlines in summary. + Summary: op.Summary, + Method: opName, + Path: requestPath, + Spec: op, + Bodies: bodyDefinitions, + Responses: responseDefinitions, + TypeDefinitions: typeDefinitions, + } + + // check for overrides of SecurityDefinitions. + // See: "Step 2. Applying security:" from the spec: + // https://swagger.io/docs/specification/authentication/ + if op.Security != nil { + opDef.SecurityDefinitions = DescribeSecurityDefinition(*op.Security) + } else { + // use global securityDefinitions + // globalSecurityDefinitions contains the top-level securityDefinitions. + // They are the default securityPermissions which are injected into each + // path, except for the case where a path explicitly overrides them. + opDef.SecurityDefinitions = DescribeSecurityDefinition(swagger.Security) + + } + + if op.RequestBody != nil { + opDef.BodyRequired = op.RequestBody.Value.Required + } + + // Generate all the type definitions needed for this operation + opDef.TypeDefinitions = append(opDef.TypeDefinitions, GenerateTypeDefsForOperation(opDef)...) + + operations = append(operations, opDef) + } + } + return operations, nil +} + +func generateDefaultOperationID(opName string, requestPath string, toCamelCaseFunc func(string) string) (string, error) { + var operationId = strings.ToLower(opName) + + if opName == "" { + return "", fmt.Errorf("operation name cannot be an empty string") + } + + if requestPath == "" { + return "", fmt.Errorf("request path cannot be an empty string") + } + + for _, part := range strings.Split(requestPath, "/") { + if part != "" { + operationId = operationId + "-" + part + } + } + + return nameNormalizer(operationId), nil +} + +// GenerateBodyDefinitions turns the Swagger body definitions into a list of our body +// definitions which will be used for code generation. +func GenerateBodyDefinitions(operationID string, bodyOrRef *openapi3.RequestBodyRef) ([]RequestBodyDefinition, []TypeDefinition, error) { + if bodyOrRef == nil { + return nil, nil, nil + } + body := bodyOrRef.Value + + var bodyDefinitions []RequestBodyDefinition + var typeDefinitions []TypeDefinition + + for _, contentType := range SortedMapKeys(body.Content) { + content := body.Content[contentType] + var tag string + var defaultBody bool + + switch { + case contentType == "application/json": + tag = "JSON" + defaultBody = true + case util.IsMediaTypeJson(contentType): + tag = mediaTypeToCamelCase(contentType) + case strings.HasPrefix(contentType, "multipart/"): + tag = "Multipart" + case contentType == "application/x-www-form-urlencoded": + tag = "Formdata" + case contentType == "text/plain": + tag = "Text" + default: + bd := RequestBodyDefinition{ + Required: body.Required, + ContentType: contentType, + } + bodyDefinitions = append(bodyDefinitions, bd) + continue + } + + bodyTypeName := operationID + tag + "Body" + bodySchema, err := GenerateGoSchema(content.Schema, []string{bodyTypeName}) + if err != nil { + return nil, nil, fmt.Errorf("error generating request body definition: %w", err) + } + + // If the body is a pre-defined type + if content.Schema != nil && IsGoTypeReference(content.Schema.Ref) { + // Convert the reference path to Go type + refType, err := RefPathToGoType(content.Schema.Ref) + if err != nil { + return nil, nil, fmt.Errorf("error turning reference (%s) into a Go type: %w", content.Schema.Ref, err) + } + bodySchema.RefType = refType + } + + // If the request has a body, but it's not a user defined + // type under #/components, we'll define a type for it, so + // that we have an easy to use type for marshaling. + if bodySchema.RefType == "" { + if contentType == "application/x-www-form-urlencoded" { + // Apply the appropriate structure tag if the request + // schema was defined under the operations' section. + for i := range bodySchema.Properties { + bodySchema.Properties[i].NeedsFormTag = true + } + + // Regenerate the Golang struct adding the new form tag. + bodySchema.GoType = GenStructFromSchema(bodySchema) + } + + td := TypeDefinition{ + TypeName: bodyTypeName, + Schema: bodySchema, + } + typeDefinitions = append(typeDefinitions, td) + // The body schema now is a reference to a type + bodySchema.RefType = bodyTypeName + } + + bd := RequestBodyDefinition{ + Required: body.Required, + Schema: bodySchema, + NameTag: tag, + ContentType: contentType, + Default: defaultBody, + } + + if len(content.Encoding) != 0 { + bd.Encoding = make(map[string]RequestBodyEncoding) + for k, v := range content.Encoding { + encoding := RequestBodyEncoding{ContentType: v.ContentType, Style: v.Style, Explode: v.Explode} + bd.Encoding[k] = encoding + } + } + + bodyDefinitions = append(bodyDefinitions, bd) + } + sort.Slice(bodyDefinitions, func(i, j int) bool { + return bodyDefinitions[i].ContentType < bodyDefinitions[j].ContentType + }) + return bodyDefinitions, typeDefinitions, nil +} + +func GenerateResponseDefinitions(operationID string, responses map[string]*openapi3.ResponseRef) ([]ResponseDefinition, error) { + var responseDefinitions []ResponseDefinition + // do not let multiple status codes ref to same response, it will break the type switch + refSet := make(map[string]struct{}) + + for _, statusCode := range SortedMapKeys(responses) { + responseOrRef := responses[statusCode] + if responseOrRef == nil { + continue + } + response := responseOrRef.Value + + var responseContentDefinitions []ResponseContentDefinition + + for _, contentType := range SortedMapKeys(response.Content) { + content := response.Content[contentType] + var tag string + switch { + case contentType == "application/json": + tag = "JSON" + case util.IsMediaTypeJson(contentType): + tag = mediaTypeToCamelCase(contentType) + case contentType == "application/x-www-form-urlencoded": + tag = "Formdata" + case strings.HasPrefix(contentType, "multipart/"): + tag = "Multipart" + case contentType == "text/plain": + tag = "Text" + default: + rcd := ResponseContentDefinition{ + ContentType: contentType, + } + responseContentDefinitions = append(responseContentDefinitions, rcd) + continue + } + + responseTypeName := operationID + statusCode + tag + "Response" + contentSchema, err := GenerateGoSchema(content.Schema, []string{responseTypeName}) + if err != nil { + return nil, fmt.Errorf("error generating request body definition: %w", err) + } + + rcd := ResponseContentDefinition{ + ContentType: contentType, + NameTag: tag, + Schema: contentSchema, + } + + responseContentDefinitions = append(responseContentDefinitions, rcd) + } + + var responseHeaderDefinitions []ResponseHeaderDefinition + for _, headerName := range SortedMapKeys(response.Headers) { + header := response.Headers[headerName] + contentSchema, err := GenerateGoSchema(header.Value.Schema, []string{}) + if err != nil { + return nil, fmt.Errorf("error generating response header definition: %w", err) + } + headerDefinition := ResponseHeaderDefinition{Name: headerName, GoName: SchemaNameToTypeName(headerName), Schema: contentSchema} + responseHeaderDefinitions = append(responseHeaderDefinitions, headerDefinition) + } + + rd := ResponseDefinition{ + StatusCode: statusCode, + Contents: responseContentDefinitions, + Headers: responseHeaderDefinitions, + } + if response.Description != nil { + rd.Description = *response.Description + } + if IsGoTypeReference(responseOrRef.Ref) { + // Convert the reference path to Go type + refType, err := RefPathToGoType(responseOrRef.Ref) + if err != nil { + return nil, fmt.Errorf("error turning reference (%s) into a Go type: %w", responseOrRef.Ref, err) + } + // Check if this ref is already used by another response definition. If not use the ref + // If we let multiple response definitions alias to same response it will break the type switch + // so only the first response will use the ref, other will generate new structs + if _, ok := refSet[refType]; !ok { + rd.Ref = refType + refSet[refType] = struct{}{} + } + } + responseDefinitions = append(responseDefinitions, rd) + } + + return responseDefinitions, nil +} + +func GenerateTypeDefsForOperation(op OperationDefinition) []TypeDefinition { + var typeDefs []TypeDefinition + // Start with the params object itself + if len(op.Params()) != 0 { + typeDefs = append(typeDefs, GenerateParamsTypes(op)...) + } + + // Now, go through all the additional types we need to declare. + for _, param := range op.AllParams() { + typeDefs = append(typeDefs, param.Schema.AdditionalTypes...) + } + + for _, body := range op.Bodies { + typeDefs = append(typeDefs, body.Schema.AdditionalTypes...) + } + return typeDefs +} + +// GenerateParamsTypes defines the schema for a parameters definition object +// which encapsulates all the query, header and cookie parameters for an operation. +func GenerateParamsTypes(op OperationDefinition) []TypeDefinition { + var typeDefs []TypeDefinition + + objectParams := op.QueryParams + objectParams = append(objectParams, op.HeaderParams...) + objectParams = append(objectParams, op.CookieParams...) + + typeName := op.OperationId + "Params" + + s := Schema{} + for _, param := range objectParams { + pSchema := param.Schema + param.Style() + if pSchema.HasAdditionalProperties { + propRefName := strings.Join([]string{typeName, param.GoName()}, "_") + pSchema.RefType = propRefName + typeDefs = append(typeDefs, TypeDefinition{ + TypeName: propRefName, + Schema: param.Schema, + }) + } + prop := Property{ + Description: param.Spec.Description, + JsonFieldName: param.ParamName, + Required: param.Required, + Schema: pSchema, + NeedsFormTag: param.Style() == "form", + Extensions: param.Spec.Extensions, + } + s.Properties = append(s.Properties, prop) + } + + s.Description = op.Spec.Description + s.GoType = GenStructFromSchema(s) + + td := TypeDefinition{ + TypeName: typeName, + Schema: s, + } + return append(typeDefs, td) +} + +// GenerateTypesForOperations generates code for all types produced within operations +func GenerateTypesForOperations(t *template.Template, ops []OperationDefinition) (string, error) { + var buf bytes.Buffer + w := bufio.NewWriter(&buf) + + addTypes, err := GenerateTemplates([]string{"param-types.tmpl", "request-bodies.tmpl"}, t, ops) + if err != nil { + return "", fmt.Errorf("error generating type boilerplate for operations: %w", err) + } + if _, err := w.WriteString(addTypes); err != nil { + return "", fmt.Errorf("error writing boilerplate to buffer: %w", err) + } + + // Generate boiler plate for all additional types. + var td []TypeDefinition + for _, op := range ops { + td = append(td, op.TypeDefinitions...) + } + + addProps, err := GenerateAdditionalPropertyBoilerplate(t, td) + if err != nil { + return "", fmt.Errorf("error generating additional properties boilerplate for operations: %w", err) + } + + if _, err := w.WriteString("\n"); err != nil { + return "", fmt.Errorf("error generating additional properties boilerplate for operations: %w", err) + } + + if _, err := w.WriteString(addProps); err != nil { + return "", fmt.Errorf("error generating additional properties boilerplate for operations: %w", err) + } + + if err = w.Flush(); err != nil { + return "", fmt.Errorf("error flushing output buffer for server interface: %w", err) + } + + return buf.String(), nil +} + +// GenerateIrisServer generates all the go code for the ServerInterface as well as +// all the wrapper functions around our handlers. +func GenerateIrisServer(t *template.Template, operations []OperationDefinition) (string, error) { + return GenerateTemplates([]string{"iris/iris-interface.tmpl", "iris/iris-middleware.tmpl", "iris/iris-handler.tmpl"}, t, operations) +} + +// GenerateChiServer generates all the go code for the ServerInterface as well as +// all the wrapper functions around our handlers. +func GenerateChiServer(t *template.Template, operations []OperationDefinition) (string, error) { + return GenerateTemplates([]string{"chi/chi-interface.tmpl", "chi/chi-middleware.tmpl", "chi/chi-handler.tmpl"}, t, operations) +} + +// GenerateFiberServer generates all the go code for the ServerInterface as well as +// all the wrapper functions around our handlers. +func GenerateFiberServer(t *template.Template, operations []OperationDefinition) (string, error) { + return GenerateTemplates([]string{"fiber/fiber-interface.tmpl", "fiber/fiber-middleware.tmpl", "fiber/fiber-handler.tmpl"}, t, operations) +} + +// GenerateEchoServer generates all the go code for the ServerInterface as well as +// all the wrapper functions around our handlers. +func GenerateEchoServer(t *template.Template, operations []OperationDefinition) (string, error) { + return GenerateTemplates([]string{"echo/echo-interface.tmpl", "echo/echo-wrappers.tmpl", "echo/echo-register.tmpl"}, t, operations) +} + +// GenerateGinServer generates all the go code for the ServerInterface as well as +// all the wrapper functions around our handlers. +func GenerateGinServer(t *template.Template, operations []OperationDefinition) (string, error) { + return GenerateTemplates([]string{"gin/gin-interface.tmpl", "gin/gin-wrappers.tmpl", "gin/gin-register.tmpl"}, t, operations) +} + +// GenerateGorillaServer generates all the go code for the ServerInterface as well as +// all the wrapper functions around our handlers. +func GenerateGorillaServer(t *template.Template, operations []OperationDefinition) (string, error) { + return GenerateTemplates([]string{"gorilla/gorilla-interface.tmpl", "gorilla/gorilla-middleware.tmpl", "gorilla/gorilla-register.tmpl"}, t, operations) +} + +// GenerateStdHTTPServer generates all the go code for the ServerInterface as well as +// all the wrapper functions around our handlers. +func GenerateStdHTTPServer(t *template.Template, operations []OperationDefinition) (string, error) { + return GenerateTemplates([]string{"stdhttp/std-http-interface.tmpl", "stdhttp/std-http-middleware.tmpl", "stdhttp/std-http-handler.tmpl"}, t, operations) +} + +func GenerateStrictServer(t *template.Template, operations []OperationDefinition, opts Configuration) (string, error) { + + var templates []string + + if opts.Generate.ChiServer || opts.Generate.GorillaServer || opts.Generate.StdHTTPServer { + templates = append(templates, "strict/strict-interface.tmpl", "strict/strict-http.tmpl") + } + if opts.Generate.EchoServer { + templates = append(templates, "strict/strict-interface.tmpl", "strict/strict-echo.tmpl") + } + if opts.Generate.GinServer { + templates = append(templates, "strict/strict-interface.tmpl", "strict/strict-gin.tmpl") + } + if opts.Generate.FiberServer { + templates = append(templates, "strict/strict-fiber-interface.tmpl", "strict/strict-fiber.tmpl") + } + if opts.Generate.IrisServer { + templates = append(templates, "strict/strict-iris-interface.tmpl", "strict/strict-iris.tmpl") + } + + return GenerateTemplates(templates, t, operations) +} + +func GenerateStrictResponses(t *template.Template, responses []ResponseDefinition) (string, error) { + return GenerateTemplates([]string{"strict/strict-responses.tmpl"}, t, responses) +} + +// GenerateClient uses the template engine to generate the function which registers our wrappers +// as Echo path handlers. +func GenerateClient(t *template.Template, ops []OperationDefinition) (string, error) { + return GenerateTemplates([]string{"client.tmpl"}, t, ops) +} + +// GenerateClientWithResponses generates a client which extends the basic client which does response +// unmarshaling. +func GenerateClientWithResponses(t *template.Template, ops []OperationDefinition) (string, error) { + return GenerateTemplates([]string{"client-with-responses.tmpl"}, t, ops) +} + +// GenerateTemplates used to generate templates +func GenerateTemplates(templates []string, t *template.Template, ops interface{}) (string, error) { + var generatedTemplates []string + for _, tmpl := range templates { + var buf bytes.Buffer + w := bufio.NewWriter(&buf) + + if err := t.ExecuteTemplate(w, tmpl, ops); err != nil { + return "", fmt.Errorf("error generating %s: %s", tmpl, err) + } + if err := w.Flush(); err != nil { + return "", fmt.Errorf("error flushing output buffer for %s: %s", tmpl, err) + } + generatedTemplates = append(generatedTemplates, buf.String()) + } + + return strings.Join(generatedTemplates, "\n"), nil +} + +// CombineOperationParameters combines the Parameters defined at a global level (Parameters defined for all methods on a given path) with the Parameters defined at a local level (Parameters defined for a specific path), preferring the locally defined parameter over the global one +func CombineOperationParameters(globalParams []ParameterDefinition, localParams []ParameterDefinition) ([]ParameterDefinition, error) { + allParams := make([]ParameterDefinition, 0, len(globalParams)+len(localParams)) + dupCheck := make(map[string]map[string]string) + for _, p := range localParams { + if dupCheck[p.In] == nil { + dupCheck[p.In] = make(map[string]string) + } + if _, exist := dupCheck[p.In][p.ParamName]; !exist { + dupCheck[p.In][p.ParamName] = "local" + allParams = append(allParams, p) + } else { + return nil, fmt.Errorf("duplicate local parameter %s/%s", p.In, p.ParamName) + } + } + for _, p := range globalParams { + if dupCheck[p.In] == nil { + dupCheck[p.In] = make(map[string]string) + } + if t, exist := dupCheck[p.In][p.ParamName]; !exist { + dupCheck[p.In][p.ParamName] = "global" + allParams = append(allParams, p) + } else if t == "global" { + return nil, fmt.Errorf("duplicate global parameter %s/%s", p.In, p.ParamName) + } + } + + return allParams, nil +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/prune.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/prune.go new file mode 100644 index 0000000000..0d3a889747 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/prune.go @@ -0,0 +1,489 @@ +package codegen + +import ( + "fmt" + + "github.com/getkin/kin-openapi/openapi3" +) + +func stringInSlice(a string, list []string) bool { + for _, b := range list { + if b == a { + return true + } + } + return false +} + +type RefWrapper struct { + Ref string + HasValue bool + SourceRef interface{} +} + +func walkSwagger(swagger *openapi3.T, doFn func(RefWrapper) (bool, error)) error { + if swagger == nil || swagger.Paths == nil { + return nil + } + + for _, p := range swagger.Paths.Map() { + for _, param := range p.Parameters { + _ = walkParameterRef(param, doFn) + } + for _, op := range p.Operations() { + _ = walkOperation(op, doFn) + } + } + + _ = walkComponents(swagger.Components, doFn) + + return nil +} + +func walkOperation(op *openapi3.Operation, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if op == nil { + return nil + } + + for _, param := range op.Parameters { + _ = walkParameterRef(param, doFn) + } + + _ = walkRequestBodyRef(op.RequestBody, doFn) + + if op.Responses != nil { + for _, response := range op.Responses.Map() { + _ = walkResponseRef(response, doFn) + } + } + + for _, callback := range op.Callbacks { + _ = walkCallbackRef(callback, doFn) + } + + return nil +} + +func walkComponents(components *openapi3.Components, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if components == nil { + return nil + } + + for _, schema := range components.Schemas { + _ = walkSchemaRef(schema, doFn) + } + + for _, param := range components.Parameters { + _ = walkParameterRef(param, doFn) + } + + for _, header := range components.Headers { + _ = walkHeaderRef(header, doFn) + } + + for _, requestBody := range components.RequestBodies { + _ = walkRequestBodyRef(requestBody, doFn) + } + + for _, response := range components.Responses { + _ = walkResponseRef(response, doFn) + } + + for _, securityScheme := range components.SecuritySchemes { + _ = walkSecuritySchemeRef(securityScheme, doFn) + } + + for _, example := range components.Examples { + _ = walkExampleRef(example, doFn) + } + + for _, link := range components.Links { + _ = walkLinkRef(link, doFn) + } + + for _, callback := range components.Callbacks { + _ = walkCallbackRef(callback, doFn) + } + + return nil +} + +func walkSchemaRef(ref *openapi3.SchemaRef, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if ref == nil { + return nil + } + refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref} + shouldContinue, err := doFn(refWrapper) + if err != nil { + return err + } + if !shouldContinue { + return nil + } + if ref.Value == nil { + return nil + } + + for _, ref := range ref.Value.OneOf { + _ = walkSchemaRef(ref, doFn) + } + + for _, ref := range ref.Value.AnyOf { + _ = walkSchemaRef(ref, doFn) + } + + for _, ref := range ref.Value.AllOf { + _ = walkSchemaRef(ref, doFn) + } + + _ = walkSchemaRef(ref.Value.Not, doFn) + _ = walkSchemaRef(ref.Value.Items, doFn) + + for _, ref := range ref.Value.Properties { + _ = walkSchemaRef(ref, doFn) + } + + _ = walkSchemaRef(ref.Value.AdditionalProperties.Schema, doFn) + + return nil +} + +func walkParameterRef(ref *openapi3.ParameterRef, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if ref == nil { + return nil + } + refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref} + shouldContinue, err := doFn(refWrapper) + if err != nil { + return err + } + if !shouldContinue { + return nil + } + if ref.Value == nil { + return nil + } + + _ = walkSchemaRef(ref.Value.Schema, doFn) + + for _, example := range ref.Value.Examples { + _ = walkExampleRef(example, doFn) + } + + for _, mediaType := range ref.Value.Content { + if mediaType == nil { + continue + } + _ = walkSchemaRef(mediaType.Schema, doFn) + + for _, example := range mediaType.Examples { + _ = walkExampleRef(example, doFn) + } + } + + return nil +} + +func walkRequestBodyRef(ref *openapi3.RequestBodyRef, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if ref == nil { + return nil + } + refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref} + shouldContinue, err := doFn(refWrapper) + if err != nil { + return err + } + if !shouldContinue { + return nil + } + if ref.Value == nil { + return nil + } + + for _, mediaType := range ref.Value.Content { + if mediaType == nil { + continue + } + _ = walkSchemaRef(mediaType.Schema, doFn) + + for _, example := range mediaType.Examples { + _ = walkExampleRef(example, doFn) + } + } + + return nil +} + +func walkResponseRef(ref *openapi3.ResponseRef, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if ref == nil { + return nil + } + refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref} + shouldContinue, err := doFn(refWrapper) + if err != nil { + return err + } + if !shouldContinue { + return nil + } + if ref.Value == nil { + return nil + } + + for _, header := range ref.Value.Headers { + _ = walkHeaderRef(header, doFn) + } + + for _, mediaType := range ref.Value.Content { + if mediaType == nil { + continue + } + _ = walkSchemaRef(mediaType.Schema, doFn) + + for _, example := range mediaType.Examples { + _ = walkExampleRef(example, doFn) + } + } + + for _, link := range ref.Value.Links { + _ = walkLinkRef(link, doFn) + } + + return nil +} + +func walkCallbackRef(ref *openapi3.CallbackRef, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if ref == nil { + return nil + } + refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref} + shouldContinue, err := doFn(refWrapper) + if err != nil { + return err + } + if !shouldContinue { + return nil + } + if ref.Value == nil { + return nil + } + + for _, pathItem := range ref.Value.Map() { + for _, parameter := range pathItem.Parameters { + _ = walkParameterRef(parameter, doFn) + } + _ = walkOperation(pathItem.Connect, doFn) + _ = walkOperation(pathItem.Delete, doFn) + _ = walkOperation(pathItem.Get, doFn) + _ = walkOperation(pathItem.Head, doFn) + _ = walkOperation(pathItem.Options, doFn) + _ = walkOperation(pathItem.Patch, doFn) + _ = walkOperation(pathItem.Post, doFn) + _ = walkOperation(pathItem.Put, doFn) + _ = walkOperation(pathItem.Trace, doFn) + } + + return nil +} + +func walkHeaderRef(ref *openapi3.HeaderRef, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if ref == nil { + return nil + } + refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref} + shouldContinue, err := doFn(refWrapper) + if err != nil { + return err + } + if !shouldContinue { + return nil + } + if ref.Value == nil { + return nil + } + + _ = walkSchemaRef(ref.Value.Schema, doFn) + + return nil +} + +func walkSecuritySchemeRef(ref *openapi3.SecuritySchemeRef, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if ref == nil { + return nil + } + refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref} + shouldContinue, err := doFn(refWrapper) + if err != nil { + return err + } + if !shouldContinue { + return nil + } + if ref.Value == nil { + return nil + } + + // NOTE: `SecuritySchemeRef`s don't contain any children that can contain refs + + return nil +} + +func walkLinkRef(ref *openapi3.LinkRef, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if ref == nil { + return nil + } + refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref} + shouldContinue, err := doFn(refWrapper) + if err != nil { + return err + } + if !shouldContinue { + return nil + } + if ref.Value == nil { + return nil + } + + return nil +} + +func walkExampleRef(ref *openapi3.ExampleRef, doFn func(RefWrapper) (bool, error)) error { + // Not a valid ref, ignore it and continue + if ref == nil { + return nil + } + refWrapper := RefWrapper{Ref: ref.Ref, HasValue: ref.Value != nil, SourceRef: ref} + shouldContinue, err := doFn(refWrapper) + if err != nil { + return err + } + if !shouldContinue { + return nil + } + if ref.Value == nil { + return nil + } + + // NOTE: `ExampleRef`s don't contain any children that can contain refs + + return nil +} + +func findComponentRefs(swagger *openapi3.T) []string { + refs := []string{} + + _ = walkSwagger(swagger, func(ref RefWrapper) (bool, error) { + if ref.Ref != "" { + refs = append(refs, ref.Ref) + return false, nil + } + return true, nil + }) + + return refs +} + +func removeOrphanedComponents(swagger *openapi3.T, refs []string) int { + if swagger.Components == nil { + return 0 + } + + countRemoved := 0 + + for key := range swagger.Components.Schemas { + ref := fmt.Sprintf("#/components/schemas/%s", key) + if !stringInSlice(ref, refs) { + countRemoved++ + delete(swagger.Components.Schemas, key) + } + } + + for key := range swagger.Components.Parameters { + ref := fmt.Sprintf("#/components/parameters/%s", key) + if !stringInSlice(ref, refs) { + countRemoved++ + delete(swagger.Components.Parameters, key) + } + } + + // securitySchemes are an exception. definitions in securitySchemes + // are referenced directly by name. and not by $ref + + // for key, _ := range swagger.Components.SecuritySchemes { + // ref := fmt.Sprintf("#/components/securitySchemes/%s", key) + // if !stringInSlice(ref, refs) { + // countRemoved++ + // delete(swagger.Components.SecuritySchemes, key) + // } + // } + + for key := range swagger.Components.RequestBodies { + ref := fmt.Sprintf("#/components/requestBodies/%s", key) + if !stringInSlice(ref, refs) { + countRemoved++ + delete(swagger.Components.RequestBodies, key) + } + } + + for key := range swagger.Components.Responses { + ref := fmt.Sprintf("#/components/responses/%s", key) + if !stringInSlice(ref, refs) { + countRemoved++ + delete(swagger.Components.Responses, key) + } + } + + for key := range swagger.Components.Headers { + ref := fmt.Sprintf("#/components/headers/%s", key) + if !stringInSlice(ref, refs) { + countRemoved++ + delete(swagger.Components.Headers, key) + } + } + + for key := range swagger.Components.Examples { + ref := fmt.Sprintf("#/components/examples/%s", key) + if !stringInSlice(ref, refs) { + countRemoved++ + delete(swagger.Components.Examples, key) + } + } + + for key := range swagger.Components.Links { + ref := fmt.Sprintf("#/components/links/%s", key) + if !stringInSlice(ref, refs) { + countRemoved++ + delete(swagger.Components.Links, key) + } + } + + for key := range swagger.Components.Callbacks { + ref := fmt.Sprintf("#/components/callbacks/%s", key) + if !stringInSlice(ref, refs) { + countRemoved++ + delete(swagger.Components.Callbacks, key) + } + } + + return countRemoved +} + +func pruneUnusedComponents(swagger *openapi3.T) { + for { + refs := findComponentRefs(swagger) + countRemoved := removeOrphanedComponents(swagger, refs) + if countRemoved < 1 { + break + } + } +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/schema.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/schema.go new file mode 100644 index 0000000000..d2e64f9805 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/schema.go @@ -0,0 +1,915 @@ +package codegen + +import ( + "errors" + "fmt" + "strings" + + "github.com/getkin/kin-openapi/openapi3" +) + +// Schema describes an OpenAPI schema, with lots of helper fields to use in the +// templating engine. +type Schema struct { + GoType string // The Go type needed to represent the schema + RefType string // If the type has a type name, this is set + + ArrayType *Schema // The schema of array element + + EnumValues map[string]string // Enum values + + Properties []Property // For an object, the fields with names + HasAdditionalProperties bool // Whether we support additional properties + AdditionalPropertiesType *Schema // And if we do, their type + AdditionalTypes []TypeDefinition // We may need to generate auxiliary helper types, stored here + + SkipOptionalPointer bool // Some types don't need a * in front when they're optional + + Description string // The description of the element + + UnionElements []UnionElement // Possible elements of oneOf/anyOf union + Discriminator *Discriminator // Describes which value is stored in a union + + // If this is set, the schema will declare a type via alias, eg, + // `type Foo = bool`. If this is not set, we will define this type via + // type definition `type Foo bool` + // + // Can be overriden by the OutputOptions#DisableTypeAliasesForType field + DefineViaAlias bool + + // The original OpenAPIv3 Schema. + OAPISchema *openapi3.Schema +} + +func (s Schema) IsRef() bool { + return s.RefType != "" +} + +func (s Schema) IsExternalRef() bool { + if !s.IsRef() { + return false + } + return strings.Contains(s.RefType, ".") +} + +func (s Schema) TypeDecl() string { + if s.IsRef() { + return s.RefType + } + return s.GoType +} + +// AddProperty adds a new property to the current Schema, and returns an error +// if it collides. Two identical fields will not collide, but two properties by +// the same name, but different definition, will collide. It's safe to merge the +// fields of two schemas with overlapping properties if those properties are +// identical. +func (s *Schema) AddProperty(p Property) error { + // Scan all existing properties for a conflict + for _, e := range s.Properties { + if e.JsonFieldName == p.JsonFieldName && !PropertiesEqual(e, p) { + return fmt.Errorf("property '%s' already exists with a different type", e.JsonFieldName) + } + } + s.Properties = append(s.Properties, p) + return nil +} + +func (s Schema) GetAdditionalTypeDefs() []TypeDefinition { + return s.AdditionalTypes +} + +type Property struct { + Description string + JsonFieldName string + Schema Schema + Required bool + Nullable bool + ReadOnly bool + WriteOnly bool + NeedsFormTag bool + Extensions map[string]interface{} + Deprecated bool +} + +func (p Property) GoFieldName() string { + goFieldName := p.JsonFieldName + if extension, ok := p.Extensions[extGoName]; ok { + if extGoFieldName, err := extParseGoFieldName(extension); err == nil { + goFieldName = extGoFieldName + } + } + + if globalState.options.Compatibility.AllowUnexportedStructFieldNames { + if extension, ok := p.Extensions[extOapiCodegenOnlyHonourGoName]; ok { + if extOapiCodegenOnlyHonourGoName, err := extParseOapiCodegenOnlyHonourGoName(extension); err == nil { + if extOapiCodegenOnlyHonourGoName { + return goFieldName + } + } + } + } + + return SchemaNameToTypeName(goFieldName) +} + +func (p Property) GoTypeDef() string { + typeDef := p.Schema.TypeDecl() + if globalState.options.OutputOptions.NullableType && p.Nullable { + return "nullable.Nullable[" + typeDef + "]" + } + if !p.Schema.SkipOptionalPointer && + (!p.Required || p.Nullable || + (p.ReadOnly && (!p.Required || !globalState.options.Compatibility.DisableRequiredReadOnlyAsPointer)) || + p.WriteOnly) { + + typeDef = "*" + typeDef + } + return typeDef +} + +// HasOptionalPointer indicates whether the generated property has an optional pointer associated with it. +// This takes into account the `x-go-type-skip-optional-pointer` extension, allowing a parameter definition to control whether the pointer should be skipped. +func (p Property) HasOptionalPointer() bool { + return p.Required == false && p.Schema.SkipOptionalPointer == false //nolint:staticcheck +} + +// EnumDefinition holds type information for enum +type EnumDefinition struct { + // Schema is the scheme of a type which has a list of enum values, eg, the + // "container" of the enum. + Schema Schema + // TypeName is the name of the enum's type, usually aliased from something. + TypeName string + // ValueWrapper wraps the value. It's used to conditionally apply quotes + // around strings. + ValueWrapper string + // PrefixTypeName determines if the enum value is prefixed with its TypeName. + // This is set to true when this enum conflicts with another in terms of + // TypeNames or when explicitly requested via the + // `compatibility.always-prefix-enum-values` option. + PrefixTypeName bool +} + +// GetValues generates enum names in a way to minimize global conflicts +func (e *EnumDefinition) GetValues() map[string]string { + // in case there are no conflicts, it's safe to use the values as-is + if !e.PrefixTypeName { + return e.Schema.EnumValues + } + // If we do have conflicts, we will prefix the enum's typename to the values. + newValues := make(map[string]string, len(e.Schema.EnumValues)) + for k, v := range e.Schema.EnumValues { + newName := e.TypeName + UppercaseFirstCharacter(k) + newValues[newName] = v + } + return newValues +} + +type Constants struct { + // SecuritySchemeProviderNames holds all provider names for security schemes. + SecuritySchemeProviderNames []string + // EnumDefinitions holds type and value information for all enums + EnumDefinitions []EnumDefinition +} + +// TypeDefinition describes a Go type definition in generated code. +// +// Let's use this example schema: +// components: +// +// schemas: +// Person: +// type: object +// properties: +// name: +// type: string +type TypeDefinition struct { + // The name of the type, eg, type <...> Person + TypeName string + + // The name of the corresponding JSON description, as it will sometimes + // differ due to invalid characters. + JsonName string + + // This is the Schema wrapper is used to populate the type description + Schema Schema +} + +// ResponseTypeDefinition is an extension of TypeDefinition, specifically for +// response unmarshaling in ClientWithResponses. +type ResponseTypeDefinition struct { + TypeDefinition + // The content type name where this is used, eg, application/json + ContentTypeName string + + // The type name of a response model. + ResponseName string + + AdditionalTypeDefinitions []TypeDefinition +} + +func (t *TypeDefinition) IsAlias() bool { + return !globalState.options.Compatibility.OldAliasing && t.Schema.DefineViaAlias +} + +type Discriminator struct { + // maps discriminator value to go type + Mapping map[string]string + + // JSON property name that holds the discriminator + Property string +} + +func (d *Discriminator) JSONTag() string { + return fmt.Sprintf("`json:\"%s\"`", d.Property) +} + +func (d *Discriminator) PropertyName() string { + return SchemaNameToTypeName(d.Property) +} + +// UnionElement describe union element, based on prefix externalRef\d+ and real ref name from external schema. +type UnionElement string + +// String returns externalRef\d+ and real ref name from external schema, like externalRef0.SomeType. +func (u UnionElement) String() string { + return string(u) +} + +// Method generate union method name for template functions `As/From/Merge`. +func (u UnionElement) Method() string { + var method string + for _, part := range strings.Split(string(u), `.`) { + method += UppercaseFirstCharacter(part) + } + return method +} + +func PropertiesEqual(a, b Property) bool { + return a.JsonFieldName == b.JsonFieldName && a.Schema.TypeDecl() == b.Schema.TypeDecl() && a.Required == b.Required +} + +func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) { + // Add a fallback value in case the sref is nil. + // i.e. the parent schema defines a type:array, but the array has + // no items defined. Therefore, we have at least valid Go-Code. + if sref == nil { + return Schema{GoType: "interface{}"}, nil + } + + schema := sref.Value + + // If Ref is set on the SchemaRef, it means that this type is actually a reference to + // another type. We're not de-referencing, so simply use the referenced type. + if IsGoTypeReference(sref.Ref) { + // Convert the reference path to Go type + refType, err := RefPathToGoType(sref.Ref) + if err != nil { + return Schema{}, fmt.Errorf("error turning reference (%s) into a Go type: %s", + sref.Ref, err) + } + return Schema{ + GoType: refType, + Description: schema.Description, + DefineViaAlias: true, + OAPISchema: schema, + }, nil + } + + outSchema := Schema{ + Description: schema.Description, + OAPISchema: schema, + // NOTE that SkipOptionalPointer will be defaulted to the global value, but can be overridden on a per-type/-field basis + SkipOptionalPointer: globalState.options.OutputOptions.PreferSkipOptionalPointer, + } + + // AllOf is interesting, and useful. It's the union of a number of other + // schemas. A common usage is to create a union of an object with an ID, + // so that in a RESTful paradigm, the Create operation can return + // (object, id), so that other operations can refer to (id) + if schema.AllOf != nil { + mergedSchema, err := MergeSchemas(schema.AllOf, path) + if err != nil { + return Schema{}, fmt.Errorf("error merging schemas: %w", err) + } + mergedSchema.OAPISchema = schema + return mergedSchema, nil + } + + // Check x-go-type-skip-optional-pointer, which will override if the type + // should be a pointer or not when the field is optional. + if extension, ok := schema.Extensions[extPropGoTypeSkipOptionalPointer]; ok { + skipOptionalPointer, err := extParsePropGoTypeSkipOptionalPointer(extension) + if err != nil { + return outSchema, fmt.Errorf("invalid value for %q: %w", extPropGoTypeSkipOptionalPointer, err) + } + outSchema.SkipOptionalPointer = skipOptionalPointer + } + + // Check x-go-type, which will completely override the definition of this + // schema with the provided type. + if extension, ok := schema.Extensions[extPropGoType]; ok { + typeName, err := extTypeName(extension) + if err != nil { + return outSchema, fmt.Errorf("invalid value for %q: %w", extPropGoType, err) + } + outSchema.GoType = typeName + outSchema.DefineViaAlias = true + + return outSchema, nil + } + + // Schema type and format, eg. string / binary + t := schema.Type + // Handle objects and empty schemas first as a special case + if t.Slice() == nil || t.Is("object") { + var outType string + + if len(schema.Properties) == 0 && !SchemaHasAdditionalProperties(schema) && schema.AnyOf == nil && schema.OneOf == nil { + // If the object has no properties or additional properties, we + // have some special cases for its type. + if t.Is("object") { + // We have an object with no properties. This is a generic object + // expressed as a map. + outType = "map[string]interface{}" + setSkipOptionalPointerForContainerType(&outSchema) + } else { // t == "" + // If we don't even have the object designator, we're a completely + // generic type. + outType = "interface{}" + // this should never have an "optional pointer", as it doesn't make sense to be a `*interface{}` + outSchema.SkipOptionalPointer = true + } + outSchema.GoType = outType + outSchema.DefineViaAlias = true + } else { + // When we define an object, we want it to be a type definition, + // not a type alias, eg, "type Foo struct {...}" + outSchema.DefineViaAlias = false + + // If the schema has additional properties, we need to special case + // a lot of behaviors. + outSchema.HasAdditionalProperties = SchemaHasAdditionalProperties(schema) + + // Until we have a concrete additional properties type, we default to + // any schema. + outSchema.AdditionalPropertiesType = &Schema{ + GoType: "interface{}", + } + + // If additional properties are defined, we will override the default + // above with the specific definition. + if schema.AdditionalProperties.Schema != nil { + additionalSchema, err := GenerateGoSchema(schema.AdditionalProperties.Schema, path) + if err != nil { + return Schema{}, fmt.Errorf("error generating type for additional properties: %w", err) + } + if additionalSchema.HasAdditionalProperties || len(additionalSchema.UnionElements) != 0 { + // If we have fields present which have additional properties or union values, + // but are not a pre-defined type, we need to define a type + // for them, which will be based on the field names we followed + // to get to the type. + typeName := PathToTypeName(append(path, "AdditionalProperties")) + + typeDef := TypeDefinition{ + TypeName: typeName, + JsonName: strings.Join(append(path, "AdditionalProperties"), "."), + Schema: additionalSchema, + } + additionalSchema.RefType = typeName + additionalSchema.AdditionalTypes = append(additionalSchema.AdditionalTypes, typeDef) + } + outSchema.AdditionalPropertiesType = &additionalSchema + outSchema.AdditionalTypes = append(outSchema.AdditionalTypes, additionalSchema.AdditionalTypes...) + } + + // If the schema has no properties, and only additional properties, we will + // early-out here and generate a map[string] instead of an object + // that contains this map. We skip over anyOf/oneOf here because they can + // introduce properties. allOf was handled above. + if !globalState.options.Compatibility.DisableFlattenAdditionalProperties && + len(schema.Properties) == 0 && schema.AnyOf == nil && schema.OneOf == nil { + // We have a dictionary here. Returns the goType to be just a map from + // string to the property type. HasAdditionalProperties=false means + // that we won't generate custom json.Marshaler and json.Unmarshaler functions, + // since we don't need them for a simple map. + outSchema.HasAdditionalProperties = false + outSchema.GoType = fmt.Sprintf("map[string]%s", additionalPropertiesType(outSchema)) + setSkipOptionalPointerForContainerType(&outSchema) + return outSchema, nil + } + + // We've got an object with some properties. + for _, pName := range SortedSchemaKeys(schema.Properties) { + p := schema.Properties[pName] + propertyPath := append(path, pName) + pSchema, err := GenerateGoSchema(p, propertyPath) + if err != nil { + return Schema{}, fmt.Errorf("error generating Go schema for property '%s': %w", pName, err) + } + + required := StringInArray(pName, schema.Required) + + if (pSchema.HasAdditionalProperties || len(pSchema.UnionElements) != 0) && pSchema.RefType == "" { + // If we have fields present which have additional properties or union values, + // but are not a pre-defined type, we need to define a type + // for them, which will be based on the field names we followed + // to get to the type. + typeName := PathToTypeName(propertyPath) + + typeDef := TypeDefinition{ + TypeName: typeName, + JsonName: strings.Join(propertyPath, "."), + Schema: pSchema, + } + pSchema.AdditionalTypes = append(pSchema.AdditionalTypes, typeDef) + + pSchema.RefType = typeName + } + description := "" + if p.Value != nil { + description = p.Value.Description + } + prop := Property{ + JsonFieldName: pName, + Schema: pSchema, + Required: required, + Description: description, + Nullable: p.Value.Nullable, + ReadOnly: p.Value.ReadOnly, + WriteOnly: p.Value.WriteOnly, + Extensions: p.Value.Extensions, + Deprecated: p.Value.Deprecated, + } + outSchema.Properties = append(outSchema.Properties, prop) + if len(pSchema.AdditionalTypes) > 0 { + outSchema.AdditionalTypes = append(outSchema.AdditionalTypes, pSchema.AdditionalTypes...) + } + } + + if schema.AnyOf != nil { + if err := generateUnion(&outSchema, schema.AnyOf, schema.Discriminator, path); err != nil { + return Schema{}, fmt.Errorf("error generating type for anyOf: %w", err) + } + } + if schema.OneOf != nil { + if err := generateUnion(&outSchema, schema.OneOf, schema.Discriminator, path); err != nil { + return Schema{}, fmt.Errorf("error generating type for oneOf: %w", err) + } + } + + outSchema.GoType = GenStructFromSchema(outSchema) + } + + // Check for x-go-type-name. It behaves much like x-go-type, however, it will + // create a type definition for the named type, and use the named type in place + // of this schema. + if extension, ok := schema.Extensions[extGoTypeName]; ok { + typeName, err := extTypeName(extension) + if err != nil { + return outSchema, fmt.Errorf("invalid value for %q: %w", extGoTypeName, err) + } + + newTypeDef := TypeDefinition{ + TypeName: typeName, + Schema: outSchema, + } + outSchema = Schema{ + Description: newTypeDef.Schema.Description, + GoType: typeName, + DefineViaAlias: true, + AdditionalTypes: append(outSchema.AdditionalTypes, newTypeDef), + } + } + + return outSchema, nil + } else if len(schema.Enum) > 0 { + err := oapiSchemaToGoType(schema, path, &outSchema) + // Enums need to be typed, so that the values aren't interchangeable, + // so no matter what schema conversion thinks, we need to define a + // new type. + outSchema.DefineViaAlias = false + + if err != nil { + return Schema{}, fmt.Errorf("error resolving primitive type: %w", err) + } + enumValues := make([]string, len(schema.Enum)) + for i, enumValue := range schema.Enum { + enumValues[i] = fmt.Sprintf("%v", enumValue) + } + + enumNames := enumValues + for _, key := range []string{extEnumVarNames, extEnumNames} { + if extension, ok := schema.Extensions[key]; ok { + if extEnumNames, err := extParseEnumVarNames(extension); err == nil { + enumNames = extEnumNames + break + } + } + } + + sanitizedValues := SanitizeEnumNames(enumNames, enumValues) + outSchema.EnumValues = make(map[string]string, len(sanitizedValues)) + + for k, v := range sanitizedValues { + var enumName string + if v == "" { + enumName = "Empty" + } else { + enumName = k + } + if globalState.options.Compatibility.OldEnumConflicts { + outSchema.EnumValues[SchemaNameToTypeName(PathToTypeName(append(path, enumName)))] = v + } else { + outSchema.EnumValues[SchemaNameToTypeName(k)] = v + } + } + if len(path) > 1 { // handle additional type only on non-toplevel types + // Allow overriding autogenerated enum type names, since these may + // cause conflicts - see https://github.com/oapi-codegen/oapi-codegen/issues/832 + var typeName string + if extension, ok := schema.Extensions[extGoTypeName]; ok { + typeName, err = extString(extension) + if err != nil { + return outSchema, fmt.Errorf("invalid value for %q: %w", extGoTypeName, err) + } + } else { + typeName = SchemaNameToTypeName(PathToTypeName(path)) + } + + typeDef := TypeDefinition{ + TypeName: typeName, + JsonName: strings.Join(path, "."), + Schema: outSchema, + } + outSchema.AdditionalTypes = append(outSchema.AdditionalTypes, typeDef) + outSchema.RefType = typeName + } + } else { + err := oapiSchemaToGoType(schema, path, &outSchema) + if err != nil { + return Schema{}, fmt.Errorf("error resolving primitive type: %w", err) + } + } + return outSchema, nil +} + +// oapiSchemaToGoType converts an OpenApi schema into a Go type definition for +// all non-object types. +func oapiSchemaToGoType(schema *openapi3.Schema, path []string, outSchema *Schema) error { + f := schema.Format + t := schema.Type + + if t.Is("array") { + // For arrays, we'll get the type of the Items and throw a + // [] in front of it. + arrayType, err := GenerateGoSchema(schema.Items, path) + if err != nil { + return fmt.Errorf("error generating type for array: %w", err) + } + if (arrayType.HasAdditionalProperties || len(arrayType.UnionElements) != 0) && arrayType.RefType == "" { + // If we have items which have additional properties or union values, + // but are not a pre-defined type, we need to define a type + // for them, which will be based on the field names we followed + // to get to the type. + typeName := PathToTypeName(append(path, "Item")) + + typeDef := TypeDefinition{ + TypeName: typeName, + JsonName: strings.Join(append(path, "Item"), "."), + Schema: arrayType, + } + arrayType.AdditionalTypes = append(arrayType.AdditionalTypes, typeDef) + + arrayType.RefType = typeName + } + outSchema.ArrayType = &arrayType + outSchema.GoType = "[]" + arrayType.TypeDecl() + outSchema.AdditionalTypes = arrayType.AdditionalTypes + outSchema.Properties = arrayType.Properties + outSchema.DefineViaAlias = true + if sliceContains(globalState.options.OutputOptions.DisableTypeAliasesForType, "array") { + outSchema.DefineViaAlias = false + } + setSkipOptionalPointerForContainerType(outSchema) + + } else if t.Is("integer") { + // We default to int if format doesn't ask for something else. + switch f { + case "int64", + "int32", + "int16", + "int8", + "int", + "uint64", + "uint32", + "uint16", + "uint8", + "uint": + outSchema.GoType = f + default: + outSchema.GoType = "int" + } + outSchema.DefineViaAlias = true + } else if t.Is("number") { + // We default to float for "number" + switch f { + case "double": + outSchema.GoType = "float64" + case "float", "": + outSchema.GoType = "float32" + default: + return fmt.Errorf("invalid number format: %s", f) + } + outSchema.DefineViaAlias = true + } else if t.Is("boolean") { + if f != "" { + return fmt.Errorf("invalid format (%s) for boolean", f) + } + outSchema.GoType = "bool" + outSchema.DefineViaAlias = true + } else if t.Is("string") { + // Special case string formats here. + switch f { + case "byte": + outSchema.GoType = "[]byte" + setSkipOptionalPointerForContainerType(outSchema) + case "email": + outSchema.GoType = "openapi_types.Email" + case "date": + outSchema.GoType = "openapi_types.Date" + case "date-time": + outSchema.GoType = "time.Time" + case "json": + outSchema.GoType = "json.RawMessage" + outSchema.SkipOptionalPointer = true + case "uuid": + outSchema.GoType = "openapi_types.UUID" + case "binary": + outSchema.GoType = "openapi_types.File" + default: + // All unrecognized formats are simply a regular string. + outSchema.GoType = "string" + } + outSchema.DefineViaAlias = true + } else { + return fmt.Errorf("unhandled Schema type: %v", t) + } + return nil +} + +// SchemaDescriptor describes a Schema, a type definition. +type SchemaDescriptor struct { + Fields []FieldDescriptor + HasAdditionalProperties bool + AdditionalPropertiesType string +} + +type FieldDescriptor struct { + Required bool // Is the schema required? If not, we'll pass by pointer + GoType string // The Go type needed to represent the json type. + GoName string // The Go compatible type name for the type + JsonName string // The json type name for the type + IsRef bool // Is this schema a reference to predefined object? +} + +// GenFieldsFromProperties produce corresponding field names with JSON annotations, +// given a list of schema descriptors +func GenFieldsFromProperties(props []Property) []string { + var fields []string + for i, p := range props { + field := "" + + goFieldName := p.GoFieldName() + + // Add a comment to a field in case we have one, otherwise skip. + if p.Description != "" { + // Separate the comment from a previous-defined, unrelated field. + // Make sure the actual field is separated by a newline. + if i != 0 { + field += "\n" + } + field += fmt.Sprintf("%s\n", StringWithTypeNameToGoComment(p.Description, p.GoFieldName())) + } + + if p.Deprecated { + // This comment has to be on its own line for godoc & IDEs to pick up + var deprecationReason string + if extension, ok := p.Extensions[extDeprecationReason]; ok { + if extOmitEmpty, err := extParseDeprecationReason(extension); err == nil { + deprecationReason = extOmitEmpty + } + } + + field += fmt.Sprintf("%s\n", DeprecationComment(deprecationReason)) + } + + // Check x-go-type-skip-optional-pointer, which will override if the type + // should be a pointer or not when the field is optional. + if extension, ok := p.Extensions[extPropGoTypeSkipOptionalPointer]; ok { + if skipOptionalPointer, err := extParsePropGoTypeSkipOptionalPointer(extension); err == nil { + p.Schema.SkipOptionalPointer = skipOptionalPointer + } + } + + field += fmt.Sprintf(" %s %s", goFieldName, p.GoTypeDef()) + + shouldOmitEmpty := (!p.Required || p.ReadOnly || p.WriteOnly) && + (!p.Required || !p.ReadOnly || !globalState.options.Compatibility.DisableRequiredReadOnlyAsPointer) + + omitEmpty := !p.Nullable && shouldOmitEmpty + + if p.Nullable && globalState.options.OutputOptions.NullableType { + omitEmpty = shouldOmitEmpty + } + + // Support x-omitempty + if extOmitEmptyValue, ok := p.Extensions[extPropOmitEmpty]; ok { + if extOmitEmpty, err := extParseOmitEmpty(extOmitEmptyValue); err == nil { + omitEmpty = extOmitEmpty + } + } + + fieldTags := make(map[string]string) + + if !omitEmpty { + fieldTags["json"] = p.JsonFieldName + if globalState.options.OutputOptions.EnableYamlTags { + fieldTags["yaml"] = p.JsonFieldName + } + if p.NeedsFormTag { + fieldTags["form"] = p.JsonFieldName + } + } else { + fieldTags["json"] = p.JsonFieldName + ",omitempty" + if globalState.options.OutputOptions.EnableYamlTags { + fieldTags["yaml"] = p.JsonFieldName + ",omitempty" + } + if p.NeedsFormTag { + fieldTags["form"] = p.JsonFieldName + ",omitempty" + } + } + + // Support x-go-json-ignore + if extension, ok := p.Extensions[extPropGoJsonIgnore]; ok { + if goJsonIgnore, err := extParseGoJsonIgnore(extension); err == nil && goJsonIgnore { + fieldTags["json"] = "-" + } + } + + // Support x-oapi-codegen-extra-tags + if extension, ok := p.Extensions[extPropExtraTags]; ok { + if tags, err := extExtraTags(extension); err == nil { + keys := SortedMapKeys(tags) + for _, k := range keys { + fieldTags[k] = tags[k] + } + } + } + // Convert the fieldTags map into Go field annotations. + keys := SortedMapKeys(fieldTags) + tags := make([]string, len(keys)) + for i, k := range keys { + tags[i] = fmt.Sprintf(`%s:"%s"`, k, fieldTags[k]) + } + field += "`" + strings.Join(tags, " ") + "`" + fields = append(fields, field) + } + return fields +} + +func additionalPropertiesType(schema Schema) string { + addPropsType := schema.AdditionalPropertiesType.GoType + if schema.AdditionalPropertiesType.RefType != "" { + addPropsType = schema.AdditionalPropertiesType.RefType + } + if schema.AdditionalPropertiesType.OAPISchema != nil && schema.AdditionalPropertiesType.OAPISchema.Nullable { + addPropsType = "*" + addPropsType + } + return addPropsType +} + +func GenStructFromSchema(schema Schema) string { + // Start out with struct { + objectParts := []string{"struct {"} + // Append all the field definitions + objectParts = append(objectParts, GenFieldsFromProperties(schema.Properties)...) + // Close the struct + if schema.HasAdditionalProperties { + objectParts = append(objectParts, + fmt.Sprintf("AdditionalProperties map[string]%s `json:\"-\"`", + additionalPropertiesType(schema))) + } + if len(schema.UnionElements) != 0 { + objectParts = append(objectParts, "union json.RawMessage") + } + objectParts = append(objectParts, "}") + return strings.Join(objectParts, "\n") +} + +// This constructs a Go type for a parameter, looking at either the schema or +// the content, whichever is available +func paramToGoType(param *openapi3.Parameter, path []string) (Schema, error) { + if param.Content == nil && param.Schema == nil { + return Schema{}, fmt.Errorf("parameter '%s' has no schema or content", param.Name) + } + + // We can process the schema through the generic schema processor + if param.Schema != nil { + return GenerateGoSchema(param.Schema, path) + } + + // At this point, we have a content type. We know how to deal with + // application/json, but if multiple formats are present, we can't do anything, + // so we'll return the parameter as a string, not bothering to decode it. + if len(param.Content) > 1 { + return Schema{ + GoType: "string", + Description: StringToGoComment(param.Description), + }, nil + } + + // Otherwise, look for application/json in there + mt, found := param.Content["application/json"] + if !found { + // If we don't have json, it's a string + return Schema{ + GoType: "string", + Description: StringToGoComment(param.Description), + }, nil + } + + // For json, we go through the standard schema mechanism + return GenerateGoSchema(mt.Schema, path) +} + +func generateUnion(outSchema *Schema, elements openapi3.SchemaRefs, discriminator *openapi3.Discriminator, path []string) error { + if discriminator != nil { + outSchema.Discriminator = &Discriminator{ + Property: discriminator.PropertyName, + Mapping: make(map[string]string), + } + } + + refToGoTypeMap := make(map[string]string) + for i, element := range elements { + elementPath := append(path, fmt.Sprint(i)) + elementSchema, err := GenerateGoSchema(element, elementPath) + if err != nil { + return err + } + + if element.Ref == "" { + elementName := SchemaNameToTypeName(PathToTypeName(elementPath)) + if elementSchema.TypeDecl() == elementName { + elementSchema.GoType = elementName + } else { + td := TypeDefinition{Schema: elementSchema, TypeName: elementName} + outSchema.AdditionalTypes = append(outSchema.AdditionalTypes, td) + elementSchema.GoType = td.TypeName + } + outSchema.AdditionalTypes = append(outSchema.AdditionalTypes, elementSchema.AdditionalTypes...) + } else { + refToGoTypeMap[element.Ref] = elementSchema.GoType + } + + if discriminator != nil { + if len(discriminator.Mapping) != 0 && element.Ref == "" { + return errors.New("ambiguous discriminator.mapping: please replace inlined object with $ref") + } + + // Explicit mapping. + var mapped bool + for k, v := range discriminator.Mapping { + if v == element.Ref { + outSchema.Discriminator.Mapping[k] = elementSchema.GoType + mapped = true + break + } + } + // Implicit mapping. + if !mapped { + outSchema.Discriminator.Mapping[RefPathToObjName(element.Ref)] = elementSchema.GoType + } + } + outSchema.UnionElements = append(outSchema.UnionElements, UnionElement(elementSchema.GoType)) + } + + if (outSchema.Discriminator != nil) && len(outSchema.Discriminator.Mapping) != len(elements) { + return errors.New("discriminator: not all schemas were mapped") + } + + return nil +} + +// setSkipOptionalPointerForContainerType ensures that the "optional pointer" is skipped on container types (such as a slice or a map). +// This is controlled using the `prefer-skip-optional-pointer-on-container-types` Output Option +// NOTE that it is still possible to override this on a per-field basis with `x-go-type-skip-optional-pointer` +func setSkipOptionalPointerForContainerType(outSchema *Schema) { + if !globalState.options.OutputOptions.PreferSkipOptionalPointerOnContainerTypes { + return + } + + outSchema.SkipOptionalPointer = true +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/template_helpers.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/template_helpers.go new file mode 100644 index 0000000000..b9efe2cf45 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/template_helpers.go @@ -0,0 +1,326 @@ +// Copyright 2019 DeepMap, Inc. +// +// 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. +package codegen + +import ( + "bytes" + "fmt" + "os" + "strings" + "text/template" + + "golang.org/x/text/cases" + "golang.org/x/text/language" + + "github.com/oapi-codegen/oapi-codegen/v2/pkg/util" +) + +const ( + // These allow the case statements to be sorted later: + prefixLeastSpecific = "9" + + defaultClientTypeName = "Client" +) + +var ( + contentTypesJSON = []string{"application/json", "text/x-json", "application/problem+json"} + contentTypesHalJSON = []string{"application/hal+json"} + contentTypesYAML = []string{"application/yaml", "application/x-yaml", "text/yaml", "text/x-yaml"} + contentTypesXML = []string{"application/xml", "text/xml", "application/problems+xml"} + + responseTypeSuffix = "Response" + + titleCaser = cases.Title(language.English) +) + +// genParamArgs takes an array of Parameter definition, and generates a valid +// Go parameter declaration from them, eg: +// ", foo int, bar string, baz float32". The preceding comma is there to save +// a lot of work in the template engine. +func genParamArgs(params []ParameterDefinition) string { + if len(params) == 0 { + return "" + } + parts := make([]string, len(params)) + for i, p := range params { + paramName := p.GoVariableName() + parts[i] = fmt.Sprintf("%s %s", paramName, p.TypeDef()) + } + return ", " + strings.Join(parts, ", ") +} + +// genParamTypes is much like the one above, except it only produces the +// types of the parameters for a type declaration. It would produce this +// from the same input as above: +// ", int, string, float32". +func genParamTypes(params []ParameterDefinition) string { + if len(params) == 0 { + return "" + } + parts := make([]string, len(params)) + for i, p := range params { + parts[i] = p.TypeDef() + } + return ", " + strings.Join(parts, ", ") +} + +// This is another variation of the function above which generates only the +// parameter names: +// ", foo, bar, baz" +func genParamNames(params []ParameterDefinition) string { + if len(params) == 0 { + return "" + } + parts := make([]string, len(params)) + for i, p := range params { + parts[i] = p.GoVariableName() + } + return ", " + strings.Join(parts, ", ") +} + +// genResponsePayload generates the payload returned at the end of each client request function +func genResponsePayload(operationID string) string { + var buffer = bytes.NewBufferString("") + + // Here is where we build up a response: + fmt.Fprintf(buffer, "&%s{\n", genResponseTypeName(operationID)) + fmt.Fprintf(buffer, "Body: bodyBytes,\n") + fmt.Fprintf(buffer, "HTTPResponse: rsp,\n") + fmt.Fprintf(buffer, "}") + + return buffer.String() +} + +// genResponseUnmarshal generates unmarshaling steps for structured response payloads +func genResponseUnmarshal(op *OperationDefinition) string { + var handledCaseClauses = make(map[string]string) + var unhandledCaseClauses = make(map[string]string) + + // Get the type definitions from the operation: + typeDefinitions, err := op.GetResponseTypeDefinitions() + if err != nil { + panic(err) + } + + if len(typeDefinitions) == 0 { + // No types. + return "" + } + + // Add a case for each possible response: + buffer := new(bytes.Buffer) + responses := op.Spec.Responses + for _, typeDefinition := range typeDefinitions { + + responseRef := responses.Value(typeDefinition.ResponseName) + if responseRef == nil { + continue + } + + // We can't do much without a value: + if responseRef.Value == nil { + fmt.Fprintf(os.Stderr, "Response %s.%s has nil value\n", op.OperationId, typeDefinition.ResponseName) + continue + } + + // If there is no content-type then we have no unmarshaling to do: + if len(responseRef.Value.Content) == 0 { + caseAction := "break // No content-type" + caseClauseKey := "case " + getConditionOfResponseName("rsp.StatusCode", typeDefinition.ResponseName) + ":" + unhandledCaseClauses[prefixLeastSpecific+caseClauseKey] = fmt.Sprintf("%s\n%s\n", caseClauseKey, caseAction) + continue + } + + // If we made it this far then we need to handle unmarshaling for each content-type: + SortedMapKeys := SortedMapKeys(responseRef.Value.Content) + jsonCount := 0 + for _, contentTypeName := range SortedMapKeys { + if StringInArray(contentTypeName, contentTypesJSON) || util.IsMediaTypeJson(contentTypeName) { + jsonCount++ + } + } + + for _, contentTypeName := range SortedMapKeys { + + // We get "interface{}" when using "anyOf" or "oneOf" (which doesn't work with Go types): + if typeDefinition.TypeName == "interface{}" { + // Unable to unmarshal this, so we leave it out: + continue + } + + // Add content-types here (json / yaml / xml etc): + switch { + + // JSON: + case StringInArray(contentTypeName, contentTypesJSON) || util.IsMediaTypeJson(contentTypeName): + if typeDefinition.ContentTypeName == contentTypeName { + caseAction := fmt.Sprintf("var dest %s\n"+ + "if err := json.Unmarshal(bodyBytes, &dest); err != nil { \n"+ + " return nil, err \n"+ + "}\n"+ + "response.%s = &dest", + typeDefinition.Schema.TypeDecl(), + typeDefinition.TypeName) + + if jsonCount > 1 { + caseKey, caseClause := buildUnmarshalCaseStrict(typeDefinition, caseAction, contentTypeName) + handledCaseClauses[caseKey] = caseClause + } else { + caseKey, caseClause := buildUnmarshalCase(typeDefinition, caseAction, "json") + handledCaseClauses[caseKey] = caseClause + } + } + + // YAML: + case StringInArray(contentTypeName, contentTypesYAML): + if typeDefinition.ContentTypeName == contentTypeName { + caseAction := fmt.Sprintf("var dest %s\n"+ + "if err := yaml.Unmarshal(bodyBytes, &dest); err != nil { \n"+ + " return nil, err \n"+ + "}\n"+ + "response.%s = &dest", + typeDefinition.Schema.TypeDecl(), + typeDefinition.TypeName) + caseKey, caseClause := buildUnmarshalCase(typeDefinition, caseAction, "yaml") + handledCaseClauses[caseKey] = caseClause + } + + // XML: + case StringInArray(contentTypeName, contentTypesXML): + if typeDefinition.ContentTypeName == contentTypeName { + caseAction := fmt.Sprintf("var dest %s\n"+ + "if err := xml.Unmarshal(bodyBytes, &dest); err != nil { \n"+ + " return nil, err \n"+ + "}\n"+ + "response.%s = &dest", + typeDefinition.Schema.TypeDecl(), + typeDefinition.TypeName) + caseKey, caseClause := buildUnmarshalCase(typeDefinition, caseAction, "xml") + handledCaseClauses[caseKey] = caseClause + } + + // Everything else: + default: + caseAction := fmt.Sprintf("// Content-type (%s) unsupported", contentTypeName) + caseClauseKey := "case " + getConditionOfResponseName("rsp.StatusCode", typeDefinition.ResponseName) + ":" + unhandledCaseClauses[prefixLeastSpecific+caseClauseKey] = fmt.Sprintf("%s\n%s\n", caseClauseKey, caseAction) + } + } + } + + if len(handledCaseClauses)+len(unhandledCaseClauses) == 0 { + // switch would be empty. + return "" + } + + // Now build the switch statement in order of most-to-least specific: + // See: https://github.com/oapi-codegen/oapi-codegen/issues/127 for why we handle this in two separate + // groups. + fmt.Fprintf(buffer, "switch {\n") + for _, caseClauseKey := range SortedMapKeys(handledCaseClauses) { + + fmt.Fprintf(buffer, "%s\n", handledCaseClauses[caseClauseKey]) + } + for _, caseClauseKey := range SortedMapKeys(unhandledCaseClauses) { + + fmt.Fprintf(buffer, "%s\n", unhandledCaseClauses[caseClauseKey]) + } + fmt.Fprintf(buffer, "}\n") + + return buffer.String() +} + +// buildUnmarshalCase builds an unmarshaling case clause for different content-types: +func buildUnmarshalCase(typeDefinition ResponseTypeDefinition, caseAction string, contentType string) (caseKey string, caseClause string) { + caseKey = fmt.Sprintf("%s.%s.%s", prefixLeastSpecific, contentType, typeDefinition.ResponseName) + caseClauseKey := getConditionOfResponseName("rsp.StatusCode", typeDefinition.ResponseName) + caseClause = fmt.Sprintf("case strings.Contains(rsp.Header.Get(\"%s\"), \"%s\") && %s:\n%s\n", "Content-Type", contentType, caseClauseKey, caseAction) + return caseKey, caseClause +} + +func buildUnmarshalCaseStrict(typeDefinition ResponseTypeDefinition, caseAction string, contentType string) (caseKey string, caseClause string) { + caseKey = fmt.Sprintf("%s.%s.%s", prefixLeastSpecific, contentType, typeDefinition.ResponseName) + caseClauseKey := getConditionOfResponseName("rsp.StatusCode", typeDefinition.ResponseName) + caseClause = fmt.Sprintf("case rsp.Header.Get(\"%s\") == \"%s\" && %s:\n%s\n", "Content-Type", contentType, caseClauseKey, caseAction) + return caseKey, caseClause +} + +// genResponseTypeName creates the name of generated response types (given the operationID): +func genResponseTypeName(operationID string) string { + return fmt.Sprintf("%s%s", UppercaseFirstCharacter(operationID), responseTypeSuffix) +} + +func getResponseTypeDefinitions(op *OperationDefinition) []ResponseTypeDefinition { + td, err := op.GetResponseTypeDefinitions() + if err != nil { + panic(err) + } + return td +} + +// Return the statusCode comparison clause from the response name. +func getConditionOfResponseName(statusCodeVar, responseName string) string { + switch responseName { + case "default": + return "true" + case "1XX", "2XX", "3XX", "4XX", "5XX": + return fmt.Sprintf("%s / 100 == %s", statusCodeVar, responseName[:1]) + default: + return fmt.Sprintf("%s == %s", statusCodeVar, responseName) + } +} + +// This outputs a string array +func toStringArray(sarr []string) string { + s := strings.Join(sarr, `","`) + if len(s) > 0 { + s = `"` + s + `"` + } + return `[]string{` + s + `}` +} + +func stripNewLines(s string) string { + r := strings.NewReplacer("\n", "") + return r.Replace(s) +} + +// TemplateFunctions is passed to the template engine, and we can call each +// function here by keyName from the template code. +var TemplateFunctions = template.FuncMap{ + "genParamArgs": genParamArgs, + "genParamTypes": genParamTypes, + "genParamNames": genParamNames, + "genParamFmtString": ReplacePathParamsWithStr, + "swaggerUriToIrisUri": SwaggerUriToIrisUri, + "swaggerUriToEchoUri": SwaggerUriToEchoUri, + "swaggerUriToFiberUri": SwaggerUriToFiberUri, + "swaggerUriToChiUri": SwaggerUriToChiUri, + "swaggerUriToGinUri": SwaggerUriToGinUri, + "swaggerUriToGorillaUri": SwaggerUriToGorillaUri, + "swaggerUriToStdHttpUri": SwaggerUriToStdHttpUri, + "lcFirst": LowercaseFirstCharacter, + "ucFirst": UppercaseFirstCharacter, + "ucFirstWithPkgName": UppercaseFirstCharacterWithPkgName, + "camelCase": ToCamelCase, + "genResponsePayload": genResponsePayload, + "genResponseTypeName": genResponseTypeName, + "genResponseUnmarshal": genResponseUnmarshal, + "getResponseTypeDefinitions": getResponseTypeDefinitions, + "toStringArray": toStringArray, + "lower": strings.ToLower, + "title": titleCaser.String, + "stripNewLines": stripNewLines, + "sanitizeGoIdentity": SanitizeGoIdentity, + "toGoComment": StringWithTypeNameToGoComment, +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/additional-properties.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/additional-properties.tmpl new file mode 100644 index 0000000000..2f450582d1 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/additional-properties.tmpl @@ -0,0 +1,72 @@ +{{range .Types}}{{$addType := .Schema.AdditionalPropertiesType.TypeDecl}} + +// Getter for additional properties for {{.TypeName}}. Returns the specified +// element and whether it was found +func (a {{.TypeName}}) Get(fieldName string) (value {{$addType}}, found bool) { + if a.AdditionalProperties != nil { + value, found = a.AdditionalProperties[fieldName] + } + return +} + +// Setter for additional properties for {{.TypeName}} +func (a *{{.TypeName}}) Set(fieldName string, value {{$addType}}) { + if a.AdditionalProperties == nil { + a.AdditionalProperties = make(map[string]{{$addType}}) + } + a.AdditionalProperties[fieldName] = value +} + +{{if eq 0 (len .Schema.UnionElements) -}} +// Override default JSON handling for {{.TypeName}} to handle AdditionalProperties +func (a *{{.TypeName}}) UnmarshalJSON(b []byte) error { + object := make(map[string]json.RawMessage) + err := json.Unmarshal(b, &object) + if err != nil { + return err + } +{{range .Schema.Properties}} + if raw, found := object["{{.JsonFieldName}}"]; found { + err = json.Unmarshal(raw, &a.{{.GoFieldName}}) + if err != nil { + return fmt.Errorf("error reading '{{.JsonFieldName}}': %w", err) + } + delete(object, "{{.JsonFieldName}}") + } +{{end}} + if len(object) != 0 { + a.AdditionalProperties = make(map[string]{{$addType}}) + for fieldName, fieldBuf := range object { + var fieldVal {{$addType}} + err := json.Unmarshal(fieldBuf, &fieldVal) + if err != nil { + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) + } + a.AdditionalProperties[fieldName] = fieldVal + } + } + return nil +} + +// Override default JSON handling for {{.TypeName}} to handle AdditionalProperties +func (a {{.TypeName}}) MarshalJSON() ([]byte, error) { + var err error + object := make(map[string]json.RawMessage) +{{range .Schema.Properties}} +{{if .HasOptionalPointer}}if a.{{.GoFieldName}} != nil { {{end}} + object["{{.JsonFieldName}}"], err = json.Marshal(a.{{.GoFieldName}}) + if err != nil { + return nil, fmt.Errorf("error marshaling '{{.JsonFieldName}}': %w", err) + } +{{if .HasOptionalPointer}} }{{end}} +{{end}} + for fieldName, field := range a.AdditionalProperties { + object[fieldName], err = json.Marshal(field) + if err != nil { + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) + } + } + return json.Marshal(object) +} +{{end}} +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-handler.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-handler.tmpl new file mode 100644 index 0000000000..113e4d7ada --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-handler.tmpl @@ -0,0 +1,50 @@ +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions { + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions { + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { +r := options.BaseRouter + +if r == nil { +r = chi.NewRouter() +} +if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } +} +{{if .}}wrapper := ServerInterfaceWrapper{ +Handler: si, +HandlerMiddlewares: options.Middlewares, +ErrorHandlerFunc: options.ErrorHandlerFunc, +} +{{end}} +{{range .}}r.Group(func(r chi.Router) { +r.{{.Method | lower | title }}(options.BaseURL+"{{.Path | swaggerUriToChiUri}}", wrapper.{{.OperationId}}) +}) +{{end}} +return r +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-interface.tmpl new file mode 100644 index 0000000000..cfc393bde2 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-interface.tmpl @@ -0,0 +1,17 @@ +// ServerInterface represents all server handlers. +type ServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{.OperationId}}(w http.ResponseWriter, r *http.Request{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) +{{end}} +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct {} + {{range .}}{{.SummaryAsComment }} + // ({{.Method}} {{.Path}}) + func (_ Unimplemented) {{.OperationId}}(w http.ResponseWriter, r *http.Request{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) { + w.WriteHeader(http.StatusNotImplemented) + } + {{end}} \ No newline at end of file diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-middleware.tmpl new file mode 100644 index 0000000000..97866fca6a --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-middleware.tmpl @@ -0,0 +1,266 @@ +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +{{range .}}{{$opid := .OperationId}} + +// {{$opid}} operation middleware +func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Request) { + {{if or .RequiresParamObject (gt (len .PathParams) 0) }} + var err error + {{end}} + + {{range .PathParams}}// ------------- Path parameter "{{.ParamName}}" ------------- + var {{$varName := .GoVariableName}}{{$varName}} {{.TypeDef}} + + {{if .IsPassThrough}} + {{$varName}} = chi.URLParam(r, "{{.ParamName}}") + {{end}} + {{if .IsJson}} + err = json.Unmarshal([]byte(chi.URLParam(r, "{{.ParamName}}")), &{{$varName}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", chi.URLParam(r, "{{.ParamName}}"), &{{$varName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + + {{end}} + + {{if .SecurityDefinitions -}} + ctx := r.Context() +{{range .SecurityDefinitions}} + ctx = context.WithValue(ctx, {{.ProviderName | sanitizeGoIdentity | ucFirst}}Scopes, {{toStringArray .Scopes}}) +{{end}} + r = r.WithContext(ctx) + {{end}} + + {{if .RequiresParamObject}} + // Parameter object where we will unmarshal all parameters from the context + var params {{.OperationId}}Params + + {{range $paramIdx, $param := .QueryParams}} + {{- if (or (or .Required .IsPassThrough) (or .IsJson .IsStyled)) -}} + // ------------- {{if .Required}}Required{{else}}Optional{{end}} query parameter "{{.ParamName}}" ------------- + {{ end }} + {{ if (or (or .Required .IsPassThrough) .IsJson) }} + if paramValue := r.URL.Query().Get("{{.ParamName}}"); paramValue != "" { + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue + {{end}} + + {{if .IsJson}} + var value {{.TypeDef}} + err = json.Unmarshal([]byte(paramValue), &value) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + }{{if .Required}} else { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "{{.ParamName}}"}) + return + }{{end}} + {{end}} + {{if .IsStyled}} + err = runtime.BindQueryParameter("{{.Style}}", {{.Explode}}, {{.Required}}, "{{.ParamName}}", r.URL.Query(), ¶ms.{{.GoName}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + {{end}} + + {{if .HeaderParams}} + headers := r.Header + + {{range .HeaderParams}}// ------------- {{if .Required}}Required{{else}}Optional{{end}} header parameter "{{.ParamName}}" ------------- + if valueList, found := headers[http.CanonicalHeaderKey("{{.ParamName}}")]; found { + var {{.GoName}} {{.TypeDef}} + n := len(valueList) + if n != 1 { + siw.ErrorHandlerFunc(w, r, &TooManyValuesForParamError{ParamName: "{{.ParamName}}", Count: n}) + return + } + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer }}&{{end}}valueList[0] + {{end}} + + {{if .IsJson}} + err = json.Unmarshal([]byte(valueList[0]), &{{.GoName}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", valueList[0], &{{.GoName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}} + + } {{if .Required}}else { + err := fmt.Errorf("Header parameter {{.ParamName}} is required, but not found") + siw.ErrorHandlerFunc(w, r, &RequiredHeaderError{ParamName: "{{.ParamName}}", Err: err}) + return + }{{end}} + + {{end}} + {{end}} + + {{range .CookieParams}} + { + var cookie *http.Cookie + + if cookie, err = r.Cookie("{{.ParamName}}"); err == nil { + + {{- if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value + {{end}} + + {{- if .IsJson}} + var value {{.TypeDef}} + var decoded string + decoded, err := url.QueryUnescape(cookie.Value) + if err != nil { + err = fmt.Errorf("Error unescaping cookie parameter '{{.ParamName}}'") + siw.ErrorHandlerFunc(w, r, &UnescapedCookieParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + + err = json.Unmarshal([]byte(decoded), &value) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + {{- if .IsStyled}} + var value {{.TypeDef}} + err = runtime.BindStyledParameterWithOptions("simple", "{{.ParamName}}", cookie.Value, &value, runtime.BindStyledParameterOptions{Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + } + + {{- if .Required}} else { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "{{.ParamName}}"}) + return + } + {{- end}} + } + {{end}} + {{end}} + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.{{.OperationId}}(w, r{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}) + })) + + {{if opts.Compatibility.ApplyChiMiddlewareFirstToLast}} + for i := len(siw.HandlerMiddlewares) -1; i >= 0; i-- { + handler = siw.HandlerMiddlewares[i](handler) + } + {{else}} + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + {{end}} + + handler.ServeHTTP(w, r) +} +{{end}} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client-with-responses.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client-with-responses.tmpl new file mode 100644 index 0000000000..3b85500a8d --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client-with-responses.tmpl @@ -0,0 +1,134 @@ +// ClientWithResponses builds on ClientInterface to offer response payloads +type ClientWithResponses struct { + ClientInterface +} + +// NewClientWithResponses creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { + client, err := NewClient(server, opts...) + if err != nil { + return nil, err + } + return &ClientWithResponses{client}, nil +} + +{{$clientTypeName := opts.OutputOptions.ClientTypeName -}} + +// WithBaseURL overrides the baseURL. +func WithBaseURL(baseURL string) ClientOption { + return func(c *{{ $clientTypeName }}) error { + newBaseURL, err := url.Parse(baseURL) + if err != nil { + return err + } + c.Server = newBaseURL.String() + return nil + } +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { +{{range . -}} +{{$hasParams := .RequiresParamObject -}} +{{$pathParams := .PathParams -}} +{{$opid := .OperationId -}} + // {{$opid}}{{if .HasBody}}WithBody{{end}}WithResponse request{{if .HasBody}} with any body{{end}} + {{$opid}}{{if .HasBody}}WithBody{{end}}WithResponse(ctx context.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}, reqEditors... RequestEditorFn) (*{{genResponseTypeName $opid}}, error) +{{range .Bodies}} + {{if .IsSupportedByClient -}} + {{$opid}}{{.Suffix}}WithResponse(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody, reqEditors... RequestEditorFn) (*{{genResponseTypeName $opid}}, error) + {{end -}} +{{end}}{{/* range .Bodies */}} +{{end}}{{/* range . $opid := .OperationId */}} +} + +{{range .}}{{$opid := .OperationId}}{{$op := .}} +{{$responseTypeDefinitions := getResponseTypeDefinitions .}} +type {{genResponseTypeName $opid | ucFirst}} struct { + Body []byte + HTTPResponse *http.Response + {{- range $responseTypeDefinitions}} + {{.TypeName}} *{{.Schema.TypeDecl}} + {{- end}} +} + +{{- range $responseTypeDefinitions}} + {{- range .AdditionalTypeDefinitions}} + type {{.TypeName}} {{if .IsAlias }}={{end}} {{.Schema.TypeDecl}} + {{- end}} +{{- end}} + +// Status returns HTTPResponse.Status +func (r {{genResponseTypeName $opid | ucFirst}}) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r {{genResponseTypeName $opid | ucFirst}}) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +{{ if opts.OutputOptions.ClientResponseBytesFunction }} +// Bytes is a convenience method to retrieve the raw bytes from the HTTP response +func (r {{genResponseTypeName $opid | ucFirst}}) Bytes() []byte { + return r.Body +} +{{end}} +{{end}} + + +{{range .}} +{{$opid := .OperationId -}} +{{/* Generate client methods (with responses)*/}} + +// {{$opid}}{{if .HasBody}}WithBody{{end}}WithResponse request{{if .HasBody}} with arbitrary body{{end}} returning *{{genResponseTypeName $opid}} +func (c *ClientWithResponses) {{$opid}}{{if .HasBody}}WithBody{{end}}WithResponse(ctx context.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}, reqEditors... RequestEditorFn) (*{{genResponseTypeName $opid}}, error){ + rsp, err := c.{{$opid}}{{if .HasBody}}WithBody{{end}}(ctx{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}{{if .HasBody}}, contentType, body{{end}}, reqEditors...) + if err != nil { + return nil, err + } + return Parse{{genResponseTypeName $opid | ucFirst}}(rsp) +} + +{{$hasParams := .RequiresParamObject -}} +{{$pathParams := .PathParams -}} +{{$bodyRequired := .BodyRequired -}} +{{range .Bodies}} +{{if .IsSupportedByClient -}} +func (c *ClientWithResponses) {{$opid}}{{.Suffix}}WithResponse(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody, reqEditors... RequestEditorFn) (*{{genResponseTypeName $opid}}, error) { + rsp, err := c.{{$opid}}{{.Suffix}}(ctx{{genParamNames $pathParams}}{{if $hasParams}}, params{{end}}, body, reqEditors...) + if err != nil { + return nil, err + } + return Parse{{genResponseTypeName $opid | ucFirst}}(rsp) +} +{{end}} +{{end}} + +{{end}}{{/* operations */}} + +{{/* Generate parse functions for responses*/}} +{{range .}}{{$opid := .OperationId}} + +// Parse{{genResponseTypeName $opid | ucFirst}} parses an HTTP response from a {{$opid}}WithResponse call +func Parse{{genResponseTypeName $opid | ucFirst}}(rsp *http.Response) (*{{genResponseTypeName $opid}}, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := {{genResponsePayload $opid}} + + {{genResponseUnmarshal .}} + + return response, nil +} +{{end}}{{/* range . $opid := .OperationId */}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client.tmpl new file mode 100644 index 0000000000..822e11097a --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client.tmpl @@ -0,0 +1,312 @@ +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Doer performs HTTP requests. +// +// The standard http.Client implements this interface. +type HttpRequestDoer interface { + Do(req *http.Request) (*http.Response, error) +} + +{{$clientTypeName := opts.OutputOptions.ClientTypeName -}} + +// {{ $clientTypeName }} which conforms to the OpenAPI3 specification for this service. +type {{ $clientTypeName }} struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client HttpRequestDoer + + // A list of callbacks for modifying requests which are generated before sending over + // the network. + RequestEditors []RequestEditorFn +} + +// ClientOption allows setting custom parameters during construction +type ClientOption func(*{{ $clientTypeName }}) error + +// Creates a new {{ $clientTypeName }}, with reasonable defaults +func NewClient(server string, opts ...ClientOption) (*{{ $clientTypeName }}, error) { + // create a client with sane default values + client := {{ $clientTypeName }}{ + Server: server, + } + // mutate client and add all optional params + for _, o := range opts { + if err := o(&client); err != nil { + return nil, err + } + } + // ensure the server URL always has a trailing slash + if !strings.HasSuffix(client.Server, "/") { + client.Server += "/" + } + // create httpClient, if not already present + if client.Client == nil { + client.Client = &http.Client{} + } + return &client, nil +} + +// WithHTTPClient allows overriding the default Doer, which is +// automatically created using http.Client. This is useful for tests. +func WithHTTPClient(doer HttpRequestDoer) ClientOption { + return func(c *{{ $clientTypeName }}) error { + c.Client = doer + return nil + } +} + +// WithRequestEditorFn allows setting up a callback function, which will be +// called right before sending the request. This can be used to mutate the request. +func WithRequestEditorFn(fn RequestEditorFn) ClientOption { + return func(c *{{ $clientTypeName }}) error { + c.RequestEditors = append(c.RequestEditors, fn) + return nil + } +} + +// The interface specification for the client above. +type ClientInterface interface { +{{range . -}} +{{$hasParams := .RequiresParamObject -}} +{{$pathParams := .PathParams -}} +{{$opid := .OperationId -}} + // {{$opid}}{{if .HasBody}}WithBody{{end}} request{{if .HasBody}} with any body{{end}} + {{$opid}}{{if .HasBody}}WithBody{{end}}(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}, reqEditors... RequestEditorFn) (*http.Response, error) +{{range .Bodies}} + {{if .IsSupportedByClient -}} + {{$opid}}{{.Suffix}}(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody, reqEditors... RequestEditorFn) (*http.Response, error) + {{end -}} +{{end}}{{/* range .Bodies */}} +{{end}}{{/* range . $opid := .OperationId */}} +} + + +{{/* Generate client methods */}} +{{range . -}} +{{$hasParams := .RequiresParamObject -}} +{{$pathParams := .PathParams -}} +{{$opid := .OperationId -}} + +func (c *{{ $clientTypeName }}) {{$opid}}{{if .HasBody}}WithBody{{end}}(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}, reqEditors... RequestEditorFn) (*http.Response, error) { + req, err := New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(c.Server{{genParamNames .PathParams}}{{if $hasParams}}, params{{end}}{{if .HasBody}}, contentType, body{{end}}) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +{{range .Bodies}} +{{if .IsSupportedByClient -}} +func (c *{{ $clientTypeName }}) {{$opid}}{{.Suffix}}(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody, reqEditors... RequestEditorFn) (*http.Response, error) { + req, err := New{{$opid}}Request{{.Suffix}}(c.Server{{genParamNames $pathParams}}{{if $hasParams}}, params{{end}}, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} +{{end -}}{{/* if .IsSupported */}} +{{end}}{{/* range .Bodies */}} +{{end}} + +{{/* Generate request builders */}} +{{range .}} +{{$hasParams := .RequiresParamObject -}} +{{$pathParams := .PathParams -}} +{{$bodyRequired := .BodyRequired -}} +{{$opid := .OperationId -}} + +{{range .Bodies}} +{{if .IsSupportedByClient -}} +// New{{$opid}}Request{{.Suffix}} calls the generic {{$opid}} builder with {{.ContentType}} body +func New{{$opid}}Request{{.Suffix}}(server string{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody) (*http.Request, error) { + var bodyReader io.Reader + {{if .IsJSON -}} + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + {{else if eq .NameTag "Formdata" -}} + bodyStr, err := runtime.MarshalForm(body, nil) + if err != nil { + return nil, err + } + bodyReader = strings.NewReader(bodyStr.Encode()) + {{else if eq .NameTag "Text" -}} + bodyReader = strings.NewReader(string(body)) + {{end -}} + return New{{$opid}}RequestWithBody(server{{genParamNames $pathParams}}{{if $hasParams}}, params{{end}}, "{{.ContentType}}", bodyReader) +} +{{end -}} +{{end}} + +// New{{$opid}}Request{{if .HasBody}}WithBody{{end}} generates requests for {{$opid}}{{if .HasBody}} with any type of body{{end}} +func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}) (*http.Request, error) { + var err error +{{range $paramIdx, $param := .PathParams}} + var pathParam{{$paramIdx}} string + {{if .IsPassThrough}} + pathParam{{$paramIdx}} = {{.GoVariableName}} + {{end}} + {{if .IsJson}} + var pathParamBuf{{$paramIdx}} []byte + pathParamBuf{{$paramIdx}}, err = json.Marshal({{.GoVariableName}}) + if err != nil { + return nil, err + } + pathParam{{$paramIdx}} = string(pathParamBuf{{$paramIdx}}) + {{end}} + {{if .IsStyled}} + pathParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationPath, {{.GoVariableName}}) + if err != nil { + return nil, err + } + {{end}} +{{end}} + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("{{genParamFmtString .Path}}"{{range $paramIdx, $param := .PathParams}}, pathParam{{$paramIdx}}{{end}}) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + +{{if .QueryParams}} + if params != nil { + queryValues := queryURL.Query() + {{range $paramIdx, $param := .QueryParams}} + {{if .HasOptionalPointer}} if params.{{.GoName}} != nil { {{end}} + {{if .IsPassThrough}} + queryValues.Add("{{.ParamName}}", {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}) + {{end}} + {{if .IsJson}} + if queryParamBuf, err := json.Marshal({{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}); err != nil { + return nil, err + } else { + queryValues.Add("{{.ParamName}}", string(queryParamBuf)) + } + + {{end}} + {{if .IsStyled}} + if queryFrag, err := runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationQuery, {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + {{end}} + {{if .HasOptionalPointer}}}{{end}} + {{end}} + queryURL.RawQuery = queryValues.Encode() + } +{{end}}{{/* if .QueryParams */}} + req, err := http.NewRequest("{{.Method}}", queryURL.String(), {{if .HasBody}}body{{else}}nil{{end}}) + if err != nil { + return nil, err + } + + {{if .HasBody}}req.Header.Add("Content-Type", contentType){{end}} +{{ if .HeaderParams }} + if params != nil { + {{range $paramIdx, $param := .HeaderParams}} + {{if .HasOptionalPointer}} if params.{{.GoName}} != nil { {{end}} + var headerParam{{$paramIdx}} string + {{if .IsPassThrough}} + headerParam{{$paramIdx}} = {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}} + {{end}} + {{if .IsJson}} + var headerParamBuf{{$paramIdx}} []byte + headerParamBuf{{$paramIdx}}, err = json.Marshal({{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}) + if err != nil { + return nil, err + } + headerParam{{$paramIdx}} = string(headerParamBuf{{$paramIdx}}) + {{end}} + {{if .IsStyled}} + headerParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationHeader, {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}) + if err != nil { + return nil, err + } + {{end}} + req.Header.Set("{{.ParamName}}", headerParam{{$paramIdx}}) + {{if .HasOptionalPointer}}}{{end}} + {{end}} + } +{{- end }}{{/* if .HeaderParams */}} + +{{ if .CookieParams }} + if params != nil { + {{range $paramIdx, $param := .CookieParams}} + {{if .HasOptionalPointer}} if params.{{.GoName}} != nil { {{end}} + var cookieParam{{$paramIdx}} string + {{if .IsPassThrough}} + cookieParam{{$paramIdx}} = {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}} + {{end}} + {{if .IsJson}} + var cookieParamBuf{{$paramIdx}} []byte + cookieParamBuf{{$paramIdx}}, err = json.Marshal({{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}) + if err != nil { + return nil, err + } + cookieParam{{$paramIdx}} = url.QueryEscape(string(cookieParamBuf{{$paramIdx}})) + {{end}} + {{if .IsStyled}} + cookieParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("simple", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationCookie, {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}) + if err != nil { + return nil, err + } + {{end}} + cookie{{$paramIdx}} := &http.Cookie{ + Name:"{{.ParamName}}", + Value:cookieParam{{$paramIdx}}, + } + req.AddCookie(cookie{{$paramIdx}}) + {{if .HasOptionalPointer}}}{{end}} + {{ end -}} + } +{{- end }}{{/* if .CookieParams */}} + return req, nil +} + +{{end}}{{/* Range */}} + +func (c *{{ $clientTypeName }}) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range c.RequestEditors { + if err := r(ctx, req); err != nil { + return err + } + } + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/constants.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/constants.tmpl new file mode 100644 index 0000000000..8fad8764c4 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/constants.tmpl @@ -0,0 +1,15 @@ +{{- if gt (len .SecuritySchemeProviderNames) 0 }} +const ( +{{range $ProviderName := .SecuritySchemeProviderNames}} + {{- $ProviderName | sanitizeGoIdentity | ucFirst}}Scopes = "{{$ProviderName}}.Scopes" +{{end}} +) +{{end}} +{{range $Enum := .EnumDefinitions}} +// Defines values for {{$Enum.TypeName}}. +const ( +{{range $name, $value := $Enum.GetValues}} + {{$name}} {{$Enum.TypeName}} = {{$Enum.ValueWrapper}}{{$value}}{{$Enum.ValueWrapper -}} +{{end}} +) +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-interface.tmpl new file mode 100644 index 0000000000..7380091690 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-interface.tmpl @@ -0,0 +1,7 @@ +// ServerInterface represents all server handlers. +type ServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{.OperationId}}(ctx echo.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) error +{{end}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-register.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-register.tmpl new file mode 100644 index 0000000000..21b52fe48b --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-register.tmpl @@ -0,0 +1,33 @@ + + +// This is a simple interface which specifies echo.Route addition functions which +// are present on both echo.Echo and echo.Group, since we want to allow using +// either of them for path registration +type EchoRouter interface { + CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route + DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route + GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route + HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route + OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route + PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route + POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route + PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route + TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route +} + +// RegisterHandlers adds each server route to the EchoRouter. +func RegisterHandlers(router EchoRouter, si ServerInterface) { + RegisterHandlersWithBaseURL(router, si, "") +} + +// Registers handlers, and prepends BaseURL to the paths, so that the paths +// can be served under a prefix. +func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) { +{{if .}} + wrapper := ServerInterfaceWrapper{ + Handler: si, + } +{{end}} +{{range .}}router.{{.Method}}(baseURL + "{{.Path | swaggerUriToEchoUri}}", wrapper.{{.OperationId}}) +{{end}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-wrappers.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-wrappers.tmpl new file mode 100644 index 0000000000..ea7b75eaad --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-wrappers.tmpl @@ -0,0 +1,131 @@ +// ServerInterfaceWrapper converts echo contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface +} + +{{range .}}{{$opid := .OperationId}}// {{$opid}} converts echo context to params. +func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx echo.Context) error { + var err error +{{range .PathParams}}// ------------- Path parameter "{{.ParamName}}" ------------- + var {{$varName := .GoVariableName}}{{$varName}} {{.TypeDef}} +{{if .IsPassThrough}} + {{$varName}} = ctx.Param("{{.ParamName}}") +{{end}} +{{if .IsJson}} + err = json.Unmarshal([]byte(ctx.Param("{{.ParamName}}")), &{{$varName}}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, "Error unmarshaling parameter '{{.ParamName}}' as JSON") + } +{{end}} +{{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", ctx.Param("{{.ParamName}}"), &{{$varName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter {{.ParamName}}: %s", err)) + } +{{end}} +{{end}} + +{{range .SecurityDefinitions}} + ctx.Set({{.ProviderName | sanitizeGoIdentity | ucFirst}}Scopes, {{toStringArray .Scopes}}) +{{end}} + +{{if .RequiresParamObject}} + // Parameter object where we will unmarshal all parameters from the context + var params {{.OperationId}}Params +{{range $paramIdx, $param := .QueryParams}} + {{- if (or (or .Required .IsPassThrough) (or .IsJson .IsStyled)) -}} + // ------------- {{if .Required}}Required{{else}}Optional{{end}} query parameter "{{.ParamName}}" ------------- + {{ end }} + {{if .IsStyled}} + err = runtime.BindQueryParameter("{{.Style}}", {{.Explode}}, {{.Required}}, "{{.ParamName}}", ctx.QueryParams(), ¶ms.{{.GoName}}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter {{.ParamName}}: %s", err)) + } + {{else}} + if paramValue := ctx.QueryParam("{{.ParamName}}"); paramValue != "" { + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue + {{end}} + {{if .IsJson}} + var value {{.TypeDef}} + err = json.Unmarshal([]byte(paramValue), &value) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, "Error unmarshaling parameter '{{.ParamName}}' as JSON") + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + }{{if .Required}} else { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query argument {{.ParamName}} is required, but not found")) + }{{end}} + {{end}} +{{end}} + +{{if .HeaderParams}} + headers := ctx.Request().Header +{{range .HeaderParams}}// ------------- {{if .Required}}Required{{else}}Optional{{end}} header parameter "{{.ParamName}}" ------------- + if valueList, found := headers[http.CanonicalHeaderKey("{{.ParamName}}")]; found { + var {{.GoName}} {{.TypeDef}} + n := len(valueList) + if n != 1 { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Expected one value for {{.ParamName}}, got %d", n)) + } +{{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0] +{{end}} +{{if .IsJson}} + err = json.Unmarshal([]byte(valueList[0]), &{{.GoName}}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, "Error unmarshaling parameter '{{.ParamName}}' as JSON") + } +{{end}} +{{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", valueList[0], &{{.GoName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter {{.ParamName}}: %s", err)) + } +{{end}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}} + } {{if .Required}}else { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Header parameter {{.ParamName}} is required, but not found")) + }{{end}} +{{end}} +{{end}} + +{{range .CookieParams}} + if cookie, err := ctx.Cookie("{{.ParamName}}"); err == nil { + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value + {{end}} + {{if .IsJson}} + var value {{.TypeDef}} + var decoded string + decoded, err := url.QueryUnescape(cookie.Value) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, "Error unescaping cookie parameter '{{.ParamName}}'") + } + err = json.Unmarshal([]byte(decoded), &value) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, "Error unmarshaling parameter '{{.ParamName}}' as JSON") + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + {{if .IsStyled}} + var value {{.TypeDef}} + err = runtime.BindStyledParameterWithOptions("simple", "{{.ParamName}}", cookie.Value, &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationCookie, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter {{.ParamName}}: %s", err)) + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + }{{if .Required}} else { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query argument {{.ParamName}} is required, but not found")) + }{{end}} + +{{end}}{{/* .CookieParams */}} + +{{end}}{{/* .RequiresParamObject */}} + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.{{.OperationId}}(ctx{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}) + return err +} +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-handler.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-handler.tmpl new file mode 100644 index 0000000000..7745e0d88e --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-handler.tmpl @@ -0,0 +1,25 @@ +// FiberServerOptions provides options for the Fiber server. +type FiberServerOptions struct { + BaseURL string + Middlewares []MiddlewareFunc +} + +// RegisterHandlers creates http.Handler with routing matching OpenAPI spec. +func RegisterHandlers(router fiber.Router, si ServerInterface) { + RegisterHandlersWithOptions(router, si, FiberServerOptions{}) +} + +// RegisterHandlersWithOptions creates http.Handler with additional options +func RegisterHandlersWithOptions(router fiber.Router, si ServerInterface, options FiberServerOptions) { +{{if .}}wrapper := ServerInterfaceWrapper{ +Handler: si, +} + +for _, m := range options.Middlewares { + router.Use(fiber.Handler(m)) +} +{{end}} +{{range .}} +router.{{.Method | lower | title }}(options.BaseURL+"{{.Path | swaggerUriToFiberUri}}", wrapper.{{.OperationId}}) +{{end}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-interface.tmpl new file mode 100644 index 0000000000..8ef90a851a --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-interface.tmpl @@ -0,0 +1,7 @@ +// ServerInterface represents all server handlers. +type ServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{.OperationId}}(c *fiber.Ctx{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) error +{{end}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-middleware.tmpl new file mode 100644 index 0000000000..e44f4836cb --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-middleware.tmpl @@ -0,0 +1,169 @@ +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface +} + +type MiddlewareFunc fiber.Handler + +{{range .}}{{$opid := .OperationId}} + +// {{$opid}} operation middleware +func (siw *ServerInterfaceWrapper) {{$opid}}(c *fiber.Ctx) error { + + {{if or .RequiresParamObject (gt (len .PathParams) 0) }} + var err error + {{end}} + + {{range .PathParams}}// ------------- Path parameter "{{.ParamName}}" ------------- + var {{$varName := .GoVariableName}}{{$varName}} {{.TypeDef}} + + {{if .IsPassThrough}} + {{$varName}} = c.Query("{{.ParamName}}") + {{end}} + {{if .IsJson}} + err = json.Unmarshal([]byte(c.Query("{{.ParamName}}")), &{{$varName}}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON: %w", err).Error()) + } + {{end}} + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", c.Params("{{.ParamName}}"), &{{$varName}}, runtime.BindStyledParameterOptions{Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err).Error()) + } + {{end}} + + {{end}} + +{{range .SecurityDefinitions}} + c.Context().SetUserValue({{.ProviderName | ucFirst}}Scopes, {{toStringArray .Scopes}}) +{{end}} + + {{if .RequiresParamObject}} + // Parameter object where we will unmarshal all parameters from the context + var params {{.OperationId}}Params + + {{if .QueryParams}} + var query url.Values + query, err = url.ParseQuery(string(c.Request().URI().QueryString())) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for query string: %w", err).Error()) + } + {{end}} + + {{range $paramIdx, $param := .QueryParams}} + {{- if (or (or .Required .IsPassThrough) (or .IsJson .IsStyled)) -}} + // ------------- {{if .Required}}Required{{else}}Optional{{end}} query parameter "{{.ParamName}}" ------------- + {{ end }} + {{ if (or (or .Required .IsPassThrough) .IsJson) }} + if paramValue := c.Query("{{.ParamName}}"); paramValue != "" { + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue + {{end}} + + {{if .IsJson}} + var value {{.TypeDef}} + err = json.Unmarshal([]byte(paramValue), &value) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON: %w", err).Error()) + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + }{{if .Required}} else { + err = fmt.Errorf("Query argument {{.ParamName}} is required, but not found") + c.Status(fiber.StatusBadRequest).JSON(err) + return err + }{{end}} + {{end}} + {{if .IsStyled}} + err = runtime.BindQueryParameter("{{.Style}}", {{.Explode}}, {{.Required}}, "{{.ParamName}}", query, ¶ms.{{.GoName}}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err).Error()) + } + {{end}} + {{end}} + + {{if .HeaderParams}} + headers := c.GetReqHeaders() + + {{range .HeaderParams}}// ------------- {{if .Required}}Required{{else}}Optional{{end}} header parameter "{{.ParamName}}" ------------- + if value, found := headers[http.CanonicalHeaderKey("{{.ParamName}}")]; found { + var {{.GoName}} {{.TypeDef}} + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + {{if .IsJson}} + err = json.Unmarshal([]byte(value), &{{.GoName}}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON: %w", err).Error()) + } + {{end}} + + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", value, &{{.GoName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err).Error()) + } + {{end}} + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}} + + } {{if .Required}}else { + err = fmt.Errorf("Header parameter {{.ParamName}} is required, but not found: %w", err) + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + }{{end}} + + {{end}} + {{end}} + + {{range .CookieParams}} + var cookie string + + if cookie = c.Cookies("{{.ParamName}}"); cookie == "" { + + {{- if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}}&{{end}}cookie + {{end}} + + {{- if .IsJson}} + var value {{.TypeDef}} + var decoded string + decoded, err := url.QueryUnescape(cookie) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Error unescaping cookie parameter '{{.ParamName}}': %w", err).Error()) + } + + err = json.Unmarshal([]byte(decoded), &value) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON: %w", err).Error()) + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + {{- if .IsStyled}} + var value {{.TypeDef}} + err = runtime.BindStyledParameterWithOptions("simple", "{{.ParamName}}", cookie, &value, runtime.BindStyledParameterOptions{Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err).Error()) + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + } + + {{- if .Required}} else { + err = fmt.Errorf("Query argument {{.ParamName}} is required, but not found") + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + {{- end}} + {{end}} + {{end}} + + return siw.Handler.{{.OperationId}}(c{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}) +} +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-interface.tmpl new file mode 100644 index 0000000000..49a18f812a --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-interface.tmpl @@ -0,0 +1,7 @@ +// ServerInterface represents all server handlers. +type ServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{.OperationId}}(c *gin.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) +{{end}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-register.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-register.tmpl new file mode 100644 index 0000000000..8f03722ab1 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-register.tmpl @@ -0,0 +1,33 @@ +// GinServerOptions provides options for the Gin server. +type GinServerOptions struct { + BaseURL string + Middlewares []MiddlewareFunc + ErrorHandler func(*gin.Context, error, int) +} + +// RegisterHandlers creates http.Handler with routing matching OpenAPI spec. +func RegisterHandlers(router gin.IRouter, si ServerInterface) { + RegisterHandlersWithOptions(router, si, GinServerOptions{}) +} + +// RegisterHandlersWithOptions creates http.Handler with additional options +func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions) { + {{- if . -}} + errorHandler := options.ErrorHandler + if errorHandler == nil { + errorHandler = func(c *gin.Context, err error, statusCode int) { + c.JSON(statusCode, gin.H{"msg": err.Error()}) + } + } + + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandler: errorHandler, + } + {{end}} + + {{range . -}} + router.{{.Method }}(options.BaseURL+"{{.Path | swaggerUriToGinUri }}", wrapper.{{.OperationId}}) + {{end -}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-wrappers.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-wrappers.tmpl new file mode 100644 index 0000000000..3bc02e5d7f --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-wrappers.tmpl @@ -0,0 +1,186 @@ +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandler func(*gin.Context, error, int) +} + +type MiddlewareFunc func(c *gin.Context) + +{{range .}}{{$opid := .OperationId}} + +// {{$opid}} operation middleware +func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) { + + {{if or .RequiresParamObject (gt (len .PathParams) 0) }} + var err error + {{end}} + + {{range .PathParams}}// ------------- Path parameter "{{.ParamName}}" ------------- + var {{$varName := .GoVariableName}}{{$varName}} {{.TypeDef}} + + {{if .IsPassThrough}} + {{$varName}} = c.Query("{{.ParamName}}") + {{end}} + {{if .IsJson}} + err = json.Unmarshal([]byte(c.Query("{{.ParamName}}")), &{{$varName}}) + if err != nil { + siw.ErrorHandler(c, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON"), http.StatusBadRequest) + return + } + {{end}} + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", c.Param("{{.ParamName}}"), &{{$varName}}, runtime.BindStyledParameterOptions{Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err), http.StatusBadRequest) + return + } + {{end}} + + {{end}} + +{{range .SecurityDefinitions}} + c.Set({{.ProviderName | sanitizeGoIdentity | ucFirst}}Scopes, {{toStringArray .Scopes}}) +{{end}} + + {{if .RequiresParamObject}} + // Parameter object where we will unmarshal all parameters from the context + var params {{.OperationId}}Params + + {{range $paramIdx, $param := .QueryParams}} + {{- if (or (or .Required .IsPassThrough) (or .IsJson .IsStyled)) -}} + // ------------- {{if .Required}}Required{{else}}Optional{{end}} query parameter "{{.ParamName}}" ------------- + {{ end }} + {{ if (or (or .Required .IsPassThrough) .IsJson) }} + if paramValue := c.Query("{{.ParamName}}"); paramValue != "" { + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue + {{end}} + + {{if .IsJson}} + var value {{.TypeDef}} + err = json.Unmarshal([]byte(paramValue), &value) + if err != nil { + siw.ErrorHandler(c, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON: %w", err), http.StatusBadRequest) + return + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + }{{if .Required}} else { + siw.ErrorHandler(c, fmt.Errorf("Query argument {{.ParamName}} is required, but not found"), http.StatusBadRequest) + return + }{{end}} + {{end}} + + {{if .IsStyled}} + err = runtime.BindQueryParameter("{{.Style}}", {{.Explode}}, {{.Required}}, "{{.ParamName}}", c.Request.URL.Query(), ¶ms.{{.GoName}}) + if err != nil { + siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err), http.StatusBadRequest) + return + } + {{end}} + {{end}} + + {{if .HeaderParams}} + headers := c.Request.Header + + {{range .HeaderParams}}// ------------- {{if .Required}}Required{{else}}Optional{{end}} header parameter "{{.ParamName}}" ------------- + if valueList, found := headers[http.CanonicalHeaderKey("{{.ParamName}}")]; found { + var {{.GoName}} {{.TypeDef}} + n := len(valueList) + if n != 1 { + siw.ErrorHandler(c, fmt.Errorf("Expected one value for {{.ParamName}}, got %d", n), http.StatusBadRequest) + return + } + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0] + {{end}} + + {{if .IsJson}} + err = json.Unmarshal([]byte(valueList[0]), &{{.GoName}}) + if err != nil { + siw.ErrorHandler(c, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON"), http.StatusBadRequest) + return + } + {{end}} + + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", valueList[0], &{{.GoName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err), http.StatusBadRequest) + return + } + {{end}} + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}} + + } {{if .Required}}else { + siw.ErrorHandler(c, fmt.Errorf("Header parameter {{.ParamName}} is required, but not found"), http.StatusBadRequest) + return + }{{end}} + + {{end}} + {{end}} + + {{range .CookieParams}} + { + var cookie string + + if cookie, err = c.Cookie("{{.ParamName}}"); err == nil { + + {{- if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie + {{end}} + + {{- if .IsJson}} + var value {{.TypeDef}} + var decoded string + decoded, err := url.QueryUnescape(cookie) + if err != nil { + siw.ErrorHandler(c, fmt.Errorf("Error unescaping cookie parameter '{{.ParamName}}'"), http.StatusBadRequest) + return + } + + err = json.Unmarshal([]byte(decoded), &value) + if err != nil { + siw.ErrorHandler(c, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON"), http.StatusBadRequest) + return + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + {{- if .IsStyled}} + var value {{.TypeDef}} + err = runtime.BindStyledParameterWithOptions("simple", "{{.ParamName}}", cookie, &value, runtime.BindStyledParameterOptions{Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err), http.StatusBadRequest) + return + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + } + + {{- if .Required}} else { + siw.ErrorHandler(c, fmt.Errorf("Query argument {{.ParamName}} is required, but not found"), http.StatusBadRequest) + return + } + {{- end}} + } + {{end}} + {{end}} + + for _, middleware := range siw.HandlerMiddlewares { + middleware(c) + if c.IsAborted() { + return + } + } + + siw.Handler.{{.OperationId}}(c{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}) +} +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-interface.tmpl new file mode 100644 index 0000000000..79a51fd75b --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-interface.tmpl @@ -0,0 +1,7 @@ +// ServerInterface represents all server handlers. +type ServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{.OperationId}}(w http.ResponseWriter, r *http.Request{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) +{{end}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-middleware.tmpl new file mode 100644 index 0000000000..e8aa9799f0 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-middleware.tmpl @@ -0,0 +1,266 @@ +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +{{range .}}{{$opid := .OperationId}} + +// {{$opid}} operation middleware +func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Request) { + {{if or .RequiresParamObject (gt (len .PathParams) 0) }} + var err error + {{end}} + + {{range .PathParams}}// ------------- Path parameter "{{.ParamName}}" ------------- + var {{$varName := .GoVariableName}}{{$varName}} {{.TypeDef}} + + {{if .IsPassThrough}} + {{$varName}} = mux.Vars(r)["{{.ParamName}}"] + {{end}} + {{if .IsJson}} + err = json.Unmarshal([]byte(mux.Vars(r)["{{.ParamName}}"]), &{{$varName}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", mux.Vars(r)["{{.ParamName}}"], &{{$varName}}, runtime.BindStyledParameterOptions{Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + + {{end}} + + {{if .SecurityDefinitions -}} + ctx := r.Context() +{{range .SecurityDefinitions}} + ctx = context.WithValue(ctx, {{.ProviderName | sanitizeGoIdentity | ucFirst}}Scopes, {{toStringArray .Scopes}}) +{{end}} + r = r.WithContext(ctx) + {{end}} + + {{if .RequiresParamObject}} + // Parameter object where we will unmarshal all parameters from the context + var params {{.OperationId}}Params + + {{range $paramIdx, $param := .QueryParams}} + {{- if (or (or .Required .IsPassThrough) (or .IsJson .IsStyled)) -}} + // ------------- {{if .Required}}Required{{else}}Optional{{end}} query parameter "{{.ParamName}}" ------------- + {{ end }} + {{ if (or (or .Required .IsPassThrough) .IsJson) }} + if paramValue := r.URL.Query().Get("{{.ParamName}}"); paramValue != "" { + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue + {{end}} + + {{if .IsJson}} + var value {{.TypeDef}} + err = json.Unmarshal([]byte(paramValue), &value) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + }{{if .Required}} else { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "{{.ParamName}}"}) + return + }{{end}} + {{end}} + {{if .IsStyled}} + err = runtime.BindQueryParameter("{{.Style}}", {{.Explode}}, {{.Required}}, "{{.ParamName}}", r.URL.Query(), ¶ms.{{.GoName}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + {{end}} + + {{if .HeaderParams}} + headers := r.Header + + {{range .HeaderParams}}// ------------- {{if .Required}}Required{{else}}Optional{{end}} header parameter "{{.ParamName}}" ------------- + if valueList, found := headers[http.CanonicalHeaderKey("{{.ParamName}}")]; found { + var {{.GoName}} {{.TypeDef}} + n := len(valueList) + if n != 1 { + siw.ErrorHandlerFunc(w, r, &TooManyValuesForParamError{ParamName: "{{.ParamName}}", Count: n}) + return + } + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0] + {{end}} + + {{if .IsJson}} + err = json.Unmarshal([]byte(valueList[0]), &{{.GoName}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", valueList[0], &{{.GoName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}} + + } {{if .Required}}else { + err = fmt.Errorf("Header parameter {{.ParamName}} is required, but not found") + siw.ErrorHandlerFunc(w, r, &RequiredHeaderError{ParamName: "{{.ParamName}}", Err: err}) + return + }{{end}} + + {{end}} + {{end}} + + {{range .CookieParams}} + { + var cookie *http.Cookie + + if cookie, err = r.Cookie("{{.ParamName}}"); err == nil { + + {{- if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value + {{end}} + + {{- if .IsJson}} + var value {{.TypeDef}} + var decoded string + decoded, err := url.QueryUnescape(cookie.Value) + if err != nil { + err = fmt.Errorf("Error unescaping cookie parameter '{{.ParamName}}'") + siw.ErrorHandlerFunc(w, r, &UnescapedCookieParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + + err = json.Unmarshal([]byte(decoded), &value) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + {{- if .IsStyled}} + var value {{.TypeDef}} + err = runtime.BindStyledParameterWithOptions("simple", "{{.ParamName}}", cookie.Value, &value, runtime.BindStyledParameterOptions{Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + } + + {{- if .Required}} else { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "{{.ParamName}}"}) + return + } + {{- end}} + } + {{end}} + {{end}} + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.{{.OperationId}}(w, r{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}) + })) + + {{if opts.Compatibility.ApplyGorillaMiddlewareFirstToLast}} + for i := len(siw.HandlerMiddlewares) -1; i >= 0; i-- { + handler = siw.HandlerMiddlewares[i](handler) + } + {{else}} + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + {{end}} + + handler.ServeHTTP(w, r) +} +{{end}} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-register.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-register.tmpl new file mode 100644 index 0000000000..b019e1dbbf --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-register.tmpl @@ -0,0 +1,49 @@ +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, GorillaServerOptions{}) +} + +type GorillaServerOptions struct { + BaseURL string + BaseRouter *mux.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r *mux.Router) http.Handler { + return HandlerWithOptions(si, GorillaServerOptions { + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r *mux.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, GorillaServerOptions { + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options GorillaServerOptions) http.Handler { +r := options.BaseRouter + +if r == nil { +r = mux.NewRouter() +} +if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } +} +{{if .}}wrapper := ServerInterfaceWrapper{ +Handler: si, +HandlerMiddlewares: options.Middlewares, +ErrorHandlerFunc: options.ErrorHandlerFunc, +} +{{end}} +{{range .}} +r.HandleFunc(options.BaseURL+"{{.Path | swaggerUriToGorillaUri }}", wrapper.{{.OperationId}}).Methods("{{.Method }}") +{{end}} +return r +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/imports.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/imports.tmpl new file mode 100644 index 0000000000..4d19422423 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/imports.tmpl @@ -0,0 +1,50 @@ +{{- if opts.Generate.StdHTTPServer}}//go:build go1.22 + +{{- end}} +// Package {{.PackageName}} provides primitives to interact with the openapi HTTP API. +// +// Code generated by {{.ModuleName}} version {{.Version}} DO NOT EDIT. +package {{.PackageName}} + +import ( + "bytes" + "compress/gzip" + "context" + "encoding/base64" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "gopkg.in/yaml.v2" + "io" + "os" + "mime" + "mime/multipart" + "net/http" + "net/url" + "path" + "strings" + "time" + + "github.com/oapi-codegen/runtime" + "github.com/oapi-codegen/nullable" + strictecho "github.com/oapi-codegen/runtime/strictmiddleware/echo" + strictgin "github.com/oapi-codegen/runtime/strictmiddleware/gin" + strictiris "github.com/oapi-codegen/runtime/strictmiddleware/iris" + strictnethttp "github.com/oapi-codegen/runtime/strictmiddleware/nethttp" + openapi_types "github.com/oapi-codegen/runtime/types" + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/labstack/echo/v4" + "github.com/gin-gonic/gin" + "github.com/gofiber/fiber/v2" + "github.com/kataras/iris/v12" + "github.com/kataras/iris/v12/core/router" + "github.com/gorilla/mux" + {{- range .ExternalImports}} + {{ . }} + {{- end}} + {{- range .AdditionalImports}} + {{.Alias}} "{{.Package}}" + {{- end}} +) diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/inline.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/inline.tmpl new file mode 100644 index 0000000000..de00120502 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/inline.tmpl @@ -0,0 +1,84 @@ +// Base64 encoded, gzipped, json marshaled Swagger object +var swaggerSpec = []string{ +{{range .SpecParts}} + "{{.}}",{{end}} +} + +// GetSwagger returns the content of the embedded swagger specification file +// or error if failed to decode +func decodeSpec() ([]byte, error) { + zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, "")) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr, err := gzip.NewReader(bytes.NewReader(zipped)) + if err != nil { + return nil, fmt.Errorf("error decompressing spec: %w", err) + } + var buf bytes.Buffer + _, err = buf.ReadFrom(zr) + if err != nil { + return nil, fmt.Errorf("error decompressing spec: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cached of a decoded swagger spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + {{ range $key, $value := .ImportMapping }}{{- if ne $value.Path "-"}} + for rawPath, rawFunc := range {{ $value.Name }}.PathToRawSpec(path.Join(path.Dir(pathToFile), "{{ $key }}")) { + if _, ok := res[rawPath]; ok { + // it is not possible to compare functions in golang, so always overwrite the old value + } + res[rawPath] = rawFunc + } + {{- end }}{{- end }} + return res +} + +// GetSwagger returns the Swagger specification corresponding to the generated code +// in this file. The external references of Swagger specification are resolved. +// The logic of resolving external references is tightly connected to "import-mapping" feature. +// Externally referenced files must be embedded in the corresponding golang packages. +// Urls can be supported but this task was out of the scope. +func GetSwagger() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-handler.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-handler.tmpl new file mode 100644 index 0000000000..3f1228faea --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-handler.tmpl @@ -0,0 +1,23 @@ +// IrisServerOption is the option for iris server +type IrisServerOptions struct { + BaseURL string + Middlewares []MiddlewareFunc +} + +// RegisterHandlers creates http.Handler with routing matching OpenAPI spec. +func RegisterHandlers(router *iris.Application, si ServerInterface) { + RegisterHandlersWithOptions(router, si, IrisServerOptions{}) +} + + +// RegisterHandlersWithOptions creates http.Handler with additional options +func RegisterHandlersWithOptions(router *iris.Application, si ServerInterface, options IrisServerOptions) { +{{if .}} + wrapper := ServerInterfaceWrapper{ + Handler: si, + } +{{end}} +{{range .}}router.{{.Method | lower | title}}(options.BaseURL + "{{.Path | swaggerUriToIrisUri}}", wrapper.{{.OperationId}}) +{{end}} + router.Build() +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-interface.tmpl new file mode 100644 index 0000000000..fb53a124b9 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-interface.tmpl @@ -0,0 +1,7 @@ +// ServerInterface represents all server handlers. +type ServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{.OperationId}}(ctx iris.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) +{{end}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-middleware.tmpl new file mode 100644 index 0000000000..814e6bc4e4 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-middleware.tmpl @@ -0,0 +1,161 @@ +// ServerInterfaceWrapper converts echo contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface +} + +type MiddlewareFunc iris.Handler + +{{range .}}{{$opid := .OperationId}}// {{$opid}} converts iris context to params. +func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx iris.Context) { +{{if or .RequiresParamObject (gt (len .PathParams) 0) }} + var err error +{{end}} + +{{range .PathParams}}// ------------- Path parameter "{{.ParamName}}" ------------- + var {{$varName := .GoVariableName}}{{$varName}} {{.TypeDef}} +{{if .IsPassThrough}} + {{$varName}} = ctx.URLParam("{{.ParamName}}") +{{end}} +{{if .IsJson}} + err = json.Unmarshal([]byte(ctx.URLParam("{{.ParamName}}")), &{{$varName}}) + if err != nil { + ctx.StatusCode(http.StatusBadRequest) + ctx.WriteString("Error unmarshaling parameter '{{.ParamName}}' as JSON") + return + } +{{end}} +{{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", ctx.Params().Get("{{.ParamName}}"), &{{$varName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + ctx.StatusCode(http.StatusBadRequest) + ctx.Writef("Invalid format for parameter {{.ParamName}}: %s", err) + return + } +{{end}} +{{end}} + +{{range .SecurityDefinitions}} + ctx.Set({{.ProviderName | sanitizeGoIdentity | ucFirst}}Scopes, {{toStringArray .Scopes}}) +{{end}} + +{{if .RequiresParamObject}} + // Parameter object where we will unmarshal all parameters from the context + var params {{.OperationId}}Params +{{range $paramIdx, $param := .QueryParams}} + {{- if (or (or .Required .IsPassThrough) (or .IsJson .IsStyled)) -}} + // ------------- {{if .Required}}Required{{else}}Optional{{end}} query parameter "{{.ParamName}}" ------------- + {{ end }} + {{if .IsStyled}} + err = runtime.BindQueryParameter("{{.Style}}", {{.Explode}}, {{.Required}}, "{{.ParamName}}", ctx.Request().URL.Query(), ¶ms.{{.GoName}}) + if err != nil { + ctx.StatusCode(http.StatusBadRequest) + ctx.Writef("Invalid format for parameter {{.ParamName}}: %s", err) + return + } + {{else}} + if paramValue := ctx.QueryParam("{{.ParamName}}"); paramValue != "" { + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue + {{end}} + {{if .IsJson}} + var value {{.TypeDef}} + err = json.Unmarshal([]byte(paramValue), &value) + if err != nil { + ctx.StatusCode(http.StatusBadRequest) + ctx.WriteString("Error unmarshaling parameter '{{.ParamName}}' as JSON") + return + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + }{{if .Required}} else { + ctx.StatusCode(http.StatusBadRequest) + ctx.WriteString("Query argument {{.ParamName}} is required, but not found") + return + }{{end}} + {{end}} +{{end}} + +{{if .HeaderParams}} + headers := ctx.Request().Header +{{range .HeaderParams}}// ------------- {{if .Required}}Required{{else}}Optional{{end}} header parameter "{{.ParamName}}" ------------- + if valueList, found := headers[http.CanonicalHeaderKey("{{.ParamName}}")]; found { + var {{.GoName}} {{.TypeDef}} + n := len(valueList) + if n != 1 { + ctx.StatusCode(http.StatusBadRequest) + ctx.Writef("Expected one value for {{.ParamName}}, got %d", n) + return + } +{{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0] +{{end}} +{{if .IsJson}} + err = json.Unmarshal([]byte(valueList[0]), &{{.GoName}}) + if err != nil { + ctx.StatusCode(http.StatusBadRequest) + ctx.WriteString("Error unmarshaling parameter '{{.ParamName}}' as JSON") + return + } +{{end}} +{{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", valueList[0], &{{.GoName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + ctx.StatusCode(http.StatusBadRequest) + ctx.Writef("Invalid format for parameter {{.ParamName}}: %s", err) + return + } +{{end}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}} + } {{if .Required}}else { + ctx.StatusCode(http.StatusBadRequest) + ctx.WriteString("Header {{.ParamName}} is required, but not found") + return + }{{end}} +{{end}} +{{end}} + +{{range .CookieParams}} + if cookie, err := ctx.Cookie("{{.ParamName}}"); err == nil { + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value + {{end}} + {{if .IsJson}} + var value {{.TypeDef}} + var decoded string + decoded, err := url.QueryUnescape(cookie.Value) + if err != nil { + ctx.StatusCode(http.StatusBadRequest) + ctx.WriteString("Error unescaping cookie parameter '{{.ParamName}}'") + return + } + err = json.Unmarshal([]byte(decoded), &value) + if err != nil { + ctx.StatusCode(http.StatusBadRequest) + ctx.WriteString("Error unmarshaling parameter '{{.ParamName}}' as JSON") + return + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + {{if .IsStyled}} + var value {{.TypeDef}} + err = runtime.BindStyledParameterWithOptions("simple", "{{.ParamName}}", cookie.Value, &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationCookie, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + ctx.StatusCode(http.StatusBadRequest) + ctx.Writef("Invalid format for parameter {{.ParamName}}: %s", err) + return + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + }{{if .Required}} else { + ctx.StatusCode(http.StatusBadRequest) + ctx.WriteString("Cookie {{.ParamName}} is required, but not found") + return + }{{end}} + +{{end}}{{/* .CookieParams */}} + +{{end}}{{/* .RequiresParamObject */}} + // Invoke the callback with all the unmarshaled arguments + w.Handler.{{.OperationId}}(ctx{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}) +} +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/param-types.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/param-types.tmpl new file mode 100644 index 0000000000..bb107b8f04 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/param-types.tmpl @@ -0,0 +1,6 @@ +{{range .}}{{$opid := .OperationId}} +{{range .TypeDefinitions}} +// {{.TypeName}} defines parameters for {{$opid}}. +type {{.TypeName}} {{if .IsAlias}}={{end}} {{.Schema.TypeDecl}} +{{end}} +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/request-bodies.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/request-bodies.tmpl new file mode 100644 index 0000000000..9661691a19 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/request-bodies.tmpl @@ -0,0 +1,11 @@ +{{range .}}{{$opid := .OperationId}} +{{range .Bodies}} +{{if .IsSupported -}} +{{$contentType := .ContentType -}} +{{with .TypeDef $opid}} +// {{.TypeName}} defines body for {{$opid}} for {{$contentType}} ContentType. +type {{.TypeName}} {{if .IsAlias}}={{end}} {{.Schema.TypeDecl}} +{{end}} +{{end}} +{{end}} +{{end}} \ No newline at end of file diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-handler.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-handler.tmpl new file mode 100644 index 0000000000..bed4685c74 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-handler.tmpl @@ -0,0 +1,55 @@ +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, StdHTTPServerOptions{}) +} + +// ServeMux is an abstraction of http.ServeMux. +type ServeMux interface { + HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) + ServeHTTP(w http.ResponseWriter, r *http.Request) +} + +type StdHTTPServerOptions struct { + BaseURL string + BaseRouter ServeMux + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler { + return HandlerWithOptions(si, StdHTTPServerOptions { + BaseRouter: m, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler { + return HandlerWithOptions(si, StdHTTPServerOptions { + BaseURL: baseURL, + BaseRouter: m, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler { + m := options.BaseRouter + + if m == nil { + m = http.NewServeMux() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } +{{if .}} + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } +{{end}} +{{range .}}m.HandleFunc("{{.Method }} "+options.BaseURL+"{{.Path | swaggerUriToStdHttpUri}}", wrapper.{{.OperationId}}) +{{end}} + return m +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-interface.tmpl new file mode 100644 index 0000000000..79a51fd75b --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-interface.tmpl @@ -0,0 +1,7 @@ +// ServerInterface represents all server handlers. +type ServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{.OperationId}}(w http.ResponseWriter, r *http.Request{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) +{{end}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-middleware.tmpl new file mode 100644 index 0000000000..09977358c8 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-middleware.tmpl @@ -0,0 +1,266 @@ +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +{{range .}}{{$opid := .OperationId}} + +// {{$opid}} operation middleware +func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Request) { + {{if or .RequiresParamObject (gt (len .PathParams) 0) }} + var err error + {{end}} + + {{range .PathParams}}// ------------- Path parameter "{{.ParamName}}" ------------- + var {{$varName := .GoVariableName}}{{$varName}} {{.TypeDef}} + + {{if .IsPassThrough}} + {{$varName}} = r.PathValue("{{.ParamName}}") + {{end}} + {{if .IsJson}} + err = json.Unmarshal([]byte(r.PathValue("{{.ParamName}}")), &{{$varName}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", r.PathValue("{{.ParamName}}"), &{{$varName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + + {{end}} + + {{if .SecurityDefinitions -}} + ctx := r.Context() +{{range .SecurityDefinitions}} + ctx = context.WithValue(ctx, {{.ProviderName | sanitizeGoIdentity | ucFirst}}Scopes, {{toStringArray .Scopes}}) +{{end}} + r = r.WithContext(ctx) + {{end}} + + {{if .RequiresParamObject}} + // Parameter object where we will unmarshal all parameters from the context + var params {{.OperationId}}Params + + {{range $paramIdx, $param := .QueryParams}} + {{- if (or (or .Required .IsPassThrough) (or .IsJson .IsStyled)) -}} + // ------------- {{if .Required}}Required{{else}}Optional{{end}} query parameter "{{.ParamName}}" ------------- + {{ end }} + {{ if (or (or .Required .IsPassThrough) .IsJson) }} + if paramValue := r.URL.Query().Get("{{.ParamName}}"); paramValue != "" { + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue + {{end}} + + {{if .IsJson}} + var value {{.TypeDef}} + err = json.Unmarshal([]byte(paramValue), &value) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + }{{if .Required}} else { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "{{.ParamName}}"}) + return + }{{end}} + {{end}} + {{if .IsStyled}} + err = runtime.BindQueryParameter("{{.Style}}", {{.Explode}}, {{.Required}}, "{{.ParamName}}", r.URL.Query(), ¶ms.{{.GoName}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + {{end}} + + {{if .HeaderParams}} + headers := r.Header + + {{range .HeaderParams}}// ------------- {{if .Required}}Required{{else}}Optional{{end}} header parameter "{{.ParamName}}" ------------- + if valueList, found := headers[http.CanonicalHeaderKey("{{.ParamName}}")]; found { + var {{.GoName}} {{.TypeDef}} + n := len(valueList) + if n != 1 { + siw.ErrorHandlerFunc(w, r, &TooManyValuesForParamError{ParamName: "{{.ParamName}}", Count: n}) + return + } + + {{if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0] + {{end}} + + {{if .IsJson}} + err = json.Unmarshal([]byte(valueList[0]), &{{.GoName}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + + {{if .IsStyled}} + err = runtime.BindStyledParameterWithOptions("{{.Style}}", "{{.ParamName}}", valueList[0], &{{.GoName}}, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + {{end}} + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}} + + } {{if .Required}}else { + err := fmt.Errorf("Header parameter {{.ParamName}} is required, but not found") + siw.ErrorHandlerFunc(w, r, &RequiredHeaderError{ParamName: "{{.ParamName}}", Err: err}) + return + }{{end}} + + {{end}} + {{end}} + + {{range .CookieParams}} + { + var cookie *http.Cookie + + if cookie, err = r.Cookie("{{.ParamName}}"); err == nil { + + {{- if .IsPassThrough}} + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value + {{end}} + + {{- if .IsJson}} + var value {{.TypeDef}} + var decoded string + decoded, err := url.QueryUnescape(cookie.Value) + if err != nil { + err = fmt.Errorf("Error unescaping cookie parameter '{{.ParamName}}'") + siw.ErrorHandlerFunc(w, r, &UnescapedCookieParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + + err = json.Unmarshal([]byte(decoded), &value) + if err != nil { + siw.ErrorHandlerFunc(w, r, &UnmarshalingParamError{ParamName: "{{.ParamName}}", Err: err}) + return + } + + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + {{- if .IsStyled}} + var value {{.TypeDef}} + err = runtime.BindStyledParameterWithOptions("simple", "{{.ParamName}}", cookie.Value, &value, runtime.BindStyledParameterOptions{Explode: {{.Explode}}, Required: {{.Required}}}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err}) + return + } + params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value + {{end}} + + } + + {{- if .Required}} else { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "{{.ParamName}}"}) + return + } + {{- end}} + } + {{end}} + {{end}} + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.{{.OperationId}}(w, r{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}) + })) + + {{if opts.Compatibility.ApplyChiMiddlewareFirstToLast}} + for i := len(siw.HandlerMiddlewares) -1; i >= 0; i-- { + handler = siw.HandlerMiddlewares[i](handler) + } + {{else}} + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + {{end}} + + handler.ServeHTTP(w, r) +} +{{end}} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-echo.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-echo.tmpl new file mode 100644 index 0000000000..676690fab3 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-echo.tmpl @@ -0,0 +1,97 @@ +type StrictHandlerFunc = strictecho.StrictEchoHandlerFunc +type StrictMiddlewareFunc = strictecho.StrictEchoMiddlewareFunc + +func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface { + return &strictHandler{ssi: ssi, middlewares: middlewares} +} + +type strictHandler struct { + ssi StrictServerInterface + middlewares []StrictMiddlewareFunc +} + +{{range .}} + {{$opid := .OperationId}} + // {{$opid}} operation middleware + func (sh *strictHandler) {{.OperationId}}(ctx echo.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) error { + var request {{$opid | ucFirst}}RequestObject + + {{range .PathParams -}} + request.{{.GoName}} = {{.GoVariableName}} + {{end -}} + + {{if .RequiresParamObject -}} + request.Params = params + {{end -}} + + {{ if .HasMaskedRequestContentTypes -}} + request.ContentType = ctx.Request().Header.Get("Content-Type") + {{end -}} + + {{$multipleBodies := gt (len .Bodies) 1 -}} + {{range .Bodies -}} + {{if $multipleBodies}}if strings.HasPrefix(ctx.Request().Header.Get("Content-Type"), "{{.ContentType}}") { {{end}} + {{if .IsJSON -}} + var body {{$opid}}{{.NameTag}}RequestBody + if err := ctx.Bind(&body); err != nil { + return err + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else if eq .NameTag "Formdata" -}} + if form, err := ctx.FormParams(); err == nil { + var body {{$opid}}{{.NameTag}}RequestBody + if err := runtime.BindForm(&body, form, nil, nil); err != nil { + return err + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + } else { + return err + } + {{else if eq .NameTag "Multipart" -}} + {{if eq .ContentType "multipart/form-data" -}} + if reader, err := ctx.Request().MultipartReader(); err != nil { + return err + } else { + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = reader + } + {{else -}} + if _, params, err := mime.ParseMediaType(ctx.Request().Header.Get("Content-Type")); err != nil { + return err + } else if boundary := params["boundary"]; boundary == "" { + return http.ErrMissingBoundary + } else { + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = multipart.NewReader(ctx.Request().Body, boundary) + } + {{end -}} + {{else if eq .NameTag "Text" -}} + data, err := io.ReadAll(ctx.Request().Body) + if err != nil { + return err + } + body := {{$opid}}{{.NameTag}}RequestBody(data) + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else -}} + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = ctx.Request().Body + {{end}}{{/* if eq .NameTag "JSON" */ -}} + {{if $multipleBodies}}}{{end}} + {{end}}{{/* range .Bodies */}} + + handler := func(ctx echo.Context, request interface{}) (interface{}, error){ + return sh.ssi.{{.OperationId}}(ctx.Request().Context(), request.({{$opid | ucFirst}}RequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "{{.OperationId}}") + } + + response, err := handler(ctx, request) + + if err != nil { + return err + } else if validResponse, ok := response.({{$opid | ucFirst}}ResponseObject); ok { + return validResponse.Visit{{$opid}}Response(ctx.Response()) + } else if response != nil { + return fmt.Errorf("unexpected response type: %T", response) + } + return nil + } +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-fiber-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-fiber-interface.tmpl new file mode 100644 index 0000000000..8bcfc89b10 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-fiber-interface.tmpl @@ -0,0 +1,145 @@ +{{range .}} + {{$opid := .OperationId -}} + type {{$opid | ucFirst}}RequestObject struct { + {{range .PathParams -}} + {{.GoName | ucFirst}} {{.TypeDef}} {{.JsonTag}} + {{end -}} + {{if .RequiresParamObject -}} + Params {{$opid}}Params + {{end -}} + {{if .HasMaskedRequestContentTypes -}} + ContentType string + {{end -}} + {{$multipleBodies := gt (len .Bodies) 1 -}} + {{range .Bodies -}} + {{if $multipleBodies}}{{.NameTag}}{{end}}Body {{if eq .NameTag "Multipart"}}*multipart.Reader{{else if ne .NameTag ""}}*{{$opid}}{{.NameTag}}RequestBody{{else}}io.Reader{{end}} + {{end -}} + } + + type {{$opid | ucFirst}}ResponseObject interface { + Visit{{$opid}}Response(ctx *fiber.Ctx) error + } + + {{range .Responses}} + {{$statusCode := .StatusCode -}} + {{$hasHeaders := ne 0 (len .Headers) -}} + {{$fixedStatusCode := .HasFixedStatusCode -}} + {{$isRef := .IsRef -}} + {{$isExternalRef := .IsExternalRef -}} + {{$ref := .Ref | ucFirst -}} + {{$headers := .Headers -}} + + {{if (and $hasHeaders (not $isRef)) -}} + type {{$opid}}{{$statusCode}}ResponseHeaders struct { + {{range .Headers -}} + {{.GoName}} {{.Schema.TypeDecl}} + {{end -}} + } + {{end}} + + {{range .Contents}} + {{$receiverTypeName := printf "%s%s%s%s" $opid $statusCode .NameTagOrContentType "Response"}} + {{if and $fixedStatusCode $isRef -}} + {{ if and (not $hasHeaders) ($fixedStatusCode) (.IsSupported) (eq .NameTag "Multipart") -}} + type {{$receiverTypeName}} {{$ref}}{{.NameTagOrContentType}}Response + {{else if $isExternalRef -}} + type {{$receiverTypeName}} struct { {{$ref}} } + {{else -}} + type {{$receiverTypeName}} struct{ {{$ref}}{{.NameTagOrContentType}}Response } + {{end}} + {{else if and (not $hasHeaders) ($fixedStatusCode) (.IsSupported) -}} + type {{$receiverTypeName}} {{if eq .NameTag "Multipart"}}func(writer *multipart.Writer)error{{else if .IsSupported}}{{if and .Schema.IsRef (not .Schema.IsExternalRef)}}={{end}} {{.Schema.TypeDecl}}{{else}}io.Reader{{end}} + {{else -}} + type {{$receiverTypeName}} struct { + Body {{if eq .NameTag "Multipart"}}func(writer *multipart.Writer)error{{else if .IsSupported}}{{.Schema.TypeDecl}}{{else}}io.Reader{{end}} + {{if $hasHeaders -}} + Headers {{if $isRef}}{{$ref}}{{else}}{{$opid}}{{$statusCode}}{{end}}ResponseHeaders + {{end -}} + + {{if not $fixedStatusCode -}} + StatusCode int + {{end -}} + + {{if not .HasFixedContentType -}} + ContentType string + {{end -}} + + {{if not .IsSupported -}} + ContentLength int64 + {{end -}} + } + {{end}} + + func (response {{$receiverTypeName}}) Visit{{$opid}}Response(ctx *fiber.Ctx) error { + {{range $headers -}} + ctx.Response().Header.Set("{{.Name}}", fmt.Sprint(response.Headers.{{.GoName}})) + {{end -}} + {{if eq .NameTag "Multipart" -}} + writer := multipart.NewWriter(ctx.Response().BodyWriter()) + {{end -}} + ctx.Response().Header.Set("Content-Type", {{if eq .NameTag "Multipart"}}{{if eq .ContentType "multipart/form-data"}}writer.FormDataContentType(){{else}}mime.FormatMediaType("{{.ContentType}}", map[string]string{"boundary": writer.Boundary()}){{end}}{{else if .HasFixedContentType }}"{{.ContentType}}"{{else}}response.ContentType{{end}}) + {{if not .IsSupported -}} + if response.ContentLength != 0 { + ctx.Response().Header.Set("Content-Length", fmt.Sprint(response.ContentLength)) + } + {{end -}} + ctx.Status({{if $fixedStatusCode}}{{$statusCode}}{{else}}response.StatusCode{{end}}) + {{$hasBodyVar := or ($hasHeaders) (not $fixedStatusCode) (not .IsSupported)}} + {{if .IsJSON }} + {{$hasUnionElements := ne 0 (len .Schema.UnionElements)}} + return ctx.JSON(&{{if $hasBodyVar}}response.Body{{else}}response{{end}}{{if $hasUnionElements}}.union{{end}}) + {{else if eq .NameTag "Text" -}} + _, err := ctx.WriteString(string({{if $hasBodyVar}}response.Body{{else}}response{{end}})) + return err + {{else if eq .NameTag "Formdata" -}} + if form, err := runtime.MarshalForm({{if $hasBodyVar}}response.Body{{else}}response{{end}}, nil); err != nil { + return err + } else { + _, err := ctx.WriteString(form.Encode()) + return err + } + {{else if eq .NameTag "Multipart" -}} + defer writer.Close() + return {{if $hasBodyVar}}response.Body{{else}}response{{end}}(writer); + {{else -}} + if closer, ok := response.Body.(io.ReadCloser); ok { + defer closer.Close() + } + _, err := io.Copy(ctx.Response().BodyWriter(), response.Body) + return err + {{end}}{{/* if eq .NameTag "JSON" */ -}} + } + {{end}} + + {{if eq 0 (len .Contents) -}} + {{if and $fixedStatusCode $isRef -}} + type {{$opid}}{{$statusCode}}Response {{if not $isExternalRef}}={{end}} {{$ref}}Response + {{else -}} + type {{$opid}}{{$statusCode}}Response struct { + {{if $hasHeaders -}} + Headers {{if $isRef}}{{$ref}}{{else}}{{$opid}}{{$statusCode}}{{end}}ResponseHeaders + {{end}} + {{if not $fixedStatusCode -}} + StatusCode int + {{end -}} + } + {{end -}} + func (response {{$opid}}{{$statusCode}}Response) Visit{{$opid}}Response(ctx *fiber.Ctx) error { + {{range $headers -}} + ctx.Response().Header.Set("{{.Name}}", fmt.Sprint(response.Headers.{{.GoName}})) + {{end -}} + ctx.Status({{if $fixedStatusCode}}{{$statusCode}}{{else}}response.StatusCode{{end}}) + return nil + } + {{end}} + {{end}} +{{end}} + +// StrictServerInterface represents all server handlers. +type StrictServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{$opid := .OperationId -}} +{{$opid}}(ctx context.Context, request {{$opid | ucFirst}}RequestObject) ({{$opid | ucFirst}}ResponseObject, error) +{{end}}{{/* range . */ -}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-fiber.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-fiber.tmpl new file mode 100644 index 0000000000..510899c9e0 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-fiber.tmpl @@ -0,0 +1,90 @@ +type StrictHandlerFunc func(ctx *fiber.Ctx, args interface{}) (interface{}, error) + +type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc + +func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface { + return &strictHandler{ssi: ssi, middlewares: middlewares} +} + +type strictHandler struct { + ssi StrictServerInterface + middlewares []StrictMiddlewareFunc +} + +{{range .}} + {{$opid := .OperationId}} + // {{$opid}} operation middleware + func (sh *strictHandler) {{.OperationId}}(ctx *fiber.Ctx{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) error { + var request {{$opid | ucFirst}}RequestObject + + {{range .PathParams -}} + {{$varName := .GoVariableName -}} + request.{{.GoName}} = {{.GoVariableName}} + {{end -}} + + {{if .RequiresParamObject -}} + request.Params = params + {{end -}} + + {{ if .HasMaskedRequestContentTypes -}} + request.ContentType = string(ctx.Request().Header.ContentType()) + {{end -}} + + {{$multipleBodies := gt (len .Bodies) 1 -}} + {{range .Bodies -}} + {{if $multipleBodies}}if strings.HasPrefix(string(ctx.Request().Header.ContentType()), "{{.ContentType}}") { {{end}} + {{if .IsJSON }} + var body {{$opid}}{{.NameTag}}RequestBody + if err := ctx.BodyParser(&body); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else if eq .NameTag "Formdata" -}} + var body {{$opid}}{{.NameTag}}RequestBody + if err := ctx.BodyParser(&body); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else if eq .NameTag "Multipart" -}} + {{if eq .ContentType "multipart/form-data" -}} + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = multipart.NewReader(bytes.NewReader(ctx.Request().Body()), string(ctx.Request().Header.MultipartFormBoundary())) + {{else -}} + if _, params, err := mime.ParseMediaType(string(ctx.Request().Header.ContentType())); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } else if boundary := params["boundary"]; boundary == "" { + return fiber.NewError(fiber.StatusBadRequest, http.ErrMissingBoundary.Error()) + } else { + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = multipart.NewReader(bytes.NewReader(ctx.Request().Body()), boundary) + } + {{end -}} + {{else if eq .NameTag "Text" -}} + data := ctx.Request().Body() + body := {{$opid}}{{.NameTag}}RequestBody(data) + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else -}} + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = bytes.NewReader(ctx.Request().Body()) + {{end}}{{/* if eq .NameTag "JSON" */ -}} + {{if $multipleBodies}}}{{end}} + {{end}}{{/* range .Bodies */}} + + handler := func(ctx *fiber.Ctx, request interface{}) (interface{}, error) { + return sh.ssi.{{.OperationId}}(ctx.UserContext(), request.({{$opid | ucFirst}}RequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "{{.OperationId}}") + } + + response, err := handler(ctx, request) + + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } else if validResponse, ok := response.({{$opid | ucFirst}}ResponseObject); ok { + if err := validResponse.Visit{{$opid}}Response(ctx); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + } else if response != nil { + return fmt.Errorf("unexpected response type: %T", response) + } + return nil + } +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-gin.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-gin.tmpl new file mode 100644 index 0000000000..d4c43164a6 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-gin.tmpl @@ -0,0 +1,106 @@ +type StrictHandlerFunc = strictgin.StrictGinHandlerFunc +type StrictMiddlewareFunc = strictgin.StrictGinMiddlewareFunc + +func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface { + return &strictHandler{ssi: ssi, middlewares: middlewares} +} + +type strictHandler struct { + ssi StrictServerInterface + middlewares []StrictMiddlewareFunc +} + +{{range .}} + {{$opid := .OperationId}} + // {{$opid}} operation middleware + func (sh *strictHandler) {{.OperationId}}(ctx *gin.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) { + var request {{$opid | ucFirst}}RequestObject + + {{range .PathParams -}} + request.{{.GoName}} = {{.GoVariableName}} + {{end -}} + + {{if .RequiresParamObject -}} + request.Params = params + {{end -}} + + {{ if .HasMaskedRequestContentTypes -}} + request.ContentType = ctx.ContentType() + {{end -}} + + {{$multipleBodies := gt (len .Bodies) 1 -}} + {{range .Bodies -}} + {{if $multipleBodies}}if strings.HasPrefix(ctx.GetHeader("Content-Type"), "{{.ContentType}}") { {{end}} + {{if .IsJSON }} + var body {{$opid}}{{.NameTag}}RequestBody + if err := ctx.ShouldBindJSON(&body); err != nil { + ctx.Status(http.StatusBadRequest) + ctx.Error(err) + return + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else if eq .NameTag "Formdata" -}} + if err := ctx.Request.ParseForm(); err != nil { + ctx.Error(err) + return + } + var body {{$opid}}{{.NameTag}}RequestBody + if err := runtime.BindForm(&body, ctx.Request.Form, nil, nil); err != nil { + ctx.Error(err) + return + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else if eq .NameTag "Multipart" -}} + {{if eq .ContentType "multipart/form-data" -}} + if reader, err := ctx.Request.MultipartReader(); err == nil { + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = reader + } else { + ctx.Error(err) + return + } + {{else -}} + if _, params, err := mime.ParseMediaType(ctx.Request.Header.Get("Content-Type")); err != nil { + ctx.Error(err) + return + } else if boundary := params["boundary"]; boundary == "" { + ctx.Error(http.ErrMissingBoundary) + return + } else { + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = multipart.NewReader(ctx.Request.Body, boundary) + } + {{end -}} + {{else if eq .NameTag "Text" -}} + data, err := io.ReadAll(ctx.Request.Body) + if err != nil { + ctx.Error(err) + return + } + body := {{$opid}}{{.NameTag}}RequestBody(data) + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else -}} + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = ctx.Request.Body + {{end}}{{/* if eq .NameTag "JSON" */ -}} + {{if $multipleBodies}}}{{end}} + {{end}}{{/* range .Bodies */}} + + handler := func(ctx *gin.Context, request interface{}) (interface{}, error) { + return sh.ssi.{{.OperationId}}(ctx, request.({{$opid | ucFirst}}RequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "{{.OperationId}}") + } + + response, err := handler(ctx, request) + + if err != nil { + ctx.Error(err) + ctx.Status(http.StatusInternalServerError) + } else if validResponse, ok := response.({{$opid | ucFirst}}ResponseObject); ok { + if err := validResponse.Visit{{$opid}}Response(ctx.Writer); err != nil { + ctx.Error(err) + } + } else if response != nil { + ctx.Error(fmt.Errorf("unexpected response type: %T", response)) + } + } +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-http.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-http.tmpl new file mode 100644 index 0000000000..8d32415ad6 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-http.tmpl @@ -0,0 +1,121 @@ +type StrictHandlerFunc = strictnethttp.StrictHTTPHandlerFunc +type StrictMiddlewareFunc = strictnethttp.StrictHTTPMiddlewareFunc + +type StrictHTTPServerOptions struct { + RequestErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) + ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface { + return &strictHandler{ssi: ssi, middlewares: middlewares, options: StrictHTTPServerOptions { + RequestErrorHandlerFunc: func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + }, + ResponseErrorHandlerFunc: func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusInternalServerError) + }, + }} +} + +func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface { + return &strictHandler{ssi: ssi, middlewares: middlewares, options: options} +} + +type strictHandler struct { + ssi StrictServerInterface + middlewares []StrictMiddlewareFunc + options StrictHTTPServerOptions +} + +{{range .}} + {{$opid := .OperationId}} + // {{$opid}} operation middleware + func (sh *strictHandler) {{.OperationId}}(w http.ResponseWriter, r *http.Request{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) { + var request {{$opid | ucFirst}}RequestObject + + {{range .PathParams -}} + request.{{.GoName}} = {{.GoVariableName}} + {{end -}} + + {{if .RequiresParamObject -}} + request.Params = params + {{end -}} + + {{ if .HasMaskedRequestContentTypes -}} + request.ContentType = r.Header.Get("Content-Type") + {{end -}} + + {{$multipleBodies := gt (len .Bodies) 1 -}} + {{range .Bodies -}} + {{if $multipleBodies}}if strings.HasPrefix(r.Header.Get("Content-Type"), "{{.ContentType}}") { {{end}} + {{if .IsJSON }} + var body {{$opid}}{{.NameTag}}RequestBody + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode JSON body: %w", err)) + return + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else if eq .NameTag "Formdata" -}} + if err := r.ParseForm(); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode formdata: %w", err)) + return + } + var body {{$opid}}{{.NameTag}}RequestBody + if err := runtime.BindForm(&body, r.Form, nil, nil); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't bind formdata: %w", err)) + return + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else if eq .NameTag "Multipart" -}} + {{if eq .ContentType "multipart/form-data" -}} + if reader, err := r.MultipartReader(); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode multipart body: %w", err)) + return + } else { + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = reader + } + {{else -}} + if _, params, err := mime.ParseMediaType(r.Header.Get("Content-Type")); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, err) + return + } else if boundary := params["boundary"]; boundary == "" { + sh.options.RequestErrorHandlerFunc(w, r, http.ErrMissingBoundary) + return + } else { + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = multipart.NewReader(r.Body, boundary) + } + {{end -}} + {{else if eq .NameTag "Text" -}} + data, err := io.ReadAll(r.Body) + if err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't read body: %w", err)) + return + } + body := {{$opid}}{{.NameTag}}RequestBody(data) + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else -}} + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = r.Body + {{end}}{{/* if eq .NameTag "JSON" */ -}} + {{if $multipleBodies}}}{{end}} + {{end}}{{/* range .Bodies */}} + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.{{.OperationId}}(ctx, request.({{$opid | ucFirst}}RequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "{{.OperationId}}") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.({{$opid | ucFirst}}ResponseObject); ok { + if err := validResponse.Visit{{$opid}}Response(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } + } +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-interface.tmpl new file mode 100644 index 0000000000..e19936d6a7 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-interface.tmpl @@ -0,0 +1,145 @@ +{{range .}} + {{$opid := .OperationId -}} + type {{$opid | ucFirst}}RequestObject struct { + {{range .PathParams -}} + {{.GoName | ucFirst}} {{.TypeDef}} {{.JsonTag}} + {{end -}} + {{if .RequiresParamObject -}} + Params {{$opid}}Params + {{end -}} + {{if .HasMaskedRequestContentTypes -}} + ContentType string + {{end -}} + {{$multipleBodies := gt (len .Bodies) 1 -}} + {{range .Bodies -}} + {{if $multipleBodies}}{{.NameTag}}{{end}}Body {{if eq .NameTag "Multipart"}}*multipart.Reader{{else if ne .NameTag ""}}*{{$opid}}{{.NameTag}}RequestBody{{else}}io.Reader{{end}} + {{end -}} + } + + type {{$opid | ucFirst}}ResponseObject interface { + Visit{{$opid}}Response(w http.ResponseWriter) error + } + + {{range .Responses}} + {{$statusCode := .StatusCode -}} + {{$hasHeaders := ne 0 (len .Headers) -}} + {{$fixedStatusCode := .HasFixedStatusCode -}} + {{$isRef := .IsRef -}} + {{$isExternalRef := .IsExternalRef -}} + {{$ref := .Ref | ucFirstWithPkgName -}} + {{$headers := .Headers -}} + + {{if (and $hasHeaders (not $isRef)) -}} + type {{$opid}}{{$statusCode}}ResponseHeaders struct { + {{range .Headers -}} + {{.GoName}} {{.Schema.TypeDecl}} + {{end -}} + } + {{end}} + + {{range .Contents}} + {{$receiverTypeName := printf "%s%s%s%s" $opid $statusCode .NameTagOrContentType "Response"}} + {{if and $fixedStatusCode $isRef -}} + {{ if and (not $hasHeaders) ($fixedStatusCode) (.IsSupported) (eq .NameTag "Multipart") -}} + type {{$receiverTypeName}} {{$ref}}{{.NameTagOrContentType}}Response + {{else if $isExternalRef -}} + type {{$receiverTypeName}} struct { {{$ref}} } + {{else -}} + type {{$receiverTypeName}} struct{ {{$ref}}{{.NameTagOrContentType}}Response } + {{end}} + {{else if and (not $hasHeaders) ($fixedStatusCode) (.IsSupported) -}} + type {{$receiverTypeName}} {{if eq .NameTag "Multipart"}}func(writer *multipart.Writer)error{{else if .IsSupported}}{{if and .Schema.IsRef (not .Schema.IsExternalRef)}}={{end}} {{.Schema.TypeDecl}}{{else}}io.Reader{{end}} + {{else -}} + type {{$receiverTypeName}} struct { + Body {{if eq .NameTag "Multipart"}}func(writer *multipart.Writer)error{{else if .IsSupported}}{{.Schema.TypeDecl}}{{else}}io.Reader{{end}} + {{if $hasHeaders -}} + Headers {{if $isRef}}{{$ref}}{{else}}{{$opid}}{{$statusCode}}{{end}}ResponseHeaders + {{end -}} + + {{if not $fixedStatusCode -}} + StatusCode int + {{end -}} + + {{if not .HasFixedContentType -}} + ContentType string + {{end -}} + + {{if not .IsSupported -}} + ContentLength int64 + {{end -}} + } + {{end}} + + func (response {{$receiverTypeName}}) Visit{{$opid}}Response(w http.ResponseWriter) error { + {{if eq .NameTag "Multipart" -}} + writer := multipart.NewWriter(w) + {{end -}} + w.Header().Set("Content-Type", {{if eq .NameTag "Multipart"}}{{if eq .ContentType "multipart/form-data"}}writer.FormDataContentType(){{else}}mime.FormatMediaType("{{.ContentType}}", map[string]string{"boundary": writer.Boundary()}){{end}}{{else if .HasFixedContentType }}"{{.ContentType}}"{{else}}response.ContentType{{end}}) + {{if not .IsSupported -}} + if response.ContentLength != 0 { + w.Header().Set("Content-Length", fmt.Sprint(response.ContentLength)) + } + {{end -}} + {{range $headers -}} + w.Header().Set("{{.Name}}", fmt.Sprint(response.Headers.{{.GoName}})) + {{end -}} + w.WriteHeader({{if $fixedStatusCode}}{{$statusCode}}{{else}}response.StatusCode{{end}}) + {{$hasBodyVar := or ($hasHeaders) (not $fixedStatusCode) (not .IsSupported)}} + {{if .IsJSON -}} + {{$hasUnionElements := ne 0 (len .Schema.UnionElements)}} + return json.NewEncoder(w).Encode(response{{if $hasBodyVar}}.Body{{end}}{{if $hasUnionElements}}.union{{end}}) + {{else if eq .NameTag "Text" -}} + _, err := w.Write([]byte({{if $hasBodyVar}}response.Body{{else}}response{{end}})) + return err + {{else if eq .NameTag "Formdata" -}} + if form, err := runtime.MarshalForm({{if $hasBodyVar}}response.Body{{else}}response{{end}}, nil); err != nil { + return err + } else { + _, err := w.Write([]byte(form.Encode())) + return err + } + {{else if eq .NameTag "Multipart" -}} + defer writer.Close() + return {{if $hasBodyVar}}response.Body{{else}}response{{end}}(writer); + {{else -}} + if closer, ok := response.Body.(io.ReadCloser); ok { + defer closer.Close() + } + _, err := io.Copy(w, response.Body) + return err + {{end}}{{/* if eq .NameTag "JSON" */ -}} + } + {{end}} + + {{if eq 0 (len .Contents) -}} + {{if and $fixedStatusCode $isRef -}} + type {{$opid}}{{$statusCode}}Response {{if not $isExternalRef}}={{end}} {{$ref}}Response + {{else -}} + type {{$opid}}{{$statusCode}}Response struct { + {{if $hasHeaders -}} + Headers {{if $isRef}}{{$ref}}{{else}}{{$opid}}{{$statusCode}}{{end}}ResponseHeaders + {{end}} + {{if not $fixedStatusCode -}} + StatusCode int + {{end -}} + } + {{end -}} + func (response {{$opid}}{{$statusCode}}Response) Visit{{$opid}}Response(w http.ResponseWriter) error { + {{range $headers -}} + w.Header().Set("{{.Name}}", fmt.Sprint(response.Headers.{{.GoName}})) + {{end -}} + w.WriteHeader({{if $fixedStatusCode}}{{$statusCode}}{{else}}response.StatusCode{{end}}) + return nil + } + {{end}} + {{end}} +{{end}} + +// StrictServerInterface represents all server handlers. +type StrictServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{$opid := .OperationId -}} +{{$opid}}(ctx context.Context, request {{$opid | ucFirst}}RequestObject) ({{$opid | ucFirst}}ResponseObject, error) +{{end}}{{/* range . */ -}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-iris-interface.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-iris-interface.tmpl new file mode 100644 index 0000000000..e93fdf6166 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-iris-interface.tmpl @@ -0,0 +1,147 @@ +{{range .}} + {{$opid := .OperationId -}} + type {{$opid | ucFirst}}RequestObject struct { + {{range .PathParams -}} + {{.GoName | ucFirst}} {{.TypeDef}} {{.JsonTag}} + {{end -}} + {{if .RequiresParamObject -}} + Params {{$opid}}Params + {{end -}} + {{if .HasMaskedRequestContentTypes -}} + ContentType string + {{end -}} + {{$multipleBodies := gt (len .Bodies) 1 -}} + {{range .Bodies -}} + {{if $multipleBodies}}{{.NameTag}}{{end}}Body {{if eq .NameTag "Multipart"}}*multipart.Reader{{else if ne .NameTag ""}}*{{$opid}}{{.NameTag}}RequestBody{{else}}io.Reader{{end}} + {{end -}} + } + + type {{$opid | ucFirst}}ResponseObject interface { + Visit{{$opid}}Response(ctx iris.Context) error + } + + {{range .Responses}} + {{$statusCode := .StatusCode -}} + {{$hasHeaders := ne 0 (len .Headers) -}} + {{$fixedStatusCode := .HasFixedStatusCode -}} + {{$isRef := .IsRef -}} + {{$isExternalRef := .IsExternalRef -}} + {{$ref := .Ref | ucFirstWithPkgName -}} + {{$headers := .Headers -}} + + {{if (and $hasHeaders (not $isRef)) -}} + type {{$opid}}{{$statusCode}}ResponseHeaders struct { + {{range .Headers -}} + {{.GoName}} {{.Schema.TypeDecl}} + {{end -}} + } + {{end}} + + {{range .Contents}} + {{$receiverTypeName := printf "%s%s%s%s" $opid $statusCode .NameTagOrContentType "Response"}} + {{if eq .NameTag "Text" -}} + type {{$receiverTypeName}} string + {{else if and $fixedStatusCode $isRef -}} + {{ if and (not $hasHeaders) ($fixedStatusCode) (.IsSupported) (eq .NameTag "Multipart") -}} + type {{$receiverTypeName}} {{$ref}}{{.NameTagOrContentType}}Response + {{else if $isExternalRef -}} + type {{$receiverTypeName}} struct { {{$ref}} } + {{else -}} + type {{$receiverTypeName}} struct{ {{$ref}}{{.NameTagOrContentType}}Response } + {{end}} + {{else if and (not $hasHeaders) ($fixedStatusCode) (.IsSupported) -}} + type {{$receiverTypeName}} {{if eq .NameTag "Multipart"}}func(writer *multipart.Writer)error{{else if .IsSupported}}{{if and .Schema.IsRef (not .Schema.IsExternalRef)}}={{end}} {{.Schema.TypeDecl}}{{else}}io.Reader{{end}} + {{else -}} + type {{$receiverTypeName}} struct { + Body {{if eq .NameTag "Multipart"}}func(writer *multipart.Writer)error{{else if .IsSupported}}{{.Schema.TypeDecl}}{{else}}io.Reader{{end}} + {{if $hasHeaders -}} + Headers {{if $isRef}}{{$ref}}{{else}}{{$opid}}{{$statusCode}}{{end}}ResponseHeaders + {{end -}} + + {{if not $fixedStatusCode -}} + StatusCode int + {{end -}} + + {{if not .HasFixedContentType -}} + ContentType string + {{end -}} + + {{if not .IsSupported -}} + ContentLength int64 + {{end -}} + } + {{end}} + + func (response {{$receiverTypeName}}) Visit{{$opid}}Response(ctx iris.Context) error { + {{range $headers -}} + ctx.ResponseWriter().Header().Set("{{.Name}}", fmt.Sprint(response.Headers.{{.GoName}})) + {{end -}} + {{if eq .NameTag "Multipart" -}} + writer := multipart.NewWriter(ctx.ResponseWriter()) + {{end -}} + ctx.ResponseWriter().Header().Set("Content-Type", {{if eq .NameTag "Multipart"}}{{if eq .ContentType "multipart/form-data"}}writer.FormDataContentType(){{else}}mime.FormatMediaType("{{.ContentType}}", map[string]string{"boundary": writer.Boundary()}){{end}}{{else if .HasFixedContentType }}"{{.ContentType}}"{{else}}response.ContentType{{end}}) + {{if not .IsSupported -}} + if response.ContentLength != 0 { + ctx.ResponseWriter().Header().Set("Content-Length", fmt.Sprint(response.ContentLength)) + } + {{end -}} + ctx.StatusCode({{if $fixedStatusCode}}{{$statusCode}}{{else}}response.StatusCode{{end}}) + {{$hasBodyVar := or ($hasHeaders) (not $fixedStatusCode) (not .IsSupported)}} + {{if .IsJSON -}} + {{$hasUnionElements := ne 0 (len .Schema.UnionElements)}} + return ctx.JSON(&{{if $hasBodyVar}}response.Body{{else}}response{{end}}{{if $hasUnionElements}}.union{{end}}) + {{else if eq .NameTag "Text" -}} + _, err := ctx.WriteString(string({{if $hasBodyVar}}response.Body{{else}}response{{end}})) + return err + {{else if eq .NameTag "Formdata" -}} + if form, err := runtime.MarshalForm({{if $hasBodyVar}}response.Body{{else}}response{{end}}, nil); err != nil { + return err + } else { + _, err := ctx.WriteString(form.Encode()) + return err + } + {{else if eq .NameTag "Multipart" -}} + defer writer.Close() + return {{if $hasBodyVar}}response.Body{{else}}response{{end}}(writer); + {{else -}} + if closer, ok := response.Body.(io.ReadCloser); ok { + defer closer.Close() + } + _, err := io.Copy(ctx.ResponseWriter(), response.Body) + return err + {{end}}{{/* if eq .NameTag "JSON" */ -}} + } + {{end}} + + {{if eq 0 (len .Contents) -}} + {{if and $fixedStatusCode $isRef -}} + type {{$opid}}{{$statusCode}}Response {{if not $isExternalRef}}={{end}} {{$ref}}Response + {{else -}} + type {{$opid}}{{$statusCode}}Response struct { + {{if $hasHeaders -}} + Headers {{if $isRef}}{{$ref}}{{else}}{{$opid}}{{$statusCode}}{{end}}ResponseHeaders + {{end}} + {{if not $fixedStatusCode -}} + StatusCode int + {{end -}} + } + {{end -}} + func (response {{$opid}}{{$statusCode}}Response) Visit{{$opid}}Response(ctx iris.Context) error { + {{range $headers -}} + ctx.Response().Header.Set("{{.Name}}", fmt.Sprint(response.Headers.{{.GoName}})) + {{end -}} + ctx.StatusCode({{if $fixedStatusCode}}{{$statusCode}}{{else}}response.StatusCode{{end}}) + return nil + } + {{end}} + {{end}} +{{end}} + +// StrictServerInterface represents all server handlers. +type StrictServerInterface interface { +{{range .}}{{.SummaryAsComment }} +// ({{.Method}} {{.Path}}) +{{$opid := .OperationId -}} +{{$opid}}(ctx context.Context, request {{$opid | ucFirst}}RequestObject) ({{$opid | ucFirst}}ResponseObject, error) +{{end}}{{/* range . */ -}} +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-iris.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-iris.tmpl new file mode 100644 index 0000000000..dfdeb1546f --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-iris.tmpl @@ -0,0 +1,107 @@ +type StrictHandlerFunc = strictiris.StrictIrisHandlerFunc +type StrictMiddlewareFunc = strictiris.StrictIrisMiddlewareFunc + +func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface { + return &strictHandler{ssi: ssi, middlewares: middlewares} +} + +type strictHandler struct { + ssi StrictServerInterface + middlewares []StrictMiddlewareFunc +} + +{{range .}} + {{$opid := .OperationId}} + // {{$opid}} operation middleware + func (sh *strictHandler) {{.OperationId}}(ctx iris.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) { + var request {{$opid | ucFirst}}RequestObject + + {{range .PathParams -}} + request.{{.GoName}} = {{.GoVariableName}} + {{end -}} + + {{if .RequiresParamObject -}} + request.Params = params + {{end -}} + + {{ if .HasMaskedRequestContentTypes -}} + request.ContentType = ctx.GetContentTypeRequested() + {{end -}} + + {{$multipleBodies := gt (len .Bodies) 1 -}} + {{range .Bodies -}} + {{if $multipleBodies}}if strings.HasPrefix(ctx.GetHeader("Content-Type"), "{{.ContentType}}") { {{end}} + {{if .IsJSON }} + var body {{$opid}}{{.NameTag}}RequestBody + if err := ctx.ReadJSON(&body); err != nil { + ctx.StopWithError(http.StatusBadRequest, err) + return + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else if eq .NameTag "Formdata" -}} + if err := ctx.Request().ParseForm(); err != nil { + ctx.StopWithError(http.StatusBadRequest, err) + return + } + var body {{$opid}}{{.NameTag}}RequestBody + if err := runtime.BindForm(&body, ctx.Request().Form, nil, nil); err != nil { + ctx.StopWithError(http.StatusBadRequest, err) + return + } + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else if eq .NameTag "Multipart" -}} + {{if eq .ContentType "multipart/form-data" -}} + if reader, err := ctx.Request().MultipartReader(); err == nil { + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = reader + } else { + ctx.StopWithError(http.StatusBadRequest, err) + return + } + {{else -}} + if _, params, err := mime.ParseMediaType(ctx.Request().Header.Get("Content-Type")); err != nil { + ctx.StopWithError(http.StatusBadRequest, err) + return + } else if boundary := params["boundary"]; boundary == "" { + ctx.StopWithError(http.StatusBadRequest, http.ErrMissingBoundary) + return + } else { + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = multipart.NewReader(ctx.Request().Body, boundary) + } + {{end -}} + {{else if eq .NameTag "Text" -}} + data, err := io.ReadAll(ctx.Request().Body) + if err != nil { + ctx.StopWithError(http.StatusBadRequest, err) + return + } + body := {{$opid}}{{.NameTag}}RequestBody(data) + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = &body + {{else -}} + request.{{if $multipleBodies}}{{.NameTag}}{{end}}Body = ctx.Request().Body + {{end}}{{/* if eq .NameTag "JSON" */ -}} + {{if $multipleBodies}}}{{end}} + {{end}}{{/* range .Bodies */}} + + handler := func(ctx iris.Context, request interface{}) (interface{}, error) { + return sh.ssi.{{.OperationId}}(ctx, request.({{$opid | ucFirst}}RequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "{{.OperationId}}") + } + + response, err := handler(ctx, request) + + if err != nil { + ctx.StopWithError(http.StatusBadRequest, err) + return + } else if validResponse, ok := response.({{$opid | ucFirst}}ResponseObject); ok { + if err := validResponse.Visit{{$opid}}Response(ctx); err != nil { + ctx.StopWithError(http.StatusBadRequest, err) + return + } + } else if response != nil { + ctx.Writef("Unexpected response type: %T", response) + return + } + } +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-responses.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-responses.tmpl new file mode 100644 index 0000000000..d04cbd7d6c --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/strict/strict-responses.tmpl @@ -0,0 +1,41 @@ +{{range . -}} + {{$hasHeaders := ne 0 (len .Headers) -}} + {{$name := .GoName | ucFirst -}} + {{if $hasHeaders -}} + type {{$name}}ResponseHeaders struct { + {{range .Headers -}} + {{.GoName}} {{.Schema.TypeDecl}} + {{end -}} + } + {{end -}} + + {{range .Contents -}} + {{if and (not $hasHeaders) (.IsSupported) -}} + type {{$name}}{{.NameTagOrContentType}}Response {{if eq .NameTag "Multipart"}}func(writer *multipart.Writer)error{{else if .IsSupported}}{{if .Schema.IsRef}}={{end}} {{.Schema.TypeDecl}}{{else}}io.Reader{{end}} + {{else -}} + type {{$name}}{{.NameTagOrContentType}}Response struct { + Body {{if eq .NameTag "Multipart"}}func(writer *multipart.Writer)error{{else if .IsSupported}}{{.Schema.TypeDecl}}{{else}}io.Reader{{end}} + + {{if $hasHeaders -}} + Headers {{$name}}ResponseHeaders + {{end -}} + + {{if not .HasFixedContentType -}} + ContentType string + {{end -}} + + {{if not .IsSupported -}} + ContentLength int64 + {{end -}} + } + {{end -}} + {{end -}} + + {{if eq 0 (len .Contents) -}} + type {{$name}}Response struct { + {{if $hasHeaders -}} + Headers {{$name}}ResponseHeaders + {{end}} + } + {{end}} +{{end -}} \ No newline at end of file diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/typedef.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/typedef.tmpl new file mode 100644 index 0000000000..be3112c0fb --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/typedef.tmpl @@ -0,0 +1,4 @@ +{{range .Types}} +{{ if .Schema.Description }}{{ toGoComment .Schema.Description .TypeName }}{{ else }}// {{.TypeName}} defines model for {{.JsonName}}.{{ end }} +type {{.TypeName}} {{if .IsAlias }}={{end}} {{.Schema.TypeDecl}} +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union-and-additional-properties.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union-and-additional-properties.tmpl new file mode 100644 index 0000000000..1c48092ccf --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union-and-additional-properties.tmpl @@ -0,0 +1,72 @@ +{{range .Types}} + +{{$addType := .Schema.AdditionalPropertiesType.TypeDecl}} +{{$typeName := .TypeName -}} +{{$discriminator := .Schema.Discriminator}} +{{$properties := .Schema.Properties -}} + +// Override default JSON handling for {{.TypeName}} to handle AdditionalProperties and union +func (a *{{.TypeName}}) UnmarshalJSON(b []byte) error { + err := a.union.UnmarshalJSON(b) + if err != nil { + return err + } + object := make(map[string]json.RawMessage) + err = json.Unmarshal(b, &object) + if err != nil { + return err + } +{{range .Schema.Properties}} + if raw, found := object["{{.JsonFieldName}}"]; found { + err = json.Unmarshal(raw, &a.{{.GoFieldName}}) + if err != nil { + return fmt.Errorf("error reading '{{.JsonFieldName}}': %w", err) + } + delete(object, "{{.JsonFieldName}}") + } +{{end}} + if len(object) != 0 { + a.AdditionalProperties = make(map[string]{{$addType}}) + for fieldName, fieldBuf := range object { + var fieldVal {{$addType}} + err := json.Unmarshal(fieldBuf, &fieldVal) + if err != nil { + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) + } + a.AdditionalProperties[fieldName] = fieldVal + } + } + return nil +} + +// Override default JSON handling for {{.TypeName}} to handle AdditionalProperties and union +func (a {{.TypeName}}) MarshalJSON() ([]byte, error) { + var err error + b, err := a.union.MarshalJSON() + if err != nil { + return nil, err + } + object := make(map[string]json.RawMessage) + if a.union != nil { + err = json.Unmarshal(b, &object) + if err != nil { + return nil, err + } + } +{{range .Schema.Properties}} +{{if .HasOptionalPointer}}if a.{{.GoFieldName}} != nil { {{end}} + object["{{.JsonFieldName}}"], err = json.Marshal(a.{{.GoFieldName}}) + if err != nil { + return nil, fmt.Errorf("error marshaling '{{.JsonFieldName}}': %w", err) + } +{{if .HasOptionalPointer}} }{{end}} +{{end}} + for fieldName, field := range a.AdditionalProperties { + object[fieldName], err = json.Marshal(field) + if err != nil { + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) + } + } + return json.Marshal(object) +} +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union.tmpl new file mode 100644 index 0000000000..c0385f82e3 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union.tmpl @@ -0,0 +1,140 @@ +{{range .Types}} + {{$typeName := .TypeName -}} + {{$discriminator := .Schema.Discriminator}} + {{$properties := .Schema.Properties -}} + {{range .Schema.UnionElements}} + {{$element := . -}} + // As{{ .Method }} returns the union data inside the {{$typeName}} as a {{.}} + func (t {{$typeName}}) As{{ .Method }}() ({{.}}, error) { + var body {{.}} + err := json.Unmarshal(t.union, &body) + return body, err + } + + // From{{ .Method }} overwrites any union data inside the {{$typeName}} as the provided {{.}} + func (t *{{$typeName}}) From{{ .Method }} (v {{.}}) error { + {{if $discriminator -}} + {{range $value, $type := $discriminator.Mapping -}} + {{if eq $type $element -}} + {{$hasProperty := false -}} + {{range $properties -}} + {{if eq .GoFieldName $discriminator.PropertyName -}} + t.{{$discriminator.PropertyName}} = "{{$value}}" + {{$hasProperty = true -}} + {{end -}} + {{end -}} + {{if not $hasProperty}}v.{{$discriminator.PropertyName}} = "{{$value}}"{{end}} + {{end -}} + {{end -}} + {{end -}} + b, err := json.Marshal(v) + t.union = b + return err + } + + // Merge{{ .Method }} performs a merge with any union data inside the {{$typeName}}, using the provided {{.}} + func (t *{{$typeName}}) Merge{{ .Method }} (v {{.}}) error { + {{if $discriminator -}} + {{range $value, $type := $discriminator.Mapping -}} + {{if eq $type $element -}} + {{$hasProperty := false -}} + {{range $properties -}} + {{if eq .GoFieldName $discriminator.PropertyName -}} + t.{{$discriminator.PropertyName}} = "{{$value}}" + {{$hasProperty = true -}} + {{end -}} + {{end -}} + {{if not $hasProperty}}v.{{$discriminator.PropertyName}} = "{{$value}}"{{end}} + {{end -}} + {{end -}} + {{end -}} + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err + } + {{end}} + + {{if $discriminator}} + func (t {{.TypeName}}) Discriminator() (string, error) { + var discriminator struct { + Discriminator string {{$discriminator.JSONTag}} + } + err := json.Unmarshal(t.union, &discriminator) + return discriminator.Discriminator, err + } + + {{if ne 0 (len $discriminator.Mapping)}} + func (t {{.TypeName}}) ValueByDiscriminator() (interface{}, error) { + discriminator, err := t.Discriminator() + if err != nil { + return nil, err + } + switch discriminator{ + {{range $value, $type := $discriminator.Mapping -}} + case "{{$value}}": + return t.As{{$type}}() + {{end -}} + default: + return nil, errors.New("unknown discriminator value: "+discriminator) + } + } + {{end}} + {{end}} + + {{if not .Schema.HasAdditionalProperties}} + + func (t {{.TypeName}}) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + {{if ne 0 (len .Schema.Properties) -}} + if err != nil { + return nil, err + } + object := make(map[string]json.RawMessage) + if t.union != nil { + err = json.Unmarshal(b, &object) + if err != nil { + return nil, err + } + } + {{range .Schema.Properties}} + {{if .HasOptionalPointer}}if t.{{.GoFieldName}} != nil { {{end}} + object["{{.JsonFieldName}}"], err = json.Marshal(t.{{.GoFieldName}}) + if err != nil { + return nil, fmt.Errorf("error marshaling '{{.JsonFieldName}}': %w", err) + } + {{if .HasOptionalPointer}} }{{end}} + {{end -}} + b, err = json.Marshal(object) + {{end -}} + return b, err + } + + func (t *{{.TypeName}}) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + {{if ne 0 (len .Schema.Properties) -}} + if err != nil { + return err + } + object := make(map[string]json.RawMessage) + err = json.Unmarshal(b, &object) + if err != nil { + return err + } + {{range .Schema.Properties}} + if raw, found := object["{{.JsonFieldName}}"]; found { + err = json.Unmarshal(raw, &t.{{.GoFieldName}}) + if err != nil { + return fmt.Errorf("error reading '{{.JsonFieldName}}': %w", err) + } + } + {{end}} + {{end -}} + return err + } + {{end}} +{{end}} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/test_schema.json b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/test_schema.json new file mode 100644 index 0000000000..d64939498e --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/test_schema.json @@ -0,0 +1,15 @@ +{ + "title": "node", + "type": "object", + "description": "Represents a node", + "properties": { + "id": { + "type": "string", + "format": "uri-reference" + }, + "type": { + "type": "string", + "pattern": "^[A-Z][a-zA-Z0-9]*$" + } + } +} \ No newline at end of file diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/test_spec.yaml b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/test_spec.yaml new file mode 100644 index 0000000000..b50f7491c5 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/test_spec.yaml @@ -0,0 +1,207 @@ +openapi: 3.0.1 + +info: + title: OpenAPI-CodeGen Test + description: 'This is a test OpenAPI Spec' + version: 1.0.0 + +servers: + - url: https://test.oapi-codegen.com/v2 + - url: http://test.oapi-codegen.com/v2 + +paths: + /test/{name}: + get: + tags: + - test + summary: Get test + operationId: getTestByName + parameters: + - name: name + in: path + required: true + schema: + type: string + - name: $top + in: query + required: false + schema: + type: integer + responses: + 200: + description: Success + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Test' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Test' + 422: + description: InvalidArray + content: + application/xml: + schema: + type: array + application/json: + schema: + type: array + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /cat: + get: + tags: + - cat + summary: Get cat status + operationId: getCatStatus + responses: + 200: + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CatAlive' + - $ref: '#/components/schemas/CatDead' + application/xml: + schema: + anyOf: + - $ref: '#/components/schemas/CatAlive' + - $ref: '#/components/schemas/CatDead' + application/yaml: + schema: + allOf: + - $ref: '#/components/schemas/CatAlive' + - $ref: '#/components/schemas/CatDead' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /enum: + get: + tags: + - enum + summary: References enum + operationId: getEnum + responses: + 200: + description: Success + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/EnumTest' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /user: + get: + tags: + - mergeAllOf + summary: Merges allOf ref-ing a JSON schema + operationId: getUser + responses: + 200: + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/User' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + +components: + schemas: + + Test: + properties: + name: + type: string + cases: + type: array + items: + $ref: '#/components/schemas/TestCase' + + TestCase: + properties: + name: + type: string + command: + type: string + + Error: + properties: + code: + type: integer + format: int32 + message: + type: string + + CatAlive: + properties: + name: + type: string + alive_since: + type: string + format: date-time + + CatDead: + properties: + name: + type: string + dead_since: + type: string + format: date-time + x-oapi-codegen-extra-tags: + tag1: value1 + tag2: value2 + cause: + type: string + enum: [ car, dog, oldage ] + + EnumTest: + properties: + numerics: + type: integer + enum: [0, 1, 2] + enumNames: + type: integer + enum: [0, 1, 2] + x-enumNames: + - zero + - one + - two + enumVarnames: + type: integer + enum: [0, 1, 2] + x-enum-varnames: + - na + - single + - double + User: + allOf: + - $ref: ./test_schema.json + - type: object + additionalProperties: false + properties: + name: + type: string + description: User name diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/utils.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/utils.go new file mode 100644 index 0000000000..6ecf27433c --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/utils.go @@ -0,0 +1,1112 @@ +// Copyright 2019 DeepMap, Inc. +// +// 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. +package codegen + +import ( + "bytes" + "fmt" + "go/token" + "net/url" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "unicode" + + "github.com/getkin/kin-openapi/openapi3" +) + +var ( + pathParamRE *regexp.Regexp + predeclaredSet map[string]struct{} + separatorSet map[rune]struct{} + nameNormalizer NameNormalizer = ToCamelCase +) + +type NameNormalizerFunction string + +const ( + // NameNormalizerFunctionUnset is the default case, where the `name-normalizer` option hasn't been set. This will use the `ToCamelCase` function. + // + // See the docs for `NameNormalizerFunctionToCamelCase` for more details. + NameNormalizerFunctionUnset NameNormalizerFunction = "" + // NameNormalizerFunctionToCamelCase will use the `ToCamelCase` function. + // + // For instance: + // + // - `getHttpPet` => `GetHttpPet` + // - `OneOf2things` => `OneOf2things` + NameNormalizerFunctionToCamelCase NameNormalizerFunction = "ToCamelCase" + // NameNormalizerFunctionToCamelCaseWithDigits will use the `NameNormalizerFunctionToCamelCaseWithDigits` function. + // + // For instance: + // + // - `getHttpPet` => `GetHttpPet` + // - `OneOf2things` => `OneOf2Things` + NameNormalizerFunctionToCamelCaseWithDigits NameNormalizerFunction = "ToCamelCaseWithDigits" + // NameNormalizerFunctionToCamelCaseWithInitialisms will use the `NameNormalizerFunctionToCamelCaseWithInitialisms` function. + // + // For instance: + // + // - `getHttpPet` => `GetHTTPPet` + // - `OneOf2things` => `OneOf2things` + NameNormalizerFunctionToCamelCaseWithInitialisms NameNormalizerFunction = "ToCamelCaseWithInitialisms" +) + +// NameNormalizer is a function that takes a type name, and returns that type name converted into a different format. +// +// This may be an Operation ID i.e. `retrieveUserRequests` or a Schema name i.e. `BigBlockOfCheese` +// +// NOTE: this must return a string that can be used as a valid Go type name +type NameNormalizer func(string) string + +type NameNormalizerMap map[NameNormalizerFunction]NameNormalizer + +func (m NameNormalizerMap) Options() []string { + options := make([]string, 0, len(m)) + + for key := range NameNormalizers { + options = append(options, string(key)) + } + + sort.Strings(options) + + return options +} + +// NameNormalizers contains the valid options for `NameNormalizerFunction`s that `oapi-codegen` supports. +// +// If you are calling `oapi-codegen` as a library, this allows you to specify your own normalisation types before generating code. +var NameNormalizers = NameNormalizerMap{ + NameNormalizerFunctionUnset: ToCamelCase, + NameNormalizerFunctionToCamelCase: ToCamelCase, + NameNormalizerFunctionToCamelCaseWithDigits: ToCamelCaseWithDigits, + NameNormalizerFunctionToCamelCaseWithInitialisms: ToCamelCaseWithInitialisms, +} + +func init() { + pathParamRE = regexp.MustCompile(`{[.;?]?([^{}*]+)\*?}`) + + predeclaredIdentifiers := []string{ + // Types + "bool", + "byte", + "complex64", + "complex128", + "error", + "float32", + "float64", + "int", + "int8", + "int16", + "int32", + "int64", + "rune", + "string", + "uint", + "uint8", + "uint16", + "uint32", + "uint64", + "uintptr", + // Constants + "true", + "false", + "iota", + // Zero value + "nil", + // Functions + "append", + "cap", + "close", + "complex", + "copy", + "delete", + "imag", + "len", + "make", + "new", + "panic", + "print", + "println", + "real", + "recover", + } + predeclaredSet = map[string]struct{}{} + for _, id := range predeclaredIdentifiers { + predeclaredSet[id] = struct{}{} + } + + separators := "-#@!$&=.+:;_~ (){}[]" + separatorSet = map[rune]struct{}{} + for _, r := range separators { + separatorSet[r] = struct{}{} + } +} + +// UppercaseFirstCharacter Uppercases the first character in a string. This assumes UTF-8, so we have +// to be careful with unicode, don't treat it as a byte array. +func UppercaseFirstCharacter(str string) string { + if str == "" { + return "" + } + runes := []rune(str) + runes[0] = unicode.ToUpper(runes[0]) + return string(runes) +} + +// Uppercase the first character in a identifier with pkg name. This assumes UTF-8, so we have +// to be careful with unicode, don't treat it as a byte array. +func UppercaseFirstCharacterWithPkgName(str string) string { + if str == "" { + return "" + } + + segs := strings.Split(str, ".") + var prefix string + if len(segs) == 2 { + prefix = segs[0] + "." + str = segs[1] + } + runes := []rune(str) + runes[0] = unicode.ToUpper(runes[0]) + return prefix + string(runes) +} + +// LowercaseFirstCharacter Lowercases the first character in a string. This assumes UTF-8, so we have +// to be careful with unicode, don't treat it as a byte array. +func LowercaseFirstCharacter(str string) string { + if str == "" { + return "" + } + runes := []rune(str) + runes[0] = unicode.ToLower(runes[0]) + return string(runes) +} + +// Lowercase the first upper characters in a string for case of abbreviation. +// This assumes UTF-8, so we have to be careful with unicode, don't treat it as a byte array. +func LowercaseFirstCharacters(str string) string { + if str == "" { + return "" + } + + runes := []rune(str) + + for i := 0; i < len(runes); i++ { + next := i + 1 + if i != 0 && next < len(runes) && unicode.IsLower(runes[next]) { + break + } + + runes[i] = unicode.ToLower(runes[i]) + } + + return string(runes) +} + +// ToCamelCase will convert query-arg style strings to CamelCase. We will +// use `., -, +, :, ;, _, ~, ' ', (, ), {, }, [, ]` as valid delimiters for words. +// So, "word.word-word+word:word;word_word~word word(word)word{word}[word]" +// would be converted to WordWordWordWordWordWordWordWordWordWordWordWordWord +func ToCamelCase(str string) string { + s := strings.Trim(str, " ") + + n := "" + capNext := true + for _, v := range s { + if unicode.IsUpper(v) { + n += string(v) + } + if unicode.IsDigit(v) { + n += string(v) + } + if unicode.IsLower(v) { + if capNext { + n += strings.ToUpper(string(v)) + } else { + n += string(v) + } + } + _, capNext = separatorSet[v] + } + return n +} + +// ToCamelCaseWithDigits function will convert query-arg style strings to CamelCase. We will +// use `., -, +, :, ;, _, ~, ' ', (, ), {, }, [, ]` as valid delimiters for words. +// The difference of ToCamelCase that letter after a number becomes capitalized. +// So, "word.word-word+word:word;word_word~word word(word)word{word}[word]3word" +// would be converted to WordWordWordWordWordWordWordWordWordWordWordWordWord3Word +func ToCamelCaseWithDigits(s string) string { + res := bytes.NewBuffer(nil) + capNext := true + for _, v := range s { + if unicode.IsUpper(v) { + res.WriteRune(v) + capNext = false + continue + } + if unicode.IsDigit(v) { + res.WriteRune(v) + capNext = true + continue + } + if unicode.IsLower(v) { + if capNext { + res.WriteRune(unicode.ToUpper(v)) + } else { + res.WriteRune(v) + } + capNext = false + continue + } + capNext = true + } + return res.String() +} + +// ToCamelCaseWithInitialisms function will convert query-arg style strings to CamelCase with initialisms in uppercase. +// So, httpOperationId would be converted to HTTPOperationID +func ToCamelCaseWithInitialisms(s string) string { + parts := camelCaseMatchParts.FindAllString(ToCamelCaseWithDigits(s), -1) + for i := range parts { + if v, ok := globalState.initialismsMap[strings.ToLower(parts[i])]; ok { + parts[i] = v + } + } + return strings.Join(parts, "") +} + +var camelCaseMatchParts = regexp.MustCompile(`[\p{Lu}\d]+([\p{Ll}\d]+|$)`) + +var initialismsList = []string{ + "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", + "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", + "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS", +} + +// targetWordRegex is a regex that matches all initialisms. +var targetWordRegex *regexp.Regexp + +func makeInitialismsMap(additionalInitialisms []string) map[string]string { + l := append(initialismsList, additionalInitialisms...) + + m := make(map[string]string, len(l)) + for i := range l { + m[strings.ToLower(l[i])] = l[i] + } + + // Create a regex to match the initialisms + targetWordRegex = regexp.MustCompile(`(?i)(` + strings.Join(l, "|") + `)`) + + return m +} + +func ToCamelCaseWithInitialism(str string) string { + return replaceInitialism(ToCamelCase(str)) +} + +func replaceInitialism(s string) string { + // These strings do not apply CamelCase + // Do not do CamelCase when these characters match when the preceding character is lowercase + return targetWordRegex.ReplaceAllStringFunc(s, func(s string) string { + // If the preceding character is lowercase, do not do CamelCase + if unicode.IsLower(rune(s[0])) { + return s + } + return strings.ToUpper(s) + }) +} + +// mediaTypeToCamelCase converts a media type to a PascalCase representation +func mediaTypeToCamelCase(s string) string { + // ToCamelCase doesn't - and won't - add `/` to the characters it'll allow word boundary + s = strings.Replace(s, "/", "_", 1) + // including a _ to make sure that these are treated as word boundaries by `ToCamelCase` + s = strings.Replace(s, "*", "Wildcard_", 1) + s = strings.Replace(s, "+", "Plus_", 1) + + return ToCamelCaseWithInitialism(s) +} + +// SortedMapKeys takes a map with keys of type string and returns a slice of those +// keys sorted lexicographically. +func SortedMapKeys[T any](m map[string]T) []string { + keys := make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + sort.Strings(keys) + return keys +} + +// SortedSchemaKeys returns the keys of the given SchemaRef dictionary in sorted +// order, since Golang scrambles dictionary keys. This isn't a generic key sort, because +// we support an extension to grant specific orders to schemas to help control output +// ordering. +func SortedSchemaKeys(dict map[string]*openapi3.SchemaRef) []string { + keys := make([]string, len(dict)) + orders := make(map[string]int64, len(dict)) + i := 0 + + for key, v := range dict { + keys[i], orders[key] = key, int64(len(dict)) + i++ + + if order, ok := schemaXOrder(v); ok { + orders[key] = order + } + } + + sort.Slice(keys, func(i, j int) bool { + if i, j := orders[keys[i]], orders[keys[j]]; i != j { + return i < j + } + return keys[i] < keys[j] + }) + return keys +} + +func schemaXOrder(v *openapi3.SchemaRef) (int64, bool) { + if v == nil { + return 0, false + } + + // YAML parsing picks up the x-order as a float64 + if order, ok := v.Extensions[extOrder].(float64); ok { + return int64(order), true + } + + if v.Value == nil { + return 0, false + } + + // if v.Value is set, then this is actually a `$ref`, and we should check if there's an x-order set on that + + // YAML parsing picks up the x-order as a float64 + if order, ok := v.Value.Extensions[extOrder].(float64); ok { + return int64(order), true + } + + return 0, false +} + +// StringInArray checks whether the specified string is present in an array +// of strings +func StringInArray(str string, array []string) bool { + for _, elt := range array { + if elt == str { + return true + } + } + return false +} + +// RefPathToObjName returns the name of referenced object without changes. +// +// #/components/schemas/Foo -> Foo +// #/components/parameters/Bar -> Bar +// #/components/responses/baz_baz -> baz_baz +// document.json#/Foo -> Foo +// http://deepmap.com/schemas/document.json#/objObj -> objObj +// +// Does not check refPath correctness. +func RefPathToObjName(refPath string) string { + parts := strings.Split(refPath, "/") + if len(parts) > 0 { + return parts[len(parts)-1] + } + return "" +} + +// RefPathToGoType takes a $ref value and converts it to a Go typename. +// #/components/schemas/Foo -> Foo +// #/components/parameters/Bar -> Bar +// #/components/responses/Baz -> Baz +// Remote components (document.json#/Foo) are supported if they present in --import-mapping +// URL components (http://deepmap.com/schemas/document.json#/Foo) are supported if they present in --import-mapping +// Remote and URL also support standard local paths even though the spec doesn't mention them. +func RefPathToGoType(refPath string) (string, error) { + return refPathToGoType(refPath, true) +} + +// refPathToGoType returns the Go typename for refPath given its +func refPathToGoType(refPath string, local bool) (string, error) { + if refPath[0] == '#' { + return refPathToGoTypeSelf(refPath, local) + } + pathParts := strings.Split(refPath, "#") + if len(pathParts) != 2 { + return "", fmt.Errorf("unsupported reference: %s", refPath) + } + remoteComponent, flatComponent := pathParts[0], pathParts[1] + goPkg, ok := globalState.importMapping[remoteComponent] + + if !ok { + return "", fmt.Errorf("unrecognized external reference '%s'; please provide the known import for this reference using option --import-mapping", remoteComponent) + } + + if goPkg.Path == importMappingCurrentPackage { + return refPathToGoTypeSelf(fmt.Sprintf("#%s", pathParts[1]), local) + } + + return refPathToGoTypeRemote(flatComponent, goPkg) + +} + +func refPathToGoTypeSelf(refPath string, local bool) (string, error) { + pathParts := strings.Split(refPath, "/") + depth := len(pathParts) + if local { + if depth != 4 { + return "", fmt.Errorf("unexpected reference depth: %d for ref: %s local: %t", depth, refPath, local) + } + } else if depth != 4 && depth != 2 { + return "", fmt.Errorf("unexpected reference depth: %d for ref: %s local: %t", depth, refPath, local) + } + + // Schemas may have been renamed locally, so look up the actual name in + // the spec. + name, err := findSchemaNameByRefPath(refPath, globalState.spec) + if err != nil { + return "", fmt.Errorf("error finding ref: %s in spec: %v", refPath, err) + } + if name != "" { + return name, nil + } + // lastPart now stores the final element of the type path. This is what + // we use as the base for a type name. + lastPart := pathParts[len(pathParts)-1] + return SchemaNameToTypeName(lastPart), nil +} + +func refPathToGoTypeRemote(flatComponent string, goPkg goImport) (string, error) { + goType, err := refPathToGoType("#"+flatComponent, false) + if err != nil { + return "", err + } + return fmt.Sprintf("%s.%s", goPkg.Name, goType), nil +} + +// IsGoTypeReference takes a $ref value and checks if it has link to go type. +// #/components/schemas/Foo -> true +// ./local/file.yml#/components/parameters/Bar -> true +// ./local/file.yml -> false +// IsGoTypeReference can be used to check whether RefPathToGoType($ref) is possible. +func IsGoTypeReference(ref string) bool { + return ref != "" && !IsWholeDocumentReference(ref) +} + +// IsWholeDocumentReference takes a $ref value and checks if it is whole document reference. +// #/components/schemas/Foo -> false +// ./local/file.yml#/components/parameters/Bar -> false +// ./local/file.yml -> true +// http://deepmap.com/schemas/document.json -> true +// http://deepmap.com/schemas/document.json#/Foo -> false +func IsWholeDocumentReference(ref string) bool { + return ref != "" && !strings.ContainsAny(ref, "#") +} + +// SwaggerUriToIrisUri converts a OpenAPI style path URI with parameters to an +// Iris compatible path URI. We need to replace all of OpenAPI parameters with +// +// {param} +// {param*} +// {.param} +// {.param*} +// {;param} +// {;param*} +// {?param} +// {?param*} +func SwaggerUriToIrisUri(uri string) string { + return pathParamRE.ReplaceAllString(uri, ":$1") +} + +// SwaggerUriToEchoUri converts a OpenAPI style path URI with parameters to an +// Echo compatible path URI. We need to replace all of OpenAPI parameters with +// ":param". Valid input parameters are: +// +// {param} +// {param*} +// {.param} +// {.param*} +// {;param} +// {;param*} +// {?param} +// {?param*} +func SwaggerUriToEchoUri(uri string) string { + return pathParamRE.ReplaceAllString(uri, ":$1") +} + +// SwaggerUriToFiberUri converts a OpenAPI style path URI with parameters to a +// Fiber compatible path URI. We need to replace all of OpenAPI parameters with +// ":param". Valid input parameters are: +// +// {param} +// {param*} +// {.param} +// {.param*} +// {;param} +// {;param*} +// {?param} +// {?param*} +func SwaggerUriToFiberUri(uri string) string { + return pathParamRE.ReplaceAllString(uri, ":$1") +} + +// SwaggerUriToChiUri converts a swagger style path URI with parameters to a +// Chi compatible path URI. We need to replace all Swagger parameters with +// "{param}". Valid input parameters are: +// +// {param} +// {param*} +// {.param} +// {.param*} +// {;param} +// {;param*} +// {?param} +// {?param*} +func SwaggerUriToChiUri(uri string) string { + return pathParamRE.ReplaceAllString(uri, "{$1}") +} + +// SwaggerUriToGinUri converts a swagger style path URI with parameters to a +// Gin compatible path URI. We need to replace all Swagger parameters with +// ":param". Valid input parameters are: +// +// {param} +// {param*} +// {.param} +// {.param*} +// {;param} +// {;param*} +// {?param} +// {?param*} +func SwaggerUriToGinUri(uri string) string { + return pathParamRE.ReplaceAllString(uri, ":$1") +} + +// SwaggerUriToGorillaUri converts a swagger style path URI with parameters to a +// Gorilla compatible path URI. We need to replace all Swagger parameters with +// ":param". Valid input parameters are: +// +// {param} +// {param*} +// {.param} +// {.param*} +// {;param} +// {;param*} +// {?param} +// {?param*} +func SwaggerUriToGorillaUri(uri string) string { + return pathParamRE.ReplaceAllString(uri, "{$1}") +} + +// SwaggerUriToStdHttpUri converts a swagger style path URI with parameters to a +// Chi compatible path URI. We need to replace all Swagger parameters with +// "{param}". Valid input parameters are: +// +// {param} +// {param*} +// {.param} +// {.param*} +// {;param} +// {;param*} +// {?param} +// {?param*} +func SwaggerUriToStdHttpUri(uri string) string { + // https://pkg.go.dev/net/http#hdr-Patterns-ServeMux + // The special wildcard {$} matches only the end of the URL. For example, the pattern "/{$}" matches only the path "/", whereas the pattern "/" matches every path. + if uri == "/" { + return "/{$}" + } + + return pathParamRE.ReplaceAllString(uri, "{$1}") +} + +// OrderedParamsFromUri returns the argument names, in order, in a given URI string, so for +// /path/{param1}/{.param2*}/{?param3}, it would return param1, param2, param3 +func OrderedParamsFromUri(uri string) []string { + matches := pathParamRE.FindAllStringSubmatch(uri, -1) + result := make([]string, len(matches)) + for i, m := range matches { + result[i] = m[1] + } + return result +} + +// ReplacePathParamsWithStr replaces path parameters of the form {param} with %s +func ReplacePathParamsWithStr(uri string) string { + return pathParamRE.ReplaceAllString(uri, "%s") +} + +// SortParamsByPath reorders the given parameter definitions to match those in the path URI. +func SortParamsByPath(path string, in []ParameterDefinition) ([]ParameterDefinition, error) { + pathParams := OrderedParamsFromUri(path) + n := len(in) + if len(pathParams) != n { + return nil, fmt.Errorf("path '%s' has %d positional parameters, but spec has %d declared", + path, len(pathParams), n) + } + out := make([]ParameterDefinition, len(in)) + for i, name := range pathParams { + p := ParameterDefinitions(in).FindByName(name) + if p == nil { + return nil, fmt.Errorf("path '%s' refers to parameter '%s', which doesn't exist in specification", + path, name) + } + out[i] = *p + } + return out, nil +} + +// IsGoKeyword returns whether the given string is a go keyword +func IsGoKeyword(str string) bool { + return token.IsKeyword(str) +} + +// IsPredeclaredGoIdentifier returns whether the given string +// is a predefined go identifier. +// +// See https://golang.org/ref/spec#Predeclared_identifiers +func IsPredeclaredGoIdentifier(str string) bool { + _, exists := predeclaredSet[str] + return exists +} + +// IsGoIdentity checks if the given string can be used as an identity +// in the generated code like a type name or constant name. +// +// See https://golang.org/ref/spec#Identifiers +func IsGoIdentity(str string) bool { + for i, c := range str { + if !isValidRuneForGoID(i, c) { + return false + } + } + + return IsGoKeyword(str) +} + +func isValidRuneForGoID(index int, char rune) bool { + if index == 0 && unicode.IsNumber(char) { + return false + } + + return unicode.IsLetter(char) || char == '_' || unicode.IsNumber(char) +} + +// IsValidGoIdentity checks if the given string can be used as a +// name of variable, constant, or type. +func IsValidGoIdentity(str string) bool { + if IsGoIdentity(str) { + return false + } + + return !IsPredeclaredGoIdentifier(str) +} + +// SanitizeGoIdentity deletes and replaces the illegal runes in the given +// string to use the string as a valid identity. +func SanitizeGoIdentity(str string) string { + sanitized := []rune(str) + + for i, c := range sanitized { + if !isValidRuneForGoID(i, c) { + sanitized[i] = '_' + } else { + sanitized[i] = c + } + } + + str = string(sanitized) + + if IsGoKeyword(str) || IsPredeclaredGoIdentifier(str) { + str = "_" + str + } + + if !IsValidGoIdentity(str) { + panic("here is a bug") + } + + return str +} + +// SanitizeEnumNames fixes illegal chars in the enum names +// and removes duplicates +func SanitizeEnumNames(enumNames, enumValues []string) map[string]string { + dupCheck := make(map[string]int, len(enumValues)) + deDup := make([][]string, 0, len(enumValues)) + + for i, v := range enumValues { + n := v + if i < len(enumNames) { + n = enumNames[i] + } + if _, dup := dupCheck[n]; !dup { + deDup = append(deDup, []string{n, v}) + } + dupCheck[n] = 0 + } + + dupCheck = make(map[string]int, len(deDup)) + sanitizedDeDup := make(map[string]string, len(deDup)) + + for _, p := range deDup { + n, v := p[0], p[1] + sanitized := SanitizeGoIdentity(SchemaNameToTypeName(n)) + + if _, dup := dupCheck[sanitized]; !dup { + sanitizedDeDup[sanitized] = v + } else { + sanitizedDeDup[sanitized+strconv.Itoa(dupCheck[sanitized])] = v + } + dupCheck[sanitized]++ + } + + return sanitizedDeDup +} + +func typeNamePrefix(name string) (prefix string) { + if len(name) == 0 { + return "Empty" + } + for _, r := range name { + switch r { + case '$': + if len(name) == 1 { + return "DollarSign" + } + case '-': + prefix += "Minus" + case '+': + prefix += "Plus" + case '&': + prefix += "And" + case '|': + prefix += "Or" + case '~': + prefix += "Tilde" + case '=': + prefix += "Equal" + case '>': + prefix += "GreaterThan" + case '<': + prefix += "LessThan" + case '#': + prefix += "Hash" + case '.': + prefix += "Dot" + case '*': + prefix += "Asterisk" + case '^': + prefix += "Caret" + case '%': + prefix += "Percent" + case '_': + prefix += "Underscore" + default: + // Prepend "N" to schemas starting with a number + if prefix == "" && unicode.IsDigit(r) { + return "N" + } + + // break the loop, done parsing prefix + return + } + } + + return +} + +// SchemaNameToTypeName converts a Schema name to a valid Go type name. It converts to camel case, and makes sure the name is +// valid in Go +func SchemaNameToTypeName(name string) string { + return typeNamePrefix(name) + nameNormalizer(name) +} + +// According to the spec, additionalProperties may be true, false, or a +// schema. If not present, true is implied. If it's a schema, true is implied. +// If it's false, no additional properties are allowed. We're going to act a little +// differently, in that if you want additionalProperties code to be generated, +// you must specify an additionalProperties type +// If additionalProperties it true/false, this field will be non-nil. +func SchemaHasAdditionalProperties(schema *openapi3.Schema) bool { + if schema.AdditionalProperties.Has != nil && *schema.AdditionalProperties.Has { + return true + } + + if schema.AdditionalProperties.Schema != nil { + return true + } + return false +} + +// PathToTypeName converts a path, like Object/field1/nestedField into a go +// type name. +func PathToTypeName(path []string) string { + for i, p := range path { + path[i] = nameNormalizer(p) + } + return strings.Join(path, "_") +} + +// StringToGoComment renders a possible multi-line string as a valid Go-Comment. +// Each line is prefixed as a comment. +func StringToGoComment(in string) string { + return stringToGoCommentWithPrefix(in, "") +} + +// StringWithTypeNameToGoComment renders a possible multi-line string as a +// valid Go-Comment, including the name of the type being referenced. Each line +// is prefixed as a comment. +func StringWithTypeNameToGoComment(in, typeName string) string { + return stringToGoCommentWithPrefix(in, typeName) +} + +func DeprecationComment(reason string) string { + content := "Deprecated:" // The colon is required at the end even without reason + if reason != "" { + content += fmt.Sprintf(" %s", reason) + } + + return stringToGoCommentWithPrefix(content, "") +} + +func stringToGoCommentWithPrefix(in, prefix string) string { + if len(in) == 0 || len(strings.TrimSpace(in)) == 0 { // ignore empty comment + return "" + } + + // Normalize newlines from Windows/Mac to Linux + in = strings.ReplaceAll(in, "\r\n", "\n") + in = strings.ReplaceAll(in, "\r", "\n") + + // Add comment to each line + var lines []string + for i, line := range strings.Split(in, "\n") { + s := "//" + if i == 0 && len(prefix) > 0 { + s += " " + prefix + } + lines = append(lines, fmt.Sprintf("%s %s", s, line)) + } + in = strings.Join(lines, "\n") + + // in case we have a multiline string which ends with \n, we would generate + // empty-line-comments, like `// `. Therefore remove this line comment. + in = strings.TrimSuffix(in, "\n// ") + return in +} + +// EscapePathElements breaks apart a path, and looks at each element. If it's +// not a path parameter, eg, {param}, it will URL-escape the element. +func EscapePathElements(path string) string { + elems := strings.Split(path, "/") + for i, e := range elems { + if strings.HasPrefix(e, "{") && strings.HasSuffix(e, "}") { + // This is a path parameter, we don't want to mess with its value + continue + } + elems[i] = url.QueryEscape(e) + } + return strings.Join(elems, "/") +} + +// renameSchema takes as input the name of a schema as provided in the spec, +// and the definition of the schema. If the schema overrides the name via +// x-go-name, the new name is returned, otherwise, the original name is +// returned. +func renameSchema(schemaName string, schemaRef *openapi3.SchemaRef) (string, error) { + // References will not change type names. + if schemaRef.Ref != "" { + return SchemaNameToTypeName(schemaName), nil + } + schema := schemaRef.Value + + if extension, ok := schema.Extensions[extGoName]; ok { + typeName, err := extTypeName(extension) + if err != nil { + return "", fmt.Errorf("invalid value for %q: %w", extPropGoType, err) + } + return typeName, nil + } + return SchemaNameToTypeName(schemaName), nil +} + +// renameParameter generates the name for a parameter, taking x-go-name into +// account +func renameParameter(parameterName string, parameterRef *openapi3.ParameterRef) (string, error) { + if parameterRef.Ref != "" { + return SchemaNameToTypeName(parameterName), nil + } + parameter := parameterRef.Value + + if extension, ok := parameter.Extensions[extGoName]; ok { + typeName, err := extTypeName(extension) + if err != nil { + return "", fmt.Errorf("invalid value for %q: %w", extPropGoType, err) + } + return typeName, nil + } + return SchemaNameToTypeName(parameterName), nil +} + +// renameResponse generates the name for a parameter, taking x-go-name into +// account +func renameResponse(responseName string, responseRef *openapi3.ResponseRef) (string, error) { + if responseRef.Ref != "" { + return SchemaNameToTypeName(responseName), nil + } + response := responseRef.Value + + if extension, ok := response.Extensions[extGoName]; ok { + typeName, err := extTypeName(extension) + if err != nil { + return "", fmt.Errorf("invalid value for %q: %w", extPropGoType, err) + } + return typeName, nil + } + return SchemaNameToTypeName(responseName), nil +} + +// renameRequestBody generates the name for a parameter, taking x-go-name into +// account +func renameRequestBody(requestBodyName string, requestBodyRef *openapi3.RequestBodyRef) (string, error) { + if requestBodyRef.Ref != "" { + return SchemaNameToTypeName(requestBodyName), nil + } + requestBody := requestBodyRef.Value + + if extension, ok := requestBody.Extensions[extGoName]; ok { + typeName, err := extTypeName(extension) + if err != nil { + return "", fmt.Errorf("invalid value for %q: %w", extPropGoType, err) + } + return typeName, nil + } + return SchemaNameToTypeName(requestBodyName), nil +} + +// findSchemaByRefPath turns a $ref path into a schema. This will return "" +// if the schema wasn't found, and it'll only work successfully for schemas +// defined within the spec that we parsed. +func findSchemaNameByRefPath(refPath string, spec *openapi3.T) (string, error) { + if spec.Components == nil { + return "", nil + } + pathElements := strings.Split(refPath, "/") + // All local references will have 4 path elements. + if len(pathElements) != 4 { + return "", nil + } + + // We only support local references + if pathElements[0] != "#" { + return "", nil + } + // Only components are supported + if pathElements[1] != "components" { + return "", nil + } + propertyName := pathElements[3] + switch pathElements[2] { + case "schemas": + if schema, found := spec.Components.Schemas[propertyName]; found { + return renameSchema(propertyName, schema) + } + case "parameters": + if parameter, found := spec.Components.Parameters[propertyName]; found { + return renameParameter(propertyName, parameter) + } + case "responses": + if response, found := spec.Components.Responses[propertyName]; found { + return renameResponse(propertyName, response) + } + case "requestBodies": + if requestBody, found := spec.Components.RequestBodies[propertyName]; found { + return renameRequestBody(propertyName, requestBody) + } + } + return "", nil +} + +func ParseGoImportExtension(v *openapi3.SchemaRef) (*goImport, error) { + if v.Value.Extensions[extPropGoImport] == nil || v.Value.Extensions[extPropGoType] == nil { + return nil, nil + } + + goTypeImportExt := v.Value.Extensions[extPropGoImport] + + importI, ok := goTypeImportExt.(map[string]interface{}) + if !ok { + return nil, fmt.Errorf("failed to convert type: %T", goTypeImportExt) + } + + gi := goImport{} + // replicate the case-insensitive field mapping json.Unmarshal would do + for k, v := range importI { + if strings.EqualFold(k, "name") { + if vs, ok := v.(string); ok { + gi.Name = vs + } else { + return nil, fmt.Errorf("failed to convert type: %T", v) + } + } else if strings.EqualFold(k, "path") { + if vs, ok := v.(string); ok { + gi.Path = vs + } else { + return nil, fmt.Errorf("failed to convert type: %T", v) + } + } + } + + return &gi, nil +} + +func MergeImports(dst, src map[string]goImport) { + for k, v := range src { + dst[k] = v + } +} + +// TypeDefinitionsEquivalent checks for equality between two type definitions, but +// not every field is considered. We only want to know if they are fundamentally +// the same type. +func TypeDefinitionsEquivalent(t1, t2 TypeDefinition) bool { + if t1.TypeName != t2.TypeName { + return false + } + return reflect.DeepEqual(t1.Schema.OAPISchema, t2.Schema.OAPISchema) +} + +// isAdditionalPropertiesExplicitFalse determines whether an openapi3.Schema is explicitly defined as `additionalProperties: false` +func isAdditionalPropertiesExplicitFalse(s *openapi3.Schema) bool { + if s.AdditionalProperties.Has == nil { + return false + } + + return *s.AdditionalProperties.Has == false //nolint:staticcheck +} + +func sliceContains[E comparable](s []E, v E) bool { + for _, ss := range s { + if ss == v { + return true + } + } + return false +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/inputmapping.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/inputmapping.go new file mode 100644 index 0000000000..613434a980 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/inputmapping.go @@ -0,0 +1,79 @@ +package util + +import ( + "fmt" + "strings" +) + +// The input mapping is expressed on the command line as `key1:value1,key2:value2,...` +// We parse it here, but need to keep in mind that keys or values may contain +// commas and colons. We will allow escaping those using double quotes, so +// when passing in "key1":"value1", we will not look inside the quoted sections. +func ParseCommandlineMap(src string) (map[string]string, error) { + result := make(map[string]string) + tuples := splitString(src, ',') + for _, t := range tuples { + kv := splitString(t, ':') + if len(kv) != 2 { + return nil, fmt.Errorf("expected key:value, got :%s", t) + } + key := strings.TrimLeft(kv[0], `"`) + key = strings.TrimRight(key, `"`) + + value := strings.TrimLeft(kv[1], `"`) + value = strings.TrimRight(value, `"`) + + result[key] = value + } + return result, nil +} + +// ParseCommandLineList parses comma separated string lists which are passed +// in on the command line. Spaces are trimmed off both sides of result +// strings. +func ParseCommandLineList(input string) []string { + input = strings.TrimSpace(input) + if len(input) == 0 { + return nil + } + splitInput := strings.Split(input, ",") + args := make([]string, 0, len(splitInput)) + for _, s := range splitInput { + s = strings.TrimSpace(s) + if len(s) > 0 { + args = append(args, s) + } + } + return args +} + +// splitString splits a string along the specified separator, but it +// ignores anything between double quotes for splitting. We do simple +// inside/outside quote counting. Quotes are not stripped from output. +func splitString(s string, sep rune) []string { + const escapeChar rune = '"' + + var parts []string + var part string + inQuotes := false + + for _, c := range s { + if c == escapeChar { + if inQuotes { + inQuotes = false + } else { + inQuotes = true + } + } + + // If we've gotten the separator rune, consider the previous part + // complete, but only if we're outside of quoted sections + if c == sep && !inQuotes { + parts = append(parts, part) + part = "" + continue + } + part += string(c) + } + return append(parts, part) +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/isjson.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/isjson.go new file mode 100644 index 0000000000..5013ba7a74 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/isjson.go @@ -0,0 +1,14 @@ +package util + +import ( + "mime" + "strings" +) + +func IsMediaTypeJson(mediaType string) bool { + parsed, _, err := mime.ParseMediaType(mediaType) + if err != nil { + return false + } + return parsed == "application/json" || strings.HasSuffix(parsed, "+json") +} diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/loader.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/loader.go new file mode 100644 index 0000000000..89830a8c44 --- /dev/null +++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/loader.go @@ -0,0 +1,100 @@ +package util + +import ( + "bytes" + "fmt" + "net/url" + "path/filepath" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/speakeasy-api/openapi-overlay/pkg/loader" + "gopkg.in/yaml.v3" +) + +func LoadSwagger(filePath string) (swagger *openapi3.T, err error) { + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + + u, err := url.Parse(filePath) + if err == nil && u.Scheme != "" && u.Host != "" { + return loader.LoadFromURI(u) + } else { + return loader.LoadFromFile(filePath) + } +} + +// Deprecated: In kin-openapi v0.126.0 (https://github.com/getkin/kin-openapi/tree/v0.126.0?tab=readme-ov-file#v01260) the Circular Reference Counter functionality was removed, instead resolving all references with backtracking, to avoid needing to provide a limit to reference counts. +// +// This is now identital in method as `LoadSwagger`. +func LoadSwaggerWithCircularReferenceCount(filePath string, _ int) (swagger *openapi3.T, err error) { + return LoadSwagger(filePath) +} + +type LoadSwaggerWithOverlayOpts struct { + Path string + Strict bool +} + +func LoadSwaggerWithOverlay(filePath string, opts LoadSwaggerWithOverlayOpts) (swagger *openapi3.T, err error) { + spec, err := LoadSwagger(filePath) + if err != nil { + return nil, fmt.Errorf("failed to load OpenAPI specification: %w", err) + } + + if opts.Path == "" { + return spec, nil + } + + // parse out the yaml.Node, which is required by the overlay library + data, err := yaml.Marshal(spec) + if err != nil { + return nil, fmt.Errorf("failed to marshal spec from %#v as YAML: %w", filePath, err) + } + + var node yaml.Node + err = yaml.NewDecoder(bytes.NewReader(data)).Decode(&node) + if err != nil { + return nil, fmt.Errorf("failed to parse spec from %#v: %w", filePath, err) + } + + overlay, err := loader.LoadOverlay(opts.Path) + if err != nil { + return nil, fmt.Errorf("failed to load Overlay from %#v: %v", opts.Path, err) + } + + err = overlay.Validate() + if err != nil { + return nil, fmt.Errorf("the Overlay in %#v was not valid: %v", opts.Path, err) + } + + if opts.Strict { + err, vs := overlay.ApplyToStrict(&node) + if err != nil { + return nil, fmt.Errorf("failed to apply Overlay %#v to specification %#v: %v\nAdditionally, the following validation errors were found:\n- %s", opts.Path, filePath, err, strings.Join(vs, "\n- ")) + } + } else { + err = overlay.ApplyTo(&node) + if err != nil { + return nil, fmt.Errorf("failed to apply Overlay %#v to specification %#v: %v", opts.Path, filePath, err) + } + } + + b, err := yaml.Marshal(&node) + if err != nil { + return nil, fmt.Errorf("failed to serialize Overlay'd specification %#v: %v", opts.Path, err) + } + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + + swagger, err = loader.LoadFromDataWithPath(b, &url.URL{ + Path: filepath.ToSlash(filePath), + }) + if err != nil { + return nil, fmt.Errorf("failed to serialize Overlay'd specification %#v: %v", opts.Path, err) + } + + return swagger, nil +} diff --git a/vendor/github.com/perimeterx/marshmallow/.gitignore b/vendor/github.com/perimeterx/marshmallow/.gitignore new file mode 100644 index 0000000000..cf53c0a1b5 --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/.gitignore @@ -0,0 +1,4 @@ +/.idea + +coverage.out +profile.out diff --git a/vendor/github.com/perimeterx/marshmallow/CHANGELOG.md b/vendor/github.com/perimeterx/marshmallow/CHANGELOG.md new file mode 100644 index 0000000000..92937d0578 --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/CHANGELOG.md @@ -0,0 +1,49 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [[1.1.5](https://github.com/PerimeterX/marshmallow/compare/v1.1.4...v1.1.5)] - 2023-07-03 + +### Added + +- Support for reporting errors from `HandleJSONData` - [info](https://github.com/PerimeterX/marshmallow/issues/27). + +## [[1.1.4](https://github.com/PerimeterX/marshmallow/compare/v1.1.3...v1.1.4)] - 2022-11-10 + +### Fixed + +- Fixed problem with nested object implementing JSONDataHandler with skipPopulateStruct - [info](https://github.com/PerimeterX/marshmallow/issues/18). +- Fixed problem with nested object implementing JSONDataHandler with skipPopulateStruct in ModeFailOverToOriginalValue - [info](https://github.com/PerimeterX/marshmallow/issues/19). + +## [[1.1.3](https://github.com/PerimeterX/marshmallow/compare/v1.1.2...v1.1.3)] - 2022-08-31 + +### Added + +- Support for excluding known fields from the result map - [info](https://github.com/PerimeterX/marshmallow/issues/16). + +## [[1.1.2](https://github.com/PerimeterX/marshmallow/compare/v1.1.1...v1.1.2)] - 2022-08-23 + +### Added + +- Support capturing nested unknown fields - [info](https://github.com/PerimeterX/marshmallow/issues/15). + +## [[1.1.1](https://github.com/PerimeterX/marshmallow/compare/v1.1.0...v1.1.1)] - 2022-08-21 + +### Fixed + +- Fix parsing bug for unknown nested fields - [info](https://github.com/PerimeterX/marshmallow/issues/12). + +## [[1.1.0](https://github.com/PerimeterX/marshmallow/compare/v0.0.1...v1.1.0)] - 2022-07-10 + +### Fixed + +- Fixed an issue with embedded fields - [info](https://github.com/PerimeterX/marshmallow/issues/9). + +## [[0.0.1](https://github.com/PerimeterX/marshmallow/tree/v0.0.1)] - 2022-04-21 + +### Added + +- All functionality from our internal repository, after it has been stabilized on production for several months - [info](https://www.perimeterx.com/tech-blog/2022/boosting-up-json-performance-of-unstructured-structs-in-go/). diff --git a/vendor/github.com/perimeterx/marshmallow/CODE_OF_CONDUCT.md b/vendor/github.com/perimeterx/marshmallow/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..0f6c45e792 --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/CODE_OF_CONDUCT.md @@ -0,0 +1,133 @@ + +# 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, caste, color, 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 +[opensource-conduct@humansecurity.com](mailto:opensource-conduct@humansecurity.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.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/vendor/github.com/perimeterx/marshmallow/CONTRIBUTING.md b/vendor/github.com/perimeterx/marshmallow/CONTRIBUTING.md new file mode 100644 index 0000000000..a265c9ab9e --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# How To Contribute + +We'd love to accept your patches and contributions to this project. There are just a few guidelines you need to follow which are described in detail below. + +## 1. Fork this repo + +You should create a fork of this project in your account and work from there. You can create a fork by clicking the fork button in GitHub. + +## 2. One feature, one branch + +Work for each new feature/issue should occur in its own branch. To create a new branch from the command line: +```shell +git checkout -b my-new-feature +``` +where "my-new-feature" describes what you're working on. + +## 3. Add unit tests +If your contribution modifies existing or adds new code please add corresponding unit tests for this. + +## 4. Ensure that the build passes + +Run +```shell +go test -v +``` +and check that there are no errors. + +## 5. Add documentation for new or updated functionality + +Please review the [README.md](README.md) file in this project to see if they are impacted by your change and update them accordingly. + +## 6. Add to CHANGELOG.md + +Any notable changes should be recorded in the CHANGELOG.md following the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) conventions. + +## 7. Submit a pull request and describe the change + +Push your changes to your branch and open a pull request against the parent repo on GitHub. The project administrators will review your pull request and respond with feedback. + +# How your contribution gets merged + +Upon pull request submission, your code will be reviewed by the maintainers. They will confirm at least the following: + +- Tests run successfully (unit, coverage, style). +- Contribution policy has been followed. + +A (human) reviewer will need to sign off on your pull request before it can be merged. diff --git a/vendor/github.com/perimeterx/marshmallow/LICENSE b/vendor/github.com/perimeterx/marshmallow/LICENSE new file mode 100644 index 0000000000..8ffe86916c --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 PerimeterX + +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/perimeterx/marshmallow/README.md b/vendor/github.com/perimeterx/marshmallow/README.md new file mode 100644 index 0000000000..bfa9036375 --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/README.md @@ -0,0 +1,205 @@ +# Marshmallow + +![Marshmallow Campfire](https://raw.githubusercontent.com/PerimeterX/marshmallow/assets/campfire.png) + +[![CodeQL Status](https://img.shields.io/github/actions/workflow/status/perimeterx/marshmallow/codeql.yml?branch=main&logo=github&label=CodeQL)](https://github.com/PerimeterX/marshmallow/actions/workflows/codeql.yml?query=branch%3Amain++) +[![Run Tests](https://img.shields.io/github/actions/workflow/status/perimeterx/marshmallow/go.yml?branch=main&logo=github&label=Run%20Tests)](https://github.com/PerimeterX/marshmallow/actions/workflows/go.yml?query=branch%3Amain) +[![Dependency Review](https://img.shields.io/github/actions/workflow/status/perimeterx/marshmallow/dependency-review.yml?logo=github&label=Dependency%20Review)](https://github.com/PerimeterX/marshmallow/actions/workflows/dependency-review.yml?query=branch%3Amain) +[![Go Report Card](https://goreportcard.com/badge/github.com/perimeterx/marshmallow)](https://goreportcard.com/report/github.com/perimeterx/marshmallow) +![Manual Code Coverage](https://img.shields.io/badge/coverage-92.6%25-green) +[![Go Reference](https://pkg.go.dev/badge/github.com/perimeterx/marshmallow.svg)](https://pkg.go.dev/github.com/perimeterx/marshmallow) +[![Licence](https://img.shields.io/github/license/perimeterx/marshmallow)](LICENSE) +[![Latest Release](https://img.shields.io/github/v/release/perimeterx/marshmallow)](https://github.com/PerimeterX/marshmallow/releases) +![Top Languages](https://img.shields.io/github/languages/top/perimeterx/marshmallow) +[![Issues](https://img.shields.io/github/issues-closed/perimeterx/marshmallow?color=%238250df&logo=github)](https://github.com/PerimeterX/marshmallow/issues) +[![Pull Requests](https://img.shields.io/github/issues-pr-closed-raw/perimeterx/marshmallow?color=%238250df&label=merged%20pull%20requests&logo=github)](https://github.com/PerimeterX/marshmallow/pulls) +[![Commits](https://img.shields.io/github/last-commit/perimeterx/marshmallow)](https://github.com/PerimeterX/marshmallow/commits/main) +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) + +marshmallow-gopher + +Marshmallow package provides a simple API to perform flexible and performant JSON unmarshalling in Go. + +Marshmallow specializes in dealing with **unstructured struct** - when some fields are known and some aren't, +with zero performance overhead nor extra coding needed. +While unmarshalling, marshmallow allows fully retaining the original data and access +it via a typed struct and a dynamic map. + +## Contents + +- [Install](#install) +- [Usage](#usage) +- [Performance Benchmark And Alternatives](#performance-benchmark-and-alternatives) +- [When Should I Use Marshmallow](#when-should-i-use-marshmallow) +- [API](#api) + +## Install + +```sh +go get -u github.com/perimeterx/marshmallow +``` + +## Usage + +```go +package main + +import ( + "fmt" + "github.com/perimeterx/marshmallow" +) + +func main() { + v := struct { + Foo string `json:"foo"` + Boo []int `json:"boo"` + }{} + result, err := marshmallow.Unmarshal([]byte(`{"foo":"bar","boo":[1,2,3],"goo":12.6}`), &v) + fmt.Printf("v=%+v, result=%+v, err=%v", v, result, err) + // Output: v={Foo:bar Boo:[1 2 3]}, result=map[boo:[1 2 3] foo:bar goo:12.6], err= +} +``` + +**Examples can be found [here](example_test.go)** + +## Performance Benchmark And Alternatives + +Marshmallow performs best when dealing with mixed data - when some fields are known and some are unknown. +More info [below](#when-should-i-use-marshmallow). +Other solutions are available for this kind of use case, each solution is explained and documented in the link below. +The full benchmark test can be found +[here](https://github.com/PerimeterX/marshmallow/blob/8c5bba9e6dc0033f4324eca554737089a99f6e5e/benchmark_test.go). + +|Benchmark|Iterations|Time/Iteration|Bytes Allocated|Allocations| +|--|--|--|--|--| +|[unmarshall twice](https://github.com/PerimeterX/marshmallow/blob/8c5bba9e6dc0033f4324eca554737089a99f6e5e/benchmark_test.go#L40)|228693|5164 ns/op|1640 B/op|51 allocs/op| +|[raw map](https://github.com/PerimeterX/marshmallow/blob/8c5bba9e6dc0033f4324eca554737089a99f6e5e/benchmark_test.go#L66)|232236|5116 ns/op|2296 B/op|53 allocs/op| +|[go codec](https://github.com/PerimeterX/marshmallow/blob/8c5bba9e6dc0033f4324eca554737089a99f6e5e/benchmark_test.go#L121)|388442|3077 ns/op|2512 B/op|37 allocs/op| +|[marshmallow](https://github.com/PerimeterX/marshmallow/blob/8c5bba9e6dc0033f4324eca554737089a99f6e5e/benchmark_test.go#L16)|626168|1853 ns/op|608 B/op|18 allocs/op| +|[marshmallow without populating struct](https://github.com/PerimeterX/marshmallow/blob/8c5bba9e6dc0033f4324eca554737089a99f6e5e/benchmark_test.go#L162)|678616|1751 ns/op|608 B/op|18 allocs/op| + +![marshmallow performance comparison](https://raw.githubusercontent.com/PerimeterX/marshmallow/e45088ca20d4ea5be4143d418d12da63a68d6dfd/performance-chart.svg) + +**Marshmallow provides the best performance (up to X3 faster) while not requiring any extra coding.** +In fact, marshmallow performs as fast as normal `json.Unmarshal` call, however, such a call causes loss of data for all +the fields that did not match the given struct. With marshmallow you never lose any data. + +|Benchmark|Iterations|Time/Iteration|Bytes Allocated|Allocations| +|--|--|--|--|--| +|[marshmallow](https://github.com/PerimeterX/marshmallow/blob/8c5bba9e6dc0033f4324eca554737089a99f6e5e/benchmark_test.go#L16)|626168|1853 ns/op|608 B/op|18 allocs/op| +|[native library](https://github.com/PerimeterX/marshmallow/blob/8c5bba9e6dc0033f4324eca554737089a99f6e5e/benchmark_test.go#L143)|652106|1845 ns/op|304 B/op|11 allocs/op| +|[marshmallow without populating struct](https://github.com/PerimeterX/marshmallow/blob/8c5bba9e6dc0033f4324eca554737089a99f6e5e/benchmark_test.go#L162)|678616|1751 ns/op|608 B/op|18 allocs/op| + +## When Should I Use Marshmallow + +Marshmallow is best suited for use cases where you are interested in all the input data, but you have predetermined +information only about a subset of it. For instance, if you plan to reference two specific fields from the data, then +iterate all the data and apply some generic logic. How does it look with the native library: + +```go +func isAllowedToDrive(data []byte) (bool, error) { + result := make(map[string]interface{}) + err := json.Unmarshal(data, &result) + if err != nil { + return false, err + } + + age, ok := result["age"] + if !ok { + return false, nil + } + a, ok := age.(float64) + if !ok { + return false, nil + } + if a < 17 { + return false, nil + } + + hasDriversLicense, ok := result["has_drivers_license"] + if !ok { + return false, nil + } + h, ok := hasDriversLicense.(bool) + if !ok { + return false, nil + } + if !h { + return false, nil + } + + for key := range result { + if strings.Contains(key, "prior_conviction") { + return false, nil + } + } + + return true, nil +} +``` + +And with marshmallow: + +```go +func isAllowedToDrive(data []byte) (bool, error) { + v := struct { + Age int `json:"age"` + HasDriversLicense bool `json:"has_drivers_license"` + }{} + result, err := marshmallow.Unmarshal(data, &v) + if err != nil { + return false, err + } + + if v.Age < 17 || !v.HasDriversLicense { + return false, nil + } + + for key := range result { + if strings.Contains(key, "prior_conviction") { + return false, nil + } + } + + return true, nil +} +``` + +## API + +Marshmallow exposes two main API functions - +[Unmarshal](https://github.com/PerimeterX/marshmallow/blob/0e0218ab860be8a4b5f57f5ff239f281c250c5da/unmarshal.go#L27) +and +[UnmarshalFromJSONMap](https://github.com/PerimeterX/marshmallow/blob/0e0218ab860be8a4b5f57f5ff239f281c250c5da/unmarshal_from_json_map.go#L37). +While unmarshalling, marshmallow supports the following optional options: + +* Setting the mode for handling invalid data using the [WithMode](https://github.com/PerimeterX/marshmallow/blob/0e0218ab860be8a4b5f57f5ff239f281c250c5da/options.go#L30) function. +* Excluding known fields from the result map using the [WithExcludeKnownFieldsFromMap](https://github.com/PerimeterX/marshmallow/blob/457669ae9973895584f2636eabfc104140d3b700/options.go#L50) function. +* Skipping struct population to boost performance using the [WithSkipPopulateStruct](https://github.com/PerimeterX/marshmallow/blob/0e0218ab860be8a4b5f57f5ff239f281c250c5da/options.go#L41) function. + +In order to capture unknown nested fields, structs must implement [JSONDataErrorHandler](https://github.com/PerimeterX/marshmallow/blob/195c994aa6e3e0852601ad9cf65bcddef0dd7479/options.go#L76). +More info [here](https://github.com/PerimeterX/marshmallow/issues/15). + +Marshmallow also supports caching of refection information using +[EnableCache](https://github.com/PerimeterX/marshmallow/blob/d3500aa5b0f330942b178b155da933c035dd3906/cache.go#L40) +and +[EnableCustomCache](https://github.com/PerimeterX/marshmallow/blob/d3500aa5b0f330942b178b155da933c035dd3906/cache.go#L35). + +## Contact and Contribute + +Reporting issues and requesting features may be done in our [GitHub issues page](https://github.com/PerimeterX/marshmallow/issues). +Discussions may be conducted in our [GitHub discussions page](https://github.com/PerimeterX/marshmallow/discussions). +For any further questions or comments you can reach us out at [open-source@humansecurity.com](mailto:open-source@humansecurity.com). + +Any type of contribution is warmly welcome and appreciated ❤️ +Please read our [contribution](CONTRIBUTING.md) guide for more info. + +If you're looking for something to get started with, tou can always follow our [issues page](https://github.com/PerimeterX/marshmallow/issues) and look for +[good first issue](https://github.com/PerimeterX/marshmallow/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and +[help wanted](https://github.com/PerimeterX/marshmallow/issues?q=is%3Aissue+label%3A%22help+wanted%22+is%3Aopen) labels. + +## Marshmallow Logo + +Marshmallow logo and assets by [Adva Rom](https://www.linkedin.com/in/adva-rom-7a6738127/) are licensed under a Creative Commons Attribution 4.0 International License.
+ +![Marshmallow Logo](https://raw.githubusercontent.com/PerimeterX/marshmallow/assets/marshmallow.png) diff --git a/vendor/github.com/perimeterx/marshmallow/cache.go b/vendor/github.com/perimeterx/marshmallow/cache.go new file mode 100644 index 0000000000..a67cea6d85 --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/cache.go @@ -0,0 +1,63 @@ +// Copyright 2022 PerimeterX. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package marshmallow + +import ( + "reflect" + "sync" +) + +// Cache allows unmarshalling to use a cached version of refection information about types. +// Cache interface follows the implementation of sync.Map, but you may wrap any cache implementation +// to match it. This allows you to control max cache size, eviction policies and any other caching aspect. +type Cache interface { + // Load returns the value stored in the map for a key, or nil if no value is present. + // The ok result indicates whether value was found in the map. + Load(key interface{}) (interface{}, bool) + // Store sets the value for a key. + Store(key, value interface{}) +} + +// EnableCustomCache enables unmarshalling cache. It allows reuse of refection information about types needed +// to perform the unmarshalling. A use of such cache can boost up unmarshalling by x1.4. +// Check out benchmark_test.go for an example. +// +// EnableCustomCache is not thread safe! Do not use it while performing unmarshalling, or it will +// cause an unsafe race condition. Typically, EnableCustomCache should be called once when the process boots. +// +// Caching is disabled by default. The use of this function allows enabling it and controlling the +// behavior of the cache. Typically, the use of sync.Map should be good enough. The caching mechanism +// stores a single map per struct type. If you plan to unmarshal a huge amount of distinct +// struct it may get to consume a lot of resources, in which case you have the control to choose +// the caching implementation you like and its setup. +func EnableCustomCache(c Cache) { + cache = c +} + +// EnableCache enables unmarshalling cache with default implementation. More info at EnableCustomCache. +func EnableCache() { + EnableCustomCache(&sync.Map{}) +} + +var cache Cache + +func cacheLookup(t reflect.Type) map[string]reflectionInfo { + if cache == nil { + return nil + } + value, exists := cache.Load(t) + if !exists { + return nil + } + result, _ := value.(map[string]reflectionInfo) + return result +} + +func cacheStore(t reflect.Type, fields map[string]reflectionInfo) { + if cache == nil { + return + } + cache.Store(t, fields) +} diff --git a/vendor/github.com/perimeterx/marshmallow/doc.go b/vendor/github.com/perimeterx/marshmallow/doc.go new file mode 100644 index 0000000000..c179e65790 --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/doc.go @@ -0,0 +1,10 @@ +/* +Package marshmallow provides a simple API to perform flexible and performant JSON unmarshalling. +Unlike other packages, marshmallow supports unmarshalling of some known and some unknown fields +with zero performance overhead nor extra coding needed. While unmarshalling, +marshmallow allows fully retaining the original data and access it via a typed struct and a +dynamic map. + +https://github.com/perimeterx/marshmallow +*/ +package marshmallow diff --git a/vendor/github.com/perimeterx/marshmallow/errors.go b/vendor/github.com/perimeterx/marshmallow/errors.go new file mode 100644 index 0000000000..c4d341cc50 --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/errors.go @@ -0,0 +1,101 @@ +// Copyright 2022 PerimeterX. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package marshmallow + +import ( + "errors" + "fmt" + "github.com/mailru/easyjson/jlexer" + "reflect" + "strings" +) + +var ( + // ErrInvalidInput indicates the input JSON is invalid + ErrInvalidInput = errors.New("invalid JSON input") + + // ErrInvalidValue indicates the target struct has invalid type + ErrInvalidValue = errors.New("unexpected non struct value") +) + +// MultipleLexerError indicates one or more unmarshalling errors during JSON bytes decode +type MultipleLexerError struct { + Errors []*jlexer.LexerError +} + +func (m *MultipleLexerError) Error() string { + errs := make([]string, len(m.Errors)) + for i, lexerError := range m.Errors { + errs[i] = lexerError.Error() + } + return strings.Join(errs, ", ") +} + +// MultipleError indicates one or more unmarshalling errors during JSON map decode +type MultipleError struct { + Errors []error +} + +func (m *MultipleError) Error() string { + errs := make([]string, len(m.Errors)) + for i, lexerError := range m.Errors { + errs[i] = lexerError.Error() + } + return strings.Join(errs, ", ") +} + +// ParseError indicates a JSON map decode error +type ParseError struct { + Reason string + Path string +} + +func (p *ParseError) Error() string { + return fmt.Sprintf("parse error: %s in %s", p.Reason, p.Path) +} + +func newUnexpectedTypeParseError(expectedType reflect.Type, path []string) *ParseError { + return &ParseError{ + Reason: fmt.Sprintf("expected type %s", externalTypeName(expectedType)), + Path: strings.Join(path, "."), + } +} + +func newUnsupportedTypeParseError(unsupportedType reflect.Type, path []string) *ParseError { + return &ParseError{ + Reason: fmt.Sprintf("unsupported type %s", externalTypeName(unsupportedType)), + Path: strings.Join(path, "."), + } +} + +func addUnexpectedTypeLexerError(lexer *jlexer.Lexer, expectedType reflect.Type) { + lexer.AddNonFatalError(fmt.Errorf("expected type %s", externalTypeName(expectedType))) +} + +func addUnsupportedTypeLexerError(lexer *jlexer.Lexer, unsupportedType reflect.Type) { + lexer.AddNonFatalError(fmt.Errorf("unsupported type %s", externalTypeName(unsupportedType))) +} + +func externalTypeName(t reflect.Type) string { + switch t.Kind() { + case reflect.String: + return "string" + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, + reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, + reflect.Float64, reflect.Complex64, reflect.Complex128: + return "number" + case reflect.Bool: + return "boolean" + case reflect.Array, reflect.Slice: + return "array" + case reflect.Interface: + return "any" + case reflect.Map, reflect.Struct: + return "object" + case reflect.Ptr: + return externalTypeName(t.Elem()) + } + return "invalid" +} diff --git a/vendor/github.com/perimeterx/marshmallow/options.go b/vendor/github.com/perimeterx/marshmallow/options.go new file mode 100644 index 0000000000..ff97d3369e --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/options.go @@ -0,0 +1,96 @@ +// Copyright 2022 PerimeterX. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package marshmallow + +// Mode dictates the unmarshalling mode. +// Each mode is self documented below. +type Mode uint8 + +const ( + // ModeFailOnFirstError is the default mode. It makes unmarshalling terminate + // immediately on any kind of error. This error will then be returned. + ModeFailOnFirstError Mode = iota + + // ModeAllowMultipleErrors mode makes unmarshalling keep decoding even if + // errors are encountered. In case of such error, the erroneous value will be omitted from the result. + // Eventually, all errors will all be returned, alongside the partial result. + ModeAllowMultipleErrors + + // ModeFailOverToOriginalValue mode makes unmarshalling keep decoding even if + // errors are encountered. In case of such error, the original external value be placed in the + // result data, even though it does not meet the schematic requirements. + // Eventually, all errors will be returned, alongside the full result. Note that the result map + // will contain values that do not match the struct schema. + ModeFailOverToOriginalValue +) + +// WithMode is an UnmarshalOption function to set the unmarshalling mode. +func WithMode(mode Mode) UnmarshalOption { + return func(options *unmarshalOptions) { + options.mode = mode + } +} + +// WithSkipPopulateStruct is an UnmarshalOption function to set the skipPopulateStruct option. +// Skipping populate struct is set to false by default. +// If you do not intend to use the struct value once unmarshalling is finished, set this +// option to true to boost performance. This would mean the struct fields will not be set +// with values, but rather it will only be used as the target schema when populating the result map. +func WithSkipPopulateStruct(skipPopulateStruct bool) UnmarshalOption { + return func(options *unmarshalOptions) { + options.skipPopulateStruct = skipPopulateStruct + } +} + +// WithExcludeKnownFieldsFromMap is an UnmarshalOption function to set the excludeKnownFieldsFromMap option. +// Exclude known fields flag is set to false by default. +// When the flag is set to true, fields specified in the input struct (known fields) will be excluded from the result map +func WithExcludeKnownFieldsFromMap(excludeKnownFields bool) UnmarshalOption { + return func(options *unmarshalOptions) { + options.excludeKnownFieldsFromMap = excludeKnownFields + } +} + +type UnmarshalOption func(*unmarshalOptions) + +type unmarshalOptions struct { + mode Mode + skipPopulateStruct bool + excludeKnownFieldsFromMap bool +} + +func buildUnmarshalOptions(options []UnmarshalOption) *unmarshalOptions { + result := &unmarshalOptions{} + for _, option := range options { + option(result) + } + return result +} + +// JSONDataErrorHandler allow types to handle JSON data as maps. +// Types should implement this interface if they wish to act on the map representation of parsed JSON input. +// This is mainly used to allow nested objects to capture unknown fields and leverage marshmallow's abilities. +// If HandleJSONData returns an error, it will be propagated as an unmarshal error +type JSONDataErrorHandler interface { + HandleJSONData(data map[string]interface{}) error +} + +// Deprecated: use JSONDataErrorHandler instead +type JSONDataHandler interface { + HandleJSONData(data map[string]interface{}) +} + +func asJSONDataHandler(value interface{}) (func(map[string]interface{}) error, bool) { + if handler, ok := value.(JSONDataErrorHandler); ok { + return handler.HandleJSONData, true + } + if handler, ok := value.(JSONDataHandler); ok { + return func(m map[string]interface{}) error { + handler.HandleJSONData(m) + return nil + }, true + } + return nil, false +} diff --git a/vendor/github.com/perimeterx/marshmallow/reflection.go b/vendor/github.com/perimeterx/marshmallow/reflection.go new file mode 100644 index 0000000000..9b7d88ce1f --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/reflection.go @@ -0,0 +1,197 @@ +// Copyright 2022 PerimeterX. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package marshmallow + +import ( + "encoding/json" + "reflect" + "strings" +) + +var unmarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() + +type reflectionInfo struct { + path []int + t reflect.Type +} + +func (r reflectionInfo) field(target reflect.Value) reflect.Value { + current := target + for _, i := range r.path { + current = current.Field(i) + } + return current +} + +func mapStructFields(target interface{}) map[string]reflectionInfo { + t := reflectStructType(target) + result := cacheLookup(t) + if result != nil { + return result + } + result = make(map[string]reflectionInfo, t.NumField()) + mapTypeFields(t, result, nil) + cacheStore(t, result) + return result +} + +func mapTypeFields(t reflect.Type, result map[string]reflectionInfo, path []int) { + num := t.NumField() + for i := 0; i < num; i++ { + field := t.Field(i) + fieldPath := append(path, i) + if field.Anonymous && field.Type.Kind() == reflect.Struct { + mapTypeFields(field.Type, result, fieldPath) + continue + } + name := field.Tag.Get("json") + if name == "" || name == "-" { + continue + } + if index := strings.Index(name, ","); index > -1 { + name = name[:index] + } + result[name] = reflectionInfo{ + path: fieldPath, + t: field.Type, + } + } +} + +func reflectStructValue(target interface{}) reflect.Value { + v := reflect.ValueOf(target) + for v.Kind() == reflect.Ptr { + v = v.Elem() + } + return v +} + +func reflectStructType(target interface{}) reflect.Type { + t := reflect.TypeOf(target) + for t.Kind() == reflect.Ptr { + t = t.Elem() + } + return t +} + +var primitiveConverters = map[reflect.Kind]func(v interface{}) (interface{}, bool){ + reflect.Bool: func(v interface{}) (interface{}, bool) { + res, ok := v.(bool) + return res, ok + }, + reflect.Int: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return int(res), true + } + return v, false + }, + reflect.Int8: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return int8(res), true + } + return v, false + }, + reflect.Int16: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return int16(res), true + } + return v, false + }, + reflect.Int32: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return int32(res), true + } + return v, false + }, + reflect.Int64: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return int64(res), true + } + return v, false + }, + reflect.Uint: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return uint(res), true + } + return v, false + }, + reflect.Uint8: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return uint8(res), true + } + return v, false + }, + reflect.Uint16: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return uint16(res), true + } + return v, false + }, + reflect.Uint32: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return uint32(res), true + } + return v, false + }, + reflect.Uint64: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return uint64(res), true + } + return v, false + }, + reflect.Float32: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return float32(res), true + } + return v, false + }, + reflect.Float64: func(v interface{}) (interface{}, bool) { + res, ok := v.(float64) + if ok { + return res, true + } + return v, false + }, + reflect.Interface: func(v interface{}) (interface{}, bool) { + return v, true + }, + reflect.String: func(v interface{}) (interface{}, bool) { + res, ok := v.(string) + return res, ok + }, +} + +func assignValue(field reflect.Value, value interface{}) { + if value == nil { + return + } + reflectValue := reflect.ValueOf(value) + if reflectValue.Type().AssignableTo(field.Type()) { + field.Set(reflectValue) + } +} + +func isValidValue(v interface{}) bool { + value := reflect.ValueOf(v) + return value.Kind() == reflect.Ptr && value.Elem().Kind() == reflect.Struct && !value.IsNil() +} + +func safeReflectValue(t reflect.Type, v interface{}) reflect.Value { + if v == nil { + return reflect.Zero(t) + } + return reflect.ValueOf(v) +} diff --git a/vendor/github.com/perimeterx/marshmallow/unmarshal.go b/vendor/github.com/perimeterx/marshmallow/unmarshal.go new file mode 100644 index 0000000000..160ea30cab --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/unmarshal.go @@ -0,0 +1,383 @@ +// Copyright 2022 PerimeterX. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package marshmallow + +import ( + "encoding/json" + "github.com/mailru/easyjson/jlexer" + "reflect" +) + +// Unmarshal parses the JSON-encoded object in data and stores the values +// in the struct pointed to by v and in the returned map. +// If v is nil or not a pointer to a struct, Unmarshal returns an ErrInvalidValue. +// If data is not a valid JSON or not a JSON object Unmarshal returns an ErrInvalidInput. +// +// Unmarshal follows the rules of json.Unmarshal with the following exceptions: +// - All input fields are stored in the resulting map, including fields that do not exist in the +// struct pointed by v. +// - Unmarshal only operates on JSON object inputs. It will reject all other types of input +// by returning ErrInvalidInput. +// - Unmarshal only operates on struct values. It will reject all other types of v by +// returning ErrInvalidValue. +// - Unmarshal supports three types of Mode values. Each mode is self documented and affects +// how Unmarshal behaves. +func Unmarshal(data []byte, v interface{}, options ...UnmarshalOption) (map[string]interface{}, error) { + if !isValidValue(v) { + return nil, ErrInvalidValue + } + opts := buildUnmarshalOptions(options) + useMultipleErrors := opts.mode == ModeAllowMultipleErrors || opts.mode == ModeFailOverToOriginalValue + d := &decoder{options: opts, lexer: &jlexer.Lexer{Data: data, UseMultipleErrors: useMultipleErrors}} + result := make(map[string]interface{}) + if d.lexer.IsNull() { + d.lexer.Skip() + } else if !d.lexer.IsDelim('{') { + return nil, ErrInvalidInput + } else { + d.populateStruct(false, v, result) + } + d.lexer.Consumed() + if useMultipleErrors { + errors := d.lexer.GetNonFatalErrors() + if len(errors) == 0 { + return result, nil + } + return result, &MultipleLexerError{Errors: errors} + } + err := d.lexer.Error() + if err != nil { + return nil, err + } + return result, nil +} + +type decoder struct { + options *unmarshalOptions + lexer *jlexer.Lexer +} + +func (d *decoder) populateStruct(forcePopulate bool, structInstance interface{}, result map[string]interface{}) (interface{}, bool) { + doPopulate := !d.options.skipPopulateStruct || forcePopulate + var structValue reflect.Value + if doPopulate { + structValue = reflectStructValue(structInstance) + } + fields := mapStructFields(structInstance) + var clone map[string]interface{} + if d.options.mode == ModeFailOverToOriginalValue { + clone = make(map[string]interface{}, len(fields)) + } + d.lexer.Delim('{') + for !d.lexer.IsDelim('}') { + key := d.lexer.UnsafeFieldName(false) + d.lexer.WantColon() + refInfo, exists := fields[key] + if exists { + value, isValidType := d.valueByReflectType(refInfo.t) + if isValidType { + if value != nil && doPopulate { + field := refInfo.field(structValue) + assignValue(field, value) + } + if !d.options.excludeKnownFieldsFromMap { + if result != nil { + result[key] = value + } + if clone != nil { + clone[key] = value + } + } + } else { + switch d.options.mode { + case ModeFailOnFirstError: + return nil, false + case ModeFailOverToOriginalValue: + if !forcePopulate { + result[key] = value + } else { + clone[key] = value + d.lexer.WantComma() + d.drainLexerMap(clone) + return clone, false + } + } + } + } else { + value := d.lexer.Interface() + if result != nil { + result[key] = value + } + if clone != nil { + clone[key] = value + } + } + d.lexer.WantComma() + } + d.lexer.Delim('}') + return structInstance, true +} + +func (d *decoder) valueByReflectType(t reflect.Type) (interface{}, bool) { + if t.Implements(unmarshalerType) { + result := reflect.New(t.Elem()).Interface() + d.valueFromCustomUnmarshaler(result.(json.Unmarshaler)) + return result, true + } + if reflect.PtrTo(t).Implements(unmarshalerType) { + value := reflect.New(t) + d.valueFromCustomUnmarshaler(value.Interface().(json.Unmarshaler)) + return value.Elem().Interface(), true + } + kind := t.Kind() + if converter := primitiveConverters[kind]; converter != nil { + v := d.lexer.Interface() + if v == nil { + return nil, true + } + converted, ok := converter(v) + if !ok { + addUnexpectedTypeLexerError(d.lexer, t) + return v, false + } + return converted, true + } + switch kind { + case reflect.Slice: + return d.buildSlice(t) + case reflect.Array: + return d.buildArray(t) + case reflect.Map: + return d.buildMap(t) + case reflect.Struct: + value, valid := d.buildStruct(t) + if value == nil { + return nil, valid + } + if !valid { + return value, false + } + return reflect.ValueOf(value).Elem().Interface(), valid + case reflect.Ptr: + if t.Elem().Kind() == reflect.Struct { + return d.buildStruct(t.Elem()) + } + value, valid := d.valueByReflectType(t.Elem()) + if value == nil { + return nil, valid + } + if !valid { + return value, false + } + result := reflect.New(reflect.TypeOf(value)) + result.Elem().Set(reflect.ValueOf(value)) + return result.Interface(), valid + } + addUnsupportedTypeLexerError(d.lexer, t) + return nil, false +} + +func (d *decoder) buildSlice(sliceType reflect.Type) (interface{}, bool) { + if d.lexer.IsNull() { + d.lexer.Skip() + return nil, true + } + if !d.lexer.IsDelim('[') { + addUnexpectedTypeLexerError(d.lexer, sliceType) + return d.lexer.Interface(), false + } + elemType := sliceType.Elem() + d.lexer.Delim('[') + var sliceValue reflect.Value + if !d.lexer.IsDelim(']') { + sliceValue = reflect.MakeSlice(sliceType, 0, 4) + } else { + sliceValue = reflect.MakeSlice(sliceType, 0, 0) + } + for !d.lexer.IsDelim(']') { + current, valid := d.valueByReflectType(elemType) + if !valid { + if d.options.mode != ModeFailOverToOriginalValue { + d.drainLexerArray(nil) + return nil, true + } + result := d.cloneReflectArray(sliceValue, -1) + result = append(result, current) + return d.drainLexerArray(result), true + } + sliceValue = reflect.Append(sliceValue, safeReflectValue(elemType, current)) + d.lexer.WantComma() + } + d.lexer.Delim(']') + return sliceValue.Interface(), true +} + +func (d *decoder) buildArray(arrayType reflect.Type) (interface{}, bool) { + if d.lexer.IsNull() { + d.lexer.Skip() + return nil, true + } + if !d.lexer.IsDelim('[') { + addUnexpectedTypeLexerError(d.lexer, arrayType) + return d.lexer.Interface(), false + } + elemType := arrayType.Elem() + arrayValue := reflect.New(arrayType).Elem() + d.lexer.Delim('[') + for i := 0; !d.lexer.IsDelim(']'); i++ { + current, valid := d.valueByReflectType(elemType) + if !valid { + if d.options.mode != ModeFailOverToOriginalValue { + d.drainLexerArray(nil) + return nil, true + } + result := d.cloneReflectArray(arrayValue, i) + result = append(result, current) + return d.drainLexerArray(result), true + } + if current != nil { + arrayValue.Index(i).Set(reflect.ValueOf(current)) + } + d.lexer.WantComma() + } + d.lexer.Delim(']') + return arrayValue.Interface(), true +} + +func (d *decoder) buildMap(mapType reflect.Type) (interface{}, bool) { + if d.lexer.IsNull() { + d.lexer.Skip() + return nil, true + } + if !d.lexer.IsDelim('{') { + addUnexpectedTypeLexerError(d.lexer, mapType) + return d.lexer.Interface(), false + } + d.lexer.Delim('{') + keyType := mapType.Key() + valueType := mapType.Elem() + mapValue := reflect.MakeMap(mapType) + for !d.lexer.IsDelim('}') { + key, valid := d.valueByReflectType(keyType) + if !valid { + if d.options.mode != ModeFailOverToOriginalValue { + d.lexer.WantColon() + d.lexer.Interface() + d.lexer.WantComma() + d.drainLexerMap(make(map[string]interface{})) + return nil, true + } + strKey, _ := key.(string) + d.lexer.WantColon() + value := d.lexer.Interface() + result := d.cloneReflectMap(mapValue) + result[strKey] = value + d.lexer.WantComma() + d.drainLexerMap(result) + return result, true + } + d.lexer.WantColon() + value, valid := d.valueByReflectType(valueType) + if !valid { + if d.options.mode != ModeFailOverToOriginalValue { + d.lexer.WantComma() + d.drainLexerMap(make(map[string]interface{})) + return nil, true + } + strKey, _ := key.(string) + result := d.cloneReflectMap(mapValue) + result[strKey] = value + d.lexer.WantComma() + d.drainLexerMap(result) + return result, true + } + mapValue.SetMapIndex(safeReflectValue(keyType, key), safeReflectValue(valueType, value)) + d.lexer.WantComma() + } + d.lexer.Delim('}') + return mapValue.Interface(), true +} + +func (d *decoder) buildStruct(structType reflect.Type) (interface{}, bool) { + if d.lexer.IsNull() { + d.lexer.Skip() + return nil, true + } + if !d.lexer.IsDelim('{') { + addUnexpectedTypeLexerError(d.lexer, structType) + return d.lexer.Interface(), false + } + value := reflect.New(structType).Interface() + handler, ok := asJSONDataHandler(value) + if !ok { + return d.populateStruct(true, value, nil) + } + data := make(map[string]interface{}) + result, valid := d.populateStruct(true, value, data) + if !valid { + return result, false + } + err := handler(data) + if err != nil { + d.lexer.AddNonFatalError(err) + return result, false + } + return result, true +} + +func (d *decoder) valueFromCustomUnmarshaler(unmarshaler json.Unmarshaler) { + data := d.lexer.Raw() + if !d.lexer.Ok() { + return + } + err := unmarshaler.UnmarshalJSON(data) + if err != nil { + d.lexer.AddNonFatalError(err) + } +} + +func (d *decoder) cloneReflectArray(value reflect.Value, length int) []interface{} { + if length == -1 { + length = value.Len() + } + result := make([]interface{}, length) + for i := 0; i < length; i++ { + result[i] = value.Index(i).Interface() + } + return result +} + +func (d *decoder) cloneReflectMap(mapValue reflect.Value) map[string]interface{} { + l := mapValue.Len() + result := make(map[string]interface{}, l) + for _, key := range mapValue.MapKeys() { + value := mapValue.MapIndex(key) + strKey, _ := key.Interface().(string) + result[strKey] = value.Interface() + } + return result +} + +func (d *decoder) drainLexerArray(target []interface{}) interface{} { + d.lexer.WantComma() + for !d.lexer.IsDelim(']') { + current := d.lexer.Interface() + target = append(target, current) + d.lexer.WantComma() + } + d.lexer.Delim(']') + return target +} + +func (d *decoder) drainLexerMap(target map[string]interface{}) { + for !d.lexer.IsDelim('}') { + key := d.lexer.String() + d.lexer.WantColon() + value := d.lexer.Interface() + target[key] = value + d.lexer.WantComma() + } + d.lexer.Delim('}') +} diff --git a/vendor/github.com/perimeterx/marshmallow/unmarshal_from_json_map.go b/vendor/github.com/perimeterx/marshmallow/unmarshal_from_json_map.go new file mode 100644 index 0000000000..0907f8f874 --- /dev/null +++ b/vendor/github.com/perimeterx/marshmallow/unmarshal_from_json_map.go @@ -0,0 +1,295 @@ +// Copyright 2022 PerimeterX. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package marshmallow + +import ( + "reflect" +) + +// UnmarshalerFromJSONMap is the interface implemented by types +// that can unmarshal a JSON description of themselves. +// In case you want to implement custom unmarshalling, json.Unmarshaler only supports +// receiving the data as []byte. However, while unmarshalling from JSON map, +// the data is not available as a raw []byte and converting to it will significantly +// hurt performance. Thus, if you wish to implement a custom unmarshalling on a type +// that is being unmarshalled from a JSON map, you need to implement +// UnmarshalerFromJSONMap interface. +type UnmarshalerFromJSONMap interface { + UnmarshalJSONFromMap(data interface{}) error +} + +// UnmarshalFromJSONMap parses the JSON map data and stores the values +// in the struct pointed to by v and in the returned map. +// If v is nil or not a pointer to a struct, UnmarshalFromJSONMap returns an ErrInvalidValue. +// +// UnmarshalFromJSONMap follows the rules of json.Unmarshal with the following exceptions: +// - All input fields are stored in the resulting map, including fields that do not exist in the +// struct pointed by v. +// - UnmarshalFromJSONMap receive a JSON map instead of raw bytes. The given input map is assumed +// to be a JSON map, meaning it should only contain the following types: bool, string, float64, +// []interface, and map[string]interface{}. Other types will cause decoding to return unexpected results. +// - UnmarshalFromJSONMap only operates on struct values. It will reject all other types of v by +// returning ErrInvalidValue. +// - UnmarshalFromJSONMap supports three types of Mode values. Each mode is self documented and affects +// how UnmarshalFromJSONMap behaves. +func UnmarshalFromJSONMap(data map[string]interface{}, v interface{}, options ...UnmarshalOption) (map[string]interface{}, error) { + if !isValidValue(v) { + return nil, ErrInvalidValue + } + opts := buildUnmarshalOptions(options) + d := &mapDecoder{options: opts} + result := make(map[string]interface{}) + if data != nil { + d.populateStruct(false, nil, data, v, result) + } + if opts.mode == ModeAllowMultipleErrors || opts.mode == ModeFailOverToOriginalValue { + if len(d.errs) == 0 { + return result, nil + } + return result, &MultipleError{Errors: d.errs} + } + if d.err != nil { + return nil, d.err + } + return result, nil +} + +var unmarshalerFromJSONMapType = reflect.TypeOf((*UnmarshalerFromJSONMap)(nil)).Elem() + +type mapDecoder struct { + options *unmarshalOptions + err error + errs []error +} + +func (m *mapDecoder) populateStruct(forcePopulate bool, path []string, data map[string]interface{}, structInstance interface{}, result map[string]interface{}) (interface{}, bool) { + doPopulate := !m.options.skipPopulateStruct || forcePopulate + var structValue reflect.Value + if doPopulate { + structValue = reflectStructValue(structInstance) + } + fields := mapStructFields(structInstance) + for key, inputValue := range data { + refInfo, exists := fields[key] + if exists { + value, isValidType := m.valueByReflectType(append(path, key), inputValue, refInfo.t) + if isValidType { + if value != nil && doPopulate { + field := refInfo.field(structValue) + assignValue(field, value) + } + if !m.options.excludeKnownFieldsFromMap { + if result != nil { + result[key] = value + } + } + } else { + switch m.options.mode { + case ModeFailOnFirstError: + return nil, false + case ModeFailOverToOriginalValue: + if !forcePopulate { + result[key] = value + } else { + return data, false + } + } + } + } else { + if result != nil { + result[key] = inputValue + } + } + } + return structInstance, true +} + +func (m *mapDecoder) valueByReflectType(path []string, v interface{}, t reflect.Type) (interface{}, bool) { + if t.Implements(unmarshalerFromJSONMapType) { + result := reflect.New(t.Elem()).Interface() + m.valueFromCustomUnmarshaler(v, result.(UnmarshalerFromJSONMap)) + return result, true + } + if reflect.PtrTo(t).Implements(unmarshalerFromJSONMapType) { + value := reflect.New(t) + m.valueFromCustomUnmarshaler(v, value.Interface().(UnmarshalerFromJSONMap)) + return value.Elem().Interface(), true + } + kind := t.Kind() + if converter := primitiveConverters[kind]; converter != nil { + if v == nil { + return nil, true + } + converted, ok := converter(v) + if !ok { + m.addError(newUnexpectedTypeParseError(t, path)) + return v, false + } + return converted, true + } + switch kind { + case reflect.Slice: + return m.buildSlice(path, v, t) + case reflect.Array: + return m.buildArray(path, v, t) + case reflect.Map: + return m.buildMap(path, v, t) + case reflect.Struct: + value, valid := m.buildStruct(path, v, t) + if value == nil { + return nil, valid + } + if !valid { + return value, false + } + return reflect.ValueOf(value).Elem().Interface(), valid + case reflect.Ptr: + if t.Elem().Kind() == reflect.Struct { + return m.buildStruct(path, v, t.Elem()) + } + value, valid := m.valueByReflectType(path, v, t.Elem()) + if value == nil { + return nil, valid + } + if !valid { + return value, false + } + result := reflect.New(reflect.TypeOf(value)) + result.Elem().Set(reflect.ValueOf(value)) + return result.Interface(), valid + } + m.addError(newUnsupportedTypeParseError(t, path)) + return nil, false +} + +func (m *mapDecoder) buildSlice(path []string, v interface{}, sliceType reflect.Type) (interface{}, bool) { + if v == nil { + return nil, true + } + arr, ok := v.([]interface{}) + if !ok { + m.addError(newUnexpectedTypeParseError(sliceType, path)) + return v, false + } + elemType := sliceType.Elem() + var sliceValue reflect.Value + if len(arr) > 0 { + sliceValue = reflect.MakeSlice(sliceType, 0, 4) + } else { + sliceValue = reflect.MakeSlice(sliceType, 0, 0) + } + for _, element := range arr { + current, valid := m.valueByReflectType(path, element, elemType) + if !valid { + if m.options.mode != ModeFailOverToOriginalValue { + return nil, true + } + return v, true + } + sliceValue = reflect.Append(sliceValue, safeReflectValue(elemType, current)) + } + return sliceValue.Interface(), true +} + +func (m *mapDecoder) buildArray(path []string, v interface{}, arrayType reflect.Type) (interface{}, bool) { + if v == nil { + return nil, true + } + arr, ok := v.([]interface{}) + if !ok { + m.addError(newUnexpectedTypeParseError(arrayType, path)) + return v, false + } + elemType := arrayType.Elem() + arrayValue := reflect.New(arrayType).Elem() + for i, element := range arr { + current, valid := m.valueByReflectType(path, element, elemType) + if !valid { + if m.options.mode != ModeFailOverToOriginalValue { + return nil, true + } + return v, true + } + if current != nil { + arrayValue.Index(i).Set(reflect.ValueOf(current)) + } + } + return arrayValue.Interface(), true +} + +func (m *mapDecoder) buildMap(path []string, v interface{}, mapType reflect.Type) (interface{}, bool) { + if v == nil { + return nil, true + } + mp, ok := v.(map[string]interface{}) + if !ok { + m.addError(newUnexpectedTypeParseError(mapType, path)) + return v, false + } + keyType := mapType.Key() + valueType := mapType.Elem() + mapValue := reflect.MakeMap(mapType) + for inputKey, inputValue := range mp { + keyPath := append(path, inputKey) + key, valid := m.valueByReflectType(keyPath, inputKey, keyType) + if !valid { + if m.options.mode != ModeFailOverToOriginalValue { + return nil, true + } + return v, true + } + value, valid := m.valueByReflectType(keyPath, inputValue, valueType) + if !valid { + if m.options.mode != ModeFailOverToOriginalValue { + return nil, true + } + return v, true + } + mapValue.SetMapIndex(safeReflectValue(keyType, key), safeReflectValue(valueType, value)) + } + return mapValue.Interface(), true +} + +func (m *mapDecoder) buildStruct(path []string, v interface{}, structType reflect.Type) (interface{}, bool) { + if v == nil { + return nil, true + } + mp, ok := v.(map[string]interface{}) + if !ok { + m.addError(newUnexpectedTypeParseError(structType, path)) + return v, false + } + value := reflect.New(structType).Interface() + handler, ok := asJSONDataHandler(value) + if !ok { + return m.populateStruct(true, path, mp, value, nil) + } + data := make(map[string]interface{}) + result, valid := m.populateStruct(true, path, mp, value, data) + if !valid { + return result, false + } + err := handler(data) + if err != nil { + m.addError(err) + return result, false + } + return result, true +} + +func (m *mapDecoder) valueFromCustomUnmarshaler(data interface{}, unmarshaler UnmarshalerFromJSONMap) { + err := unmarshaler.UnmarshalJSONFromMap(data) + if err != nil { + m.addError(err) + } +} + +func (m *mapDecoder) addError(err error) { + if m.options.mode == ModeFailOnFirstError { + m.err = err + } else { + m.errs = append(m.errs, err) + } +} diff --git a/vendor/github.com/speakeasy-api/jsonpath/LICENSE b/vendor/github.com/speakeasy-api/jsonpath/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/LICENSE @@ -0,0 +1,201 @@ + 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/speakeasy-api/jsonpath/pkg/jsonpath/config/config.go b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/config/config.go new file mode 100644 index 0000000000..bd8286ca6f --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/config/config.go @@ -0,0 +1,31 @@ +package config + +type Option func(*config) + +// WithPropertyNameExtension enables the use of the "~" character to access a property key. +// It is not enabled by default as this is outside of RFC 9535, but is important for several use-cases +func WithPropertyNameExtension() Option { + return func(cfg *config) { + cfg.propertyNameExtension = true + } +} + +type Config interface { + PropertyNameEnabled() bool +} + +type config struct { + propertyNameExtension bool +} + +func (c *config) PropertyNameEnabled() bool { + return c.propertyNameExtension +} + +func New(opts ...Option) Config { + cfg := &config{} + for _, opt := range opts { + opt(cfg) + } + return cfg +} diff --git a/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/filter.go b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/filter.go new file mode 100644 index 0000000000..0f5b77f619 --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/filter.go @@ -0,0 +1,456 @@ +package jsonpath + +import ( + "gopkg.in/yaml.v3" + "strconv" + "strings" +) + +// filter-selector = "?" S logical-expr +type filterSelector struct { + // logical-expr = logical-or-expr + expression *logicalOrExpr +} + +func (s filterSelector) ToString() string { + return s.expression.ToString() +} + +// logical-or-expr = logical-and-expr *(S "||" S logical-and-expr) +type logicalOrExpr struct { + expressions []*logicalAndExpr +} + +func (e logicalOrExpr) ToString() string { + builder := strings.Builder{} + for i, expr := range e.expressions { + if i > 0 { + builder.WriteString(" || ") + } + builder.WriteString(expr.ToString()) + } + return builder.String() +} + +// logical-and-expr = basic-expr *(S "&&" S basic-expr) +type logicalAndExpr struct { + expressions []*basicExpr +} + +func (e logicalAndExpr) ToString() string { + builder := strings.Builder{} + for i, expr := range e.expressions { + if i > 0 { + builder.WriteString(" && ") + } + builder.WriteString(expr.ToString()) + } + return builder.String() +} + +// relQuery rel-query = current-node-identifier segments +// current-node-identifier = "@" +type relQuery struct { + segments []*segment +} + +func (q relQuery) ToString() string { + builder := strings.Builder{} + builder.WriteString("@") + for _, segment := range q.segments { + builder.WriteString(segment.ToString()) + } + return builder.String() +} + +// filterQuery filter-query = rel-query / jsonpath-query +type filterQuery struct { + relQuery *relQuery + jsonPathQuery *jsonPathAST +} + +func (q filterQuery) ToString() string { + if q.relQuery != nil { + return q.relQuery.ToString() + } else if q.jsonPathQuery != nil { + return q.jsonPathQuery.ToString() + } + return "" +} + +// functionArgument function-argument = literal / +// +// filter-query / ; (includes singular-query) +// logical-expr / +// function-expr +type functionArgument struct { + literal *literal + filterQuery *filterQuery + logicalExpr *logicalOrExpr + functionExpr *functionExpr +} + +type functionArgType int + +const ( + functionArgTypeLiteral functionArgType = iota + functionArgTypeNodes +) + +type resolvedArgument struct { + kind functionArgType + literal *literal + nodes []*literal +} + +func (a functionArgument) Eval(idx index, node *yaml.Node, root *yaml.Node) resolvedArgument { + if a.literal != nil { + return resolvedArgument{kind: functionArgTypeLiteral, literal: a.literal} + } else if a.filterQuery != nil { + result := a.filterQuery.Query(idx, node, root) + lits := make([]*literal, len(result)) + for i, node := range result { + lit := nodeToLiteral(node) + lits[i] = &lit + } + if len(result) != 1 { + return resolvedArgument{kind: functionArgTypeNodes, nodes: lits} + } else { + return resolvedArgument{kind: functionArgTypeLiteral, literal: lits[0]} + } + } else if a.logicalExpr != nil { + res := a.logicalExpr.Matches(idx, node, root) + return resolvedArgument{kind: functionArgTypeLiteral, literal: &literal{bool: &res}} + } else if a.functionExpr != nil { + res := a.functionExpr.Evaluate(idx, node, root) + return resolvedArgument{kind: functionArgTypeLiteral, literal: &res} + } + return resolvedArgument{} +} + +func (a functionArgument) ToString() string { + builder := strings.Builder{} + if a.literal != nil { + builder.WriteString(a.literal.ToString()) + } else if a.filterQuery != nil { + builder.WriteString(a.filterQuery.ToString()) + } else if a.logicalExpr != nil { + builder.WriteString(a.logicalExpr.ToString()) + } else if a.functionExpr != nil { + builder.WriteString(a.functionExpr.ToString()) + } + return builder.String() +} + +//function-name = function-name-first *function-name-char +//function-name-first = LCALPHA +//function-name-char = function-name-first / "_" / DIGIT +//LCALPHA = %x61-7A ; "a".."z" +// + +type functionType int + +const ( + functionTypeLength functionType = iota + functionTypeCount + functionTypeMatch + functionTypeSearch + functionTypeValue +) + +var functionTypeMap = map[string]functionType{ + "length": functionTypeLength, + "count": functionTypeCount, + "match": functionTypeMatch, + "search": functionTypeSearch, + "value": functionTypeValue, +} + +func (f functionType) String() string { + for k, v := range functionTypeMap { + if v == f { + return k + } + } + return "unknown" +} + +// functionExpr function-expr = function-name "(" S [function-argument +// *(S "," S function-argument)] S ")" +type functionExpr struct { + funcType functionType + args []*functionArgument +} + +func (e functionExpr) ToString() string { + builder := strings.Builder{} + builder.WriteString(e.funcType.String()) + builder.WriteString("(") + for i, arg := range e.args { + if i > 0 { + builder.WriteString(", ") + } + builder.WriteString(arg.ToString()) + } + builder.WriteString(")") + return builder.String() +} + +// testExpr test-expr = [logical-not-op S] +// +// (filter-query / ; existence/non-existence +// function-expr) ; LogicalType or NodesType +type testExpr struct { + not bool + filterQuery *filterQuery + functionExpr *functionExpr +} + +func (e testExpr) ToString() string { + builder := strings.Builder{} + if e.not { + builder.WriteString("!") + } + if e.filterQuery != nil { + builder.WriteString(e.filterQuery.ToString()) + } else if e.functionExpr != nil { + builder.WriteString(e.functionExpr.ToString()) + } + return builder.String() +} + +// basicExpr basic-expr = +// +// paren-expr / +// comparison-expr / +// test-expr +type basicExpr struct { + parenExpr *parenExpr + comparisonExpr *comparisonExpr + testExpr *testExpr +} + +func (e basicExpr) ToString() string { + if e.parenExpr != nil { + return e.parenExpr.ToString() + } else if e.comparisonExpr != nil { + return e.comparisonExpr.ToString() + } else if e.testExpr != nil { + return e.testExpr.ToString() + } + return "" +} + +// literal literal = number / +// . string-literal / +// . true / false / null +type literal struct { + // we generally decompose these into their component parts for easier evaluation + integer *int + float64 *float64 + string *string + bool *bool + null *bool + node *yaml.Node +} + +func (l literal) ToString() string { + if l.integer != nil { + return strconv.Itoa(*l.integer) + } else if l.float64 != nil { + return strconv.FormatFloat(*l.float64, 'f', -1, 64) + } else if l.string != nil { + builder := strings.Builder{} + builder.WriteString("'") + builder.WriteString(escapeString(*l.string)) + builder.WriteString("'") + return builder.String() + } else if l.bool != nil { + if *l.bool { + return "true" + } else { + return "false" + } + } else if l.null != nil { + if *l.null { + return "null" + } else { + return "null" + } + } else if l.node != nil { + switch l.node.Kind { + case yaml.ScalarNode: + return l.node.Value + case yaml.SequenceNode: + builder := strings.Builder{} + builder.WriteString("[") + for i, child := range l.node.Content { + if i > 0 { + builder.WriteString(",") + } + builder.WriteString(literal{node: child}.ToString()) + } + builder.WriteString("]") + return builder.String() + case yaml.MappingNode: + builder := strings.Builder{} + builder.WriteString("{") + for i, child := range l.node.Content { + if i > 0 { + builder.WriteString(",") + } + builder.WriteString(literal{node: child}.ToString()) + } + builder.WriteString("}") + return builder.String() + } + } + return "" +} + +func escapeString(value string) string { + b := strings.Builder{} + for i := 0; i < len(value); i++ { + if value[i] == '\n' { + b.WriteString("\\\\n") + } else if value[i] == '\\' { + b.WriteString("\\\\") + } else if value[i] == '\'' { + b.WriteString("\\'") + } else { + b.WriteByte(value[i]) + } + } + return b.String() +} + +type absQuery jsonPathAST + +func (q absQuery) ToString() string { + builder := strings.Builder{} + builder.WriteString("$") + for _, segment := range q.segments { + builder.WriteString(segment.ToString()) + } + return builder.String() +} + +// singularQuery singular-query = rel-singular-query / abs-singular-query +type singularQuery struct { + relQuery *relQuery + absQuery *absQuery +} + +func (q singularQuery) ToString() string { + if q.relQuery != nil { + return q.relQuery.ToString() + } else if q.absQuery != nil { + return q.absQuery.ToString() + } + return "" +} + +// comparable +// +// comparable = literal / +// singular-query / ; singular query value +// function-expr ; ValueType +type comparable struct { + literal *literal + singularQuery *singularQuery + functionExpr *functionExpr +} + +func (c comparable) ToString() string { + if c.literal != nil { + return c.literal.ToString() + } else if c.singularQuery != nil { + return c.singularQuery.ToString() + } else if c.functionExpr != nil { + return c.functionExpr.ToString() + } + return "" +} + +// comparisonExpr represents a comparison expression +// +// comparison-expr = comparable S comparison-op S comparable +// literal = number / string-literal / +// true / false / null +// comparable = literal / +// singular-query / ; singular query value +// function-expr ; ValueType +// comparison-op = "==" / "!=" / +// "<=" / ">=" / +// "<" / ">" +type comparisonExpr struct { + left *comparable + op comparisonOperator + right *comparable +} + +func (e comparisonExpr) ToString() string { + builder := strings.Builder{} + builder.WriteString(e.left.ToString()) + builder.WriteString(" ") + builder.WriteString(e.op.ToString()) + builder.WriteString(" ") + builder.WriteString(e.right.ToString()) + return builder.String() +} + +// existExpr represents an existence expression +type existExpr struct { + query string +} + +// parenExpr represents a parenthesized expression +// +// paren-expr = [logical-not-op S] "(" S logical-expr S ")" +type parenExpr struct { + // "!" + not bool + // "(" logicalOrExpr ")" + expr *logicalOrExpr +} + +func (e parenExpr) ToString() string { + builder := strings.Builder{} + if e.not { + builder.WriteString("!") + } + builder.WriteString("(") + builder.WriteString(e.expr.ToString()) + builder.WriteString(")") + return builder.String() +} + +// comparisonOperator represents a comparison operator +type comparisonOperator int + +const ( + equalTo comparisonOperator = iota + notEqualTo + lessThan + lessThanEqualTo + greaterThan + greaterThanEqualTo +) + +func (o comparisonOperator) ToString() string { + switch o { + case equalTo: + return "==" + case notEqualTo: + return "!=" + case lessThan: + return "<" + case lessThanEqualTo: + return "<=" + case greaterThan: + return ">" + case greaterThanEqualTo: + return ">=" + } + return "" +} diff --git a/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/jsonpath.go b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/jsonpath.go new file mode 100644 index 0000000000..d5c8a5b3b6 --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/jsonpath.go @@ -0,0 +1,35 @@ +package jsonpath + +import ( + "fmt" + "github.com/speakeasy-api/jsonpath/pkg/jsonpath/config" + "github.com/speakeasy-api/jsonpath/pkg/jsonpath/token" + "gopkg.in/yaml.v3" +) + +func NewPath(input string, opts ...config.Option) (*JSONPath, error) { + tokenizer := token.NewTokenizer(input, opts...) + tokens := tokenizer.Tokenize() + for i := 0; i < len(tokens); i++ { + if tokens[i].Token == token.ILLEGAL { + return nil, fmt.Errorf(tokenizer.ErrorString(&tokens[i], "unexpected token")) + } + } + parser := newParserPrivate(tokenizer, tokens, opts...) + err := parser.parse() + if err != nil { + return nil, err + } + return parser, nil +} + +func (p *JSONPath) Query(root *yaml.Node) []*yaml.Node { + return p.ast.Query(root, root) +} + +func (p *JSONPath) String() string { + if p == nil { + return "" + } + return p.ast.ToString() +} diff --git a/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/parser.go b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/parser.go new file mode 100644 index 0000000000..ae6e7f13cb --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/parser.go @@ -0,0 +1,729 @@ +package jsonpath + +import ( + "errors" + "fmt" + "github.com/speakeasy-api/jsonpath/pkg/jsonpath/config" + "github.com/speakeasy-api/jsonpath/pkg/jsonpath/token" + "strconv" + "strings" +) + +const MaxSafeFloat int64 = 9007199254740991 + +type mode int + +const ( + modeNormal mode = iota + modeSingular +) + +// JSONPath represents a JSONPath parser. +type JSONPath struct { + tokenizer *token.Tokenizer + tokens []token.TokenInfo + ast jsonPathAST + current int + mode []mode + config config.Config +} + +// newParserPrivate creates a new JSONPath with the given tokens. +func newParserPrivate(tokenizer *token.Tokenizer, tokens []token.TokenInfo, opts ...config.Option) *JSONPath { + return &JSONPath{tokenizer, tokens, jsonPathAST{}, 0, []mode{modeNormal}, config.New(opts...)} +} + +// parse parses the JSONPath tokens and returns the root node of the AST. +// +// jsonpath-query = root-identifier segments +func (p *JSONPath) parse() error { + if len(p.tokens) == 0 { + return fmt.Errorf("empty JSONPath expression") + } + + if p.tokens[p.current].Token != token.ROOT { + return p.parseFailure(&p.tokens[p.current], "expected '$'") + } + p.current++ + + for p.current < len(p.tokens) { + segment, err := p.parseSegment() + if err != nil { + return err + } + p.ast.segments = append(p.ast.segments, segment) + } + return nil +} + +func (p *JSONPath) parseFailure(target *token.TokenInfo, msg string) error { + return errors.New(p.tokenizer.ErrorString(target, msg)) +} + +// peek returns true if the upcoming token matches the given token type. +func (p *JSONPath) peek(token token.Token) bool { + return p.current+1 < len(p.tokens) && p.tokens[p.current+1].Token == token +} + +// peek returns true if the upcoming token matches the given token type. +func (p *JSONPath) next(token token.Token) bool { + return p.current < len(p.tokens) && p.tokens[p.current].Token == token +} + +// expect consumes the current token if it matches the given token type. +func (p *JSONPath) expect(token token.Token) bool { + if p.peek(token) { + p.current++ + return true + } + return false +} + +// isComparisonOperator returns true if the given token is a comparison operator. +func (p *JSONPath) isComparisonOperator(tok token.Token) bool { + return tok == token.EQ || tok == token.NE || tok == token.GT || tok == token.GE || tok == token.LT || tok == token.LE +} + +func (p *JSONPath) parseSegment() (*segment, error) { + currentToken := p.tokens[p.current] + if currentToken.Token == token.RECURSIVE { + if p.mode[len(p.mode)-1] == modeSingular { + return nil, p.parseFailure(&p.tokens[p.current], "unexpected recursive descent in singular query") + } + p.current++ + child, err := p.parseInnerSegment() + if err != nil { + return nil, err + } + return &segment{kind: segmentKindDescendant, descendant: child}, nil + } else if currentToken.Token == token.CHILD || currentToken.Token == token.BRACKET_LEFT { + if currentToken.Token == token.CHILD { + p.current++ + } + child, err := p.parseInnerSegment() + if err != nil { + return nil, err + } + return &segment{kind: segmentKindChild, child: child}, nil + } else if p.config.PropertyNameEnabled() && currentToken.Token == token.PROPERTY_NAME { + p.current++ + return &segment{kind: segmentKindProperyName}, nil + } + return nil, p.parseFailure(¤tToken, "unexpected token when parsing segment") +} + +func (p *JSONPath) parseInnerSegment() (retValue *innerSegment, err error) { + defer func() { + if p.mode[len(p.mode)-1] == modeSingular && retValue != nil { + if len(retValue.selectors) > 1 { + retValue = nil + err = p.parseFailure(&p.tokens[p.current], "unexpected multiple selectors in singular query") + return + } else if retValue.kind == segmentDotWildcard { + retValue = nil + err = p.parseFailure(&p.tokens[p.current], "unexpected wildcard in singular query") + return + } + } + }() + // .* + // .STRING + // [] + if p.current >= len(p.tokens) { + return nil, p.parseFailure(nil, "unexpected end of input") + } + firstToken := p.tokens[p.current] + if firstToken.Token == token.WILDCARD { + p.current += 1 + return &innerSegment{segmentDotWildcard, "", nil}, nil + } else if firstToken.Token == token.STRING { + dotName := p.tokens[p.current].Literal + p.current += 1 + return &innerSegment{segmentDotMemberName, dotName, nil}, nil + } else if firstToken.Token == token.BRACKET_LEFT { + prior := p.current + p.current += 1 + selectors := []*selector{} + for p.current < len(p.tokens) { + innerSelector, err := p.parseSelector() + if err != nil { + p.current = prior + return nil, err + } + selectors = append(selectors, innerSelector) + if len(p.tokens) <= p.current { + return nil, p.parseFailure(&p.tokens[p.current-1], "unexpected end of input") + } + if p.tokens[p.current].Token == token.BRACKET_RIGHT { + break + } else if p.tokens[p.current].Token == token.COMMA { + p.current++ + } + } + if p.tokens[p.current].Token != token.BRACKET_RIGHT { + prior = p.current + return nil, p.parseFailure(&p.tokens[p.current], "expected ']'") + } + p.current += 1 + return &innerSegment{kind: segmentLongHand, dotName: "", selectors: selectors}, nil + } + return nil, p.parseFailure(&firstToken, "unexpected token when parsing inner segment") +} + +func (p *JSONPath) parseSelector() (retSelector *selector, err error) { + //selector = name-selector / + // wildcard-selector / + // slice-selector / + // index-selector / + // filter-selector + initial := p.current + defer func() { + if p.mode[len(p.mode)-1] == modeSingular && retSelector != nil { + if retSelector.kind == selectorSubKindWildcard { + err = p.parseFailure(&p.tokens[initial], "unexpected wildcard in singular query") + retSelector = nil + } else if retSelector.kind == selectorSubKindArraySlice { + err = p.parseFailure(&p.tokens[initial], "unexpected slice in singular query") + retSelector = nil + } + } + }() + + // name-selector = string-literal + if p.tokens[p.current].Token == token.STRING_LITERAL { + name := p.tokens[p.current].Literal + p.current++ + return &selector{kind: selectorSubKindName, name: name}, nil + // wildcard-selector = "*" + } else if p.tokens[p.current].Token == token.WILDCARD { + p.current++ + return &selector{kind: selectorSubKindWildcard}, nil + } else if p.tokens[p.current].Token == token.INTEGER { + // peek ahead to see if it's a slice + if p.peek(token.ARRAY_SLICE) { + slice, err := p.parseSliceSelector() + if err != nil { + return nil, err + } + return &selector{kind: selectorSubKindArraySlice, slice: slice}, nil + } + // peek ahead to see if we close the array index properly + if !p.peek(token.BRACKET_RIGHT) && !p.peek(token.COMMA) { + return nil, p.parseFailure(&p.tokens[p.current], "expected ']' or ','") + } + // else it's an index + lit := p.tokens[p.current].Literal + // make sure it's not -0 + if lit == "-0" { + return nil, p.parseFailure(&p.tokens[p.current], "-0 unexpected") + } + // make sure lit is an integer + i, err := strconv.ParseInt(lit, 10, 64) + if err != nil { + return nil, p.parseFailure(&p.tokens[p.current], "expected an integer") + } + err = p.checkSafeInteger(i, lit) + if err != nil { + return nil, err + } + + p.current++ + + return &selector{kind: selectorSubKindArrayIndex, index: i}, nil + } else if p.tokens[p.current].Token == token.ARRAY_SLICE { + slice, err := p.parseSliceSelector() + if err != nil { + return nil, err + } + return &selector{kind: selectorSubKindArraySlice, slice: slice}, nil + } else if p.tokens[p.current].Token == token.FILTER { + return p.parseFilterSelector() + } + + return nil, p.parseFailure(&p.tokens[p.current], "unexpected token when parsing selector") +} + +func (p *JSONPath) parseSliceSelector() (*slice, error) { + // slice-selector = [start S] ":" S [end S] [":" [S step]] + var start, end, step *int64 + + // parse the start index + if p.tokens[p.current].Token == token.INTEGER { + literal := p.tokens[p.current].Literal + i, err := strconv.ParseInt(literal, 10, 64) + if err != nil { + return nil, p.parseFailure(&p.tokens[p.current], "expected an integer") + } + err = p.checkSafeInteger(i, literal) + if err != nil { + return nil, err + } + + start = &i + p.current += 1 + } + + // Expect a colon + if p.tokens[p.current].Token != token.ARRAY_SLICE { + return nil, p.parseFailure(&p.tokens[p.current], "expected ':'") + } + p.current++ + + // parse the end index + if p.tokens[p.current].Token == token.INTEGER { + literal := p.tokens[p.current].Literal + i, err := strconv.ParseInt(literal, 10, 64) + if err != nil { + return nil, p.parseFailure(&p.tokens[p.current], "expected an integer") + } + err = p.checkSafeInteger(i, literal) + if err != nil { + return nil, err + } + + end = &i + p.current++ + } + + // Check for an optional second colon and step value + if p.tokens[p.current].Token == token.ARRAY_SLICE { + p.current++ + if p.tokens[p.current].Token == token.INTEGER { + literal := p.tokens[p.current].Literal + i, err := strconv.ParseInt(literal, 10, 64) + if err != nil { + return nil, p.parseFailure(&p.tokens[p.current], "expected an integer") + } + err = p.checkSafeInteger(i, literal) + if err != nil { + return nil, err + } + + step = &i + p.current++ + } + } + if p.tokens[p.current].Token != token.BRACKET_RIGHT { + return nil, p.parseFailure(&p.tokens[p.current], "expected ']'") + } + + return &slice{start: start, end: end, step: step}, nil +} + +func (p *JSONPath) checkSafeInteger(i int64, literal string) error { + if i > MaxSafeFloat || i < -MaxSafeFloat { + return p.parseFailure(&p.tokens[p.current], "outside bounds for safe integers") + } + if literal == "-0" { + return p.parseFailure(&p.tokens[p.current], "-0 unexpected") + } + return nil +} + +func (p *JSONPath) parseFilterSelector() (*selector, error) { + + if p.tokens[p.current].Token != token.FILTER { + return nil, p.parseFailure(&p.tokens[p.current], "expected '?'") + } + p.current++ + + expr, err := p.parseLogicalOrExpr() + if err != nil { + return nil, err + } + + return &selector{kind: selectorSubKindFilter, filter: &filterSelector{expr}}, nil +} + +func (p *JSONPath) parseLogicalOrExpr() (*logicalOrExpr, error) { + var expr logicalOrExpr + + for { + andExpr, err := p.parseLogicalAndExpr() + if err != nil { + return nil, err + } + expr.expressions = append(expr.expressions, andExpr) + + if !p.next(token.OR) { + break + } + p.current++ + } + + return &expr, nil +} + +func (p *JSONPath) parseLogicalAndExpr() (*logicalAndExpr, error) { + var expr logicalAndExpr + + for { + basicExpr, err := p.parseBasicExpr() + if err != nil { + return nil, err + } + expr.expressions = append(expr.expressions, basicExpr) + + if !p.next(token.AND) { + break + } + p.current++ + } + + return &expr, nil +} + +func (p *JSONPath) parseBasicExpr() (*basicExpr, error) { + //basic-expr = paren-expr / + // comparison-expr / + // test-expr + + switch p.tokens[p.current].Token { + case token.NOT: + p.current++ + expr, err := p.parseLogicalOrExpr() + if err != nil { + return nil, err + } + // Inspect if the expr is topped by a parenExpr -- if so we can simplify + if len(expr.expressions) == 1 && len(expr.expressions[0].expressions) == 1 && expr.expressions[0].expressions[0].parenExpr != nil { + child := expr.expressions[0].expressions[0].parenExpr + child.not = !child.not + return &basicExpr{parenExpr: child}, nil + } + return &basicExpr{parenExpr: &parenExpr{not: true, expr: expr}}, nil + case token.PAREN_LEFT: + p.current++ + expr, err := p.parseLogicalOrExpr() + if err != nil { + return nil, err + } + if p.tokens[p.current].Token != token.PAREN_RIGHT { + return nil, p.parseFailure(&p.tokens[p.current], "expected ')'") + } + p.current++ + return &basicExpr{parenExpr: &parenExpr{not: false, expr: expr}}, nil + } + prevCurrent := p.current + comparisonExpr, comparisonErr := p.parseComparisonExpr() + if comparisonErr == nil { + return &basicExpr{comparisonExpr: comparisonExpr}, nil + } + p.current = prevCurrent + testExpr, testErr := p.parseTestExpr() + if testErr == nil { + return &basicExpr{testExpr: testExpr}, nil + } + p.current = prevCurrent + return nil, p.parseFailure(&p.tokens[p.current], fmt.Sprintf("could not parse query: expected either testExpr [err: %s] or comparisonExpr: [err: %s]", testErr.Error(), comparisonErr.Error())) +} + +func (p *JSONPath) parseComparisonExpr() (*comparisonExpr, error) { + left, err := p.parseComparable() + if err != nil { + return nil, err + } + + if !p.isComparisonOperator(p.tokens[p.current].Token) { + return nil, p.parseFailure(&p.tokens[p.current], "expected comparison operator") + } + operator := p.tokens[p.current].Token + var op comparisonOperator + switch operator { + case token.EQ: + op = equalTo + case token.NE: + op = notEqualTo + case token.LT: + op = lessThan + case token.LE: + op = lessThanEqualTo + case token.GT: + op = greaterThan + case token.GE: + op = greaterThanEqualTo + default: + return nil, p.parseFailure(&p.tokens[p.current], "expected comparison operator") + } + p.current++ + + right, err := p.parseComparable() + if err != nil { + return nil, err + } + + return &comparisonExpr{left: left, op: op, right: right}, nil +} + +func (p *JSONPath) parseComparable() (*comparable, error) { + // comparable = literal / + // singular-query / ; singular query value + // function-expr ; ValueType + if literal, err := p.parseLiteral(); err == nil { + return &comparable{literal: literal}, nil + } + if funcExpr, err := p.parseFunctionExpr(); err == nil { + if funcExpr.funcType == functionTypeMatch { + return nil, p.parseFailure(&p.tokens[p.current], "match result cannot be compared") + } else if funcExpr.funcType == functionTypeSearch { + return nil, p.parseFailure(&p.tokens[p.current], "search result cannot be compared") + } + return &comparable{functionExpr: funcExpr}, nil + } + switch p.tokens[p.current].Token { + case token.ROOT: + p.current++ + query, err := p.parseSingleQuery() + if err != nil { + return nil, err + } + return &comparable{singularQuery: &singularQuery{absQuery: &absQuery{segments: query.segments}}}, nil + case token.CURRENT: + p.current++ + query, err := p.parseSingleQuery() + if err != nil { + return nil, err + } + return &comparable{singularQuery: &singularQuery{relQuery: &relQuery{segments: query.segments}}}, nil + default: + return nil, p.parseFailure(&p.tokens[p.current], "expected literal or query") + } +} + +func (p *JSONPath) parseQuery() (*jsonPathAST, error) { + var query jsonPathAST + p.mode = append(p.mode, modeNormal) + + for p.current < len(p.tokens) { + prior := p.current + segment, err := p.parseSegment() + if err != nil { + p.current = prior + break + } + query.segments = append(query.segments, segment) + } + p.mode = p.mode[:len(p.mode)-1] + return &query, nil +} + +func (p *JSONPath) parseTestExpr() (*testExpr, error) { + //test-expr = [logical-not-op S] + // (filter-query / ; existence/non-existence + // function-expr) ; LogicalType or NodesType + //filter-query = rel-query / jsonpath-query + //rel-query = current-node-identifier segments + //current-node-identifier = "@" + not := false + if p.tokens[p.current].Token == token.NOT { + not = true + p.current++ + } + switch p.tokens[p.current].Token { + case token.CURRENT: + p.current++ + query, err := p.parseQuery() + if err != nil { + return nil, err + } + return &testExpr{filterQuery: &filterQuery{relQuery: &relQuery{segments: query.segments}}, not: not}, nil + case token.ROOT: + p.current++ + query, err := p.parseQuery() + if err != nil { + return nil, err + } + return &testExpr{filterQuery: &filterQuery{jsonPathQuery: &jsonPathAST{segments: query.segments}}, not: not}, nil + default: + funcExpr, err := p.parseFunctionExpr() + if err != nil { + return nil, err + } + if funcExpr.funcType == functionTypeCount { + return nil, p.parseFailure(&p.tokens[p.current], "count function must be compared") + } + if funcExpr.funcType == functionTypeLength { + return nil, p.parseFailure(&p.tokens[p.current], "length function must be compared") + } + if funcExpr.funcType == functionTypeValue { + return nil, p.parseFailure(&p.tokens[p.current], "length function must be compared") + } + return &testExpr{functionExpr: funcExpr, not: not}, nil + } + + return nil, p.parseFailure(&p.tokens[p.current], "unexpected token when parsing test expression") +} + +func (p *JSONPath) parseFunctionExpr() (*functionExpr, error) { + functionName := p.tokens[p.current].Literal + if p.current+1 >= len(p.tokens) || p.tokens[p.current+1].Token != token.PAREN_LEFT { + return nil, p.parseFailure(&p.tokens[p.current], "expected '(' after function") + } + p.current += 2 + args := []*functionArgument{} + switch functionTypeMap[functionName] { + case functionTypeLength: + arg, err := p.parseFunctionArgument(true) + if err != nil { + return nil, err + } + args = append(args, arg) + case functionTypeCount: + arg, err := p.parseFunctionArgument(false) + if err != nil { + return nil, err + } + if arg.literal != nil && arg.literal.node == nil { + return nil, p.parseFailure(&p.tokens[p.current], "count function only supports containers") + } + args = append(args, arg) + case functionTypeValue: + arg, err := p.parseFunctionArgument(false) + if err != nil { + return nil, err + } + args = append(args, arg) + case functionTypeMatch: + fallthrough + case functionTypeSearch: + arg, err := p.parseFunctionArgument(false) + if err != nil { + return nil, err + } + args = append(args, arg) + if p.tokens[p.current].Token != token.COMMA { + return nil, p.parseFailure(&p.tokens[p.current], "expected ','") + } + p.current++ + arg, err = p.parseFunctionArgument(false) + if err != nil { + return nil, err + } + args = append(args, arg) + } + if p.tokens[p.current].Token != token.PAREN_RIGHT { + return nil, p.parseFailure(&p.tokens[p.current], "expected ')'") + } + p.current++ + return &functionExpr{funcType: functionTypeMap[functionName], args: args}, nil +} + +func (p *JSONPath) parseSingleQuery() (*jsonPathAST, error) { + var query jsonPathAST + for p.current < len(p.tokens) { + try := p.current + p.mode = append(p.mode, modeSingular) + segment, err := p.parseSegment() + if err != nil { + // rollback + p.mode = p.mode[:len(p.mode)-1] + p.current = try + break + } + p.mode = p.mode[:len(p.mode)-1] + query.segments = append(query.segments, segment) + } + //if len(query.segments) == 0 { + // return nil, p.parseFailure(p.tokens[p.current], "expected at least one segment") + //} + return &query, nil +} + +func (p *JSONPath) parseFunctionArgument(single bool) (*functionArgument, error) { + //function-argument = literal / + // filter-query / ; (includes singular-query) + // logical-expr / + // function-expr + + if lit, err := p.parseLiteral(); err == nil { + return &functionArgument{literal: lit}, nil + } + switch p.tokens[p.current].Token { + case token.CURRENT: + p.current++ + var query *jsonPathAST + var err error + if single { + query, err = p.parseSingleQuery() + } else { + query, err = p.parseQuery() + } + if err != nil { + return nil, err + } + return &functionArgument{filterQuery: &filterQuery{relQuery: &relQuery{segments: query.segments}}}, nil + case token.ROOT: + p.current++ + var query *jsonPathAST + var err error + if single { + query, err = p.parseSingleQuery() + } else { + query, err = p.parseQuery() + } + if err != nil { + return nil, err + } + return &functionArgument{filterQuery: &filterQuery{jsonPathQuery: &jsonPathAST{segments: query.segments}}}, nil + } + if expr, err := p.parseLogicalOrExpr(); err == nil { + return &functionArgument{logicalExpr: expr}, nil + } + if funcExpr, err := p.parseFunctionExpr(); err == nil { + return &functionArgument{functionExpr: funcExpr}, nil + } + + return nil, p.parseFailure(&p.tokens[p.current], "unexpected token for function argument") +} + +func (p *JSONPath) parseLiteral() (*literal, error) { + switch p.tokens[p.current].Token { + case token.STRING_LITERAL: + lit := p.tokens[p.current].Literal + p.current++ + return &literal{string: &lit}, nil + case token.INTEGER: + lit := p.tokens[p.current].Literal + p.current++ + i, err := strconv.Atoi(lit) + if err != nil { + return nil, p.parseFailure(&p.tokens[p.current], "expected integer") + } + return &literal{integer: &i}, nil + case token.FLOAT: + lit := p.tokens[p.current].Literal + p.current++ + f, err := strconv.ParseFloat(lit, 64) + if err != nil { + return nil, p.parseFailure(&p.tokens[p.current], "expected float") + } + return &literal{float64: &f}, nil + case token.TRUE: + p.current++ + res := true + return &literal{bool: &res}, nil + case token.FALSE: + p.current++ + res := false + return &literal{bool: &res}, nil + case token.NULL: + p.current++ + res := true + return &literal{null: &res}, nil + } + return nil, p.parseFailure(&p.tokens[p.current], "expected literal") +} + +type jsonPathAST struct { + // "$" + segments []*segment +} + +func (q jsonPathAST) ToString() string { + b := strings.Builder{} + b.WriteString("$") + for _, seg := range q.segments { + b.WriteString(seg.ToString()) + } + return b.String() +} diff --git a/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/segment.go b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/segment.go new file mode 100644 index 0000000000..cb6233f840 --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/segment.go @@ -0,0 +1,83 @@ +package jsonpath + +import ( + "gopkg.in/yaml.v3" + "strings" +) + +type segmentKind int + +const ( + segmentKindChild segmentKind = iota // . + segmentKindDescendant // .. + segmentKindProperyName // ~ (extension only) +) + +type segment struct { + kind segmentKind + child *innerSegment + descendant *innerSegment +} + +type segmentSubKind int + +const ( + segmentDotWildcard segmentSubKind = iota // .* + segmentDotMemberName // .property + segmentLongHand // [ selector[] ] +) + +func (s segment) ToString() string { + switch s.kind { + case segmentKindChild: + if s.child.kind != segmentLongHand { + return "." + s.child.ToString() + } else { + return s.child.ToString() + } + case segmentKindDescendant: + return ".." + s.descendant.ToString() + case segmentKindProperyName: + return "~" + } + panic("unknown segment kind") +} + +type innerSegment struct { + kind segmentSubKind + dotName string + selectors []*selector +} + +func (s innerSegment) ToString() string { + builder := strings.Builder{} + switch s.kind { + case segmentDotWildcard: + builder.WriteString("*") + break + case segmentDotMemberName: + builder.WriteString(s.dotName) + break + case segmentLongHand: + builder.WriteString("[") + for i, selector := range s.selectors { + builder.WriteString(selector.ToString()) + if i < len(s.selectors)-1 { + builder.WriteString(", ") + } + } + builder.WriteString("]") + break + default: + panic("unknown child segment kind") + } + return builder.String() +} + +func descend(value *yaml.Node, root *yaml.Node) []*yaml.Node { + result := []*yaml.Node{value} + for _, child := range value.Content { + result = append(result, descend(child, root)...) + } + return result +} diff --git a/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/selector.go b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/selector.go new file mode 100644 index 0000000000..f71cb47e73 --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/selector.go @@ -0,0 +1,63 @@ +package jsonpath + +import ( + "fmt" + "strconv" + "strings" +) + +type selectorSubKind int + +const ( + selectorSubKindWildcard selectorSubKind = iota + selectorSubKindName + selectorSubKindArraySlice + selectorSubKindArrayIndex + selectorSubKindFilter +) + +type slice struct { + start *int64 + end *int64 + step *int64 +} + +type selector struct { + kind selectorSubKind + name string + index int64 + slice *slice + filter *filterSelector +} + +func (s selector) ToString() string { + switch s.kind { + case selectorSubKindName: + return "'" + escapeString(s.name) + "'" + case selectorSubKindArrayIndex: + // int to string + return strconv.FormatInt(s.index, 10) + case selectorSubKindFilter: + return "?" + s.filter.ToString() + case selectorSubKindWildcard: + return "*" + case selectorSubKindArraySlice: + builder := strings.Builder{} + if s.slice.start != nil { + builder.WriteString(strconv.FormatInt(*s.slice.start, 10)) + } + builder.WriteString(":") + if s.slice.end != nil { + builder.WriteString(strconv.FormatInt(*s.slice.end, 10)) + } + + if s.slice.step != nil { + builder.WriteString(":") + builder.WriteString(strconv.FormatInt(*s.slice.step, 10)) + } + return builder.String() + default: + panic(fmt.Sprintf("unimplemented selector kind: %v", s.kind)) + } + return "" +} diff --git a/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/token/token.go b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/token/token.go new file mode 100644 index 0000000000..6cf1654772 --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/token/token.go @@ -0,0 +1,776 @@ +package token + +import ( + "fmt" + "github.com/speakeasy-api/jsonpath/pkg/jsonpath/config" + "strconv" + "strings" +) + +// ***************************************************************************** +// The Tokenizer is responsible for tokenizing the jsonpath expression. This means +// * removing whitespace +// * scanning strings +// * and detecting illegal characters +// ***************************************************************************** + +// Token represents a lexical token in a JSONPath expression. +type Token int + +// We are allowed the following tokens + +//jsonpath-query = root-identifier segments +//segments = *(segment) +//root-identifier = "$" +//selector = name-selector / +// wildcard-selector / +// slice-selector / +// index-selector / +// filter-selector +//name-selector = string-literal +//wildcard-selector = "*" +//index-selector = int ; decimal integer +// +//int = "0" / +// (["-"] DIGIT1 *DIGIT) ; - optional +//DIGIT1 = %x31-39 ; 1-9 non-zero digit +//slice-selector = [start] ":" [end] [":" [step]] +// +//start = int ; included in selection +//end = int ; not included in selection +//step = int ; default: 1 +//filter-selector = "?" logical-expr +//logical-expr = logical-or-expr +//logical-or-expr = logical-and-expr *("||" logical-and-expr) +// ; disjunction +// ; binds less tightly than conjunction +//logical-and-expr = basic-expr *("&&" basic-expr) +// ; conjunction +// ; binds more tightly than disjunction +// +//basic-expr = paren-expr / +// comparison-expr / +// test-expr +// +//paren-expr = [logical-not-op] "(" logical-expr ")" +// ; parenthesized expression +//logical-not-op = "!" ; logical NOT operator +//test-expr = [logical-not-op S] +// (filter-query / ; existence/non-existence +// function-expr) ; LogicalType or NodesType +//filter-query = rel-query / jsonpath-query +//rel-query = current-node-identifier segments +//current-node-identifier = "@" +//comparison-expr = comparable comparison-op comparable +//literal = number / string-literal / +// true / false / null +//comparable = literal / +// singular-query / ; singular query value +// function-expr ; ValueType +//comparison-op = "==" / "!=" / +// "<=" / ">=" / +// "<" / ">" +// +//singular-query = rel-singular-query / abs-singular-query +//rel-singular-query = current-node-identifier singular-query-segments +//abs-singular-query = root-identifier singular-query-segments +//singular-query-segments = *(S (name-segment / index-segment)) +//name-segment = ("[" name-selector "]") / +// ("." member-name-shorthand) +//index-segment = "[" index-selector "]" +//number = (int / "-0") [ frac ] [ exp ] ; decimal number +//frac = "." 1*DIGIT ; decimal fraction +//exp = "e" [ "-" / "+" ] 1*DIGIT ; decimal exponent +//true = %x74.72.75.65 ; true +//false = %x66.61.6c.73.65 ; false +//null = %x6e.75.6c.6c ; null +//function-name = function-name-first *function-name-char +//function-name-first = LCALPHA +//function-name-char = function-name-first / "_" / DIGIT +//LCALPHA = %x61-7A ; "a".."z" +// +//function-expr = function-name "(" [function-argument +// *(S "," function-argument)] ")" +//function-argument = literal / +// filter-query / ; (includes singular-query) +// logical-expr / +// function-expr +//segment = child-segment / descendant-segment +//child-segment = bracketed-selection / +// ("." +// (wildcard-selector / +// member-name-shorthand)) +// +//bracketed-selection = "[" selector *(S "," selector) "]" +// +//member-name-shorthand = name-first *name-char +//name-first = ALPHA / +// "_" / +// %x80-D7FF / +// ; skip surrogate code points +// %xE000-10FFFF +//name-char = name-first / DIGIT +// +//DIGIT = %x30-39 ; 0-9 +//ALPHA = %x41-5A / %x61-7A ; A-Z / a-z +//descendant-segment = ".." (bracketed-selection / +// wildcard-selector / +// member-name-shorthand) +// +// Figure 2: Collected ABNF of JSONPath Queries +// +//Figure 3 contains the collected ABNF grammar that defines the syntax +//of a JSONPath Normalized Path while also using the rules root- +//identifier, ESC, DIGIT, and DIGIT1 from Figure 2. +// +//normalized-path = root-identifier *(normal-index-segment) +//normal-index-segment = "[" normal-selector "]" +//normal-selector = normal-name-selector / normal-index-selector +//normal-name-selector = %x27 *normal-single-quoted %x27 ; 'string' +//normal-single-quoted = normal-unescaped / +// ESC normal-escapable +//normal-unescaped = ; omit %x0-1F control codes +// %x20-26 / +// ; omit 0x27 ' +// %x28-5B / +// ; omit 0x5C \ +// %x5D-D7FF / +// ; skip surrogate code points +// %xE000-10FFFF +// +//normal-escapable = %x62 / ; b BS backspace U+0008 +// %x66 / ; f FF form feed U+000C +// %x6E / ; n LF line feed U+000A +// %x72 / ; r CR carriage return U+000D +// %x74 / ; t HT horizontal tab U+0009 +// "'" / ; ' apostrophe U+0027 +// "\" / ; \ backslash (reverse solidus) U+005C +// (%x75 normal-hexchar) +// ; certain values u00xx U+00XX +//normal-hexchar = "0" "0" +// ( +// ("0" %x30-37) / ; "00"-"07" +// ; omit U+0008-U+000A BS HT LF +// ("0" %x62) / ; "0b" +// ; omit U+000C-U+000D FF CR +// ("0" %x65-66) / ; "0e"-"0f" +// ("1" normal-HEXDIG) +// ) +//normal-HEXDIG = DIGIT / %x61-66 ; "0"-"9", "a"-"f" +//normal-index-selector = "0" / (DIGIT1 *DIGIT) +// ; non-negative decimal integer + +// The list of tokens. +const ( + ILLEGAL Token = iota + STRING + INTEGER + FLOAT + STRING_LITERAL + TRUE + FALSE + NULL + ROOT + CURRENT + WILDCARD + PROPERTY_NAME + RECURSIVE + CHILD + ARRAY_SLICE + FILTER + PAREN_LEFT + PAREN_RIGHT + BRACKET_LEFT + BRACKET_RIGHT + COMMA + TILDE + AND + OR + NOT + EQ + NE + GT + GE + LT + LE + MATCHES + FUNCTION +) + +var SimpleTokens = [...]Token{ + STRING, + INTEGER, + STRING_LITERAL, + CHILD, + BRACKET_LEFT, + BRACKET_RIGHT, + ROOT, +} + +var tokens = [...]string{ + ILLEGAL: "ILLEGAL", + STRING: "STRING", + INTEGER: "INTEGER", + FLOAT: "FLOAT", + STRING_LITERAL: "STRING_LITERAL", + TRUE: "TRUE", + FALSE: "FALSE", + NULL: "NULL", + // root node identifier (Section 2.2) + ROOT: "$", + // current node identifier (Section 2.3.5) + // (valid only within filter selectors) + CURRENT: "@", + WILDCARD: "*", + RECURSIVE: "..", + CHILD: ".", + // start:end:step array slice operator (Section 2.3.4) + ARRAY_SLICE: ":", + // filter selector (Section 2.3.5): selects + // particular children using a logical + // expression + FILTER: "?", + PAREN_LEFT: "(", + PAREN_RIGHT: ")", + BRACKET_LEFT: "[", + BRACKET_RIGHT: "]", + COMMA: ",", + TILDE: "~", + AND: "&&", + OR: "||", + NOT: "!", + EQ: "==", + NE: "!=", + GT: ">", + GE: ">=", + LT: "<", + LE: "<=", + MATCHES: "=~", + FUNCTION: "FUNCTION", +} + +// String returns the string representation of the token. +func (tok Token) String() string { + if tok >= 0 && tok < Token(len(tokens)) { + return tokens[tok] + } + return "token(" + strconv.Itoa(int(tok)) + ")" +} + +func (tok Tokens) IsSimple() bool { + if len(tok) == 0 { + return false + } + if tok[0].Token != ROOT { + return false + } + for _, token := range tok { + isSimple := false + for _, simpleToken := range SimpleTokens { + if token.Token == simpleToken { + isSimple = true + } + } + if !isSimple { + return false + } + } + return true +} + +// When there's an error in the tokenizer, this helps represent it. +func (t Tokenizer) ErrorString(target *TokenInfo, msg string) string { + var errorBuilder strings.Builder + + var token TokenInfo + if target == nil { + // grab last token (as value) + token = t.tokens[len(t.tokens)-1] + // set column to +1 + token.Column++ + target = &token + } + + // Write the error message with line and column information + errorBuilder.WriteString(fmt.Sprintf("Error at line %d, column %d: %s\n", target.Line, target.Column, msg)) + + // Find the start and end positions of the line containing the target token + lineStart := 0 + lineEnd := len(t.input) + for i := target.Line - 1; i > 0; i-- { + if pos := strings.LastIndexByte(t.input[:lineStart], '\n'); pos != -1 { + lineStart = pos + 1 + break + } + } + if pos := strings.IndexByte(t.input[lineStart:], '\n'); pos != -1 { + lineEnd = lineStart + pos + } + + // Extract the line containing the target token + line := t.input[lineStart:lineEnd] + errorBuilder.WriteString(line) + errorBuilder.WriteString("\n") + + // Calculate the number of spaces before the target token + spaces := strings.Repeat(" ", target.Column) + + // Write the caret symbol pointing to the target token + errorBuilder.WriteString(spaces) + dots := "" + if target.Len > 0 { + dots = strings.Repeat(".", target.Len-1) + } + errorBuilder.WriteString("^" + dots + "\n") + + return errorBuilder.String() +} + +// When there's an error +func (t Tokenizer) ErrorTokenString(target *TokenInfo, msg string) string { + var errorBuilder strings.Builder + var token TokenInfo + if target == nil { + // grab last token (as value) + token = t.tokens[len(t.tokens)-1] + // set column to +1 + token.Column++ + target = &token + } + // Write the error message with line and column information + errorBuilder.WriteString(t.ErrorString(target, msg)) + + // Find the start and end positions of the line containing the target token + lineStart := 0 + lineEnd := len(t.input) + for i := target.Line - 1; i > 0; i-- { + if pos := strings.LastIndexByte(t.input[:lineStart], '\n'); pos != -1 { + lineStart = pos + 1 + break + } + } + if pos := strings.IndexByte(t.input[lineStart:], '\n'); pos != -1 { + lineEnd = lineStart + pos + } + + // Extract the line containing the target token + line := t.input[lineStart:lineEnd] + + // Calculate the number of spaces before the target token + for _, token := range t.tokens { + errorBuilder.WriteString(line) + errorBuilder.WriteString("\n") + spaces := strings.Repeat(" ", token.Column) + dots := "" + if token.Len > 0 { + dots = strings.Repeat(".", token.Len-1) + } + errorBuilder.WriteString(spaces) + errorBuilder.WriteString(fmt.Sprintf("^%s %s\n", dots, tokens[token.Token])) + } + + return errorBuilder.String() +} + +// TokenInfo represents a token and its associated information. +type TokenInfo struct { + Token Token + Line int + Column int + Literal string + Len int +} + +// Tokens represents the list of tokens +type Tokens []TokenInfo + +// Tokenizer represents a JSONPath tokenizer. +type Tokenizer struct { + input string + pos int + line int + column int + tokens []TokenInfo + stack []Token + illegalWhitespace bool + config config.Config +} + +// NewTokenizer creates a new JSONPath tokenizer for the given input string. +func NewTokenizer(input string, opts ...config.Option) *Tokenizer { + cfg := config.New(opts...) + return &Tokenizer{ + input: input, + config: cfg, + line: 1, + stack: make([]Token, 0), + } +} + +// Tokenize tokenizes the input string and returns a slice of TokenInfo. +func (t *Tokenizer) Tokenize() Tokens { + for t.pos < len(t.input) { + if !t.illegalWhitespace { + t.skipWhitespace() + } + if t.pos >= len(t.input) { + break + } + + switch ch := t.input[t.pos]; { + case ch == '$': + t.addToken(ROOT, 1, "") + case ch == '@': + t.addToken(CURRENT, 1, "") + case ch == '*': + t.addToken(WILDCARD, 1, "") + case ch == '~': + if t.config.PropertyNameEnabled() { + t.addToken(PROPERTY_NAME, 1, "") + } else { + t.addToken(ILLEGAL, 1, "invalid property name token without config.PropertyNameExtension set to true") + } + case ch == '.': + if t.peek() == '.' { + t.addToken(RECURSIVE, 2, "") + t.pos++ + t.column++ + t.illegalWhitespace = true + } else { + t.addToken(CHILD, 1, "") + t.illegalWhitespace = true + } + case ch == ',': + t.addToken(COMMA, 1, "") + case ch == ':': + t.addToken(ARRAY_SLICE, 1, "") + case ch == '?': + t.addToken(FILTER, 1, "") + case ch == '(': + t.addToken(PAREN_LEFT, 1, "") + t.stack = append(t.stack, PAREN_LEFT) + case ch == ')': + t.addToken(PAREN_RIGHT, 1, "") + if len(t.stack) > 0 && t.stack[len(t.stack)-1] == PAREN_LEFT { + t.stack = t.stack[:len(t.stack)-1] + } else { + t.addToken(ILLEGAL, 1, "unmatched closing parenthesis") + } + case ch == '[': + t.addToken(BRACKET_LEFT, 1, "") + t.stack = append(t.stack, BRACKET_LEFT) + case ch == ']': + if len(t.stack) > 0 && t.stack[len(t.stack)-1] == BRACKET_LEFT { + t.addToken(BRACKET_RIGHT, 1, "") + t.stack = t.stack[:len(t.stack)-1] + } else { + t.addToken(ILLEGAL, 1, "unmatched closing bracket") + } + case ch == '&': + if t.peek() == '&' { + t.addToken(AND, 2, "") + t.pos++ + t.column++ + } else { + t.addToken(ILLEGAL, 1, "invalid token") + } + case ch == '|': + if t.peek() == '|' { + t.addToken(OR, 2, "") + t.pos++ + t.column++ + } else { + t.addToken(ILLEGAL, 1, "invalid token") + } + case ch == '!': + if t.peek() == '=' { + t.addToken(NE, 2, "") + t.pos++ + t.column++ + } else { + t.addToken(NOT, 1, "") + } + case ch == '=': + if t.peek() == '=' { + t.addToken(EQ, 2, "") + t.pos++ + t.column++ + } else if t.peek() == '~' { + t.addToken(MATCHES, 2, "") + t.pos++ + t.column++ + } else { + t.addToken(ILLEGAL, 1, "invalid token") + } + case ch == '>': + if t.peek() == '=' { + t.addToken(GE, 2, "") + t.pos++ + t.column++ + } else { + t.addToken(GT, 1, "") + } + case ch == '<': + if t.peek() == '=' { + t.addToken(LE, 2, "") + t.pos++ + t.column++ + } else { + t.addToken(LT, 1, "") + } + case ch == '"' || ch == '\'': + t.scanString(rune(ch)) + case ch == '-' && isDigit(t.peek()): + fallthrough + case isDigit(ch): + t.scanNumber() + case isLiteralChar(ch): + t.scanLiteral() + default: + t.addToken(ILLEGAL, 1, string(ch)) + } + t.pos++ + t.column++ + } + + if len(t.stack) > 0 { + t.addToken(ILLEGAL, 1, fmt.Sprintf("unmatched %s", t.stack[len(t.stack)-1].String())) + } + return t.tokens +} + +func (t *Tokenizer) addToken(token Token, len int, literal string) { + t.tokens = append(t.tokens, TokenInfo{ + Token: token, + Line: t.line, + Column: t.column, + Len: len, + Literal: literal, + }) + t.illegalWhitespace = false +} + +func (t *Tokenizer) scanString(quote rune) { + start := t.pos + 1 + var literal strings.Builder +illegal: + for i := start; i < len(t.input); i++ { + b := literal.String() + _ = b + if t.input[i] == byte(quote) { + t.addToken(STRING_LITERAL, len(t.input[start:i])+2, literal.String()) + t.pos = i + t.column += i - start + 1 + return + } + if t.input[i] == '\\' { + i++ + if i >= len(t.input) { + t.addToken(ILLEGAL, len(t.input[start:]), literal.String()) + t.pos = len(t.input) - 1 + t.column = len(t.input) - 1 + return + } + switch t.input[i] { + case 'b': + literal.WriteByte('\b') + case 'f': + literal.WriteByte('\f') + case 'n': + literal.WriteByte('\n') + case 'r': + literal.WriteByte('\n') + case 't': + literal.WriteByte('\t') + case '\'': + if quote != '\'' { + // don't escape it, when we're not in a single quoted string + break illegal + } else { + literal.WriteByte(t.input[i]) + } + case '"': + if quote != '"' { + // don't escape it, when we're not in a single quoted string + break illegal + } else { + literal.WriteByte(t.input[i]) + } + case '\\', '/': + literal.WriteByte(t.input[i]) + default: + break illegal + } + } else { + literal.WriteByte(t.input[i]) + } + } + t.addToken(ILLEGAL, len(t.input[start:]), literal.String()) + t.pos = len(t.input) - 1 + t.column = len(t.input) - 1 +} + +func (t *Tokenizer) scanNumber() { + start := t.pos + tokenType := INTEGER + dotSeen := false + exponentSeen := false + + for i := start; i < len(t.input); i++ { + if i == start && t.input[i] == '-' { + continue + } + + if t.input[i] == '.' { + if dotSeen || exponentSeen { + t.addToken(ILLEGAL, len(t.input[start:i]), t.input[start:i]) + t.pos = i + t.column += i - start + return + } + tokenType = FLOAT + dotSeen = true + continue + } + + if t.input[i] == 'e' || t.input[i] == 'E' { + if exponentSeen || (len(t.input) > 0 && t.input[i-1] == '.') { + t.addToken(ILLEGAL, len(t.input[start:i]), t.input[start:i]) + t.pos = i + t.column += i - start + return + } + tokenType = FLOAT + exponentSeen = true + if i+1 < len(t.input) && (t.input[i+1] == '+' || t.input[i+1] == '-') { + i++ + } + continue + } + + if !isDigit(t.input[i]) { + literal := t.input[start:i] + // check for legal numbers + _, err := strconv.ParseFloat(literal, 64) + if err != nil { + tokenType = ILLEGAL + } + // conformance spec + if len(literal) > 1 && literal[0] == '0' && !dotSeen { + // no leading zero + tokenType = ILLEGAL + } else if len(literal) > 2 && literal[0] == '-' && literal[1] == '0' && !dotSeen { + // no trailing dot + tokenType = ILLEGAL + } else if len(literal) > 0 && literal[len(literal)-1] == '.' { + // no trailing dot + tokenType = ILLEGAL + } else if literal[len(literal)-1] == 'e' || literal[len(literal)-1] == 'E' { + // no exponent + tokenType = ILLEGAL + } + + t.addToken(tokenType, len(literal), literal) + t.pos = i - 1 + t.column += i - start - 1 + return + } + } + + if exponentSeen && !isDigit(t.input[len(t.input)-1]) { + t.addToken(ILLEGAL, len(t.input[start:]), t.input[start:]) + t.pos = len(t.input) - 1 + t.column = len(t.input) - 1 + return + } + + literal := t.input[start:] + t.addToken(tokenType, len(literal), literal) + t.pos = len(t.input) - 1 + t.column = len(t.input) - 1 +} + +func (t *Tokenizer) scanLiteral() { + start := t.pos + for i := start; i < len(t.input); i++ { + if !isLiteralChar(t.input[i]) && !isDigit(t.input[i]) { + literal := t.input[start:i] + switch literal { + case "true": + t.addToken(TRUE, len(literal), literal) + case "false": + t.addToken(FALSE, len(literal), literal) + case "null": + t.addToken(NULL, len(literal), literal) + default: + if isFunctionName(literal) { + t.addToken(FUNCTION, len(literal), literal) + t.illegalWhitespace = true + } else { + t.addToken(STRING, len(literal), literal) + } + } + t.pos = i - 1 + t.column += i - start - 1 + return + } + } + literal := t.input[start:] + switch literal { + case "true": + t.addToken(TRUE, len(literal), literal) + case "false": + t.addToken(FALSE, len(literal), literal) + case "null": + t.addToken(NULL, len(literal), literal) + default: + t.addToken(STRING, len(literal), literal) + } + t.pos = len(t.input) - 1 + t.column = len(t.input) - 1 +} + +func isFunctionName(literal string) bool { + return literal == "length" || literal == "count" || literal == "match" || literal == "search" || literal == "value" +} + +func (t *Tokenizer) skipWhitespace() { + // S = *B ; optional blank space + // B = %x20 / ; Space + // %x09 / ; Horizontal tab + // %x0A / ; Line feed or New line + // %x0D ; Carriage return + for len(t.tokens) > 0 && t.pos+1 < len(t.input) { + ch := t.input[t.pos] + if ch == '\n' { + t.line++ + t.pos++ + t.column = 0 + } else if !isSpace(ch) { + break + } else { + t.pos++ + t.column++ + } + } +} + +func (t *Tokenizer) peek() byte { + if t.pos+1 < len(t.input) { + return t.input[t.pos+1] + } + return 0 +} + +func isDigit(ch byte) bool { + return '0' <= ch && ch <= '9' +} + +func isLiteralChar(ch byte) bool { + // allow unicode characters + return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 +} + +func isSpace(ch byte) bool { + return ch == ' ' || ch == '\t' || ch == '\r' +} diff --git a/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/yaml_eval.go b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/yaml_eval.go new file mode 100644 index 0000000000..7291ea9f6e --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/yaml_eval.go @@ -0,0 +1,278 @@ +package jsonpath + +import ( + "fmt" + "gopkg.in/yaml.v3" + "reflect" + "regexp" + "strconv" + "unicode/utf8" +) + +func (l literal) Equals(value literal) bool { + if l.integer != nil && value.integer != nil { + return *l.integer == *value.integer + } + if l.float64 != nil && value.float64 != nil { + return *l.float64 == *value.float64 + } + if l.integer != nil && value.float64 != nil { + return float64(*l.integer) == *value.float64 + } + if l.float64 != nil && value.integer != nil { + return *l.float64 == float64(*value.integer) + } + if l.string != nil && value.string != nil { + return *l.string == *value.string + } + if l.bool != nil && value.bool != nil { + return *l.bool == *value.bool + } + if l.null != nil && value.null != nil { + return *l.null == *value.null + } + if l.node != nil && value.node != nil { + return equalsNode(l.node, value.node) + } + if reflect.ValueOf(l).IsZero() && reflect.ValueOf(value).IsZero() { + return true + } + return false +} + +func equalsNode(a *yaml.Node, b *yaml.Node) bool { + // decode into interfaces, then compare + if a.Tag != b.Tag { + return false + } + switch a.Tag { + case "!!str": + return a.Value == b.Value + case "!!int": + return a.Value == b.Value + case "!!float": + return a.Value == b.Value + case "!!bool": + return a.Value == b.Value + case "!!null": + return a.Value == b.Value + case "!!seq": + if len(a.Content) != len(b.Content) { + return false + } + for i := 0; i < len(a.Content); i++ { + if !equalsNode(a.Content[i], b.Content[i]) { + return false + } + } + case "!!map": + if len(a.Content) != len(b.Content) { + return false + } + for i := 0; i < len(a.Content); i += 2 { + if !equalsNode(a.Content[i], b.Content[i]) { + return false + } + if !equalsNode(a.Content[i+1], b.Content[i+1]) { + return false + } + } + } + return true +} + +func (l literal) LessThan(value literal) bool { + if l.integer != nil && value.integer != nil { + return *l.integer < *value.integer + } + if l.float64 != nil && value.float64 != nil { + return *l.float64 < *value.float64 + } + if l.integer != nil && value.float64 != nil { + return float64(*l.integer) < *value.float64 + } + if l.float64 != nil && value.integer != nil { + return *l.float64 < float64(*value.integer) + } + if l.string != nil && value.string != nil { + return *l.string < *value.string + } + return false +} + +func (l literal) LessThanOrEqual(value literal) bool { + return l.LessThan(value) || l.Equals(value) +} + +func (c comparable) Evaluate(idx index, node *yaml.Node, root *yaml.Node) literal { + if c.literal != nil { + return *c.literal + } + if c.singularQuery != nil { + return c.singularQuery.Evaluate(idx, node, root) + } + if c.functionExpr != nil { + return c.functionExpr.Evaluate(idx, node, root) + } + return literal{} +} + +func (e functionExpr) length(idx index, node *yaml.Node, root *yaml.Node) literal { + args := e.args[0].Eval(idx, node, root) + if args.kind != functionArgTypeLiteral { + return literal{} + } + //* If the argument value is a string, the result is the number of + //Unicode scalar values in the string. + if args.literal != nil && args.literal.string != nil { + res := utf8.RuneCountInString(*args.literal.string) + return literal{integer: &res} + } + //* If the argument value is an array, the result is the number of + //elements in the array. + // + //* If the argument value is an object, the result is the number of + //members in the object. + // + //* For any other argument value, the result is the special result + //Nothing. + + if args.literal.node != nil { + switch args.literal.node.Kind { + case yaml.SequenceNode: + res := len(args.literal.node.Content) + return literal{integer: &res} + case yaml.MappingNode: + res := len(args.literal.node.Content) / 2 + return literal{integer: &res} + } + } + return literal{} +} + +func (e functionExpr) count(idx index, node *yaml.Node, root *yaml.Node) literal { + args := e.args[0].Eval(idx, node, root) + if args.kind == functionArgTypeNodes { + res := len(args.nodes) + return literal{integer: &res} + } + + res := 1 + return literal{integer: &res} +} + +func (e functionExpr) match(idx index, node *yaml.Node, root *yaml.Node) literal { + arg1 := e.args[0].Eval(idx, node, root) + arg2 := e.args[1].Eval(idx, node, root) + if arg1.kind != functionArgTypeLiteral || arg2.kind != functionArgTypeLiteral { + return literal{} + } + if arg1.literal.string == nil || arg2.literal.string == nil { + return literal{bool: &[]bool{false}[0]} + } + matched, _ := regexp.MatchString(fmt.Sprintf("^(%s)$", *arg2.literal.string), *arg1.literal.string) + return literal{bool: &matched} +} + +func (e functionExpr) search(idx index, node *yaml.Node, root *yaml.Node) literal { + arg1 := e.args[0].Eval(idx, node, root) + arg2 := e.args[1].Eval(idx, node, root) + if arg1.kind != functionArgTypeLiteral || arg2.kind != functionArgTypeLiteral { + return literal{} + } + if arg1.literal.string == nil || arg2.literal.string == nil { + return literal{bool: &[]bool{false}[0]} + } + matched, _ := regexp.MatchString(*arg2.literal.string, *arg1.literal.string) + return literal{bool: &matched} +} + +func (e functionExpr) value(idx index, node *yaml.Node, root *yaml.Node) literal { + // 2.4.8. value() Function Extension + // + //Parameters: + // 1. NodesType + // + //Result: ValueType + //Its only argument is an instance of NodesType (possibly taken from a + //filter-query, as in the example above). The result is an instance of + //ValueType. + // + //* If the argument contains a single node, the result is the value of + //the node. + // + //* If the argument is the empty nodelist or contains multiple nodes, + // the result is Nothing. + + nodesType := e.args[0].Eval(idx, node, root) + if nodesType.kind == functionArgTypeLiteral { + return *nodesType.literal + } else if nodesType.kind == functionArgTypeNodes && len(nodesType.nodes) == 1 { + return *nodesType.nodes[0] + } + return literal{} +} + +func nodeToLiteral(node *yaml.Node) literal { + switch node.Tag { + case "!!str": + return literal{string: &node.Value} + case "!!int": + i, _ := strconv.Atoi(node.Value) + return literal{integer: &i} + case "!!float": + f, _ := strconv.ParseFloat(node.Value, 64) + return literal{float64: &f} + case "!!bool": + b, _ := strconv.ParseBool(node.Value) + return literal{bool: &b} + case "!!null": + b := true + return literal{null: &b} + default: + return literal{node: node} + } +} + +func (e functionExpr) Evaluate(idx index, node *yaml.Node, root *yaml.Node) literal { + switch e.funcType { + case functionTypeLength: + return e.length(idx, node, root) + case functionTypeCount: + return e.count(idx, node, root) + case functionTypeMatch: + return e.match(idx, node, root) + case functionTypeSearch: + return e.search(idx, node, root) + case functionTypeValue: + return e.value(idx, node, root) + } + return literal{} +} + +func (q singularQuery) Evaluate(idx index, node *yaml.Node, root *yaml.Node) literal { + if q.relQuery != nil { + return q.relQuery.Evaluate(idx, node, root) + } + if q.absQuery != nil { + return q.absQuery.Evaluate(idx, node, root) + } + return literal{} +} + +func (q relQuery) Evaluate(idx index, node *yaml.Node, root *yaml.Node) literal { + result := q.Query(idx, node, root) + if len(result) == 1 { + return nodeToLiteral(result[0]) + } + return literal{} + +} + +func (q absQuery) Evaluate(idx index, node *yaml.Node, root *yaml.Node) literal { + result := q.Query(idx, root, root) + if len(result) == 1 { + return nodeToLiteral(result[0]) + } + return literal{} +} diff --git a/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/yaml_query.go b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/yaml_query.go new file mode 100644 index 0000000000..44b55a31bd --- /dev/null +++ b/vendor/github.com/speakeasy-api/jsonpath/pkg/jsonpath/yaml_query.go @@ -0,0 +1,393 @@ +package jsonpath + +import ( + "gopkg.in/yaml.v3" +) + +type Evaluator interface { + Query(current *yaml.Node, root *yaml.Node) []*yaml.Node +} + +type index interface { + setPropertyKey(key *yaml.Node, value *yaml.Node) + getPropertyKey(key *yaml.Node) *yaml.Node +} + +type _index struct { + propertyKeys map[*yaml.Node]*yaml.Node +} + +func (i *_index) setPropertyKey(key *yaml.Node, value *yaml.Node) { + if i != nil && i.propertyKeys != nil { + i.propertyKeys[key] = value + } +} + +func (i *_index) getPropertyKey(key *yaml.Node) *yaml.Node { + if i != nil { + return i.propertyKeys[key] + } + return nil +} + +// jsonPathAST can be Evaluated +var _ Evaluator = jsonPathAST{} + +func (q jsonPathAST) Query(current *yaml.Node, root *yaml.Node) []*yaml.Node { + idx := _index{ + propertyKeys: map[*yaml.Node]*yaml.Node{}, + } + result := make([]*yaml.Node, 0) + // If the top level node is a documentnode, unwrap it + if root.Kind == yaml.DocumentNode && len(root.Content) == 1 { + root = root.Content[0] + } + result = append(result, root) + + for _, segment := range q.segments { + newValue := []*yaml.Node{} + for _, value := range result { + newValue = append(newValue, segment.Query(&idx, value, root)...) + } + result = newValue + } + return result +} + +func (s segment) Query(idx index, value *yaml.Node, root *yaml.Node) []*yaml.Node { + switch s.kind { + case segmentKindChild: + return s.child.Query(idx, value, root) + case segmentKindDescendant: + // run the inner segment against this node + var result = []*yaml.Node{} + children := descend(value, root) + for _, child := range children { + result = append(result, s.descendant.Query(idx, child, root)...) + } + // make children unique by pointer value + result = unique(result) + return result + case segmentKindProperyName: + found := idx.getPropertyKey(value) + if found != nil { + return []*yaml.Node{found} + } + return []*yaml.Node{} + } + panic("no segment type") +} + +func unique(nodes []*yaml.Node) []*yaml.Node { + // stably returns a new slice containing only the unique elements from nodes + res := make([]*yaml.Node, 0) + seen := make(map[*yaml.Node]bool) + for _, node := range nodes { + if _, ok := seen[node]; !ok { + res = append(res, node) + seen[node] = true + } + } + return res +} + +func (s innerSegment) Query(idx index, value *yaml.Node, root *yaml.Node) []*yaml.Node { + result := []*yaml.Node{} + + switch s.kind { + case segmentDotWildcard: + // Handle wildcard - get all children + switch value.Kind { + case yaml.MappingNode: + // in a mapping node, keys and values alternate + // we just want to return the values + for i, child := range value.Content { + if i%2 == 1 { + idx.setPropertyKey(value.Content[i-1], value) + idx.setPropertyKey(child, value.Content[i-1]) + result = append(result, child) + } + } + case yaml.SequenceNode: + for _, child := range value.Content { + result = append(result, child) + } + } + return result + case segmentDotMemberName: + // Handle member access + if value.Kind == yaml.MappingNode { + // In YAML mapping nodes, keys and values alternate + + for i := 0; i < len(value.Content); i += 2 { + key := value.Content[i] + val := value.Content[i+1] + + if key.Value == s.dotName { + idx.setPropertyKey(key, value) + idx.setPropertyKey(val, key) + result = append(result, val) + break + } + } + } + + case segmentLongHand: + // Handle long hand selectors + for _, selector := range s.selectors { + result = append(result, selector.Query(idx, value, root)...) + } + default: + panic("unknown child segment kind") + } + + return result + +} + +func (s selector) Query(idx index, value *yaml.Node, root *yaml.Node) []*yaml.Node { + switch s.kind { + case selectorSubKindName: + if value.Kind != yaml.MappingNode { + return nil + } + // MappingNode children is a list of alternating keys and values + var key string + for i, child := range value.Content { + if i%2 == 0 { + key = child.Value + continue + } + if key == s.name && i%2 == 1 { + idx.setPropertyKey(value.Content[i], value.Content[i-1]) + idx.setPropertyKey(value.Content[i-1], value) + return []*yaml.Node{child} + } + } + case selectorSubKindArrayIndex: + if value.Kind != yaml.SequenceNode { + return nil + } + // if out of bounds, return nothing + if s.index >= int64(len(value.Content)) || s.index < -int64(len(value.Content)) { + return nil + } + // if index is negative, go backwards + if s.index < 0 { + return []*yaml.Node{value.Content[int64(len(value.Content))+s.index]} + } + return []*yaml.Node{value.Content[s.index]} + case selectorSubKindWildcard: + if value.Kind == yaml.SequenceNode { + return value.Content + } else if value.Kind == yaml.MappingNode { + var result []*yaml.Node + for i, child := range value.Content { + if i%2 == 1 { + idx.setPropertyKey(value.Content[i-1], value) + idx.setPropertyKey(child, value.Content[i-1]) + result = append(result, child) + } + } + return result + } + return nil + case selectorSubKindArraySlice: + if value.Kind != yaml.SequenceNode { + return nil + } + if len(value.Content) == 0 { + return nil + } + step := int64(1) + if s.slice.step != nil { + step = *s.slice.step + } + if step == 0 { + return nil + } + + start, end := s.slice.start, s.slice.end + lower, upper := bounds(start, end, step, int64(len(value.Content))) + + var result []*yaml.Node + if step > 0 { + for i := lower; i < upper; i += step { + result = append(result, value.Content[i]) + } + } else { + for i := upper; i > lower; i += step { + result = append(result, value.Content[i]) + } + } + + return result + case selectorSubKindFilter: + var result []*yaml.Node + switch value.Kind { + case yaml.MappingNode: + for i := 1; i < len(value.Content); i += 2 { + idx.setPropertyKey(value.Content[i-1], value) + idx.setPropertyKey(value.Content[i], value.Content[i-1]) + if s.filter.Matches(idx, value.Content[i], root) { + result = append(result, value.Content[i]) + } + } + case yaml.SequenceNode: + for _, child := range value.Content { + if s.filter.Matches(idx, child, root) { + result = append(result, child) + } + } + } + return result + } + return nil +} + +func normalize(i, length int64) int64 { + if i >= 0 { + return i + } + return length + i +} + +func bounds(start, end *int64, step, length int64) (int64, int64) { + var nStart, nEnd int64 + if start != nil { + nStart = normalize(*start, length) + } else if step > 0 { + nStart = 0 + } else { + nStart = length - 1 + } + if end != nil { + nEnd = normalize(*end, length) + } else if step > 0 { + nEnd = length + } else { + nEnd = -1 + } + + var lower, upper int64 + if step >= 0 { + lower = max(min(nStart, length), 0) + upper = min(max(nEnd, 0), length) + } else { + upper = min(max(nStart, -1), length-1) + lower = min(max(nEnd, -1), length-1) + } + + return lower, upper +} + +func (s filterSelector) Matches(idx index, node *yaml.Node, root *yaml.Node) bool { + return s.expression.Matches(idx, node, root) +} + +func (e logicalOrExpr) Matches(idx index, node *yaml.Node, root *yaml.Node) bool { + for _, expr := range e.expressions { + if expr.Matches(idx, node, root) { + return true + } + } + return false +} + +func (e logicalAndExpr) Matches(idx index, node *yaml.Node, root *yaml.Node) bool { + for _, expr := range e.expressions { + if !expr.Matches(idx, node, root) { + return false + } + } + return true +} + +func (e basicExpr) Matches(idx index, node *yaml.Node, root *yaml.Node) bool { + if e.parenExpr != nil { + result := e.parenExpr.expr.Matches(idx, node, root) + if e.parenExpr.not { + return !result + } + return result + } else if e.comparisonExpr != nil { + return e.comparisonExpr.Matches(idx, node, root) + } else if e.testExpr != nil { + return e.testExpr.Matches(idx, node, root) + } + return false +} + +func (e comparisonExpr) Matches(idx index, node *yaml.Node, root *yaml.Node) bool { + leftValue := e.left.Evaluate(idx, node, root) + rightValue := e.right.Evaluate(idx, node, root) + + switch e.op { + case equalTo: + return leftValue.Equals(rightValue) + case notEqualTo: + return !leftValue.Equals(rightValue) + case lessThan: + return leftValue.LessThan(rightValue) + case lessThanEqualTo: + return leftValue.LessThanOrEqual(rightValue) + case greaterThan: + return rightValue.LessThan(leftValue) + case greaterThanEqualTo: + return rightValue.LessThanOrEqual(leftValue) + default: + return false + } +} + +func (e testExpr) Matches(idx index, node *yaml.Node, root *yaml.Node) bool { + var result bool + if e.filterQuery != nil { + result = len(e.filterQuery.Query(idx, node, root)) > 0 + } else if e.functionExpr != nil { + funcResult := e.functionExpr.Evaluate(idx, node, root) + if funcResult.bool != nil { + result = *funcResult.bool + } else if funcResult.null == nil { + result = true + } + } + if e.not { + return !result + } + return result +} + +func (q filterQuery) Query(idx index, node *yaml.Node, root *yaml.Node) []*yaml.Node { + if q.relQuery != nil { + return q.relQuery.Query(idx, node, root) + } + if q.jsonPathQuery != nil { + return q.jsonPathQuery.Query(node, root) + } + return nil +} + +func (q relQuery) Query(idx index, node *yaml.Node, root *yaml.Node) []*yaml.Node { + result := []*yaml.Node{node} + for _, seg := range q.segments { + var newResult []*yaml.Node + for _, value := range result { + newResult = append(newResult, seg.Query(idx, value, root)...) + } + result = newResult + } + return result +} + +func (q absQuery) Query(idx index, node *yaml.Node, root *yaml.Node) []*yaml.Node { + result := []*yaml.Node{root} + for _, seg := range q.segments { + var newResult []*yaml.Node + for _, value := range result { + newResult = append(newResult, seg.Query(idx, value, root)...) + } + result = newResult + } + return result +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/LICENSE b/vendor/github.com/speakeasy-api/openapi-overlay/LICENSE new file mode 100644 index 0000000000..467ab518ea --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/LICENSE @@ -0,0 +1,8 @@ +Copyright 2023 SPEAKEASY DEVELOPMENT INC + +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/speakeasy-api/openapi-overlay/pkg/loader/overlay.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/loader/overlay.go new file mode 100644 index 0000000000..99a8373d51 --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/loader/overlay.go @@ -0,0 +1,17 @@ +package loader + +import ( + "fmt" + "github.com/speakeasy-api/openapi-overlay/pkg/overlay" +) + +// LoadOverlay is a tool for loading and parsing an overlay file from the file +// system. +func LoadOverlay(path string) (*overlay.Overlay, error) { + o, err := overlay.Parse(path) + if err != nil { + return nil, fmt.Errorf("failed to parse overlay from path %q: %w", path, err) + } + + return o, nil +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/loader/spec.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/loader/spec.go new file mode 100644 index 0000000000..57ec4cb3e4 --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/loader/spec.go @@ -0,0 +1,78 @@ +package loader + +import ( + "fmt" + "github.com/speakeasy-api/openapi-overlay/pkg/overlay" + "gopkg.in/yaml.v3" + "net/url" + "os" +) + +// GetOverlayExtendsPath returns the path to file if the extends URL is a file +// URL. Otherwise, returns an empty string and an error. The error may occur if +// no extends URL is present or if the URL is not a file URL or if the URL is +// malformed. +func GetOverlayExtendsPath(o *overlay.Overlay) (string, error) { + if o.Extends == "" { + return "", fmt.Errorf("overlay does not specify an extends URL") + } + + specUrl, err := url.Parse(o.Extends) + if err != nil { + return "", fmt.Errorf("failed to parse URL %q: %w", o.Extends, err) + } + + if specUrl.Scheme != "file" { + return "", fmt.Errorf("only file:// extends URLs are supported, not %q", o.Extends) + } + + return specUrl.Path, nil +} + +// LoadExtendsSpecification will load and parse a YAML or JSON file as specified +// in the extends parameter of the overlay. Currently, this only supports file +// URLs. +func LoadExtendsSpecification(o *overlay.Overlay) (*yaml.Node, error) { + path, err := GetOverlayExtendsPath(o) + if err != nil { + return nil, err + } + + return LoadSpecification(path) +} + +// LoadSpecification will load and parse a YAML or JSON file from the given path. +func LoadSpecification(path string) (*yaml.Node, error) { + rs, err := os.Open(path) + if err != nil { + return nil, fmt.Errorf("failed to open schema from path %q: %w", path, err) + } + + var ys yaml.Node + err = yaml.NewDecoder(rs).Decode(&ys) + if err != nil { + return nil, fmt.Errorf("failed to parse schema at path %q: %w", path, err) + } + + return &ys, nil +} + +// LoadEitherSpecification is a convenience function that will load a +// specification from the given file path if it is non-empty. Otherwise, it will +// attempt to load the path from the overlay's extends URL. Also returns the name +// of the file loaded. +func LoadEitherSpecification(path string, o *overlay.Overlay) (*yaml.Node, string, error) { + var ( + y *yaml.Node + err error + ) + + if path != "" { + y, err = LoadSpecification(path) + } else { + path, _ = GetOverlayExtendsPath(o) + y, err = LoadExtendsSpecification(o) + } + + return y, path, err +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/apply.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/apply.go new file mode 100644 index 0000000000..faaaf9230a --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/apply.go @@ -0,0 +1,238 @@ +package overlay + +import ( + "fmt" + "github.com/speakeasy-api/jsonpath/pkg/jsonpath/config" + "github.com/speakeasy-api/jsonpath/pkg/jsonpath/token" + "gopkg.in/yaml.v3" + "strings" +) + +// ApplyTo will take an overlay and apply its changes to the given YAML +// document. +func (o *Overlay) ApplyTo(root *yaml.Node) error { + for _, action := range o.Actions { + var err error + if action.Remove { + err = o.applyRemoveAction(root, action, nil) + } else { + err = o.applyUpdateAction(root, action, &[]string{}) + } + + if err != nil { + return err + } + } + + return nil +} + +func (o *Overlay) ApplyToStrict(root *yaml.Node) (error, []string) { + multiError := []string{} + warnings := []string{} + hasFilterExpression := false + for i, action := range o.Actions { + tokens := token.NewTokenizer(action.Target, config.WithPropertyNameExtension()).Tokenize() + for _, tok := range tokens { + if tok.Token == token.FILTER { + hasFilterExpression = true + } + } + + actionWarnings := []string{} + err := o.validateSelectorHasAtLeastOneTarget(root, action) + if err != nil { + multiError = append(multiError, err.Error()) + } + if action.Remove { + err = o.applyRemoveAction(root, action, &actionWarnings) + } else { + err = o.applyUpdateAction(root, action, &actionWarnings) + } + for _, warning := range actionWarnings { + warnings = append(warnings, fmt.Sprintf("update action (%v / %v) target=%s: %s", i+1, len(o.Actions), action.Target, warning)) + } + } + + if hasFilterExpression && !o.UsesRFC9535() { + warnings = append(warnings, "overlay has a filter expression but lacks `x-speakeasy-jsonpath: rfc9535` extension. Deprecated jsonpath behaviour in use. See overlay.speakeasy.com for the implementation playground.") + } + + if len(multiError) > 0 { + return fmt.Errorf("error applying overlay (strict): %v", strings.Join(multiError, ",")), warnings + } + return nil, warnings +} + +func (o *Overlay) validateSelectorHasAtLeastOneTarget(root *yaml.Node, action Action) error { + if action.Target == "" { + return nil + } + + p, err := o.NewPath(action.Target, nil) + if err != nil { + return err + } + + nodes := p.Query(root) + + if len(nodes) == 0 { + return fmt.Errorf("selector %q did not match any targets", action.Target) + } + + return nil +} + +func (o *Overlay) applyRemoveAction(root *yaml.Node, action Action, warnings *[]string) error { + if action.Target == "" { + return nil + } + + idx := newParentIndex(root) + + p, err := o.NewPath(action.Target, warnings) + if err != nil { + return err + } + + nodes := p.Query(root) + if err != nil { + return err + } + + for _, node := range nodes { + removeNode(idx, node) + } + + return nil +} + +func removeNode(idx parentIndex, node *yaml.Node) { + parent := idx.getParent(node) + if parent == nil { + return + } + + for i, child := range parent.Content { + if child == node { + switch parent.Kind { + case yaml.MappingNode: + if i%2 == 1 { + // if we select a value, we should delete the key too + parent.Content = append(parent.Content[:i-1], parent.Content[i+1:]...) + } else { + // if we select a key, we should delete the value + parent.Content = append(parent.Content[:i], parent.Content[i+2:]...) + } + return + case yaml.SequenceNode: + parent.Content = append(parent.Content[:i], parent.Content[i+1:]...) + return + } + } + } +} + +func (o *Overlay) applyUpdateAction(root *yaml.Node, action Action, warnings *[]string) error { + if action.Target == "" { + return nil + } + + if action.Update.IsZero() { + return nil + } + + p, err := o.NewPath(action.Target, warnings) + if err != nil { + return err + } + + nodes := p.Query(root) + prior, err := yaml.Marshal(root) + if err != nil { + return err + } + + for _, node := range nodes { + if err := updateNode(node, &action.Update); err != nil { + return err + } + } + post, err := yaml.Marshal(root) + if err != nil { + return err + } + if warnings != nil && string(prior) == string(post) { + *warnings = append(*warnings, "does nothing") + } + + return nil +} + +func updateNode(node *yaml.Node, updateNode *yaml.Node) error { + mergeNode(node, updateNode) + return nil +} + +func mergeNode(node *yaml.Node, merge *yaml.Node) { + if node.Kind != merge.Kind { + *node = *clone(merge) + return + } + switch node.Kind { + default: + node.Value = merge.Value + case yaml.MappingNode: + mergeMappingNode(node, merge) + case yaml.SequenceNode: + mergeSequenceNode(node, merge) + } +} + +// mergeMappingNode will perform a shallow merge of the merge node into the main +// node. +func mergeMappingNode(node *yaml.Node, merge *yaml.Node) { +NextKey: + for i := 0; i < len(merge.Content); i += 2 { + mergeKey := merge.Content[i].Value + mergeValue := merge.Content[i+1] + + for j := 0; j < len(node.Content); j += 2 { + nodeKey := node.Content[j].Value + if nodeKey == mergeKey { + mergeNode(node.Content[j+1], mergeValue) + continue NextKey + } + } + + node.Content = append(node.Content, merge.Content[i], clone(mergeValue)) + } +} + +// mergeSequenceNode will append the merge node's content to the original node. +func mergeSequenceNode(node *yaml.Node, merge *yaml.Node) { + node.Content = append(node.Content, clone(merge).Content...) +} + +func clone(node *yaml.Node) *yaml.Node { + newNode := &yaml.Node{ + Kind: node.Kind, + Style: node.Style, + Tag: node.Tag, + Value: node.Value, + Anchor: node.Anchor, + HeadComment: node.HeadComment, + LineComment: node.LineComment, + FootComment: node.FootComment, + } + if node.Alias != nil { + newNode.Alias = clone(node.Alias) + } + if node.Content != nil { + newNode.Content = make([]*yaml.Node, len(node.Content)) + for i, child := range node.Content { + newNode.Content[i] = clone(child) + } + } + return newNode +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/compare.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/compare.go new file mode 100644 index 0000000000..33dff6a480 --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/compare.go @@ -0,0 +1,261 @@ +package overlay + +import ( + "bytes" + "fmt" + "log" + "strings" + + "gopkg.in/yaml.v3" +) + +// Compare compares input specifications from two files and returns an overlay +// that will convert the first into the second. +func Compare(title string, y1 *yaml.Node, y2 yaml.Node) (*Overlay, error) { + actions, err := walkTreesAndCollectActions(simplePath{}, y1, y2) + if err != nil { + return nil, err + } + + return &Overlay{ + Version: "1.0.0", + JSONPathVersion: "rfc9535", + Info: Info{ + Title: title, + Version: "0.0.0", + }, + Actions: actions, + }, nil +} + +type simplePart struct { + isKey bool + key string + index int +} + +func intPart(index int) simplePart { + return simplePart{ + index: index, + } +} + +func keyPart(key string) simplePart { + return simplePart{ + isKey: true, + key: key, + } +} + +func (p simplePart) String() string { + if p.isKey { + return fmt.Sprintf("[%q]", p.key) + } + return fmt.Sprintf("[%d]", p.index) +} + +func (p simplePart) KeyString() string { + if p.isKey { + return p.key + } + panic("FIXME: Bug detected in overlay comparison algorithm: attempt to use non key part as key") +} + +type simplePath []simplePart + +func (p simplePath) WithIndex(index int) simplePath { + return append(p, intPart(index)) +} + +func (p simplePath) WithKey(key string) simplePath { + return append(p, keyPart(key)) +} + +func (p simplePath) ToJSONPath() string { + out := &strings.Builder{} + out.WriteString("$") + for _, part := range p { + out.WriteString(part.String()) + } + return out.String() +} + +func (p simplePath) Dir() simplePath { + return p[:len(p)-1] +} + +func (p simplePath) Base() simplePart { + return p[len(p)-1] +} + +func walkTreesAndCollectActions(path simplePath, y1 *yaml.Node, y2 yaml.Node) ([]Action, error) { + if y1 == nil { + return []Action{{ + Target: path.Dir().ToJSONPath(), + Update: y2, + }}, nil + } + + if y2.IsZero() { + return []Action{{ + Target: path.ToJSONPath(), + Remove: true, + }}, nil + } + if y1.Kind != y2.Kind { + return []Action{{ + Target: path.ToJSONPath(), + Update: y2, + }}, nil + } + + switch y1.Kind { + case yaml.DocumentNode: + return walkTreesAndCollectActions(path, y1.Content[0], *y2.Content[0]) + case yaml.SequenceNode: + if len(y2.Content) == len(y1.Content) { + return walkSequenceNode(path, y1, y2) + } + + if len(y2.Content) == len(y1.Content)+1 && + yamlEquals(y2.Content[:len(y1.Content)], y1.Content) { + return []Action{{ + Target: path.ToJSONPath(), + Update: yaml.Node{ + Kind: y1.Kind, + Content: []*yaml.Node{y2.Content[len(y1.Content)]}, + }, + }}, nil + } + + return []Action{{ + Target: path.ToJSONPath() + "[*]", // target all elements + Remove: true, + }, { + Target: path.ToJSONPath(), + Update: yaml.Node{ + Kind: y1.Kind, + Content: y2.Content, + }, + }}, nil + case yaml.MappingNode: + return walkMappingNode(path, y1, y2) + case yaml.ScalarNode: + if y1.Value != y2.Value { + return []Action{{ + Target: path.ToJSONPath(), + Update: y2, + }}, nil + } + case yaml.AliasNode: + log.Println("YAML alias nodes are not yet supported for compare.") + } + return nil, nil +} + +func yamlEquals(nodes []*yaml.Node, content []*yaml.Node) bool { + for i := range nodes { + bufA := &bytes.Buffer{} + bufB := &bytes.Buffer{} + decodeA := yaml.NewEncoder(bufA) + decodeB := yaml.NewEncoder(bufB) + err := decodeA.Encode(nodes[i]) + if err != nil { + return false + } + err = decodeB.Encode(content[i]) + if err != nil { + return false + } + + if bufA.String() != bufB.String() { + return false + } + } + return true +} + +func walkSequenceNode(path simplePath, y1 *yaml.Node, y2 yaml.Node) ([]Action, error) { + nodeLen := max(len(y1.Content), len(y2.Content)) + var actions []Action + for i := 0; i < nodeLen; i++ { + var c1, c2 *yaml.Node + if i < len(y1.Content) { + c1 = y1.Content[i] + } + if i < len(y2.Content) { + c2 = y2.Content[i] + } + + newActions, err := walkTreesAndCollectActions( + path.WithIndex(i), + c1, *c2) + if err != nil { + return nil, err + } + + actions = append(actions, newActions...) + } + + return actions, nil +} + +func walkMappingNode(path simplePath, y1 *yaml.Node, y2 yaml.Node) ([]Action, error) { + var actions []Action + foundKeys := map[string]struct{}{} + + // Add or update keys in y2 that differ/missing from y1 +Outer: + for i := 0; i < len(y2.Content); i += 2 { + k2 := y2.Content[i] + v2 := y2.Content[i+1] + + foundKeys[k2.Value] = struct{}{} + + // find keys in y1 to update + for j := 0; j < len(y1.Content); j += 2 { + k1 := y1.Content[j] + v1 := y1.Content[j+1] + + if k1.Value == k2.Value { + newActions, err := walkTreesAndCollectActions( + path.WithKey(k2.Value), + v1, *v2) + if err != nil { + return nil, err + } + actions = append(actions, newActions...) + continue Outer + } + } + + // key not found in y1, so add it + newActions, err := walkTreesAndCollectActions( + path.WithKey(k2.Value), + nil, yaml.Node{ + Kind: y1.Kind, + Content: []*yaml.Node{k2, v2}, + }) + if err != nil { + return nil, err + } + + actions = append(actions, newActions...) + } + + // look for keys in y1 that are not in y2: remove them + for i := 0; i < len(y1.Content); i += 2 { + k1 := y1.Content[i] + + if _, alreadySeen := foundKeys[k1.Value]; alreadySeen { + continue + } + + actions = append(actions, Action{ + Target: path.WithKey(k1.Value).ToJSONPath(), + Remove: true, + }) + } + + return actions, nil +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/jsonpath.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/jsonpath.go new file mode 100644 index 0000000000..d43617c743 --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/jsonpath.go @@ -0,0 +1,47 @@ +package overlay + +import ( + "fmt" + "github.com/speakeasy-api/jsonpath/pkg/jsonpath" + "github.com/speakeasy-api/jsonpath/pkg/jsonpath/config" + "github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath" + "gopkg.in/yaml.v3" +) + +type Queryable interface { + Query(root *yaml.Node) []*yaml.Node +} + +type yamlPathQueryable struct { + path *yamlpath.Path +} + +func (y yamlPathQueryable) Query(root *yaml.Node) []*yaml.Node { + if y.path == nil { + return []*yaml.Node{} + } + // errors aren't actually possible from yamlpath. + result, _ := y.path.Find(root) + return result +} + +func (o *Overlay) NewPath(target string, warnings *[]string) (Queryable, error) { + rfcJSONPath, rfcJSONPathErr := jsonpath.NewPath(target, config.WithPropertyNameExtension()) + if o.UsesRFC9535() { + return rfcJSONPath, rfcJSONPathErr + } + if rfcJSONPathErr != nil && warnings != nil { + *warnings = append(*warnings, fmt.Sprintf("invalid rfc9535 jsonpath %s: %s\nThis will be treated as an error in the future. Please fix and opt into the new implementation with `\"x-speakeasy-jsonpath\": rfc9535` in the root of your overlay. See overlay.speakeasy.com for an implementation playground.", target, rfcJSONPathErr.Error())) + } + + path, err := yamlpath.NewPath(target) + return mustExecute(path), err +} + +func (o *Overlay) UsesRFC9535() bool { + return o.JSONPathVersion == "rfc9535" +} + +func mustExecute(path *yamlpath.Path) yamlPathQueryable { + return yamlPathQueryable{path} +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/parents.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/parents.go new file mode 100644 index 0000000000..a2b4942cbb --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/parents.go @@ -0,0 +1,23 @@ +package overlay + +import "gopkg.in/yaml.v3" + +type parentIndex map[*yaml.Node]*yaml.Node + +// newParentIndex returns a new parentIndex, populated for the given root node. +func newParentIndex(root *yaml.Node) parentIndex { + index := parentIndex{} + index.indexNodeRecursively(root) + return index +} + +func (index parentIndex) indexNodeRecursively(parent *yaml.Node) { + for _, child := range parent.Content { + index[child] = parent + index.indexNodeRecursively(child) + } +} + +func (index parentIndex) getParent(child *yaml.Node) *yaml.Node { + return index[child] +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/parse.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/parse.go new file mode 100644 index 0000000000..0708846f7e --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/parse.go @@ -0,0 +1,58 @@ +package overlay + +import ( + "fmt" + "gopkg.in/yaml.v3" + "io" + "os" + "path/filepath" +) + +// Parse will parse the given reader as an overlay file. +func Parse(path string) (*Overlay, error) { + filePath, err := filepath.Abs(path) + if err != nil { + return nil, fmt.Errorf("failed to get absolute path for %q: %w", path, err) + } + + ro, err := os.Open(filePath) + if err != nil { + return nil, fmt.Errorf("failed to open overlay file at path %q: %w", path, err) + } + defer ro.Close() + + var overlay Overlay + dec := yaml.NewDecoder(ro) + + err = dec.Decode(&overlay) + if err != nil { + return nil, err + } + + return &overlay, err +} + +// Format will validate reformat the given file +func Format(path string) error { + overlay, err := Parse(path) + if err != nil { + return err + } + filePath, err := filepath.Abs(path) + if err != nil { + return fmt.Errorf("failed to open overlay file at path %q: %w", path, err) + } + formatted, err := overlay.ToString() + if err != nil { + return err + } + + return os.WriteFile(filePath, []byte(formatted), 0644) +} + +// Format writes the file back out as YAML. +func (o *Overlay) Format(w io.Writer) error { + enc := yaml.NewEncoder(w) + enc.SetIndent(2) + return enc.Encode(o) +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/schema.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/schema.go new file mode 100644 index 0000000000..f4408f0fa5 --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/schema.go @@ -0,0 +1,66 @@ +package overlay + +import ( + "bytes" + "gopkg.in/yaml.v3" +) + +// Extensible provides a place for extensions to be added to components of the +// Overlay configuration. These are a map from x-* extension fields to their values. +type Extensions map[string]any + +// Overlay is the top-level configuration for an OpenAPI overlay. +type Overlay struct { + Extensions `yaml:"-,inline"` + + // Version is the version of the overlay configuration. This is only ever expected to be 1.0.0 + Version string `yaml:"overlay"` + + // JSONPathVersion should be set to rfc9535, and is used for backwards compatability purposes + JSONPathVersion string `yaml:"x-speakeasy-jsonpath,omitempty"` + + // Info describes the metadata for the overlay. + Info Info `yaml:"info"` + + // Extends is a URL to the OpenAPI specification this overlay applies to. + Extends string `yaml:"extends,omitempty"` + + // Actions is the list of actions to perform to apply the overlay. + Actions []Action `yaml:"actions"` +} + +func (o *Overlay) ToString() (string, error) { + buf := bytes.NewBuffer([]byte{}) + decoder := yaml.NewEncoder(buf) + decoder.SetIndent(2) + err := decoder.Encode(o) + return buf.String(), err +} + +// Info describes the metadata for the overlay. +type Info struct { + Extensions `yaml:"-,inline"` + + // Title is the title of the overlay. + Title string `yaml:"title"` + + // Version is the version of the overlay. + Version string `yaml:"version"` +} + +type Action struct { + Extensions `yaml:"-,inline"` + + // Target is the JSONPath to the target of the action. + Target string `yaml:"target"` + + // Description is a description of the action. + Description string `yaml:"description,omitempty"` + + // Update is the sub-document to use to merge or replace in the target. This is + // ignored if Remove is set. + Update yaml.Node `yaml:"update,omitempty"` + + // Remove marks the target node for removal rather than update. + Remove bool `yaml:"remove,omitempty"` +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/utils.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/utils.go new file mode 100644 index 0000000000..0ca4054c83 --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/utils.go @@ -0,0 +1,19 @@ +package overlay + +import ( + "fmt" + "gopkg.in/yaml.v3" +) + +func NewTargetSelector(path, method string) string { + return fmt.Sprintf(`$["paths"]["%s"]["%s"]`, path, method) +} + +func NewUpdateAction(path, method string, update yaml.Node) Action { + target := NewTargetSelector(path, method) + + return Action{ + Target: target, + Update: update, + } +} diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/validate.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/validate.go new file mode 100644 index 0000000000..922592eba2 --- /dev/null +++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/validate.go @@ -0,0 +1,61 @@ +package overlay + +import ( + "fmt" + "net/url" + "strings" +) + +type ValidationErrors []error + +func (v ValidationErrors) Error() string { + msgs := make([]string, len(v)) + for i, err := range v { + msgs[i] = err.Error() + } + return strings.Join(msgs, "\n") +} + +func (v ValidationErrors) Return() error { + if len(v) > 0 { + return v + } + return nil +} + +func (o *Overlay) Validate() error { + errs := make(ValidationErrors, 0) + if o.Version != "1.0.0" { + errs = append(errs, fmt.Errorf("overlay version must be 1.0.0")) + } + + if o.Info.Title == "" { + errs = append(errs, fmt.Errorf("overlay info title must be defined")) + } + if o.Info.Version == "" { + errs = append(errs, fmt.Errorf("overlay info version must be defined")) + } + + if o.Extends != "" { + _, err := url.Parse(o.Extends) + if err != nil { + errs = append(errs, fmt.Errorf("overlay extends must be a valid URL")) + } + } + + if len(o.Actions) == 0 { + errs = append(errs, fmt.Errorf("overlay must define at least one action")) + } else { + for i, action := range o.Actions { + if action.Target == "" { + errs = append(errs, fmt.Errorf("overlay action at index %d target must be defined", i)) + } + + if action.Remove && !action.Update.IsZero() { + errs = append(errs, fmt.Errorf("overlay action at index %d should not both set remove and define update", i)) + } + } + } + + return errs.Return() +} diff --git a/vendor/github.com/vmware-labs/yaml-jsonpath/LICENSE b/vendor/github.com/vmware-labs/yaml-jsonpath/LICENSE new file mode 100644 index 0000000000..62a56a3359 --- /dev/null +++ b/vendor/github.com/vmware-labs/yaml-jsonpath/LICENSE @@ -0,0 +1,181 @@ +yaml-jsonpath +Copyright (c) 2020 VMware, Inc. All rights reserved. + +The Apache 2.0 license (the "License") set forth below applies to all parts of the yaml-jsonpath project. You may not use this file except in compliance with the License. + +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 + + diff --git a/vendor/github.com/vmware-labs/yaml-jsonpath/NOTICE b/vendor/github.com/vmware-labs/yaml-jsonpath/NOTICE new file mode 100644 index 0000000000..055021a2dd --- /dev/null +++ b/vendor/github.com/vmware-labs/yaml-jsonpath/NOTICE @@ -0,0 +1,7 @@ +yaml-jsonpath +Copyright (c) 2020 VMware, Inc. All Rights Reserved. + +This product is licensed to you under the Apache 2.0 license (the "License"). You may not use this product except in compliance with the Apache 2.0 License. + +This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + diff --git a/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/comparison.go b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/comparison.go new file mode 100644 index 0000000000..15cc38a0f7 --- /dev/null +++ b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/comparison.go @@ -0,0 +1,93 @@ +/* + * Copyright 2020 VMware, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package yamlpath + +import "strconv" + +type comparison int + +const ( + compareLessThan comparison = iota + compareEqual + compareGreaterThan + compareIncomparable +) + +type orderingOperator string + +const ( + operatorLessThan orderingOperator = "<" + operatorLessThanOrEqual orderingOperator = "<=" + operatorGreaterThan orderingOperator = ">" + operatorGreaterThanOrEqual orderingOperator = ">=" +) + +func (o orderingOperator) String() string { + return string(o) +} + +type comparator func(comparison) bool + +func equal(c comparison) bool { + return c == compareEqual +} + +func notEqual(c comparison) bool { + return c != compareEqual +} + +func greaterThan(c comparison) bool { + return c == compareGreaterThan +} + +func greaterThanOrEqual(c comparison) bool { + return c == compareGreaterThan || c == compareEqual +} + +func lessThan(c comparison) bool { + return c == compareLessThan +} + +func lessThanOrEqual(c comparison) bool { + return c == compareLessThan || c == compareEqual +} + +func compareStrings(a, b string) comparison { + if a == b { + return compareEqual + } + return compareIncomparable +} + +func compareFloat64(lhs, rhs float64) comparison { + if lhs < rhs { + return compareLessThan + } + if lhs > rhs { + return compareGreaterThan + } + return compareEqual +} + +// compareNodeValues compares two values each of which may be a string, integer, or float +func compareNodeValues(lhs, rhs typedValue) comparison { + if lhs.typ.isNumeric() && rhs.typ.isNumeric() { + return compareFloat64(mustParseFloat64(lhs.val), mustParseFloat64(rhs.val)) + } + if (lhs.typ != stringValueType && !lhs.typ.isNumeric()) || (rhs.typ != stringValueType && !rhs.typ.isNumeric()) { + panic("invalid type of value passed to compareNodeValues") // should never happen + } + return compareStrings(lhs.val, rhs.val) +} + +func mustParseFloat64(s string) float64 { + f, err := strconv.ParseFloat(s, 64) + if err != nil { + panic("invalid numeric value " + s) // should never happen + } + return f +} diff --git a/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/doc.go b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/doc.go new file mode 100644 index 0000000000..bba7f27689 --- /dev/null +++ b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/doc.go @@ -0,0 +1,8 @@ +/* + * Copyright 2020 VMware, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// Package yamlpath provides YAML node searching using path notation. +package yamlpath diff --git a/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/filter.go b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/filter.go new file mode 100644 index 0000000000..dead1912bf --- /dev/null +++ b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/filter.go @@ -0,0 +1,297 @@ +/* + * Copyright 2020 VMware, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package yamlpath + +import ( + "fmt" + "regexp" + "strconv" + "strings" + + "gopkg.in/yaml.v3" +) + +type filter func(node, root *yaml.Node) bool + +func newFilter(n *filterNode) filter { + if n == nil { + return never + } + + switch n.lexeme.typ { + case lexemeFilterAt, lexemeRoot: + path := pathFilterScanner(n) + return func(node, root *yaml.Node) bool { + return len(path(node, root)) > 0 + } + + case lexemeFilterEquality, lexemeFilterInequality, + lexemeFilterGreaterThan, lexemeFilterGreaterThanOrEqual, + lexemeFilterLessThan, lexemeFilterLessThanOrEqual: + return comparisonFilter(n) + + case lexemeFilterMatchesRegularExpression: + return matchRegularExpression(n) + + case lexemeFilterNot: + f := newFilter(n.children[0]) + return func(node, root *yaml.Node) bool { + return !f(node, root) + } + + case lexemeFilterOr: + f1 := newFilter(n.children[0]) + f2 := newFilter(n.children[1]) + return func(node, root *yaml.Node) bool { + return f1(node, root) || f2(node, root) + } + + case lexemeFilterAnd: + f1 := newFilter(n.children[0]) + f2 := newFilter(n.children[1]) + return func(node, root *yaml.Node) bool { + return f1(node, root) && f2(node, root) + } + + case lexemeFilterBooleanLiteral: + b, err := strconv.ParseBool(n.lexeme.val) + if err != nil { + panic(err) // should not happen + } + return func(node, root *yaml.Node) bool { + return b + } + + default: + return never + } +} + +func never(node, root *yaml.Node) bool { + return false +} + +func comparisonFilter(n *filterNode) filter { + compare := func(b bool) bool { + var c comparison + if b { + c = compareEqual + } else { + c = compareIncomparable + } + return n.lexeme.comparator()(c) + } + return nodeToFilter(n, func(l, r typedValue) bool { + if !l.typ.compatibleWith(r.typ) { + return compare(false) + } + switch l.typ { + case booleanValueType: + return compare(equalBooleans(l.val, r.val)) + + case nullValueType: + return compare(equalNulls(l.val, r.val)) + + default: + return n.lexeme.comparator()(compareNodeValues(l, r)) + } + }) +} + +var x, y typedValue + +func init() { + x = typedValue{stringValueType, "x"} + y = typedValue{stringValueType, "y"} +} + +func nodeToFilter(n *filterNode, accept func(typedValue, typedValue) bool) filter { + lhsPath := newFilterScanner(n.children[0]) + rhsPath := newFilterScanner(n.children[1]) + return func(node, root *yaml.Node) (result bool) { + // perform a set-wise comparison of the values in each path + match := false + for _, l := range lhsPath(node, root) { + for _, r := range rhsPath(node, root) { + if !accept(l, r) { + return false + } + match = true + } + } + return match + } +} + +func equalBooleans(l, r string) bool { + // Note: the YAML parser and our JSONPath lexer both rule out invalid boolean literals such as tRue. + return strings.EqualFold(l, r) +} + +func equalNulls(l, r string) bool { + // Note: the YAML parser and our JSONPath lexer both rule out invalid null literals such as nUll. + return true +} + +// filterScanner is a function that returns a slice of typed values from either a filter literal or a path expression +// which refers to either the current node or the root node. It is used in filter comparisons. +type filterScanner func(node, root *yaml.Node) []typedValue + +func emptyScanner(*yaml.Node, *yaml.Node) []typedValue { + return []typedValue{} +} + +func newFilterScanner(n *filterNode) filterScanner { + switch { + case n == nil: + return emptyScanner + + case n.isItemFilter(): + return pathFilterScanner(n) + + case n.isLiteral(): + return literalFilterScanner(n) + + default: + return emptyScanner + } +} + +func pathFilterScanner(n *filterNode) filterScanner { + var at bool + switch n.lexeme.typ { + case lexemeFilterAt: + at = true + case lexemeRoot: + at = false + default: + panic("false precondition") + } + subpath := "" + for _, lexeme := range n.subpath { + subpath += lexeme.val + } + path, err := NewPath(subpath) + if err != nil { + return emptyScanner + } + return func(node, root *yaml.Node) []typedValue { + if at { + return values(path.Find(node)) + } + return values(path.Find(root)) + } +} + +type valueType int + +const ( + unknownValueType valueType = iota + stringValueType + intValueType + floatValueType + booleanValueType + nullValueType + regularExpressionValueType +) + +func (vt valueType) isNumeric() bool { + return vt == intValueType || vt == floatValueType +} + +func (vt valueType) compatibleWith(vt2 valueType) bool { + return vt.isNumeric() && vt2.isNumeric() || vt == vt2 || vt == stringValueType && vt2 == regularExpressionValueType +} + +type typedValue struct { + typ valueType + val string +} + +const ( + nullTag = "!!null" + boolTag = "!!bool" + strTag = "!!str" + intTag = "!!int" + floatTag = "!!float" +) + +func typedValueOfNode(node *yaml.Node) typedValue { + var t valueType = unknownValueType + if node.Kind == yaml.ScalarNode { + switch node.ShortTag() { + case nullTag: + t = nullValueType + + case boolTag: + t = booleanValueType + + case strTag: + t = stringValueType + + case intTag: + t = intValueType + + case floatTag: + t = floatValueType + } + } + + return typedValue{ + typ: t, + val: node.Value, + } +} + +func newTypedValue(t valueType, v string) typedValue { + return typedValue{ + typ: t, + val: v, + } +} + +func typedValueOfString(s string) typedValue { + return newTypedValue(stringValueType, s) +} + +func typedValueOfInt(i string) typedValue { + return newTypedValue(intValueType, i) +} + +func typedValueOfFloat(f string) typedValue { + return newTypedValue(floatValueType, f) +} + +func values(nodes []*yaml.Node, err error) []typedValue { + if err != nil { + panic(fmt.Errorf("unexpected error: %v", err)) // should never happen + } + v := []typedValue{} + for _, n := range nodes { + v = append(v, typedValueOfNode(n)) + } + return v +} + +func literalFilterScanner(n *filterNode) filterScanner { + v := n.lexeme.literalValue() + return func(node, root *yaml.Node) []typedValue { + return []typedValue{v} + } +} + +func matchRegularExpression(parseTree *filterNode) filter { + return nodeToFilter(parseTree, stringMatchesRegularExpression) +} + +func stringMatchesRegularExpression(s, expr typedValue) bool { + if s.typ != stringValueType || expr.typ != regularExpressionValueType { + return false // can't compare types so return false + } + re, _ := regexp.Compile(expr.val) // regex already compiled during lexing + return re.Match([]byte(s.val)) +} diff --git a/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/filter_parser.go b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/filter_parser.go new file mode 100644 index 0000000000..48a1c7af57 --- /dev/null +++ b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/filter_parser.go @@ -0,0 +1,295 @@ +/* + * Copyright 2020 VMware, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package yamlpath + +/* + filterNode represents a node of a filter expression parse tree. Each node is labelled with a lexeme. + + Terminal nodes have one of the following lexemes: root, lexemeFilterAt, lexemeFilterIntegerLiteral, + lexemeFilterFloatLiteral, lexemeFilterStringLiteral, lexemeFilterBooleanLiteral. + root and lexemeFilterAt nodes also have a slice of lexemes representing the subpath of `$`` or `@``, + respectively. + + Non-terminal nodes represent either basic filters (simpler predicates of one or two terminal + nodes) or filter expressions (more complex predicates of basic filters). A filter existence expression + is represented as a terminal node with lexemeFilterAt or (less commonly) root. + + The following examples illustrate the approach. + + The basic filter `@.child > 3` is represented as the following parse tree (where each node is indicated by + its lexeme and `<...>` represents the node's children): + + lexemeFilterGreaterThan + + or, graphically: + + > + / \ + @.child 3 + + The filter expression `@.child > 3 && @.other` is represented as the parse tree: + + lexemeFilterConjunction,lexemeFilterAt> + + or, graphically: + + && + / \ + > @.other + / \ + @.child 3 + + The filter expression `(@.child < 5 || @.child > 10) && @.other == 'x'` is represented as the parse tree: + + lexemeFilterConjunction, + lexemeFilterGreaterThan + >, + lexemeFilterEquality + > + + or, graphically: + + && + / \ + || == + / \ / \ + < > @.other 'x' + / \ / \ + @.child 5 @.child 10 + + Note that brackets do not appear in the parse tree. +*/ +type filterNode struct { + lexeme lexeme + subpath []lexeme // empty unless lexeme is root or lexemeFilterAt + children []*filterNode +} + +func newFilterNode(lexemes []lexeme) *filterNode { + return newParser(lexemes).parse() +} + +func (n *filterNode) isItemFilter() bool { + return n.lexeme.typ == lexemeFilterAt || n.lexeme.typ == lexemeRoot +} + +func (n *filterNode) isLiteral() bool { + return n.isStringLiteral() || n.isBooleanLiteral() || n.isNullLiteral() || n.isNumericLiteral() || n.isRegularExpressionLiteral() +} + +func (n *filterNode) isStringLiteral() bool { + return n.lexeme.typ == lexemeFilterStringLiteral +} + +func (n *filterNode) isBooleanLiteral() bool { + return n.lexeme.typ == lexemeFilterBooleanLiteral +} + +func (n *filterNode) isNullLiteral() bool { + return n.lexeme.typ == lexemeFilterNullLiteral +} + +func (n *filterNode) isNumericLiteral() bool { + return n.lexeme.typ == lexemeFilterFloatLiteral || n.lexeme.typ == lexemeFilterIntegerLiteral +} + +func (n *filterNode) isRegularExpressionLiteral() bool { + return n.lexeme.typ == lexemeFilterRegularExpressionLiteral +} + +// parser holds the state of the filter expression parser. +type parser struct { + input []lexeme // the lexemes being scanned + pos int // current position in the input + stack []*filterNode // parser stack + tree *filterNode // parse tree +} + +// newParser creates a new parser for the input slice of lexemes. +func newParser(input []lexeme) *parser { + l := &parser{ + input: input, + stack: make([]*filterNode, 0), + } + return l +} + +// push pushes a parse tree on the stack. +func (p *parser) push(tree *filterNode) { + p.stack = append(p.stack, tree) +} + +// pop pops a parse tree from the stack, which must be non-empty. +func (p *parser) pop() *filterNode { + index := len(p.stack) - 1 + element := p.stack[index] + p.stack = p.stack[:index] + return element +} + +// nextLexeme returns the next item from the input. +// The caller must peek to ensure there is more input before calling nextLexeme. +func (p *parser) nextLexeme() lexeme { + next := p.input[p.pos] + p.pos++ + return next +} + +// peek returns the next item from the input without consuming the item. +func (p *parser) peek() lexeme { + if p.pos >= len(p.input) { + return lexeme{lexemeEOF, ""} + } + return p.input[p.pos] +} + +func (p *parser) parse() *filterNode { + if p.peek().typ == lexemeEOF { + return nil + } + p.expression() + return p.tree +} + +func (p *parser) expression() { + p.conjunction() + for p.peek().typ == lexemeFilterOr { + p.push(p.tree) + p.or() + } +} + +func (p *parser) or() { + n := p.nextLexeme() + p.conjunction() + p.tree = &filterNode{ + lexeme: n, + subpath: []lexeme{}, + children: []*filterNode{ + p.pop(), + p.tree, + }, + } +} + +func (p *parser) conjunction() { + p.basicFilter() + for p.peek().typ == lexemeFilterAnd { + p.push(p.tree) + p.and() + } +} + +func (p *parser) and() { + n := p.nextLexeme() + p.basicFilter() + p.tree = &filterNode{ + lexeme: n, + subpath: []lexeme{}, + children: []*filterNode{ + p.pop(), + p.tree, + }, + } +} + +// basicFilter consumes then next basic filter and sets it as the parser's tree. If a basic filter it not next, nil is set. +func (p *parser) basicFilter() { + n := p.peek() + switch n.typ { + case lexemeFilterNot: + p.nextLexeme() + p.basicFilter() + p.tree = &filterNode{ + lexeme: n, + subpath: []lexeme{}, + children: []*filterNode{ + p.tree, + }, + } + return + + case lexemeFilterOpenBracket: + p.nextLexeme() + p.expression() + if p.peek().typ == lexemeFilterCloseBracket { + p.nextLexeme() + } + return + } + + p.filterTerm() + n = p.peek() + if n.typ.isComparisonOrMatch() { + p.nextLexeme() + filterTerm := p.tree + p.filterTerm() + p.tree = &filterNode{ + lexeme: n, + subpath: []lexeme{}, + children: []*filterNode{ + filterTerm, + p.tree, + }, + } + } +} + +// filterTerm consumes the next filter term and sets it as the parser's tree. If a filter term is not next, nil is set. +func (p *parser) filterTerm() { + n := p.peek() + switch n.typ { + case lexemeEOF, lexemeError: + p.tree = nil + + case lexemeFilterAt, lexemeRoot: + p.nextLexeme() + subpath := []lexeme{} + filterNestingLevel := 1 + f: + for { + s := p.peek() + switch s.typ { + case lexemeIdentity, lexemeDotChild, lexemeBracketChild, lexemeRecursiveDescent, lexemeArraySubscript: + + case lexemeFilterBegin: + filterNestingLevel++ + + case lexemeFilterEnd: + filterNestingLevel-- + if filterNestingLevel == 0 { + break f + } + + case lexemeEOF: + break f + + default: + // allow any other lexemes only in a nested filter + if filterNestingLevel == 1 { + break f + } + } + subpath = append(subpath, s) + p.nextLexeme() + } + p.tree = &filterNode{ + lexeme: n, + subpath: subpath, + children: []*filterNode{}, + } + + case lexemeFilterIntegerLiteral, lexemeFilterFloatLiteral, lexemeFilterStringLiteral, lexemeFilterBooleanLiteral, + lexemeFilterNullLiteral, lexemeFilterRegularExpressionLiteral: + p.nextLexeme() + p.tree = &filterNode{ + lexeme: n, + subpath: []lexeme{}, + children: []*filterNode{}, + } + } +} diff --git a/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/lexer.go b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/lexer.go new file mode 100644 index 0000000000..67fe197a30 --- /dev/null +++ b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/lexer.go @@ -0,0 +1,1011 @@ +/* + * Copyright 2020 VMware, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package yamlpath + +import ( + "fmt" + "regexp" + "strconv" + "strings" + "unicode" + "unicode/utf8" +) + +// This lexer was based on Rob Pike's talk "Lexical Scanning in Go" (https://talks.golang.org/2011/lex.slide#1) + +type lexemeType int + +const ( + lexemeError lexemeType = iota + lexemeIdentity + lexemeRoot + lexemeDotChild + lexemeUndottedChild + lexemeBracketChild + lexemeRecursiveDescent + lexemeArraySubscript + lexemeFilterBegin + lexemeFilterEnd + lexemeFilterOpenBracket + lexemeFilterCloseBracket + lexemeFilterNot + lexemeFilterAt + lexemeFilterAnd + lexemeFilterOr + lexemeFilterEquality + lexemeFilterInequality + lexemeFilterGreaterThan + lexemeFilterGreaterThanOrEqual + lexemeFilterLessThanOrEqual + lexemeFilterLessThan + lexemeFilterMatchesRegularExpression + lexemeFilterIntegerLiteral + lexemeFilterFloatLiteral + lexemeFilterStringLiteral + lexemeFilterBooleanLiteral + lexemeFilterNullLiteral + lexemeFilterRegularExpressionLiteral + lexemePropertyName + lexemeBracketPropertyName + lexemeArraySubscriptPropertyName + lexemeRecursiveFilterBegin + lexemeEOF // lexing complete +) + +func (t lexemeType) comparator() comparator { + switch t { + case lexemeFilterEquality: + return equal + + case lexemeFilterInequality: + return notEqual + + case lexemeFilterGreaterThan: + return greaterThan + + case lexemeFilterGreaterThanOrEqual: + return greaterThanOrEqual + + case lexemeFilterLessThan: + return lessThan + + case lexemeFilterLessThanOrEqual: + return lessThanOrEqual + + default: + panic(fmt.Sprintf("invalid comparator %d", t)) // should never happen + } +} + +func (t lexemeType) isComparisonOrMatch() bool { + switch t { + case lexemeFilterEquality, lexemeFilterInequality, + lexemeFilterGreaterThan, lexemeFilterGreaterThanOrEqual, + lexemeFilterLessThan, lexemeFilterLessThanOrEqual, + lexemeFilterMatchesRegularExpression: + return true + } + return false +} + +// a lexeme is a token returned from the lexer +type lexeme struct { + typ lexemeType + val string // original lexeme or error message if typ is lexemeError +} + +func (l lexeme) literalValue() typedValue { + switch l.typ { + case lexemeFilterIntegerLiteral: + return typedValue{ + typ: intValueType, + val: l.val, + } + + case lexemeFilterFloatLiteral: + return typedValue{ + typ: floatValueType, + val: l.val, + } + + case lexemeFilterStringLiteral: + return typedValue{ + typ: stringValueType, + val: l.val[1 : len(l.val)-1], + } + + case lexemeFilterBooleanLiteral: + return typedValue{ + typ: booleanValueType, + val: l.val, + } + + case lexemeFilterNullLiteral: + return typedValue{ + typ: nullValueType, + val: l.val, + } + + case lexemeFilterRegularExpressionLiteral: + return typedValue{ + typ: regularExpressionValueType, + val: sanitiseRegularExpressionLiteral(l.val), + } + + default: + return typedValue{ + typ: unknownValueType, + val: l.val, + } + } +} + +func sanitiseRegularExpressionLiteral(re string) string { + return strings.ReplaceAll(re[1:len(re)-1], `\/`, `/`) +} + +func (l lexeme) comparator() comparator { + return l.typ.comparator() +} + +// stateFn represents the state of the lexer as a function that returns the next state. +// A nil stateFn indicates lexing is complete. +type stateFn func(*lexer) stateFn + +// lexer holds the state of the scanner. +type lexer struct { + name string // name of the lexer, used only for error reports + input string // the string being scanned + start int // start position of this item + pos int // current position in the input + width int // width of last rune read from input + state stateFn // lexer state + stack []stateFn // lexer stack + items chan lexeme // channel of scanned lexemes + lastEmittedStart int // start position of last scanned lexeme + lastEmittedLexemeType lexemeType // type of last emitted lexeme (or lexemEOF if no lexeme has been emitted) +} + +// lex creates a new scanner for the input string. +func lex(name, input string) *lexer { + l := &lexer{ + name: name, + input: input, + state: lexPath, + stack: make([]stateFn, 0), + items: make(chan lexeme, 2), + lastEmittedLexemeType: lexemeEOF, + } + return l +} + +// push pushes a state function on the stack which will be resumed when parsing terminates. +func (l *lexer) push(state stateFn) { + l.stack = append(l.stack, state) +} + +// pop pops a state function from the stack. If the stack is empty, returns an error function. +func (l *lexer) pop() stateFn { + if len(l.stack) == 0 { + return l.errorf("syntax error") + } + index := len(l.stack) - 1 + element := l.stack[index] + l.stack = l.stack[:index] + return element +} + +// empty returns true if and onl if the stack of state functions is empty. +func (l *lexer) emptyStack() bool { + return len(l.stack) == 0 +} + +// nextLexeme returns the next item from the input. +func (l *lexer) nextLexeme() lexeme { + for { + select { + case item := <-l.items: + return item + default: + if l.state == nil { + return lexeme{ + typ: lexemeEOF, + } + } + l.state = l.state(l) + } + } +} + +const eof rune = -1 // invalid Unicode code point + +// next returns the next rune in the input. +func (l *lexer) next() (rune rune) { + if l.pos >= len(l.input) { + l.width = 0 + return eof + } + rune, l.width = utf8.DecodeRuneInString(l.input[l.pos:]) + l.pos += l.width + return rune +} + +// consume consumes as many runes as there are in the given string +func (l *lexer) consume(s string) { + for range s { + l.next() + } +} + +// consumed checks the input to see if it starts with the given token and does +// not start with any of the given exceptions. If so, it consumes the given +// token and returns true. Otherwise, it returns false. +func (l *lexer) consumed(token string, except ...string) bool { + if l.hasPrefix(token) { + for _, e := range except { + if l.hasPrefix(e) { + return false + } + } + l.consume(token) + return true + } + return false +} + +// consumedWhitespaces checks the input to see if, after whitespace is removed, it +// starts with the given tokens. If so, it consumes the given +// tokens and any whitespace and returns true. Otherwise, it returns false. +func (l *lexer) consumedWhitespaced(tokens ...string) bool { + pos := l.pos + for _, token := range tokens { + // skip past whitespace + for { + if pos >= len(l.input) { + return false + } + rune, width := utf8.DecodeRuneInString(l.input[pos:]) + if !unicode.IsSpace(rune) { + break + } + pos += width + } + if !strings.HasPrefix(l.input[pos:], token) { + return false + } + pos += len(token) + } + l.pos = pos + return true +} + +// consumeWhitespace consumes any leading whitespace. +func (l *lexer) consumeWhitespace() { + pos := l.pos + for { + if pos >= len(l.input) { + break + } + rune, width := utf8.DecodeRuneInString(l.input[pos:]) + if !unicode.IsSpace(rune) { + break + } + pos += width + } + l.pos = pos +} + +// peek returns the next rune in the input but without consuming it. +// it is equivalent to calling next() followed by backup() +func (l *lexer) peek() (rune rune) { + if l.pos >= len(l.input) { + l.width = 0 + return eof + } + rune, l.width = utf8.DecodeRuneInString(l.input[l.pos:]) + return rune +} + +// peeked checks the input to see if it starts with the given token and does +// not start with any of the given exceptions. If so, it returns true. +// Otherwise, it returns false. +func (l *lexer) peeked(token string, except ...string) bool { + if l.hasPrefix(token) { + for _, e := range except { + if l.hasPrefix(e) { + return false + } + } + return true + } + return false +} + +// peekedWhitespaces checks the input to see if, after whitespace is removed, it +// starts with the given tokens. If so, it returns true. Otherwise, it returns false. +func (l *lexer) peekedWhitespaced(tokens ...string) bool { + pos := l.pos + for _, token := range tokens { + // skip past whitespace + for { + if pos >= len(l.input) { + return false + } + rune, width := utf8.DecodeRuneInString(l.input[pos:]) + if !unicode.IsSpace(rune) { + break + } + pos += width + } + if !strings.HasPrefix(l.input[pos:], token) { + return false + } + pos += len(token) + } + return true +} + +// backup steps back one rune. +// Can be called only once per call of next. +func (l *lexer) backup() { + l.pos -= l.width +} + +// stripWhitespace strips out whitespace +// it should only be called immediately after emitting a lexeme +func (l *lexer) stripWhitespace() { + // find whitespace + for { + nextRune := l.next() + if !unicode.IsSpace(nextRune) { + l.backup() + break + } + } + // strip any whitespace + l.start = l.pos +} + +// emit passes a lexeme back to the client. +func (l *lexer) emit(typ lexemeType) { + l.items <- lexeme{ + typ: typ, + val: l.value(), + } + l.lastEmittedStart = l.start + l.start = l.pos + l.lastEmittedLexemeType = typ +} + +// value returns the portion of the current lexeme scanned so far +func (l *lexer) value() string { + return l.input[l.start:l.pos] +} + +// context returns the last emitted lexeme (if any) followed by the portion +// of the current lexeme scanned so far +func (l *lexer) context() string { + return l.input[l.lastEmittedStart:l.pos] +} + +// emitSynthetic passes a lexeme back to the client which wasn't encountered in the input. +// The lexing position is not modified. +func (l *lexer) emitSynthetic(typ lexemeType, val string) { + l.items <- lexeme{ + typ: typ, + val: val, + } +} + +func (l *lexer) empty() bool { + return l.pos >= len(l.input) +} + +func (l *lexer) hasPrefix(p string) bool { + return strings.HasPrefix(l.input[l.pos:], p) +} + +// errorf returns an error lexeme with context and terminates the scan +func (l *lexer) errorf(format string, args ...interface{}) stateFn { + l.items <- lexeme{ + typ: lexemeError, + val: fmt.Sprintf("%s at position %d, following %q", fmt.Sprintf(format, args...), l.pos, l.context()), + } + return nil +} + +// rawErrorf returns an error lexeme with no context and terminates the scan +func (l *lexer) rawErrorf(format string, args ...interface{}) stateFn { + l.items <- lexeme{ + typ: lexemeError, + val: fmt.Sprintf(format, args...), + } + return nil +} + +const ( + root string = "$" + dot string = "." + leftBracket string = "[" + rightBracket string = "]" + bracketQuote string = "['" + bracketDoubleQuote string = `["` + filterBegin string = "[?(" + filterEnd string = ")]" + filterOpenBracket string = "(" + filterCloseBracket string = ")" + filterNot string = "!" + filterAt string = "@" + filterConjunction string = "&&" + filterDisjunction string = "||" + filterEquality string = "==" + filterInequality string = "!=" + filterMatchesRegularExpression string = "=~" + filterStringLiteralDelimiter string = "'" + filterStringLiteralAlternateDelimiter string = `"` + filterRegularExpressionLiteralDelimiter string = "/" + filterRegularExpressionEscape string = `\` + recursiveDescent string = ".." + propertyName string = "~" +) + +var orderingOperators []orderingOperator + +func init() { + // list the ordering operators in an order suitable for lexing + orderingOperators = []orderingOperator{ + operatorGreaterThanOrEqual, + operatorGreaterThan, + operatorLessThanOrEqual, + operatorLessThan, + } +} + +func lexPath(l *lexer) stateFn { + if l.empty() { + l.emit(lexemeIdentity) + l.emit(lexemeEOF) + return nil + } + if l.hasPrefix(root) { + return lexRoot + } + + // emit implicit root + l.emitSynthetic(lexemeRoot, root) + return lexSubPath +} + +func lexRoot(l *lexer) stateFn { + l.pos += len(root) + l.emit(lexemeRoot) + return lexSubPath +} + +// consumedEscapedString consumes a string with the given string validly escaped using "\" and returns +// true if and only if such a string was consumed. +func consumedEscapedString(l *lexer, quote string) bool { + for { + switch { + case l.peeked(quote): // unescaped quote + return true + case l.consumed(`\` + quote): + case l.consumed(`\\`): + case l.peeked(`\`): + l.errorf("unsupported escape sequence inside %s%s", quote, quote) + return false + default: + if l.next() == eof { + l.errorf("unmatched %s", enquote(quote)) + return false + } + } + } +} + +func lexSubPath(l *lexer) stateFn { + switch { + case l.hasPrefix(")"): + return l.pop() + + case l.empty(): + if !l.emptyStack() { + return l.pop() + } + l.emit(lexemeIdentity) + l.emit(lexemeEOF) + return nil + + case l.consumed(recursiveDescent): + childName := false + for { + le := l.next() + if le == '.' || le == '[' || le == eof { + l.backup() + break + } + childName = true + } + if !childName && !l.peeked(leftBracket, bracketQuote, bracketDoubleQuote) { + return l.errorf("child name or array access or filter missing after recursive descent") + } + l.emit(lexemeRecursiveDescent) + return lexSubPath + + case l.consumed(dot): + childName := false + for { + le := l.next() + if le == '.' || le == '[' || le == ')' || le == ' ' || le == '&' || le == '|' || le == '=' || le == '!' || le == '>' || le == '<' || le == '~' || le == eof { + l.backup() + break + } + childName = true + } + if !childName { + return l.errorf("child name missing") + } + if l.consumed(propertyName) { + if l.peek() != eof { + return l.errorf("property name operator may only be used on last child in path") + } + l.emit(lexemePropertyName) + return lexSubPath + } + + l.emit(lexemeDotChild) + + return lexOptionalArrayIndex + + case l.peekedWhitespaced("[", "'") || l.peekedWhitespaced("[", `"`): // bracketQuote or bracketDoubleQuote + l.consumedWhitespaced("[") + for { + l.consumeWhitespace() + quote := string(l.next()) + + if !consumedEscapedString(l, quote) { + return nil + } + if !l.consumed(quote) { + return l.errorf(`missing %s`, enquote(quote)) + } + if l.consumedWhitespaced(",") { + if !l.peekedWhitespaced("'") && !l.peekedWhitespaced(`"`) { + return l.errorf(`missing %s or %s`, enquote("'"), enquote(`"`)) + } + } else { + break + } + } + if !l.consumedWhitespaced("]") { + return l.errorf(`missing "]" or ","`) + } + if l.consumed(propertyName) { + l.emit(lexemeBracketPropertyName) + if l.peek() != eof { + return l.errorf("property name operator may only be used on last child in path") + } + return lexSubPath + } + + l.emit(lexemeBracketChild) + + return lexOptionalArrayIndex + + case l.consumed(filterBegin): + if l.lastEmittedLexemeType == lexemeRecursiveDescent { + l.emit(lexemeRecursiveFilterBegin) + } else { + l.emit(lexemeFilterBegin) + } + l.push(lexFilterEnd) + return lexFilterExprInitial + + case l.peeked(leftBracket): + return lexOptionalArrayIndex + + case l.lastEmittedLexemeType == lexemeEOF: + childName := false + for { + le := l.next() + if le == '.' || le == '[' || le == ']' || le == ')' || le == ' ' || le == '&' || le == '|' || le == '=' || le == '!' || le == '>' || le == '<' || le == '~' || le == eof { + l.backup() + break + } + childName = true + } + if !childName { + return l.errorf("child name missing") + } + if l.consumed(propertyName) { + if l.peek() != eof { + return l.errorf("property name operator may only be used on last child in path") + } + l.emit(lexemePropertyName) + return lexSubPath + } + l.emit(lexemeUndottedChild) + + return lexOptionalArrayIndex + + default: + return l.errorf("invalid path syntax") + } +} + +func lexOptionalArrayIndex(l *lexer) stateFn { + if l.consumed(leftBracket, bracketQuote, bracketDoubleQuote, filterBegin) { + subscript := false + for { + if l.consumed(rightBracket) { + break + } + if l.next() == eof { + return l.errorf("unmatched %s", leftBracket) + } + subscript = true + } + if !subscript { + return l.rawErrorf("subscript missing from %s%s before position %d", leftBracket, rightBracket, l.pos) + } + if !validateArrayIndex(l) { + return nil + } + if l.consumed(propertyName) { + if l.peek() != eof { + return l.errorf("property name operator can only be used on last item in path") + } + subscript := l.value() + index := strings.TrimSuffix(strings.TrimPrefix(subscript, leftBracket), rightBracket+propertyName) + if index != "*" { + return l.errorf("property name operator can only be used on map nodes") + } + l.emit(lexemeArraySubscriptPropertyName) + return lexSubPath + + } + l.emit(lexemeArraySubscript) + } + + le := l.peek() + if le == ' ' || le == '&' || le == '|' || le == '=' || le == '!' || le == '>' || le == '<' { + if l.emptyStack() { + return l.errorf("invalid character %q", l.peek()) + } + return l.pop() + } + + return lexSubPath +} + +func enquote(quote string) string { + switch quote { + case "'": + return `"'"` + + case `"`: + return `'"'` + + default: + panic(fmt.Sprintf(`enquote called with incorrect argument %q`, quote)) + } +} + +func lexFilterExprInitial(l *lexer) stateFn { + l.stripWhitespace() + + if nextState, present := lexNumericLiteral(l, lexFilterExpr); present { + return nextState + } + + if nextState, present := lexStringLiteral(l, lexFilterExpr); present { + return nextState + } + + if nextState, present := lexBooleanLiteral(l, lexFilterExpr); present { + return nextState + } + + if nextState, present := lexNullLiteral(l, lexFilterExpr); present { + return nextState + } + + switch { + case l.consumed(filterOpenBracket): + l.emit(lexemeFilterOpenBracket) + l.push(lexFilterExpr) + return lexFilterExprInitial + + case l.hasPrefix(filterInequality): + return l.errorf("missing first operand for binary operator !=") + + case l.consumed(filterNot): + l.emit(lexemeFilterNot) + return lexFilterExprInitial + + case l.consumed(filterAt): + l.emit(lexemeFilterAt) + if l.peekedWhitespaced("=") || l.peekedWhitespaced("!") || l.peekedWhitespaced(">") || l.peekedWhitespaced("<") { + return lexFilterExpr + } + l.push(lexFilterExpr) + return lexSubPath + + case l.consumed(root): + l.emit(lexemeRoot) + l.push(lexFilterExpr) + return lexSubPath + + case l.hasPrefix(filterConjunction): + return l.errorf("missing first operand for binary operator &&") + + case l.hasPrefix(filterDisjunction): + return l.errorf("missing first operand for binary operator ||") + + case l.hasPrefix(filterEquality): + return l.errorf("missing first operand for binary operator ==") + } + + for _, o := range orderingOperators { + if l.hasPrefix(o.String()) { + return l.errorf("missing first operand for binary operator %s", o) + } + } + + return l.pop() +} + +func lexFilterExpr(l *lexer) stateFn { + l.stripWhitespace() + + switch { + case l.empty(): + return l.errorf("missing end of filter") + + case l.hasPrefix(filterEnd): // this will be consumed by the popped state function + return l.pop() + + case l.consumed(filterCloseBracket): + l.emit(lexemeFilterCloseBracket) + return l.pop() + + case l.consumed(filterConjunction): + l.emit(lexemeFilterAnd) + l.stripWhitespace() + return lexFilterExprInitial + + case l.consumed(filterDisjunction): + l.emit(lexemeFilterOr) + l.stripWhitespace() + return lexFilterExprInitial + + case l.consumed(filterEquality): + l.emit(lexemeFilterEquality) + l.push(lexFilterExpr) + return lexFilterTerm + + case l.consumed(filterInequality): + l.emit(lexemeFilterInequality) + l.push(lexFilterExpr) + return lexFilterTerm + + case l.hasPrefix(filterMatchesRegularExpression): + switch l.lastEmittedLexemeType { + case lexemeFilterStringLiteral, lexemeFilterIntegerLiteral, lexemeFilterFloatLiteral: + return l.errorf("literal cannot be matched using %s", filterMatchesRegularExpression) + } + l.consume(filterMatchesRegularExpression) + l.emit(lexemeFilterMatchesRegularExpression) + + l.stripWhitespace() + return lexRegularExpressionLiteral(l, lexFilterExpr) + } + + for _, o := range orderingOperators { + if l.hasPrefix(o.String()) { + return lexComparison(l, o) + } + } + + return l.errorf("invalid filter expression") +} + +func lexFilterTerm(l *lexer) stateFn { + l.stripWhitespace() + + if l.consumed(filterAt) { + l.emit(lexemeFilterAt) + + if l.peekedWhitespaced("|") || l.peekedWhitespaced("&") || l.peekedWhitespaced(")") { + if l.emptyStack() { + return l.errorf("invalid character %q", l.peek()) + } + return l.pop() + } + return lexSubPath + } + + if l.consumed(root) { + l.emit(lexemeRoot) + return lexSubPath + } + + if nextState, present := lexNumericLiteral(l, lexFilterExpr); present { + return nextState + } + + if nextState, present := lexStringLiteral(l, lexFilterExpr); present { + return nextState + } + + if nextState, present := lexBooleanLiteral(l, lexFilterExpr); present { + return nextState + } + + if nextState, present := lexNullLiteral(l, lexFilterExpr); present { + return nextState + } + + return l.errorf("invalid filter term") +} + +func lexFilterEnd(l *lexer) stateFn { + if l.hasPrefix(filterEnd) { + if l.lastEmittedLexemeType == lexemeFilterBegin { + return l.errorf("missing filter") + } + l.consume(filterEnd) + l.emit(lexemeFilterEnd) + return lexSubPath + } + + return l.errorf("invalid filter syntax") +} + +func validateArrayIndex(l *lexer) bool { + subscript := l.value() + index := strings.TrimSuffix(strings.TrimPrefix(subscript, leftBracket), rightBracket) + if _, err := slice(index, 0); err != nil { + l.rawErrorf("invalid array index %s before position %d: %s", subscript, l.pos, err) + return false + } + return true +} + +func lexNumericLiteral(l *lexer, nextState stateFn) (stateFn, bool) { + n := l.peek() + if n == '.' || n == '-' || (n >= '0' && n <= '9') { + float := n == '.' + for { + l.next() + n := l.peek() + if n == '.' || n == 'e' || n == 'E' || n == '-' { + float = true + continue + } + if !(n >= '0' && n <= '9') { + break + } + } + + if float { + // validate float + if _, err := strconv.ParseFloat(l.value(), 64); err != nil { + err := err.(*strconv.NumError) + return l.rawErrorf("invalid float literal %q: %s before position %d", err.Num, err, l.pos), true + } + l.emit(lexemeFilterFloatLiteral) + return lexFilterExpr, true + } + // validate integer + if _, err := strconv.Atoi(l.value()); err != nil { + err := err.(*strconv.NumError) + return l.rawErrorf("invalid integer literal %q: %s before position %d", err.Num, err, l.pos), true + } + l.emit(lexemeFilterIntegerLiteral) + return lexFilterExpr, true + } + return nil, false +} + +func lexStringLiteral(l *lexer, nextState stateFn) (stateFn, bool) { + var quote string + if l.hasPrefix(filterStringLiteralDelimiter) { + quote = filterStringLiteralDelimiter + } else if l.hasPrefix(filterStringLiteralAlternateDelimiter) { + quote = filterStringLiteralAlternateDelimiter + } + if quote != "" { + pos := l.pos + context := l.context() + for { + if l.next() == eof { + return l.rawErrorf(`unmatched string delimiter %s at position %d, following %q`, quote, pos, context), true + } + if l.hasPrefix(quote) { + break + } + } + l.next() + l.emit(lexemeFilterStringLiteral) + + return nextState, true + } + return nil, false +} + +func lexBooleanLiteral(l *lexer, nextState stateFn) (stateFn, bool) { + if l.consumedWhitespaced("true") || l.consumedWhitespaced("false") { + l.emit(lexemeFilterBooleanLiteral) + return nextState, true + } + return nil, false +} + +func lexNullLiteral(l *lexer, nextState stateFn) (stateFn, bool) { + if l.consumedWhitespaced("null") { + l.emit(lexemeFilterNullLiteral) + return nextState, true + } + return nil, false +} + +var comparisonOperatorLexeme map[orderingOperator]lexemeType + +func init() { + comparisonOperatorLexeme = map[orderingOperator]lexemeType{ + operatorGreaterThan: lexemeFilterGreaterThan, + operatorGreaterThanOrEqual: lexemeFilterGreaterThanOrEqual, + operatorLessThan: lexemeFilterLessThan, + operatorLessThanOrEqual: lexemeFilterLessThanOrEqual, + } +} + +func lexComparison(l *lexer, comparisonOperator orderingOperator) stateFn { + if l.lastEmittedLexemeType == lexemeFilterStringLiteral { + return l.errorf("strings cannot be compared using %s", comparisonOperator) + } + l.consume(comparisonOperator.String()) + l.emit(comparisonOperatorLexeme[comparisonOperator]) + + l.stripWhitespace() + if l.hasPrefix(filterStringLiteralDelimiter) { + return l.errorf("strings cannot be compared using %s", comparisonOperator) + } + + l.push(lexFilterExpr) + return lexFilterTerm +} + +func lexRegularExpressionLiteral(l *lexer, nextState stateFn) stateFn { + if !l.hasPrefix(filterRegularExpressionLiteralDelimiter) { + return l.errorf("regular expression does not start with %s", filterRegularExpressionLiteralDelimiter) + } + pos := l.pos + context := l.context() + escape := false + for { + if l.next() == eof { + return l.rawErrorf(`unmatched regular expression delimiter %s at position %d, following %q`, filterRegularExpressionLiteralDelimiter, pos, context) + } + if !escape && l.hasPrefix(filterRegularExpressionLiteralDelimiter) { + break + } + if !escape && l.hasPrefix(filterRegularExpressionEscape) { + escape = true + } else { + escape = false + } + } + l.next() + if _, err := regexp.Compile(sanitiseRegularExpressionLiteral(l.value())); err != nil { + return l.rawErrorf(`invalid regular expression at position %d, following %q: %s`, pos, context, err) + } + l.emit(lexemeFilterRegularExpressionLiteral) + + return nextState +} diff --git a/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/path.go b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/path.go new file mode 100644 index 0000000000..fb0fd0219a --- /dev/null +++ b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/path.go @@ -0,0 +1,463 @@ +/* + * Copyright 2020 VMware, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package yamlpath + +import ( + "errors" + "strings" + "unicode/utf8" + + "github.com/dprotaso/go-yit" + "gopkg.in/yaml.v3" +) + +// Path is a compiled YAML path expression. +type Path struct { + f func(node, root *yaml.Node) yit.Iterator +} + +// Find applies the Path to a YAML node and returns the addresses of the subnodes which match the Path. +func (p *Path) Find(node *yaml.Node) ([]*yaml.Node, error) { + return p.find(node, node), nil // currently, errors are not possible +} + +func (p *Path) find(node, root *yaml.Node) []*yaml.Node { + return p.f(node, root).ToArray() +} + +// NewPath constructs a Path from a string expression. +func NewPath(path string) (*Path, error) { + return newPath(lex("Path lexer", path)) +} + +func newPath(l *lexer) (*Path, error) { + lx := l.nextLexeme() + + switch lx.typ { + + case lexemeError: + return nil, errors.New(lx.val) + + case lexemeIdentity, lexemeEOF: + return new(identity), nil + + case lexemeRoot: + subPath, err := newPath(l) + if err != nil { + return nil, err + } + return new(func(node, root *yaml.Node) yit.Iterator { + if node.Kind == yaml.DocumentNode { + node = node.Content[0] + } + return compose(yit.FromNode(node), subPath, root) + }), nil + + case lexemeRecursiveDescent: + subPath, err := newPath(l) + if err != nil { + return nil, err + } + childName := strings.TrimPrefix(lx.val, "..") + switch childName { + case "*": + // includes all nodes, not just mapping nodes + return new(func(node, root *yaml.Node) yit.Iterator { + return compose(yit.FromNode(node).RecurseNodes(), allChildrenThen(subPath), root) + }), nil + + case "": + return new(func(node, root *yaml.Node) yit.Iterator { + return compose(yit.FromNode(node).RecurseNodes(), subPath, root) + }), nil + + default: + return new(func(node, root *yaml.Node) yit.Iterator { + return compose(yit.FromNode(node).RecurseNodes(), childThen(childName, subPath), root) + }), nil + } + + case lexemeDotChild: + subPath, err := newPath(l) + if err != nil { + return nil, err + } + childName := strings.TrimPrefix(lx.val, ".") + + return childThen(childName, subPath), nil + + case lexemeUndottedChild: + subPath, err := newPath(l) + if err != nil { + return nil, err + } + + return childThen(lx.val, subPath), nil + + case lexemeBracketChild: + subPath, err := newPath(l) + if err != nil { + return nil, err + } + childNames := strings.TrimSpace(lx.val) + childNames = strings.TrimSuffix(strings.TrimPrefix(childNames, "["), "]") + childNames = strings.TrimSpace(childNames) + return bracketChildThen(childNames, subPath), nil + + case lexemeArraySubscript: + subPath, err := newPath(l) + if err != nil { + return nil, err + } + subscript := strings.TrimSuffix(strings.TrimPrefix(lx.val, "["), "]") + return arraySubscriptThen(subscript, subPath), nil + + case lexemeFilterBegin, lexemeRecursiveFilterBegin: + var recursive bool + + if lx.typ == lexemeRecursiveFilterBegin { + recursive = true + } + filterLexemes := []lexeme{} + filterNestingLevel := 1 + f: + for { + lx := l.nextLexeme() + switch lx.typ { + case lexemeFilterBegin: + filterNestingLevel++ + case lexemeFilterEnd: + filterNestingLevel-- + if filterNestingLevel == 0 { + break f + } + case lexemeError: + return nil, errors.New(lx.val) + + case lexemeEOF: + // should never happen as lexer should have detected an error + return nil, errors.New("missing end of filter") + } + filterLexemes = append(filterLexemes, lx) + } + + subPath, err := newPath(l) + if err != nil { + return nil, err + } + if recursive { + return recursiveFilterThen(filterLexemes, subPath), nil + } + return filterThen(filterLexemes, subPath), nil + case lexemePropertyName: + subPath, err := newPath(l) + if err != nil { + return nil, err + } + childName := strings.TrimPrefix(lx.val, ".") + childName = strings.TrimSuffix(childName, propertyName) + return propertyNameChildThen(childName, subPath), nil + case lexemeBracketPropertyName: + subPath, err := newPath(l) + if err != nil { + return nil, err + } + childNames := strings.TrimSpace(lx.val) + childNames = strings.TrimSuffix(childNames, propertyName) + childNames = strings.TrimSuffix(strings.TrimPrefix(childNames, "["), "]") + childNames = strings.TrimSpace(childNames) + return propertyNameBracketChildThen(childNames, subPath), nil + case lexemeArraySubscriptPropertyName: + subPath, err := newPath(l) + if err != nil { + return nil, err + } + subscript := strings.TrimSuffix(strings.TrimPrefix(lx.val, "["), "]~") + return propertyNameArraySubscriptThen(subscript, subPath), nil + } + + return nil, errors.New("invalid path syntax") +} + +func identity(node, root *yaml.Node) yit.Iterator { + if node.Kind == 0 { + return yit.FromNodes() + } + return yit.FromNode(node) +} + +func empty(node, root *yaml.Node) yit.Iterator { + return yit.FromNodes() +} + +func compose(i yit.Iterator, p *Path, root *yaml.Node) yit.Iterator { + its := []yit.Iterator{} + for a, ok := i(); ok; a, ok = i() { + its = append(its, p.f(a, root)) + } + return yit.FromIterators(its...) +} + +func new(f func(node, root *yaml.Node) yit.Iterator) *Path { + return &Path{f: f} +} + +func propertyNameChildThen(childName string, p *Path) *Path { + childName = unescape(childName) + + return new(func(node, root *yaml.Node) yit.Iterator { + if node.Kind != yaml.MappingNode { + return empty(node, root) + } + for i, n := range node.Content { + if i%2 == 0 && n.Value == childName { + return compose(yit.FromNode(node.Content[i]), p, root) + } + } + return empty(node, root) + }) +} + +func propertyNameBracketChildThen(childNames string, p *Path) *Path { + unquotedChildren := bracketChildNames(childNames) + + return new(func(node, root *yaml.Node) yit.Iterator { + if node.Kind != yaml.MappingNode { + return empty(node, root) + } + its := []yit.Iterator{} + for _, childName := range unquotedChildren { + for i, n := range node.Content { + if i%2 == 0 && n.Value == childName { + its = append(its, yit.FromNode(node.Content[i])) + } + } + } + return compose(yit.FromIterators(its...), p, root) + }) +} + +func propertyNameArraySubscriptThen(subscript string, p *Path) *Path { + return new(func(node, root *yaml.Node) yit.Iterator { + if node.Kind == yaml.MappingNode && subscript == "*" { + its := []yit.Iterator{} + for i, n := range node.Content { + if i%2 != 0 { + continue // skip child values + } + its = append(its, compose(yit.FromNode(n), p, root)) + } + return yit.FromIterators(its...) + } + return empty(node, root) + }) +} + +func childThen(childName string, p *Path) *Path { + if childName == "*" { + return allChildrenThen(p) + } + childName = unescape(childName) + + return new(func(node, root *yaml.Node) yit.Iterator { + if node.Kind != yaml.MappingNode { + return empty(node, root) + } + for i, n := range node.Content { + if i%2 == 0 && n.Value == childName { + return compose(yit.FromNode(node.Content[i+1]), p, root) + } + } + return empty(node, root) + }) +} + +func bracketChildNames(childNames string) []string { + s := strings.Split(childNames, ",") + // reconstitute child names with embedded commas + children := []string{} + accum := "" + for _, c := range s { + if balanced(c, '\'') && balanced(c, '"') { + if accum != "" { + accum += "," + c + } else { + children = append(children, c) + accum = "" + } + } else { + if accum == "" { + accum = c + } else { + accum += "," + c + children = append(children, accum) + accum = "" + } + } + } + if accum != "" { + children = append(children, accum) + } + + unquotedChildren := []string{} + for _, c := range children { + c = strings.TrimSpace(c) + if strings.HasPrefix(c, "'") { + c = strings.TrimSuffix(strings.TrimPrefix(c, "'"), "'") + } else { + c = strings.TrimSuffix(strings.TrimPrefix(c, `"`), `"`) + } + c = unescape(c) + unquotedChildren = append(unquotedChildren, c) + } + return unquotedChildren +} + +func balanced(c string, q rune) bool { + bal := true + prev := eof + for i := 0; i < len(c); { + rune, width := utf8.DecodeRuneInString(c[i:]) + i += width + if rune == q { + if i > 0 && prev == '\\' { + prev = rune + continue + } + bal = !bal + } + prev = rune + } + return bal +} + +func bracketChildThen(childNames string, p *Path) *Path { + unquotedChildren := bracketChildNames(childNames) + + return new(func(node, root *yaml.Node) yit.Iterator { + if node.Kind != yaml.MappingNode { + return empty(node, root) + } + its := []yit.Iterator{} + for _, childName := range unquotedChildren { + for i, n := range node.Content { + if i%2 == 0 && n.Value == childName { + its = append(its, yit.FromNode(node.Content[i+1])) + } + } + } + return compose(yit.FromIterators(its...), p, root) + }) +} + +func unescape(raw string) string { + esc := "" + escaped := false + for i := 0; i < len(raw); { + rune, width := utf8.DecodeRuneInString(raw[i:]) + i += width + if rune == '\\' { + if escaped { + esc += string(rune) + } + escaped = !escaped + continue + } + escaped = false + esc += string(rune) + } + + return esc +} + +func allChildrenThen(p *Path) *Path { + return new(func(node, root *yaml.Node) yit.Iterator { + switch node.Kind { + case yaml.MappingNode: + its := []yit.Iterator{} + for i, n := range node.Content { + if i%2 == 0 { + continue // skip child names + } + its = append(its, compose(yit.FromNode(n), p, root)) + } + return yit.FromIterators(its...) + + case yaml.SequenceNode: + its := []yit.Iterator{} + for i := 0; i < len(node.Content); i++ { + its = append(its, compose(yit.FromNode(node.Content[i]), p, root)) + } + return yit.FromIterators(its...) + + default: + return empty(node, root) + } + }) +} + +func arraySubscriptThen(subscript string, p *Path) *Path { + return new(func(node, root *yaml.Node) yit.Iterator { + if node.Kind == yaml.MappingNode && subscript == "*" { + its := []yit.Iterator{} + for i, n := range node.Content { + if i%2 == 0 { + continue // skip child names + } + its = append(its, compose(yit.FromNode(n), p, root)) + } + return yit.FromIterators(its...) + } + if node.Kind != yaml.SequenceNode { + return empty(node, root) + } + + slice, err := slice(subscript, len(node.Content)) + if err != nil { + panic(err) // should not happen, lexer should have detected errors + } + + its := []yit.Iterator{} + for _, s := range slice { + if s >= 0 && s < len(node.Content) { + its = append(its, compose(yit.FromNode(node.Content[s]), p, root)) + } + } + return yit.FromIterators(its...) + }) +} + +func filterThen(filterLexemes []lexeme, p *Path) *Path { + filter := newFilter(newFilterNode(filterLexemes)) + return new(func(node, root *yaml.Node) yit.Iterator { + its := []yit.Iterator{} + if node.Kind == yaml.SequenceNode { + for _, c := range node.Content { + if filter(c, root) { + its = append(its, compose(yit.FromNode(c), p, root)) + } + } + } else { + if filter(node, root) { + its = append(its, compose(yit.FromNode(node), p, root)) + } + } + return yit.FromIterators(its...) + }) +} + +func recursiveFilterThen(filterLexemes []lexeme, p *Path) *Path { + filter := newFilter(newFilterNode(filterLexemes)) + return new(func(node, root *yaml.Node) yit.Iterator { + its := []yit.Iterator{} + + if filter(node, root) { + its = append(its, compose(yit.FromNode(node), p, root)) + } + return yit.FromIterators(its...) + }) +} diff --git a/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/slicer.go b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/slicer.go new file mode 100644 index 0000000000..da66989b3a --- /dev/null +++ b/vendor/github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath/slicer.go @@ -0,0 +1,143 @@ +/* + * Copyright 2020 VMware, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package yamlpath + +import ( + "errors" + "fmt" + "strconv" + "strings" +) + +func slice(index string, length int) ([]int, error) { + if union := strings.Split(index, ","); len(union) > 1 { + combination := []int{} + for i, idx := range union { + sl, err := slice(idx, length) + if err != nil { + return nil, fmt.Errorf("error in union member %d: %s", i, err) + } + combination = append(combination, sl...) + } + return combination, nil + } + + index = strings.TrimSpace(index) + + if index == "*" { + return indices(0, length, 1, length), nil + } + + subscr := strings.Split(index, ":") + if len(subscr) > 3 { + return nil, errors.New("malformed array index, too many colons") + } + type subscript struct { + present bool + value int + } + var subscripts []subscript = []subscript{{false, 0}, {false, 0}, {false, 0}} + const ( + sFrom = iota + sTo + sStep + ) + for i, s := range subscr { + s = strings.TrimSpace(s) + if s != "" { + n, err := strconv.Atoi(s) + if err != nil { + return nil, errors.New("non-integer array index") + } + subscripts[i] = subscript{ + present: true, + value: n, + } + } + } + + // pick out the case of a single subscript first since the "to" value needs special-casing + if len(subscr) == 1 { + if !subscripts[sFrom].present { + return nil, errors.New("array index missing") + } + from := subscripts[sFrom].value + if from < 0 { + from += length + } + return indices(from, from+1, 1, length), nil + } + + var from, to, step int + + if subscripts[sStep].present { + step = subscripts[sStep].value + if step == 0 { + return nil, errors.New("array index step value must be non-zero") + } + } else { + step = 1 + } + + if subscripts[sFrom].present { + from = subscripts[sFrom].value + if from < 0 { + from += length + } + } else { + if step > 0 { + from = 0 + } else { + from = length - 1 + } + } + + if subscripts[sTo].present { + to = subscripts[sTo].value + if to < 0 { + to += length + } + } else { + if step > 0 { + to = length + } else { + to = -1 + } + } + + return indices(from, to, step, length), nil +} + +func indices(from, to, step, length int) []int { + slice := []int{} + if step > 0 { + if from < 0 { + from = 0 // avoid CPU attack + } + if to > length { + to = length // avoid CPU attack + } + for i := from; i < to; i += step { + if 0 <= i && i < length { + slice = append(slice, i) + } + } + } else if step < 0 { + if from > length { + from = length // avoid CPU attack + } + if to < -1 { + to = -1 // avoid CPU attack + } + for i := from; i > to; i += step { + if 0 <= i && i < length { + slice = append(slice, i) + } + } + } + return slice +} diff --git a/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go b/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go new file mode 100644 index 0000000000..150f887e7a --- /dev/null +++ b/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go @@ -0,0 +1,78 @@ +// Copyright 2018 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 lazyregexp is a thin wrapper over regexp, allowing the use of global +// regexp variables without forcing them to be compiled at init. +package lazyregexp + +import ( + "os" + "regexp" + "strings" + "sync" +) + +// Regexp is a wrapper around [regexp.Regexp], where the underlying regexp will be +// compiled the first time it is needed. +type Regexp struct { + str string + once sync.Once + rx *regexp.Regexp +} + +func (r *Regexp) re() *regexp.Regexp { + r.once.Do(r.build) + return r.rx +} + +func (r *Regexp) build() { + r.rx = regexp.MustCompile(r.str) + r.str = "" +} + +func (r *Regexp) FindSubmatch(s []byte) [][]byte { + return r.re().FindSubmatch(s) +} + +func (r *Regexp) FindStringSubmatch(s string) []string { + return r.re().FindStringSubmatch(s) +} + +func (r *Regexp) FindStringSubmatchIndex(s string) []int { + return r.re().FindStringSubmatchIndex(s) +} + +func (r *Regexp) ReplaceAllString(src, repl string) string { + return r.re().ReplaceAllString(src, repl) +} + +func (r *Regexp) FindString(s string) string { + return r.re().FindString(s) +} + +func (r *Regexp) FindAllString(s string, n int) []string { + return r.re().FindAllString(s, n) +} + +func (r *Regexp) MatchString(s string) bool { + return r.re().MatchString(s) +} + +func (r *Regexp) SubexpNames() []string { + return r.re().SubexpNames() +} + +var inTest = len(os.Args) > 0 && strings.HasSuffix(strings.TrimSuffix(os.Args[0], ".exe"), ".test") + +// New creates a new lazy regexp, delaying the compiling work until it is first +// needed. If the code is being run as part of tests, the regexp compiling will +// happen immediately. +func New(str string) *Regexp { + lr := &Regexp{str: str} + if inTest { + // In tests, always compile the regexps early. + lr.re() + } + return lr +} diff --git a/vendor/golang.org/x/mod/modfile/print.go b/vendor/golang.org/x/mod/modfile/print.go new file mode 100644 index 0000000000..2a0123d4b9 --- /dev/null +++ b/vendor/golang.org/x/mod/modfile/print.go @@ -0,0 +1,184 @@ +// Copyright 2018 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. + +// Module file printer. + +package modfile + +import ( + "bytes" + "fmt" + "strings" +) + +// Format returns a go.mod file as a byte slice, formatted in standard style. +func Format(f *FileSyntax) []byte { + pr := &printer{} + pr.file(f) + + // remove trailing blank lines + b := pr.Bytes() + for len(b) > 0 && b[len(b)-1] == '\n' && (len(b) == 1 || b[len(b)-2] == '\n') { + b = b[:len(b)-1] + } + return b +} + +// A printer collects the state during printing of a file or expression. +type printer struct { + bytes.Buffer // output buffer + comment []Comment // pending end-of-line comments + margin int // left margin (indent), a number of tabs +} + +// printf prints to the buffer. +func (p *printer) printf(format string, args ...interface{}) { + fmt.Fprintf(p, format, args...) +} + +// indent returns the position on the current line, in bytes, 0-indexed. +func (p *printer) indent() int { + b := p.Bytes() + n := 0 + for n < len(b) && b[len(b)-1-n] != '\n' { + n++ + } + return n +} + +// newline ends the current line, flushing end-of-line comments. +func (p *printer) newline() { + if len(p.comment) > 0 { + p.printf(" ") + for i, com := range p.comment { + if i > 0 { + p.trim() + p.printf("\n") + for i := 0; i < p.margin; i++ { + p.printf("\t") + } + } + p.printf("%s", strings.TrimSpace(com.Token)) + } + p.comment = p.comment[:0] + } + + p.trim() + if b := p.Bytes(); len(b) == 0 || (len(b) >= 2 && b[len(b)-1] == '\n' && b[len(b)-2] == '\n') { + // skip the blank line at top of file or after a blank line + } else { + p.printf("\n") + } + for i := 0; i < p.margin; i++ { + p.printf("\t") + } +} + +// trim removes trailing spaces and tabs from the current line. +func (p *printer) trim() { + // Remove trailing spaces and tabs from line we're about to end. + b := p.Bytes() + n := len(b) + for n > 0 && (b[n-1] == '\t' || b[n-1] == ' ') { + n-- + } + p.Truncate(n) +} + +// file formats the given file into the print buffer. +func (p *printer) file(f *FileSyntax) { + for _, com := range f.Before { + p.printf("%s", strings.TrimSpace(com.Token)) + p.newline() + } + + for i, stmt := range f.Stmt { + switch x := stmt.(type) { + case *CommentBlock: + // comments already handled + p.expr(x) + + default: + p.expr(x) + p.newline() + } + + for _, com := range stmt.Comment().After { + p.printf("%s", strings.TrimSpace(com.Token)) + p.newline() + } + + if i+1 < len(f.Stmt) { + p.newline() + } + } +} + +func (p *printer) expr(x Expr) { + // Emit line-comments preceding this expression. + if before := x.Comment().Before; len(before) > 0 { + // Want to print a line comment. + // Line comments must be at the current margin. + p.trim() + if p.indent() > 0 { + // There's other text on the line. Start a new line. + p.printf("\n") + } + // Re-indent to margin. + for i := 0; i < p.margin; i++ { + p.printf("\t") + } + for _, com := range before { + p.printf("%s", strings.TrimSpace(com.Token)) + p.newline() + } + } + + switch x := x.(type) { + default: + panic(fmt.Errorf("printer: unexpected type %T", x)) + + case *CommentBlock: + // done + + case *LParen: + p.printf("(") + case *RParen: + p.printf(")") + + case *Line: + p.tokens(x.Token) + + case *LineBlock: + p.tokens(x.Token) + p.printf(" ") + p.expr(&x.LParen) + p.margin++ + for _, l := range x.Line { + p.newline() + p.expr(l) + } + p.margin-- + p.newline() + p.expr(&x.RParen) + } + + // Queue end-of-line comments for printing when we + // reach the end of the line. + p.comment = append(p.comment, x.Comment().Suffix...) +} + +func (p *printer) tokens(tokens []string) { + sep := "" + for _, t := range tokens { + if t == "," || t == ")" || t == "]" || t == "}" { + sep = "" + } + p.printf("%s%s", sep, t) + sep = " " + if t == "(" || t == "[" || t == "{" { + sep = "" + } + } +} diff --git a/vendor/golang.org/x/mod/modfile/read.go b/vendor/golang.org/x/mod/modfile/read.go new file mode 100644 index 0000000000..2d7486804f --- /dev/null +++ b/vendor/golang.org/x/mod/modfile/read.go @@ -0,0 +1,964 @@ +// Copyright 2018 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 modfile + +import ( + "bytes" + "errors" + "fmt" + "os" + "strconv" + "strings" + "unicode" + "unicode/utf8" +) + +// A Position describes an arbitrary source position in a file, including the +// file, line, column, and byte offset. +type Position struct { + Line int // line in input (starting at 1) + LineRune int // rune in line (starting at 1) + Byte int // byte in input (starting at 0) +} + +// add returns the position at the end of s, assuming it starts at p. +func (p Position) add(s string) Position { + p.Byte += len(s) + if n := strings.Count(s, "\n"); n > 0 { + p.Line += n + s = s[strings.LastIndex(s, "\n")+1:] + p.LineRune = 1 + } + p.LineRune += utf8.RuneCountInString(s) + return p +} + +// An Expr represents an input element. +type Expr interface { + // Span returns the start and end position of the expression, + // excluding leading or trailing comments. + Span() (start, end Position) + + // Comment returns the comments attached to the expression. + // This method would normally be named 'Comments' but that + // would interfere with embedding a type of the same name. + Comment() *Comments +} + +// A Comment represents a single // comment. +type Comment struct { + Start Position + Token string // without trailing newline + Suffix bool // an end of line (not whole line) comment +} + +// Comments collects the comments associated with an expression. +type Comments struct { + Before []Comment // whole-line comments before this expression + Suffix []Comment // end-of-line comments after this expression + + // For top-level expressions only, After lists whole-line + // comments following the expression. + After []Comment +} + +// Comment returns the receiver. This isn't useful by itself, but +// a [Comments] struct is embedded into all the expression +// implementation types, and this gives each of those a Comment +// method to satisfy the Expr interface. +func (c *Comments) Comment() *Comments { + return c +} + +// A FileSyntax represents an entire go.mod file. +type FileSyntax struct { + Name string // file path + Comments + Stmt []Expr +} + +func (x *FileSyntax) Span() (start, end Position) { + if len(x.Stmt) == 0 { + return + } + start, _ = x.Stmt[0].Span() + _, end = x.Stmt[len(x.Stmt)-1].Span() + return start, end +} + +// addLine adds a line containing the given tokens to the file. +// +// If the first token of the hint matches the first token of the +// line, the new line is added at the end of the block containing hint, +// extracting hint into a new block if it is not yet in one. +// +// If the hint is non-nil buts its first token does not match, +// the new line is added after the block containing hint +// (or hint itself, if not in a block). +// +// If no hint is provided, addLine appends the line to the end of +// the last block with a matching first token, +// or to the end of the file if no such block exists. +func (x *FileSyntax) addLine(hint Expr, tokens ...string) *Line { + if hint == nil { + // If no hint given, add to the last statement of the given type. + Loop: + for i := len(x.Stmt) - 1; i >= 0; i-- { + stmt := x.Stmt[i] + switch stmt := stmt.(type) { + case *Line: + if stmt.Token != nil && stmt.Token[0] == tokens[0] { + hint = stmt + break Loop + } + case *LineBlock: + if stmt.Token[0] == tokens[0] { + hint = stmt + break Loop + } + } + } + } + + newLineAfter := func(i int) *Line { + new := &Line{Token: tokens} + if i == len(x.Stmt) { + x.Stmt = append(x.Stmt, new) + } else { + x.Stmt = append(x.Stmt, nil) + copy(x.Stmt[i+2:], x.Stmt[i+1:]) + x.Stmt[i+1] = new + } + return new + } + + if hint != nil { + for i, stmt := range x.Stmt { + switch stmt := stmt.(type) { + case *Line: + if stmt == hint { + if stmt.Token == nil || stmt.Token[0] != tokens[0] { + return newLineAfter(i) + } + + // Convert line to line block. + stmt.InBlock = true + block := &LineBlock{Token: stmt.Token[:1], Line: []*Line{stmt}} + stmt.Token = stmt.Token[1:] + x.Stmt[i] = block + new := &Line{Token: tokens[1:], InBlock: true} + block.Line = append(block.Line, new) + return new + } + + case *LineBlock: + if stmt == hint { + if stmt.Token[0] != tokens[0] { + return newLineAfter(i) + } + + new := &Line{Token: tokens[1:], InBlock: true} + stmt.Line = append(stmt.Line, new) + return new + } + + for j, line := range stmt.Line { + if line == hint { + if stmt.Token[0] != tokens[0] { + return newLineAfter(i) + } + + // Add new line after hint within the block. + stmt.Line = append(stmt.Line, nil) + copy(stmt.Line[j+2:], stmt.Line[j+1:]) + new := &Line{Token: tokens[1:], InBlock: true} + stmt.Line[j+1] = new + return new + } + } + } + } + } + + new := &Line{Token: tokens} + x.Stmt = append(x.Stmt, new) + return new +} + +func (x *FileSyntax) updateLine(line *Line, tokens ...string) { + if line.InBlock { + tokens = tokens[1:] + } + line.Token = tokens +} + +// markRemoved modifies line so that it (and its end-of-line comment, if any) +// will be dropped by (*FileSyntax).Cleanup. +func (line *Line) markRemoved() { + line.Token = nil + line.Comments.Suffix = nil +} + +// Cleanup cleans up the file syntax x after any edit operations. +// To avoid quadratic behavior, (*Line).markRemoved marks the line as dead +// by setting line.Token = nil but does not remove it from the slice +// in which it appears. After edits have all been indicated, +// calling Cleanup cleans out the dead lines. +func (x *FileSyntax) Cleanup() { + w := 0 + for _, stmt := range x.Stmt { + switch stmt := stmt.(type) { + case *Line: + if stmt.Token == nil { + continue + } + case *LineBlock: + ww := 0 + for _, line := range stmt.Line { + if line.Token != nil { + stmt.Line[ww] = line + ww++ + } + } + if ww == 0 { + continue + } + if ww == 1 && len(stmt.RParen.Comments.Before) == 0 { + // Collapse block into single line but keep the Line reference used by the + // parsed File structure. + *stmt.Line[0] = Line{ + Comments: Comments{ + Before: commentsAdd(stmt.Before, stmt.Line[0].Before), + Suffix: commentsAdd(stmt.Line[0].Suffix, stmt.Suffix), + After: commentsAdd(stmt.Line[0].After, stmt.After), + }, + Token: stringsAdd(stmt.Token, stmt.Line[0].Token), + } + x.Stmt[w] = stmt.Line[0] + w++ + continue + } + stmt.Line = stmt.Line[:ww] + } + x.Stmt[w] = stmt + w++ + } + x.Stmt = x.Stmt[:w] +} + +func commentsAdd(x, y []Comment) []Comment { + return append(x[:len(x):len(x)], y...) +} + +func stringsAdd(x, y []string) []string { + return append(x[:len(x):len(x)], y...) +} + +// A CommentBlock represents a top-level block of comments separate +// from any rule. +type CommentBlock struct { + Comments + Start Position +} + +func (x *CommentBlock) Span() (start, end Position) { + return x.Start, x.Start +} + +// A Line is a single line of tokens. +type Line struct { + Comments + Start Position + Token []string + InBlock bool + End Position +} + +func (x *Line) Span() (start, end Position) { + return x.Start, x.End +} + +// A LineBlock is a factored block of lines, like +// +// require ( +// "x" +// "y" +// ) +type LineBlock struct { + Comments + Start Position + LParen LParen + Token []string + Line []*Line + RParen RParen +} + +func (x *LineBlock) Span() (start, end Position) { + return x.Start, x.RParen.Pos.add(")") +} + +// An LParen represents the beginning of a parenthesized line block. +// It is a place to store suffix comments. +type LParen struct { + Comments + Pos Position +} + +func (x *LParen) Span() (start, end Position) { + return x.Pos, x.Pos.add(")") +} + +// An RParen represents the end of a parenthesized line block. +// It is a place to store whole-line (before) comments. +type RParen struct { + Comments + Pos Position +} + +func (x *RParen) Span() (start, end Position) { + return x.Pos, x.Pos.add(")") +} + +// An input represents a single input file being parsed. +type input struct { + // Lexing state. + filename string // name of input file, for errors + complete []byte // entire input + remaining []byte // remaining input + tokenStart []byte // token being scanned to end of input + token token // next token to be returned by lex, peek + pos Position // current input position + comments []Comment // accumulated comments + + // Parser state. + file *FileSyntax // returned top-level syntax tree + parseErrors ErrorList // errors encountered during parsing + + // Comment assignment state. + pre []Expr // all expressions, in preorder traversal + post []Expr // all expressions, in postorder traversal +} + +func newInput(filename string, data []byte) *input { + return &input{ + filename: filename, + complete: data, + remaining: data, + pos: Position{Line: 1, LineRune: 1, Byte: 0}, + } +} + +// parse parses the input file. +func parse(file string, data []byte) (f *FileSyntax, err error) { + // The parser panics for both routine errors like syntax errors + // and for programmer bugs like array index errors. + // Turn both into error returns. Catching bug panics is + // especially important when processing many files. + in := newInput(file, data) + defer func() { + if e := recover(); e != nil && e != &in.parseErrors { + in.parseErrors = append(in.parseErrors, Error{ + Filename: in.filename, + Pos: in.pos, + Err: fmt.Errorf("internal error: %v", e), + }) + } + if err == nil && len(in.parseErrors) > 0 { + err = in.parseErrors + } + }() + + // Prime the lexer by reading in the first token. It will be available + // in the next peek() or lex() call. + in.readToken() + + // Invoke the parser. + in.parseFile() + if len(in.parseErrors) > 0 { + return nil, in.parseErrors + } + in.file.Name = in.filename + + // Assign comments to nearby syntax. + in.assignComments() + + return in.file, nil +} + +// Error is called to report an error. +// Error does not return: it panics. +func (in *input) Error(s string) { + in.parseErrors = append(in.parseErrors, Error{ + Filename: in.filename, + Pos: in.pos, + Err: errors.New(s), + }) + panic(&in.parseErrors) +} + +// eof reports whether the input has reached end of file. +func (in *input) eof() bool { + return len(in.remaining) == 0 +} + +// peekRune returns the next rune in the input without consuming it. +func (in *input) peekRune() int { + if len(in.remaining) == 0 { + return 0 + } + r, _ := utf8.DecodeRune(in.remaining) + return int(r) +} + +// peekPrefix reports whether the remaining input begins with the given prefix. +func (in *input) peekPrefix(prefix string) bool { + // This is like bytes.HasPrefix(in.remaining, []byte(prefix)) + // but without the allocation of the []byte copy of prefix. + for i := 0; i < len(prefix); i++ { + if i >= len(in.remaining) || in.remaining[i] != prefix[i] { + return false + } + } + return true +} + +// readRune consumes and returns the next rune in the input. +func (in *input) readRune() int { + if len(in.remaining) == 0 { + in.Error("internal lexer error: readRune at EOF") + } + r, size := utf8.DecodeRune(in.remaining) + in.remaining = in.remaining[size:] + if r == '\n' { + in.pos.Line++ + in.pos.LineRune = 1 + } else { + in.pos.LineRune++ + } + in.pos.Byte += size + return int(r) +} + +type token struct { + kind tokenKind + pos Position + endPos Position + text string +} + +type tokenKind int + +const ( + _EOF tokenKind = -(iota + 1) + _EOLCOMMENT + _IDENT + _STRING + _COMMENT + + // newlines and punctuation tokens are allowed as ASCII codes. +) + +func (k tokenKind) isComment() bool { + return k == _COMMENT || k == _EOLCOMMENT +} + +// isEOL returns whether a token terminates a line. +func (k tokenKind) isEOL() bool { + return k == _EOF || k == _EOLCOMMENT || k == '\n' +} + +// startToken marks the beginning of the next input token. +// It must be followed by a call to endToken, once the token's text has +// been consumed using readRune. +func (in *input) startToken() { + in.tokenStart = in.remaining + in.token.text = "" + in.token.pos = in.pos +} + +// endToken marks the end of an input token. +// It records the actual token string in tok.text. +// A single trailing newline (LF or CRLF) will be removed from comment tokens. +func (in *input) endToken(kind tokenKind) { + in.token.kind = kind + text := string(in.tokenStart[:len(in.tokenStart)-len(in.remaining)]) + if kind.isComment() { + if strings.HasSuffix(text, "\r\n") { + text = text[:len(text)-2] + } else { + text = strings.TrimSuffix(text, "\n") + } + } + in.token.text = text + in.token.endPos = in.pos +} + +// peek returns the kind of the next token returned by lex. +func (in *input) peek() tokenKind { + return in.token.kind +} + +// lex is called from the parser to obtain the next input token. +func (in *input) lex() token { + tok := in.token + in.readToken() + return tok +} + +// readToken lexes the next token from the text and stores it in in.token. +func (in *input) readToken() { + // Skip past spaces, stopping at non-space or EOF. + for !in.eof() { + c := in.peekRune() + if c == ' ' || c == '\t' || c == '\r' { + in.readRune() + continue + } + + // Comment runs to end of line. + if in.peekPrefix("//") { + in.startToken() + + // Is this comment the only thing on its line? + // Find the last \n before this // and see if it's all + // spaces from there to here. + i := bytes.LastIndex(in.complete[:in.pos.Byte], []byte("\n")) + suffix := len(bytes.TrimSpace(in.complete[i+1:in.pos.Byte])) > 0 + in.readRune() + in.readRune() + + // Consume comment. + for len(in.remaining) > 0 && in.readRune() != '\n' { + } + + // If we are at top level (not in a statement), hand the comment to + // the parser as a _COMMENT token. The grammar is written + // to handle top-level comments itself. + if !suffix { + in.endToken(_COMMENT) + return + } + + // Otherwise, save comment for later attachment to syntax tree. + in.endToken(_EOLCOMMENT) + in.comments = append(in.comments, Comment{in.token.pos, in.token.text, suffix}) + return + } + + if in.peekPrefix("/*") { + in.Error("mod files must use // comments (not /* */ comments)") + } + + // Found non-space non-comment. + break + } + + // Found the beginning of the next token. + in.startToken() + + // End of file. + if in.eof() { + in.endToken(_EOF) + return + } + + // Punctuation tokens. + switch c := in.peekRune(); c { + case '\n', '(', ')', '[', ']', '{', '}', ',': + in.readRune() + in.endToken(tokenKind(c)) + return + + case '"', '`': // quoted string + quote := c + in.readRune() + for { + if in.eof() { + in.pos = in.token.pos + in.Error("unexpected EOF in string") + } + if in.peekRune() == '\n' { + in.Error("unexpected newline in string") + } + c := in.readRune() + if c == quote { + break + } + if c == '\\' && quote != '`' { + if in.eof() { + in.pos = in.token.pos + in.Error("unexpected EOF in string") + } + in.readRune() + } + } + in.endToken(_STRING) + return + } + + // Checked all punctuation. Must be identifier token. + if c := in.peekRune(); !isIdent(c) { + in.Error(fmt.Sprintf("unexpected input character %#q", c)) + } + + // Scan over identifier. + for isIdent(in.peekRune()) { + if in.peekPrefix("//") { + break + } + if in.peekPrefix("/*") { + in.Error("mod files must use // comments (not /* */ comments)") + } + in.readRune() + } + in.endToken(_IDENT) +} + +// isIdent reports whether c is an identifier rune. +// We treat most printable runes as identifier runes, except for a handful of +// ASCII punctuation characters. +func isIdent(c int) bool { + switch r := rune(c); r { + case ' ', '(', ')', '[', ']', '{', '}', ',': + return false + default: + return !unicode.IsSpace(r) && unicode.IsPrint(r) + } +} + +// Comment assignment. +// We build two lists of all subexpressions, preorder and postorder. +// The preorder list is ordered by start location, with outer expressions first. +// The postorder list is ordered by end location, with outer expressions last. +// We use the preorder list to assign each whole-line comment to the syntax +// immediately following it, and we use the postorder list to assign each +// end-of-line comment to the syntax immediately preceding it. + +// order walks the expression adding it and its subexpressions to the +// preorder and postorder lists. +func (in *input) order(x Expr) { + if x != nil { + in.pre = append(in.pre, x) + } + switch x := x.(type) { + default: + panic(fmt.Errorf("order: unexpected type %T", x)) + case nil: + // nothing + case *LParen, *RParen: + // nothing + case *CommentBlock: + // nothing + case *Line: + // nothing + case *FileSyntax: + for _, stmt := range x.Stmt { + in.order(stmt) + } + case *LineBlock: + in.order(&x.LParen) + for _, l := range x.Line { + in.order(l) + } + in.order(&x.RParen) + } + if x != nil { + in.post = append(in.post, x) + } +} + +// assignComments attaches comments to nearby syntax. +func (in *input) assignComments() { + const debug = false + + // Generate preorder and postorder lists. + in.order(in.file) + + // Split into whole-line comments and suffix comments. + var line, suffix []Comment + for _, com := range in.comments { + if com.Suffix { + suffix = append(suffix, com) + } else { + line = append(line, com) + } + } + + if debug { + for _, c := range line { + fmt.Fprintf(os.Stderr, "LINE %q :%d:%d #%d\n", c.Token, c.Start.Line, c.Start.LineRune, c.Start.Byte) + } + } + + // Assign line comments to syntax immediately following. + for _, x := range in.pre { + start, _ := x.Span() + if debug { + fmt.Fprintf(os.Stderr, "pre %T :%d:%d #%d\n", x, start.Line, start.LineRune, start.Byte) + } + xcom := x.Comment() + for len(line) > 0 && start.Byte >= line[0].Start.Byte { + if debug { + fmt.Fprintf(os.Stderr, "ASSIGN LINE %q #%d\n", line[0].Token, line[0].Start.Byte) + } + xcom.Before = append(xcom.Before, line[0]) + line = line[1:] + } + } + + // Remaining line comments go at end of file. + in.file.After = append(in.file.After, line...) + + if debug { + for _, c := range suffix { + fmt.Fprintf(os.Stderr, "SUFFIX %q :%d:%d #%d\n", c.Token, c.Start.Line, c.Start.LineRune, c.Start.Byte) + } + } + + // Assign suffix comments to syntax immediately before. + for i := len(in.post) - 1; i >= 0; i-- { + x := in.post[i] + + start, end := x.Span() + if debug { + fmt.Fprintf(os.Stderr, "post %T :%d:%d #%d :%d:%d #%d\n", x, start.Line, start.LineRune, start.Byte, end.Line, end.LineRune, end.Byte) + } + + // Do not assign suffix comments to end of line block or whole file. + // Instead assign them to the last element inside. + switch x.(type) { + case *FileSyntax: + continue + } + + // Do not assign suffix comments to something that starts + // on an earlier line, so that in + // + // x ( y + // z ) // comment + // + // we assign the comment to z and not to x ( ... ). + if start.Line != end.Line { + continue + } + xcom := x.Comment() + for len(suffix) > 0 && end.Byte <= suffix[len(suffix)-1].Start.Byte { + if debug { + fmt.Fprintf(os.Stderr, "ASSIGN SUFFIX %q #%d\n", suffix[len(suffix)-1].Token, suffix[len(suffix)-1].Start.Byte) + } + xcom.Suffix = append(xcom.Suffix, suffix[len(suffix)-1]) + suffix = suffix[:len(suffix)-1] + } + } + + // We assigned suffix comments in reverse. + // If multiple suffix comments were appended to the same + // expression node, they are now in reverse. Fix that. + for _, x := range in.post { + reverseComments(x.Comment().Suffix) + } + + // Remaining suffix comments go at beginning of file. + in.file.Before = append(in.file.Before, suffix...) +} + +// reverseComments reverses the []Comment list. +func reverseComments(list []Comment) { + for i, j := 0, len(list)-1; i < j; i, j = i+1, j-1 { + list[i], list[j] = list[j], list[i] + } +} + +func (in *input) parseFile() { + in.file = new(FileSyntax) + var cb *CommentBlock + for { + switch in.peek() { + case '\n': + in.lex() + if cb != nil { + in.file.Stmt = append(in.file.Stmt, cb) + cb = nil + } + case _COMMENT: + tok := in.lex() + if cb == nil { + cb = &CommentBlock{Start: tok.pos} + } + com := cb.Comment() + com.Before = append(com.Before, Comment{Start: tok.pos, Token: tok.text}) + case _EOF: + if cb != nil { + in.file.Stmt = append(in.file.Stmt, cb) + } + return + default: + in.parseStmt() + if cb != nil { + in.file.Stmt[len(in.file.Stmt)-1].Comment().Before = cb.Before + cb = nil + } + } + } +} + +func (in *input) parseStmt() { + tok := in.lex() + start := tok.pos + end := tok.endPos + tokens := []string{tok.text} + for { + tok := in.lex() + switch { + case tok.kind.isEOL(): + in.file.Stmt = append(in.file.Stmt, &Line{ + Start: start, + Token: tokens, + End: end, + }) + return + + case tok.kind == '(': + if next := in.peek(); next.isEOL() { + // Start of block: no more tokens on this line. + in.file.Stmt = append(in.file.Stmt, in.parseLineBlock(start, tokens, tok)) + return + } else if next == ')' { + rparen := in.lex() + if in.peek().isEOL() { + // Empty block. + in.lex() + in.file.Stmt = append(in.file.Stmt, &LineBlock{ + Start: start, + Token: tokens, + LParen: LParen{Pos: tok.pos}, + RParen: RParen{Pos: rparen.pos}, + }) + return + } + // '( )' in the middle of the line, not a block. + tokens = append(tokens, tok.text, rparen.text) + } else { + // '(' in the middle of the line, not a block. + tokens = append(tokens, tok.text) + } + + default: + tokens = append(tokens, tok.text) + end = tok.endPos + } + } +} + +func (in *input) parseLineBlock(start Position, token []string, lparen token) *LineBlock { + x := &LineBlock{ + Start: start, + Token: token, + LParen: LParen{Pos: lparen.pos}, + } + var comments []Comment + for { + switch in.peek() { + case _EOLCOMMENT: + // Suffix comment, will be attached later by assignComments. + in.lex() + case '\n': + // Blank line. Add an empty comment to preserve it. + in.lex() + if len(comments) == 0 && len(x.Line) > 0 || len(comments) > 0 && comments[len(comments)-1].Token != "" { + comments = append(comments, Comment{}) + } + case _COMMENT: + tok := in.lex() + comments = append(comments, Comment{Start: tok.pos, Token: tok.text}) + case _EOF: + in.Error(fmt.Sprintf("syntax error (unterminated block started at %s:%d:%d)", in.filename, x.Start.Line, x.Start.LineRune)) + case ')': + rparen := in.lex() + // Don't preserve blank lines (denoted by a single empty comment, added above) + // at the end of the block. + if len(comments) == 1 && comments[0] == (Comment{}) { + comments = nil + } + x.RParen.Before = comments + x.RParen.Pos = rparen.pos + if !in.peek().isEOL() { + in.Error("syntax error (expected newline after closing paren)") + } + in.lex() + return x + default: + l := in.parseLine() + x.Line = append(x.Line, l) + l.Comment().Before = comments + comments = nil + } + } +} + +func (in *input) parseLine() *Line { + tok := in.lex() + if tok.kind.isEOL() { + in.Error("internal parse error: parseLine at end of line") + } + start := tok.pos + end := tok.endPos + tokens := []string{tok.text} + for { + tok := in.lex() + if tok.kind.isEOL() { + return &Line{ + Start: start, + Token: tokens, + End: end, + InBlock: true, + } + } + tokens = append(tokens, tok.text) + end = tok.endPos + } +} + +var ( + slashSlash = []byte("//") + moduleStr = []byte("module") +) + +// ModulePath returns the module path from the gomod file text. +// If it cannot find a module path, it returns an empty string. +// It is tolerant of unrelated problems in the go.mod file. +func ModulePath(mod []byte) string { + for len(mod) > 0 { + line := mod + mod = nil + if i := bytes.IndexByte(line, '\n'); i >= 0 { + line, mod = line[:i], line[i+1:] + } + if i := bytes.Index(line, slashSlash); i >= 0 { + line = line[:i] + } + line = bytes.TrimSpace(line) + if !bytes.HasPrefix(line, moduleStr) { + continue + } + line = line[len(moduleStr):] + n := len(line) + line = bytes.TrimSpace(line) + if len(line) == n || len(line) == 0 { + continue + } + + if line[0] == '"' || line[0] == '`' { + p, err := strconv.Unquote(string(line)) + if err != nil { + return "" // malformed quoted string or multiline module path + } + return p + } + + return string(line) + } + return "" // missing module path +} diff --git a/vendor/golang.org/x/mod/modfile/rule.go b/vendor/golang.org/x/mod/modfile/rule.go new file mode 100644 index 0000000000..3e4a1d0ab4 --- /dev/null +++ b/vendor/golang.org/x/mod/modfile/rule.go @@ -0,0 +1,1836 @@ +// Copyright 2018 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 modfile implements a parser and formatter for go.mod files. +// +// The go.mod syntax is described in +// https://pkg.go.dev/cmd/go/#hdr-The_go_mod_file. +// +// The [Parse] and [ParseLax] functions both parse a go.mod file and return an +// abstract syntax tree. ParseLax ignores unknown statements and may be used to +// parse go.mod files that may have been developed with newer versions of Go. +// +// The [File] struct returned by Parse and ParseLax represent an abstract +// go.mod file. File has several methods like [File.AddNewRequire] and +// [File.DropReplace] that can be used to programmatically edit a file. +// +// The [Format] function formats a File back to a byte slice which can be +// written to a file. +package modfile + +import ( + "errors" + "fmt" + "path/filepath" + "sort" + "strconv" + "strings" + "unicode" + + "golang.org/x/mod/internal/lazyregexp" + "golang.org/x/mod/module" + "golang.org/x/mod/semver" +) + +// A File is the parsed, interpreted form of a go.mod file. +type File struct { + Module *Module + Go *Go + Toolchain *Toolchain + Godebug []*Godebug + Require []*Require + Exclude []*Exclude + Replace []*Replace + Retract []*Retract + Tool []*Tool + + Syntax *FileSyntax +} + +// A Module is the module statement. +type Module struct { + Mod module.Version + Deprecated string + Syntax *Line +} + +// A Go is the go statement. +type Go struct { + Version string // "1.23" + Syntax *Line +} + +// A Toolchain is the toolchain statement. +type Toolchain struct { + Name string // "go1.21rc1" + Syntax *Line +} + +// A Godebug is a single godebug key=value statement. +type Godebug struct { + Key string + Value string + Syntax *Line +} + +// An Exclude is a single exclude statement. +type Exclude struct { + Mod module.Version + Syntax *Line +} + +// A Replace is a single replace statement. +type Replace struct { + Old module.Version + New module.Version + Syntax *Line +} + +// A Retract is a single retract statement. +type Retract struct { + VersionInterval + Rationale string + Syntax *Line +} + +// A Tool is a single tool statement. +type Tool struct { + Path string + Syntax *Line +} + +// A VersionInterval represents a range of versions with upper and lower bounds. +// Intervals are closed: both bounds are included. When Low is equal to High, +// the interval may refer to a single version ('v1.2.3') or an interval +// ('[v1.2.3, v1.2.3]'); both have the same representation. +type VersionInterval struct { + Low, High string +} + +// A Require is a single require statement. +type Require struct { + Mod module.Version + Indirect bool // has "// indirect" comment + Syntax *Line +} + +func (r *Require) markRemoved() { + r.Syntax.markRemoved() + *r = Require{} +} + +func (r *Require) setVersion(v string) { + r.Mod.Version = v + + if line := r.Syntax; len(line.Token) > 0 { + if line.InBlock { + // If the line is preceded by an empty line, remove it; see + // https://golang.org/issue/33779. + if len(line.Comments.Before) == 1 && len(line.Comments.Before[0].Token) == 0 { + line.Comments.Before = line.Comments.Before[:0] + } + if len(line.Token) >= 2 { // example.com v1.2.3 + line.Token[1] = v + } + } else { + if len(line.Token) >= 3 { // require example.com v1.2.3 + line.Token[2] = v + } + } + } +} + +// setIndirect sets line to have (or not have) a "// indirect" comment. +func (r *Require) setIndirect(indirect bool) { + r.Indirect = indirect + line := r.Syntax + if isIndirect(line) == indirect { + return + } + if indirect { + // Adding comment. + if len(line.Suffix) == 0 { + // New comment. + line.Suffix = []Comment{{Token: "// indirect", Suffix: true}} + return + } + + com := &line.Suffix[0] + text := strings.TrimSpace(strings.TrimPrefix(com.Token, string(slashSlash))) + if text == "" { + // Empty comment. + com.Token = "// indirect" + return + } + + // Insert at beginning of existing comment. + com.Token = "// indirect; " + text + return + } + + // Removing comment. + f := strings.TrimSpace(strings.TrimPrefix(line.Suffix[0].Token, string(slashSlash))) + if f == "indirect" { + // Remove whole comment. + line.Suffix = nil + return + } + + // Remove comment prefix. + com := &line.Suffix[0] + i := strings.Index(com.Token, "indirect;") + com.Token = "//" + com.Token[i+len("indirect;"):] +} + +// isIndirect reports whether line has a "// indirect" comment, +// meaning it is in go.mod only for its effect on indirect dependencies, +// so that it can be dropped entirely once the effective version of the +// indirect dependency reaches the given minimum version. +func isIndirect(line *Line) bool { + if len(line.Suffix) == 0 { + return false + } + f := strings.Fields(strings.TrimPrefix(line.Suffix[0].Token, string(slashSlash))) + return (len(f) == 1 && f[0] == "indirect" || len(f) > 1 && f[0] == "indirect;") +} + +func (f *File) AddModuleStmt(path string) error { + if f.Syntax == nil { + f.Syntax = new(FileSyntax) + } + if f.Module == nil { + f.Module = &Module{ + Mod: module.Version{Path: path}, + Syntax: f.Syntax.addLine(nil, "module", AutoQuote(path)), + } + } else { + f.Module.Mod.Path = path + f.Syntax.updateLine(f.Module.Syntax, "module", AutoQuote(path)) + } + return nil +} + +func (f *File) AddComment(text string) { + if f.Syntax == nil { + f.Syntax = new(FileSyntax) + } + f.Syntax.Stmt = append(f.Syntax.Stmt, &CommentBlock{ + Comments: Comments{ + Before: []Comment{ + { + Token: text, + }, + }, + }, + }) +} + +type VersionFixer func(path, version string) (string, error) + +// errDontFix is returned by a VersionFixer to indicate the version should be +// left alone, even if it's not canonical. +var dontFixRetract VersionFixer = func(_, vers string) (string, error) { + return vers, nil +} + +// Parse parses and returns a go.mod file. +// +// file is the name of the file, used in positions and errors. +// +// data is the content of the file. +// +// fix is an optional function that canonicalizes module versions. +// If fix is nil, all module versions must be canonical ([module.CanonicalVersion] +// must return the same string). +func Parse(file string, data []byte, fix VersionFixer) (*File, error) { + return parseToFile(file, data, fix, true) +} + +// ParseLax is like Parse but ignores unknown statements. +// It is used when parsing go.mod files other than the main module, +// under the theory that most statement types we add in the future will +// only apply in the main module, like exclude and replace, +// and so we get better gradual deployments if old go commands +// simply ignore those statements when found in go.mod files +// in dependencies. +func ParseLax(file string, data []byte, fix VersionFixer) (*File, error) { + return parseToFile(file, data, fix, false) +} + +func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (parsed *File, err error) { + fs, err := parse(file, data) + if err != nil { + return nil, err + } + f := &File{ + Syntax: fs, + } + var errs ErrorList + + // fix versions in retract directives after the file is parsed. + // We need the module path to fix versions, and it might be at the end. + defer func() { + oldLen := len(errs) + f.fixRetract(fix, &errs) + if len(errs) > oldLen { + parsed, err = nil, errs + } + }() + + for _, x := range fs.Stmt { + switch x := x.(type) { + case *Line: + f.add(&errs, nil, x, x.Token[0], x.Token[1:], fix, strict) + + case *LineBlock: + if len(x.Token) > 1 { + if strict { + errs = append(errs, Error{ + Filename: file, + Pos: x.Start, + Err: fmt.Errorf("unknown block type: %s", strings.Join(x.Token, " ")), + }) + } + continue + } + switch x.Token[0] { + default: + if strict { + errs = append(errs, Error{ + Filename: file, + Pos: x.Start, + Err: fmt.Errorf("unknown block type: %s", strings.Join(x.Token, " ")), + }) + } + continue + case "module", "godebug", "require", "exclude", "replace", "retract", "tool": + for _, l := range x.Line { + f.add(&errs, x, l, x.Token[0], l.Token, fix, strict) + } + } + } + } + + if len(errs) > 0 { + return nil, errs + } + return f, nil +} + +var GoVersionRE = lazyregexp.New(`^([1-9][0-9]*)\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))?([a-z]+[0-9]+)?$`) +var laxGoVersionRE = lazyregexp.New(`^v?(([1-9][0-9]*)\.(0|[1-9][0-9]*))([^0-9].*)$`) + +// Toolchains must be named beginning with `go1`, +// like "go1.20.3" or "go1.20.3-gccgo". As a special case, "default" is also permitted. +// Note that this regexp is a much looser condition than go/version.IsValid, +// for forward compatibility. +// (This code has to be work to identify new toolchains even if we tweak the syntax in the future.) +var ToolchainRE = lazyregexp.New(`^default$|^go1($|\.)`) + +func (f *File) add(errs *ErrorList, block *LineBlock, line *Line, verb string, args []string, fix VersionFixer, strict bool) { + // If strict is false, this module is a dependency. + // We ignore all unknown directives as well as main-module-only + // directives like replace and exclude. It will work better for + // forward compatibility if we can depend on modules that have unknown + // statements (presumed relevant only when acting as the main module) + // and simply ignore those statements. + if !strict { + switch verb { + case "go", "module", "retract", "require": + // want these even for dependency go.mods + default: + return + } + } + + wrapModPathError := func(modPath string, err error) { + *errs = append(*errs, Error{ + Filename: f.Syntax.Name, + Pos: line.Start, + ModPath: modPath, + Verb: verb, + Err: err, + }) + } + wrapError := func(err error) { + *errs = append(*errs, Error{ + Filename: f.Syntax.Name, + Pos: line.Start, + Err: err, + }) + } + errorf := func(format string, args ...interface{}) { + wrapError(fmt.Errorf(format, args...)) + } + + switch verb { + default: + errorf("unknown directive: %s", verb) + + case "go": + if f.Go != nil { + errorf("repeated go statement") + return + } + if len(args) != 1 { + errorf("go directive expects exactly one argument") + return + } else if !GoVersionRE.MatchString(args[0]) { + fixed := false + if !strict { + if m := laxGoVersionRE.FindStringSubmatch(args[0]); m != nil { + args[0] = m[1] + fixed = true + } + } + if !fixed { + errorf("invalid go version '%s': must match format 1.23.0", args[0]) + return + } + } + + f.Go = &Go{Syntax: line} + f.Go.Version = args[0] + + case "toolchain": + if f.Toolchain != nil { + errorf("repeated toolchain statement") + return + } + if len(args) != 1 { + errorf("toolchain directive expects exactly one argument") + return + } else if !ToolchainRE.MatchString(args[0]) { + errorf("invalid toolchain version '%s': must match format go1.23.0 or default", args[0]) + return + } + f.Toolchain = &Toolchain{Syntax: line} + f.Toolchain.Name = args[0] + + case "module": + if f.Module != nil { + errorf("repeated module statement") + return + } + deprecated := parseDeprecation(block, line) + f.Module = &Module{ + Syntax: line, + Deprecated: deprecated, + } + if len(args) != 1 { + errorf("usage: module module/path") + return + } + s, err := parseString(&args[0]) + if err != nil { + errorf("invalid quoted string: %v", err) + return + } + f.Module.Mod = module.Version{Path: s} + + case "godebug": + if len(args) != 1 || strings.ContainsAny(args[0], "\"`',") { + errorf("usage: godebug key=value") + return + } + key, value, ok := strings.Cut(args[0], "=") + if !ok { + errorf("usage: godebug key=value") + return + } + f.Godebug = append(f.Godebug, &Godebug{ + Key: key, + Value: value, + Syntax: line, + }) + + case "require", "exclude": + if len(args) != 2 { + errorf("usage: %s module/path v1.2.3", verb) + return + } + s, err := parseString(&args[0]) + if err != nil { + errorf("invalid quoted string: %v", err) + return + } + v, err := parseVersion(verb, s, &args[1], fix) + if err != nil { + wrapError(err) + return + } + pathMajor, err := modulePathMajor(s) + if err != nil { + wrapError(err) + return + } + if err := module.CheckPathMajor(v, pathMajor); err != nil { + wrapModPathError(s, err) + return + } + if verb == "require" { + f.Require = append(f.Require, &Require{ + Mod: module.Version{Path: s, Version: v}, + Syntax: line, + Indirect: isIndirect(line), + }) + } else { + f.Exclude = append(f.Exclude, &Exclude{ + Mod: module.Version{Path: s, Version: v}, + Syntax: line, + }) + } + + case "replace": + replace, wrappederr := parseReplace(f.Syntax.Name, line, verb, args, fix) + if wrappederr != nil { + *errs = append(*errs, *wrappederr) + return + } + f.Replace = append(f.Replace, replace) + + case "retract": + rationale := parseDirectiveComment(block, line) + vi, err := parseVersionInterval(verb, "", &args, dontFixRetract) + if err != nil { + if strict { + wrapError(err) + return + } else { + // Only report errors parsing intervals in the main module. We may + // support additional syntax in the future, such as open and half-open + // intervals. Those can't be supported now, because they break the + // go.mod parser, even in lax mode. + return + } + } + if len(args) > 0 && strict { + // In the future, there may be additional information after the version. + errorf("unexpected token after version: %q", args[0]) + return + } + retract := &Retract{ + VersionInterval: vi, + Rationale: rationale, + Syntax: line, + } + f.Retract = append(f.Retract, retract) + + case "tool": + if len(args) != 1 { + errorf("tool directive expects exactly one argument") + return + } + s, err := parseString(&args[0]) + if err != nil { + errorf("invalid quoted string: %v", err) + return + } + f.Tool = append(f.Tool, &Tool{ + Path: s, + Syntax: line, + }) + } +} + +func parseReplace(filename string, line *Line, verb string, args []string, fix VersionFixer) (*Replace, *Error) { + wrapModPathError := func(modPath string, err error) *Error { + return &Error{ + Filename: filename, + Pos: line.Start, + ModPath: modPath, + Verb: verb, + Err: err, + } + } + wrapError := func(err error) *Error { + return &Error{ + Filename: filename, + Pos: line.Start, + Err: err, + } + } + errorf := func(format string, args ...interface{}) *Error { + return wrapError(fmt.Errorf(format, args...)) + } + + arrow := 2 + if len(args) >= 2 && args[1] == "=>" { + arrow = 1 + } + if len(args) < arrow+2 || len(args) > arrow+3 || args[arrow] != "=>" { + return nil, errorf("usage: %s module/path [v1.2.3] => other/module v1.4\n\t or %s module/path [v1.2.3] => ../local/directory", verb, verb) + } + s, err := parseString(&args[0]) + if err != nil { + return nil, errorf("invalid quoted string: %v", err) + } + pathMajor, err := modulePathMajor(s) + if err != nil { + return nil, wrapModPathError(s, err) + + } + var v string + if arrow == 2 { + v, err = parseVersion(verb, s, &args[1], fix) + if err != nil { + return nil, wrapError(err) + } + if err := module.CheckPathMajor(v, pathMajor); err != nil { + return nil, wrapModPathError(s, err) + } + } + ns, err := parseString(&args[arrow+1]) + if err != nil { + return nil, errorf("invalid quoted string: %v", err) + } + nv := "" + if len(args) == arrow+2 { + if !IsDirectoryPath(ns) { + if strings.Contains(ns, "@") { + return nil, errorf("replacement module must match format 'path version', not 'path@version'") + } + return nil, errorf("replacement module without version must be directory path (rooted or starting with . or ..)") + } + if filepath.Separator == '/' && strings.Contains(ns, `\`) { + return nil, errorf("replacement directory appears to be Windows path (on a non-windows system)") + } + } + if len(args) == arrow+3 { + nv, err = parseVersion(verb, ns, &args[arrow+2], fix) + if err != nil { + return nil, wrapError(err) + } + if IsDirectoryPath(ns) { + return nil, errorf("replacement module directory path %q cannot have version", ns) + } + } + return &Replace{ + Old: module.Version{Path: s, Version: v}, + New: module.Version{Path: ns, Version: nv}, + Syntax: line, + }, nil +} + +// fixRetract applies fix to each retract directive in f, appending any errors +// to errs. +// +// Most versions are fixed as we parse the file, but for retract directives, +// the relevant module path is the one specified with the module directive, +// and that might appear at the end of the file (or not at all). +func (f *File) fixRetract(fix VersionFixer, errs *ErrorList) { + if fix == nil { + return + } + path := "" + if f.Module != nil { + path = f.Module.Mod.Path + } + var r *Retract + wrapError := func(err error) { + *errs = append(*errs, Error{ + Filename: f.Syntax.Name, + Pos: r.Syntax.Start, + Err: err, + }) + } + + for _, r = range f.Retract { + if path == "" { + wrapError(errors.New("no module directive found, so retract cannot be used")) + return // only print the first one of these + } + + args := r.Syntax.Token + if args[0] == "retract" { + args = args[1:] + } + vi, err := parseVersionInterval("retract", path, &args, fix) + if err != nil { + wrapError(err) + } + r.VersionInterval = vi + } +} + +func (f *WorkFile) add(errs *ErrorList, line *Line, verb string, args []string, fix VersionFixer) { + wrapError := func(err error) { + *errs = append(*errs, Error{ + Filename: f.Syntax.Name, + Pos: line.Start, + Err: err, + }) + } + errorf := func(format string, args ...interface{}) { + wrapError(fmt.Errorf(format, args...)) + } + + switch verb { + default: + errorf("unknown directive: %s", verb) + + case "go": + if f.Go != nil { + errorf("repeated go statement") + return + } + if len(args) != 1 { + errorf("go directive expects exactly one argument") + return + } else if !GoVersionRE.MatchString(args[0]) { + errorf("invalid go version '%s': must match format 1.23.0", args[0]) + return + } + + f.Go = &Go{Syntax: line} + f.Go.Version = args[0] + + case "toolchain": + if f.Toolchain != nil { + errorf("repeated toolchain statement") + return + } + if len(args) != 1 { + errorf("toolchain directive expects exactly one argument") + return + } else if !ToolchainRE.MatchString(args[0]) { + errorf("invalid toolchain version '%s': must match format go1.23.0 or default", args[0]) + return + } + + f.Toolchain = &Toolchain{Syntax: line} + f.Toolchain.Name = args[0] + + case "godebug": + if len(args) != 1 || strings.ContainsAny(args[0], "\"`',") { + errorf("usage: godebug key=value") + return + } + key, value, ok := strings.Cut(args[0], "=") + if !ok { + errorf("usage: godebug key=value") + return + } + f.Godebug = append(f.Godebug, &Godebug{ + Key: key, + Value: value, + Syntax: line, + }) + + case "use": + if len(args) != 1 { + errorf("usage: %s local/dir", verb) + return + } + s, err := parseString(&args[0]) + if err != nil { + errorf("invalid quoted string: %v", err) + return + } + f.Use = append(f.Use, &Use{ + Path: s, + Syntax: line, + }) + + case "replace": + replace, wrappederr := parseReplace(f.Syntax.Name, line, verb, args, fix) + if wrappederr != nil { + *errs = append(*errs, *wrappederr) + return + } + f.Replace = append(f.Replace, replace) + } +} + +// IsDirectoryPath reports whether the given path should be interpreted as a directory path. +// Just like on the go command line, relative paths starting with a '.' or '..' path component +// and rooted paths are directory paths; the rest are module paths. +func IsDirectoryPath(ns string) bool { + // Because go.mod files can move from one system to another, + // we check all known path syntaxes, both Unix and Windows. + return ns == "." || strings.HasPrefix(ns, "./") || strings.HasPrefix(ns, `.\`) || + ns == ".." || strings.HasPrefix(ns, "../") || strings.HasPrefix(ns, `..\`) || + strings.HasPrefix(ns, "/") || strings.HasPrefix(ns, `\`) || + len(ns) >= 2 && ('A' <= ns[0] && ns[0] <= 'Z' || 'a' <= ns[0] && ns[0] <= 'z') && ns[1] == ':' +} + +// MustQuote reports whether s must be quoted in order to appear as +// a single token in a go.mod line. +func MustQuote(s string) bool { + for _, r := range s { + switch r { + case ' ', '"', '\'', '`': + return true + + case '(', ')', '[', ']', '{', '}', ',': + if len(s) > 1 { + return true + } + + default: + if !unicode.IsPrint(r) { + return true + } + } + } + return s == "" || strings.Contains(s, "//") || strings.Contains(s, "/*") +} + +// AutoQuote returns s or, if quoting is required for s to appear in a go.mod, +// the quotation of s. +func AutoQuote(s string) string { + if MustQuote(s) { + return strconv.Quote(s) + } + return s +} + +func parseVersionInterval(verb string, path string, args *[]string, fix VersionFixer) (VersionInterval, error) { + toks := *args + if len(toks) == 0 || toks[0] == "(" { + return VersionInterval{}, fmt.Errorf("expected '[' or version") + } + if toks[0] != "[" { + v, err := parseVersion(verb, path, &toks[0], fix) + if err != nil { + return VersionInterval{}, err + } + *args = toks[1:] + return VersionInterval{Low: v, High: v}, nil + } + toks = toks[1:] + + if len(toks) == 0 { + return VersionInterval{}, fmt.Errorf("expected version after '['") + } + low, err := parseVersion(verb, path, &toks[0], fix) + if err != nil { + return VersionInterval{}, err + } + toks = toks[1:] + + if len(toks) == 0 || toks[0] != "," { + return VersionInterval{}, fmt.Errorf("expected ',' after version") + } + toks = toks[1:] + + if len(toks) == 0 { + return VersionInterval{}, fmt.Errorf("expected version after ','") + } + high, err := parseVersion(verb, path, &toks[0], fix) + if err != nil { + return VersionInterval{}, err + } + toks = toks[1:] + + if len(toks) == 0 || toks[0] != "]" { + return VersionInterval{}, fmt.Errorf("expected ']' after version") + } + toks = toks[1:] + + *args = toks + return VersionInterval{Low: low, High: high}, nil +} + +func parseString(s *string) (string, error) { + t := *s + if strings.HasPrefix(t, `"`) { + var err error + if t, err = strconv.Unquote(t); err != nil { + return "", err + } + } else if strings.ContainsAny(t, "\"'`") { + // Other quotes are reserved both for possible future expansion + // and to avoid confusion. For example if someone types 'x' + // we want that to be a syntax error and not a literal x in literal quotation marks. + return "", fmt.Errorf("unquoted string cannot contain quote") + } + *s = AutoQuote(t) + return t, nil +} + +var deprecatedRE = lazyregexp.New(`(?s)(?:^|\n\n)Deprecated: *(.*?)(?:$|\n\n)`) + +// parseDeprecation extracts the text of comments on a "module" directive and +// extracts a deprecation message from that. +// +// A deprecation message is contained in a paragraph within a block of comments +// that starts with "Deprecated:" (case sensitive). The message runs until the +// end of the paragraph and does not include the "Deprecated:" prefix. If the +// comment block has multiple paragraphs that start with "Deprecated:", +// parseDeprecation returns the message from the first. +func parseDeprecation(block *LineBlock, line *Line) string { + text := parseDirectiveComment(block, line) + m := deprecatedRE.FindStringSubmatch(text) + if m == nil { + return "" + } + return m[1] +} + +// parseDirectiveComment extracts the text of comments on a directive. +// If the directive's line does not have comments and is part of a block that +// does have comments, the block's comments are used. +func parseDirectiveComment(block *LineBlock, line *Line) string { + comments := line.Comment() + if block != nil && len(comments.Before) == 0 && len(comments.Suffix) == 0 { + comments = block.Comment() + } + groups := [][]Comment{comments.Before, comments.Suffix} + var lines []string + for _, g := range groups { + for _, c := range g { + if !strings.HasPrefix(c.Token, "//") { + continue // blank line + } + lines = append(lines, strings.TrimSpace(strings.TrimPrefix(c.Token, "//"))) + } + } + return strings.Join(lines, "\n") +} + +type ErrorList []Error + +func (e ErrorList) Error() string { + errStrs := make([]string, len(e)) + for i, err := range e { + errStrs[i] = err.Error() + } + return strings.Join(errStrs, "\n") +} + +type Error struct { + Filename string + Pos Position + Verb string + ModPath string + Err error +} + +func (e *Error) Error() string { + var pos string + if e.Pos.LineRune > 1 { + // Don't print LineRune if it's 1 (beginning of line). + // It's always 1 except in scanner errors, which are rare. + pos = fmt.Sprintf("%s:%d:%d: ", e.Filename, e.Pos.Line, e.Pos.LineRune) + } else if e.Pos.Line > 0 { + pos = fmt.Sprintf("%s:%d: ", e.Filename, e.Pos.Line) + } else if e.Filename != "" { + pos = fmt.Sprintf("%s: ", e.Filename) + } + + var directive string + if e.ModPath != "" { + directive = fmt.Sprintf("%s %s: ", e.Verb, e.ModPath) + } else if e.Verb != "" { + directive = fmt.Sprintf("%s: ", e.Verb) + } + + return pos + directive + e.Err.Error() +} + +func (e *Error) Unwrap() error { return e.Err } + +func parseVersion(verb string, path string, s *string, fix VersionFixer) (string, error) { + t, err := parseString(s) + if err != nil { + return "", &Error{ + Verb: verb, + ModPath: path, + Err: &module.InvalidVersionError{ + Version: *s, + Err: err, + }, + } + } + if fix != nil { + fixed, err := fix(path, t) + if err != nil { + if err, ok := err.(*module.ModuleError); ok { + return "", &Error{ + Verb: verb, + ModPath: path, + Err: err.Err, + } + } + return "", err + } + t = fixed + } else { + cv := module.CanonicalVersion(t) + if cv == "" { + return "", &Error{ + Verb: verb, + ModPath: path, + Err: &module.InvalidVersionError{ + Version: t, + Err: errors.New("must be of the form v1.2.3"), + }, + } + } + t = cv + } + *s = t + return *s, nil +} + +func modulePathMajor(path string) (string, error) { + _, major, ok := module.SplitPathVersion(path) + if !ok { + return "", fmt.Errorf("invalid module path") + } + return major, nil +} + +func (f *File) Format() ([]byte, error) { + return Format(f.Syntax), nil +} + +// Cleanup cleans up the file f after any edit operations. +// To avoid quadratic behavior, modifications like [File.DropRequire] +// clear the entry but do not remove it from the slice. +// Cleanup cleans out all the cleared entries. +func (f *File) Cleanup() { + w := 0 + for _, g := range f.Godebug { + if g.Key != "" { + f.Godebug[w] = g + w++ + } + } + f.Godebug = f.Godebug[:w] + + w = 0 + for _, r := range f.Require { + if r.Mod.Path != "" { + f.Require[w] = r + w++ + } + } + f.Require = f.Require[:w] + + w = 0 + for _, x := range f.Exclude { + if x.Mod.Path != "" { + f.Exclude[w] = x + w++ + } + } + f.Exclude = f.Exclude[:w] + + w = 0 + for _, r := range f.Replace { + if r.Old.Path != "" { + f.Replace[w] = r + w++ + } + } + f.Replace = f.Replace[:w] + + w = 0 + for _, r := range f.Retract { + if r.Low != "" || r.High != "" { + f.Retract[w] = r + w++ + } + } + f.Retract = f.Retract[:w] + + f.Syntax.Cleanup() +} + +func (f *File) AddGoStmt(version string) error { + if !GoVersionRE.MatchString(version) { + return fmt.Errorf("invalid language version %q", version) + } + if f.Go == nil { + var hint Expr + if f.Module != nil && f.Module.Syntax != nil { + hint = f.Module.Syntax + } else if f.Syntax == nil { + f.Syntax = new(FileSyntax) + } + f.Go = &Go{ + Version: version, + Syntax: f.Syntax.addLine(hint, "go", version), + } + } else { + f.Go.Version = version + f.Syntax.updateLine(f.Go.Syntax, "go", version) + } + return nil +} + +// DropGoStmt deletes the go statement from the file. +func (f *File) DropGoStmt() { + if f.Go != nil { + f.Go.Syntax.markRemoved() + f.Go = nil + } +} + +// DropToolchainStmt deletes the toolchain statement from the file. +func (f *File) DropToolchainStmt() { + if f.Toolchain != nil { + f.Toolchain.Syntax.markRemoved() + f.Toolchain = nil + } +} + +func (f *File) AddToolchainStmt(name string) error { + if !ToolchainRE.MatchString(name) { + return fmt.Errorf("invalid toolchain name %q", name) + } + if f.Toolchain == nil { + var hint Expr + if f.Go != nil && f.Go.Syntax != nil { + hint = f.Go.Syntax + } else if f.Module != nil && f.Module.Syntax != nil { + hint = f.Module.Syntax + } + f.Toolchain = &Toolchain{ + Name: name, + Syntax: f.Syntax.addLine(hint, "toolchain", name), + } + } else { + f.Toolchain.Name = name + f.Syntax.updateLine(f.Toolchain.Syntax, "toolchain", name) + } + return nil +} + +// AddGodebug sets the first godebug line for key to value, +// preserving any existing comments for that line and removing all +// other godebug lines for key. +// +// If no line currently exists for key, AddGodebug adds a new line +// at the end of the last godebug block. +func (f *File) AddGodebug(key, value string) error { + need := true + for _, g := range f.Godebug { + if g.Key == key { + if need { + g.Value = value + f.Syntax.updateLine(g.Syntax, "godebug", key+"="+value) + need = false + } else { + g.Syntax.markRemoved() + *g = Godebug{} + } + } + } + + if need { + f.addNewGodebug(key, value) + } + return nil +} + +// addNewGodebug adds a new godebug key=value line at the end +// of the last godebug block, regardless of any existing godebug lines for key. +func (f *File) addNewGodebug(key, value string) { + line := f.Syntax.addLine(nil, "godebug", key+"="+value) + g := &Godebug{ + Key: key, + Value: value, + Syntax: line, + } + f.Godebug = append(f.Godebug, g) +} + +// AddRequire sets the first require line for path to version vers, +// preserving any existing comments for that line and removing all +// other lines for path. +// +// If no line currently exists for path, AddRequire adds a new line +// at the end of the last require block. +func (f *File) AddRequire(path, vers string) error { + need := true + for _, r := range f.Require { + if r.Mod.Path == path { + if need { + r.Mod.Version = vers + f.Syntax.updateLine(r.Syntax, "require", AutoQuote(path), vers) + need = false + } else { + r.Syntax.markRemoved() + *r = Require{} + } + } + } + + if need { + f.AddNewRequire(path, vers, false) + } + return nil +} + +// AddNewRequire adds a new require line for path at version vers at the end of +// the last require block, regardless of any existing require lines for path. +func (f *File) AddNewRequire(path, vers string, indirect bool) { + line := f.Syntax.addLine(nil, "require", AutoQuote(path), vers) + r := &Require{ + Mod: module.Version{Path: path, Version: vers}, + Syntax: line, + } + r.setIndirect(indirect) + f.Require = append(f.Require, r) +} + +// SetRequire updates the requirements of f to contain exactly req, preserving +// the existing block structure and line comment contents (except for 'indirect' +// markings) for the first requirement on each named module path. +// +// The Syntax field is ignored for the requirements in req. +// +// Any requirements not already present in the file are added to the block +// containing the last require line. +// +// The requirements in req must specify at most one distinct version for each +// module path. +// +// If any existing requirements may be removed, the caller should call +// [File.Cleanup] after all edits are complete. +func (f *File) SetRequire(req []*Require) { + type elem struct { + version string + indirect bool + } + need := make(map[string]elem) + for _, r := range req { + if prev, dup := need[r.Mod.Path]; dup && prev.version != r.Mod.Version { + panic(fmt.Errorf("SetRequire called with conflicting versions for path %s (%s and %s)", r.Mod.Path, prev.version, r.Mod.Version)) + } + need[r.Mod.Path] = elem{r.Mod.Version, r.Indirect} + } + + // Update or delete the existing Require entries to preserve + // only the first for each module path in req. + for _, r := range f.Require { + e, ok := need[r.Mod.Path] + if ok { + r.setVersion(e.version) + r.setIndirect(e.indirect) + } else { + r.markRemoved() + } + delete(need, r.Mod.Path) + } + + // Add new entries in the last block of the file for any paths that weren't + // already present. + // + // This step is nondeterministic, but the final result will be deterministic + // because we will sort the block. + for path, e := range need { + f.AddNewRequire(path, e.version, e.indirect) + } + + f.SortBlocks() +} + +// SetRequireSeparateIndirect updates the requirements of f to contain the given +// requirements. Comment contents (except for 'indirect' markings) are retained +// from the first existing requirement for each module path. Like SetRequire, +// SetRequireSeparateIndirect adds requirements for new paths in req, +// updates the version and "// indirect" comment on existing requirements, +// and deletes requirements on paths not in req. Existing duplicate requirements +// are deleted. +// +// As its name suggests, SetRequireSeparateIndirect puts direct and indirect +// requirements into two separate blocks, one containing only direct +// requirements, and the other containing only indirect requirements. +// SetRequireSeparateIndirect may move requirements between these two blocks +// when their indirect markings change. However, SetRequireSeparateIndirect +// won't move requirements from other blocks, especially blocks with comments. +// +// If the file initially has one uncommented block of requirements, +// SetRequireSeparateIndirect will split it into a direct-only and indirect-only +// block. This aids in the transition to separate blocks. +func (f *File) SetRequireSeparateIndirect(req []*Require) { + // hasComments returns whether a line or block has comments + // other than "indirect". + hasComments := func(c Comments) bool { + return len(c.Before) > 0 || len(c.After) > 0 || len(c.Suffix) > 1 || + (len(c.Suffix) == 1 && + strings.TrimSpace(strings.TrimPrefix(c.Suffix[0].Token, string(slashSlash))) != "indirect") + } + + // moveReq adds r to block. If r was in another block, moveReq deletes + // it from that block and transfers its comments. + moveReq := func(r *Require, block *LineBlock) { + var line *Line + if r.Syntax == nil { + line = &Line{Token: []string{AutoQuote(r.Mod.Path), r.Mod.Version}} + r.Syntax = line + if r.Indirect { + r.setIndirect(true) + } + } else { + line = new(Line) + *line = *r.Syntax + if !line.InBlock && len(line.Token) > 0 && line.Token[0] == "require" { + line.Token = line.Token[1:] + } + r.Syntax.Token = nil // Cleanup will delete the old line. + r.Syntax = line + } + line.InBlock = true + block.Line = append(block.Line, line) + } + + // Examine existing require lines and blocks. + var ( + // We may insert new requirements into the last uncommented + // direct-only and indirect-only blocks. We may also move requirements + // to the opposite block if their indirect markings change. + lastDirectIndex = -1 + lastIndirectIndex = -1 + + // If there are no direct-only or indirect-only blocks, a new block may + // be inserted after the last require line or block. + lastRequireIndex = -1 + + // If there's only one require line or block, and it's uncommented, + // we'll move its requirements to the direct-only or indirect-only blocks. + requireLineOrBlockCount = 0 + + // Track the block each requirement belongs to (if any) so we can + // move them later. + lineToBlock = make(map[*Line]*LineBlock) + ) + for i, stmt := range f.Syntax.Stmt { + switch stmt := stmt.(type) { + case *Line: + if len(stmt.Token) == 0 || stmt.Token[0] != "require" { + continue + } + lastRequireIndex = i + requireLineOrBlockCount++ + if !hasComments(stmt.Comments) { + if isIndirect(stmt) { + lastIndirectIndex = i + } else { + lastDirectIndex = i + } + } + + case *LineBlock: + if len(stmt.Token) == 0 || stmt.Token[0] != "require" { + continue + } + lastRequireIndex = i + requireLineOrBlockCount++ + allDirect := len(stmt.Line) > 0 && !hasComments(stmt.Comments) + allIndirect := len(stmt.Line) > 0 && !hasComments(stmt.Comments) + for _, line := range stmt.Line { + lineToBlock[line] = stmt + if hasComments(line.Comments) { + allDirect = false + allIndirect = false + } else if isIndirect(line) { + allDirect = false + } else { + allIndirect = false + } + } + if allDirect { + lastDirectIndex = i + } + if allIndirect { + lastIndirectIndex = i + } + } + } + + oneFlatUncommentedBlock := requireLineOrBlockCount == 1 && + !hasComments(*f.Syntax.Stmt[lastRequireIndex].Comment()) + + // Create direct and indirect blocks if needed. Convert lines into blocks + // if needed. If we end up with an empty block or a one-line block, + // Cleanup will delete it or convert it to a line later. + insertBlock := func(i int) *LineBlock { + block := &LineBlock{Token: []string{"require"}} + f.Syntax.Stmt = append(f.Syntax.Stmt, nil) + copy(f.Syntax.Stmt[i+1:], f.Syntax.Stmt[i:]) + f.Syntax.Stmt[i] = block + return block + } + + ensureBlock := func(i int) *LineBlock { + switch stmt := f.Syntax.Stmt[i].(type) { + case *LineBlock: + return stmt + case *Line: + block := &LineBlock{ + Token: []string{"require"}, + Line: []*Line{stmt}, + } + stmt.Token = stmt.Token[1:] // remove "require" + stmt.InBlock = true + f.Syntax.Stmt[i] = block + return block + default: + panic(fmt.Sprintf("unexpected statement: %v", stmt)) + } + } + + var lastDirectBlock *LineBlock + if lastDirectIndex < 0 { + if lastIndirectIndex >= 0 { + lastDirectIndex = lastIndirectIndex + lastIndirectIndex++ + } else if lastRequireIndex >= 0 { + lastDirectIndex = lastRequireIndex + 1 + } else { + lastDirectIndex = len(f.Syntax.Stmt) + } + lastDirectBlock = insertBlock(lastDirectIndex) + } else { + lastDirectBlock = ensureBlock(lastDirectIndex) + } + + var lastIndirectBlock *LineBlock + if lastIndirectIndex < 0 { + lastIndirectIndex = lastDirectIndex + 1 + lastIndirectBlock = insertBlock(lastIndirectIndex) + } else { + lastIndirectBlock = ensureBlock(lastIndirectIndex) + } + + // Delete requirements we don't want anymore. + // Update versions and indirect comments on requirements we want to keep. + // If a requirement is in last{Direct,Indirect}Block with the wrong + // indirect marking after this, or if the requirement is in an single + // uncommented mixed block (oneFlatUncommentedBlock), move it to the + // correct block. + // + // Some blocks may be empty after this. Cleanup will remove them. + need := make(map[string]*Require) + for _, r := range req { + need[r.Mod.Path] = r + } + have := make(map[string]*Require) + for _, r := range f.Require { + path := r.Mod.Path + if need[path] == nil || have[path] != nil { + // Requirement not needed, or duplicate requirement. Delete. + r.markRemoved() + continue + } + have[r.Mod.Path] = r + r.setVersion(need[path].Mod.Version) + r.setIndirect(need[path].Indirect) + if need[path].Indirect && + (oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastDirectBlock) { + moveReq(r, lastIndirectBlock) + } else if !need[path].Indirect && + (oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastIndirectBlock) { + moveReq(r, lastDirectBlock) + } + } + + // Add new requirements. + for path, r := range need { + if have[path] == nil { + if r.Indirect { + moveReq(r, lastIndirectBlock) + } else { + moveReq(r, lastDirectBlock) + } + f.Require = append(f.Require, r) + } + } + + f.SortBlocks() +} + +func (f *File) DropGodebug(key string) error { + for _, g := range f.Godebug { + if g.Key == key { + g.Syntax.markRemoved() + *g = Godebug{} + } + } + return nil +} + +func (f *File) DropRequire(path string) error { + for _, r := range f.Require { + if r.Mod.Path == path { + r.Syntax.markRemoved() + *r = Require{} + } + } + return nil +} + +// AddExclude adds a exclude statement to the mod file. Errors if the provided +// version is not a canonical version string +func (f *File) AddExclude(path, vers string) error { + if err := checkCanonicalVersion(path, vers); err != nil { + return err + } + + var hint *Line + for _, x := range f.Exclude { + if x.Mod.Path == path && x.Mod.Version == vers { + return nil + } + if x.Mod.Path == path { + hint = x.Syntax + } + } + + f.Exclude = append(f.Exclude, &Exclude{Mod: module.Version{Path: path, Version: vers}, Syntax: f.Syntax.addLine(hint, "exclude", AutoQuote(path), vers)}) + return nil +} + +func (f *File) DropExclude(path, vers string) error { + for _, x := range f.Exclude { + if x.Mod.Path == path && x.Mod.Version == vers { + x.Syntax.markRemoved() + *x = Exclude{} + } + } + return nil +} + +func (f *File) AddReplace(oldPath, oldVers, newPath, newVers string) error { + return addReplace(f.Syntax, &f.Replace, oldPath, oldVers, newPath, newVers) +} + +func addReplace(syntax *FileSyntax, replace *[]*Replace, oldPath, oldVers, newPath, newVers string) error { + need := true + old := module.Version{Path: oldPath, Version: oldVers} + new := module.Version{Path: newPath, Version: newVers} + tokens := []string{"replace", AutoQuote(oldPath)} + if oldVers != "" { + tokens = append(tokens, oldVers) + } + tokens = append(tokens, "=>", AutoQuote(newPath)) + if newVers != "" { + tokens = append(tokens, newVers) + } + + var hint *Line + for _, r := range *replace { + if r.Old.Path == oldPath && (oldVers == "" || r.Old.Version == oldVers) { + if need { + // Found replacement for old; update to use new. + r.New = new + syntax.updateLine(r.Syntax, tokens...) + need = false + continue + } + // Already added; delete other replacements for same. + r.Syntax.markRemoved() + *r = Replace{} + } + if r.Old.Path == oldPath { + hint = r.Syntax + } + } + if need { + *replace = append(*replace, &Replace{Old: old, New: new, Syntax: syntax.addLine(hint, tokens...)}) + } + return nil +} + +func (f *File) DropReplace(oldPath, oldVers string) error { + for _, r := range f.Replace { + if r.Old.Path == oldPath && r.Old.Version == oldVers { + r.Syntax.markRemoved() + *r = Replace{} + } + } + return nil +} + +// AddRetract adds a retract statement to the mod file. Errors if the provided +// version interval does not consist of canonical version strings +func (f *File) AddRetract(vi VersionInterval, rationale string) error { + var path string + if f.Module != nil { + path = f.Module.Mod.Path + } + if err := checkCanonicalVersion(path, vi.High); err != nil { + return err + } + if err := checkCanonicalVersion(path, vi.Low); err != nil { + return err + } + + r := &Retract{ + VersionInterval: vi, + } + if vi.Low == vi.High { + r.Syntax = f.Syntax.addLine(nil, "retract", AutoQuote(vi.Low)) + } else { + r.Syntax = f.Syntax.addLine(nil, "retract", "[", AutoQuote(vi.Low), ",", AutoQuote(vi.High), "]") + } + if rationale != "" { + for _, line := range strings.Split(rationale, "\n") { + com := Comment{Token: "// " + line} + r.Syntax.Comment().Before = append(r.Syntax.Comment().Before, com) + } + } + return nil +} + +func (f *File) DropRetract(vi VersionInterval) error { + for _, r := range f.Retract { + if r.VersionInterval == vi { + r.Syntax.markRemoved() + *r = Retract{} + } + } + return nil +} + +// AddTool adds a new tool directive with the given path. +// It does nothing if the tool line already exists. +func (f *File) AddTool(path string) error { + for _, t := range f.Tool { + if t.Path == path { + return nil + } + } + + f.Tool = append(f.Tool, &Tool{ + Path: path, + Syntax: f.Syntax.addLine(nil, "tool", path), + }) + + f.SortBlocks() + return nil +} + +// RemoveTool removes a tool directive with the given path. +// It does nothing if no such tool directive exists. +func (f *File) DropTool(path string) error { + for _, t := range f.Tool { + if t.Path == path { + t.Syntax.markRemoved() + *t = Tool{} + } + } + return nil +} + +func (f *File) SortBlocks() { + f.removeDups() // otherwise sorting is unsafe + + // semanticSortForExcludeVersionV is the Go version (plus leading "v") at which + // lines in exclude blocks start to use semantic sort instead of lexicographic sort. + // See go.dev/issue/60028. + const semanticSortForExcludeVersionV = "v1.21" + useSemanticSortForExclude := f.Go != nil && semver.Compare("v"+f.Go.Version, semanticSortForExcludeVersionV) >= 0 + + for _, stmt := range f.Syntax.Stmt { + block, ok := stmt.(*LineBlock) + if !ok { + continue + } + less := lineLess + if block.Token[0] == "exclude" && useSemanticSortForExclude { + less = lineExcludeLess + } else if block.Token[0] == "retract" { + less = lineRetractLess + } + sort.SliceStable(block.Line, func(i, j int) bool { + return less(block.Line[i], block.Line[j]) + }) + } +} + +// removeDups removes duplicate exclude, replace and tool directives. +// +// Earlier exclude and tool directives take priority. +// +// Later replace directives take priority. +// +// require directives are not de-duplicated. That's left up to higher-level +// logic (MVS). +// +// retract directives are not de-duplicated since comments are +// meaningful, and versions may be retracted multiple times. +func (f *File) removeDups() { + removeDups(f.Syntax, &f.Exclude, &f.Replace, &f.Tool) +} + +func removeDups(syntax *FileSyntax, exclude *[]*Exclude, replace *[]*Replace, tool *[]*Tool) { + kill := make(map[*Line]bool) + + // Remove duplicate excludes. + if exclude != nil { + haveExclude := make(map[module.Version]bool) + for _, x := range *exclude { + if haveExclude[x.Mod] { + kill[x.Syntax] = true + continue + } + haveExclude[x.Mod] = true + } + var excl []*Exclude + for _, x := range *exclude { + if !kill[x.Syntax] { + excl = append(excl, x) + } + } + *exclude = excl + } + + // Remove duplicate replacements. + // Later replacements take priority over earlier ones. + haveReplace := make(map[module.Version]bool) + for i := len(*replace) - 1; i >= 0; i-- { + x := (*replace)[i] + if haveReplace[x.Old] { + kill[x.Syntax] = true + continue + } + haveReplace[x.Old] = true + } + var repl []*Replace + for _, x := range *replace { + if !kill[x.Syntax] { + repl = append(repl, x) + } + } + *replace = repl + + if tool != nil { + haveTool := make(map[string]bool) + for _, t := range *tool { + if haveTool[t.Path] { + kill[t.Syntax] = true + continue + } + haveTool[t.Path] = true + } + var newTool []*Tool + for _, t := range *tool { + if !kill[t.Syntax] { + newTool = append(newTool, t) + } + } + *tool = newTool + } + + // Duplicate require and retract directives are not removed. + + // Drop killed statements from the syntax tree. + var stmts []Expr + for _, stmt := range syntax.Stmt { + switch stmt := stmt.(type) { + case *Line: + if kill[stmt] { + continue + } + case *LineBlock: + var lines []*Line + for _, line := range stmt.Line { + if !kill[line] { + lines = append(lines, line) + } + } + stmt.Line = lines + if len(lines) == 0 { + continue + } + } + stmts = append(stmts, stmt) + } + syntax.Stmt = stmts +} + +// lineLess returns whether li should be sorted before lj. It sorts +// lexicographically without assigning any special meaning to tokens. +func lineLess(li, lj *Line) bool { + for k := 0; k < len(li.Token) && k < len(lj.Token); k++ { + if li.Token[k] != lj.Token[k] { + return li.Token[k] < lj.Token[k] + } + } + return len(li.Token) < len(lj.Token) +} + +// lineExcludeLess reports whether li should be sorted before lj for lines in +// an "exclude" block. +func lineExcludeLess(li, lj *Line) bool { + if len(li.Token) != 2 || len(lj.Token) != 2 { + // Not a known exclude specification. + // Fall back to sorting lexicographically. + return lineLess(li, lj) + } + // An exclude specification has two tokens: ModulePath and Version. + // Compare module path by string order and version by semver rules. + if pi, pj := li.Token[0], lj.Token[0]; pi != pj { + return pi < pj + } + return semver.Compare(li.Token[1], lj.Token[1]) < 0 +} + +// lineRetractLess returns whether li should be sorted before lj for lines in +// a "retract" block. It treats each line as a version interval. Single versions +// are compared as if they were intervals with the same low and high version. +// Intervals are sorted in descending order, first by low version, then by +// high version, using semver.Compare. +func lineRetractLess(li, lj *Line) bool { + interval := func(l *Line) VersionInterval { + if len(l.Token) == 1 { + return VersionInterval{Low: l.Token[0], High: l.Token[0]} + } else if len(l.Token) == 5 && l.Token[0] == "[" && l.Token[2] == "," && l.Token[4] == "]" { + return VersionInterval{Low: l.Token[1], High: l.Token[3]} + } else { + // Line in unknown format. Treat as an invalid version. + return VersionInterval{} + } + } + vii := interval(li) + vij := interval(lj) + if cmp := semver.Compare(vii.Low, vij.Low); cmp != 0 { + return cmp > 0 + } + return semver.Compare(vii.High, vij.High) > 0 +} + +// checkCanonicalVersion returns a non-nil error if vers is not a canonical +// version string or does not match the major version of path. +// +// If path is non-empty, the error text suggests a format with a major version +// corresponding to the path. +func checkCanonicalVersion(path, vers string) error { + _, pathMajor, pathMajorOk := module.SplitPathVersion(path) + + if vers == "" || vers != module.CanonicalVersion(vers) { + if pathMajor == "" { + return &module.InvalidVersionError{ + Version: vers, + Err: fmt.Errorf("must be of the form v1.2.3"), + } + } + return &module.InvalidVersionError{ + Version: vers, + Err: fmt.Errorf("must be of the form %s.2.3", module.PathMajorPrefix(pathMajor)), + } + } + + if pathMajorOk { + if err := module.CheckPathMajor(vers, pathMajor); err != nil { + if pathMajor == "" { + // In this context, the user probably wrote "v2.3.4" when they meant + // "v2.3.4+incompatible". Suggest that instead of "v0 or v1". + return &module.InvalidVersionError{ + Version: vers, + Err: fmt.Errorf("should be %s+incompatible (or module %s/%v)", vers, path, semver.Major(vers)), + } + } + return err + } + } + + return nil +} diff --git a/vendor/golang.org/x/mod/modfile/work.go b/vendor/golang.org/x/mod/modfile/work.go new file mode 100644 index 0000000000..5387d0c265 --- /dev/null +++ b/vendor/golang.org/x/mod/modfile/work.go @@ -0,0 +1,335 @@ +// Copyright 2021 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 modfile + +import ( + "fmt" + "sort" + "strings" +) + +// A WorkFile is the parsed, interpreted form of a go.work file. +type WorkFile struct { + Go *Go + Toolchain *Toolchain + Godebug []*Godebug + Use []*Use + Replace []*Replace + + Syntax *FileSyntax +} + +// A Use is a single directory statement. +type Use struct { + Path string // Use path of module. + ModulePath string // Module path in the comment. + Syntax *Line +} + +// ParseWork parses and returns a go.work file. +// +// file is the name of the file, used in positions and errors. +// +// data is the content of the file. +// +// fix is an optional function that canonicalizes module versions. +// If fix is nil, all module versions must be canonical ([module.CanonicalVersion] +// must return the same string). +func ParseWork(file string, data []byte, fix VersionFixer) (*WorkFile, error) { + fs, err := parse(file, data) + if err != nil { + return nil, err + } + f := &WorkFile{ + Syntax: fs, + } + var errs ErrorList + + for _, x := range fs.Stmt { + switch x := x.(type) { + case *Line: + f.add(&errs, x, x.Token[0], x.Token[1:], fix) + + case *LineBlock: + if len(x.Token) > 1 { + errs = append(errs, Error{ + Filename: file, + Pos: x.Start, + Err: fmt.Errorf("unknown block type: %s", strings.Join(x.Token, " ")), + }) + continue + } + switch x.Token[0] { + default: + errs = append(errs, Error{ + Filename: file, + Pos: x.Start, + Err: fmt.Errorf("unknown block type: %s", strings.Join(x.Token, " ")), + }) + continue + case "godebug", "use", "replace": + for _, l := range x.Line { + f.add(&errs, l, x.Token[0], l.Token, fix) + } + } + } + } + + if len(errs) > 0 { + return nil, errs + } + return f, nil +} + +// Cleanup cleans up the file f after any edit operations. +// To avoid quadratic behavior, modifications like [WorkFile.DropRequire] +// clear the entry but do not remove it from the slice. +// Cleanup cleans out all the cleared entries. +func (f *WorkFile) Cleanup() { + w := 0 + for _, r := range f.Use { + if r.Path != "" { + f.Use[w] = r + w++ + } + } + f.Use = f.Use[:w] + + w = 0 + for _, r := range f.Replace { + if r.Old.Path != "" { + f.Replace[w] = r + w++ + } + } + f.Replace = f.Replace[:w] + + f.Syntax.Cleanup() +} + +func (f *WorkFile) AddGoStmt(version string) error { + if !GoVersionRE.MatchString(version) { + return fmt.Errorf("invalid language version %q", version) + } + if f.Go == nil { + stmt := &Line{Token: []string{"go", version}} + f.Go = &Go{ + Version: version, + Syntax: stmt, + } + // Find the first non-comment-only block and add + // the go statement before it. That will keep file comments at the top. + i := 0 + for i = 0; i < len(f.Syntax.Stmt); i++ { + if _, ok := f.Syntax.Stmt[i].(*CommentBlock); !ok { + break + } + } + f.Syntax.Stmt = append(append(f.Syntax.Stmt[:i:i], stmt), f.Syntax.Stmt[i:]...) + } else { + f.Go.Version = version + f.Syntax.updateLine(f.Go.Syntax, "go", version) + } + return nil +} + +func (f *WorkFile) AddToolchainStmt(name string) error { + if !ToolchainRE.MatchString(name) { + return fmt.Errorf("invalid toolchain name %q", name) + } + if f.Toolchain == nil { + stmt := &Line{Token: []string{"toolchain", name}} + f.Toolchain = &Toolchain{ + Name: name, + Syntax: stmt, + } + // Find the go line and add the toolchain line after it. + // Or else find the first non-comment-only block and add + // the toolchain line before it. That will keep file comments at the top. + i := 0 + for i = 0; i < len(f.Syntax.Stmt); i++ { + if line, ok := f.Syntax.Stmt[i].(*Line); ok && len(line.Token) > 0 && line.Token[0] == "go" { + i++ + goto Found + } + } + for i = 0; i < len(f.Syntax.Stmt); i++ { + if _, ok := f.Syntax.Stmt[i].(*CommentBlock); !ok { + break + } + } + Found: + f.Syntax.Stmt = append(append(f.Syntax.Stmt[:i:i], stmt), f.Syntax.Stmt[i:]...) + } else { + f.Toolchain.Name = name + f.Syntax.updateLine(f.Toolchain.Syntax, "toolchain", name) + } + return nil +} + +// DropGoStmt deletes the go statement from the file. +func (f *WorkFile) DropGoStmt() { + if f.Go != nil { + f.Go.Syntax.markRemoved() + f.Go = nil + } +} + +// DropToolchainStmt deletes the toolchain statement from the file. +func (f *WorkFile) DropToolchainStmt() { + if f.Toolchain != nil { + f.Toolchain.Syntax.markRemoved() + f.Toolchain = nil + } +} + +// AddGodebug sets the first godebug line for key to value, +// preserving any existing comments for that line and removing all +// other godebug lines for key. +// +// If no line currently exists for key, AddGodebug adds a new line +// at the end of the last godebug block. +func (f *WorkFile) AddGodebug(key, value string) error { + need := true + for _, g := range f.Godebug { + if g.Key == key { + if need { + g.Value = value + f.Syntax.updateLine(g.Syntax, "godebug", key+"="+value) + need = false + } else { + g.Syntax.markRemoved() + *g = Godebug{} + } + } + } + + if need { + f.addNewGodebug(key, value) + } + return nil +} + +// addNewGodebug adds a new godebug key=value line at the end +// of the last godebug block, regardless of any existing godebug lines for key. +func (f *WorkFile) addNewGodebug(key, value string) { + line := f.Syntax.addLine(nil, "godebug", key+"="+value) + g := &Godebug{ + Key: key, + Value: value, + Syntax: line, + } + f.Godebug = append(f.Godebug, g) +} + +func (f *WorkFile) DropGodebug(key string) error { + for _, g := range f.Godebug { + if g.Key == key { + g.Syntax.markRemoved() + *g = Godebug{} + } + } + return nil +} + +func (f *WorkFile) AddUse(diskPath, modulePath string) error { + need := true + for _, d := range f.Use { + if d.Path == diskPath { + if need { + d.ModulePath = modulePath + f.Syntax.updateLine(d.Syntax, "use", AutoQuote(diskPath)) + need = false + } else { + d.Syntax.markRemoved() + *d = Use{} + } + } + } + + if need { + f.AddNewUse(diskPath, modulePath) + } + return nil +} + +func (f *WorkFile) AddNewUse(diskPath, modulePath string) { + line := f.Syntax.addLine(nil, "use", AutoQuote(diskPath)) + f.Use = append(f.Use, &Use{Path: diskPath, ModulePath: modulePath, Syntax: line}) +} + +func (f *WorkFile) SetUse(dirs []*Use) { + need := make(map[string]string) + for _, d := range dirs { + need[d.Path] = d.ModulePath + } + + for _, d := range f.Use { + if modulePath, ok := need[d.Path]; ok { + d.ModulePath = modulePath + } else { + d.Syntax.markRemoved() + *d = Use{} + } + } + + // TODO(#45713): Add module path to comment. + + for diskPath, modulePath := range need { + f.AddNewUse(diskPath, modulePath) + } + f.SortBlocks() +} + +func (f *WorkFile) DropUse(path string) error { + for _, d := range f.Use { + if d.Path == path { + d.Syntax.markRemoved() + *d = Use{} + } + } + return nil +} + +func (f *WorkFile) AddReplace(oldPath, oldVers, newPath, newVers string) error { + return addReplace(f.Syntax, &f.Replace, oldPath, oldVers, newPath, newVers) +} + +func (f *WorkFile) DropReplace(oldPath, oldVers string) error { + for _, r := range f.Replace { + if r.Old.Path == oldPath && r.Old.Version == oldVers { + r.Syntax.markRemoved() + *r = Replace{} + } + } + return nil +} + +func (f *WorkFile) SortBlocks() { + f.removeDups() // otherwise sorting is unsafe + + for _, stmt := range f.Syntax.Stmt { + block, ok := stmt.(*LineBlock) + if !ok { + continue + } + sort.SliceStable(block.Line, func(i, j int) bool { + return lineLess(block.Line[i], block.Line[j]) + }) + } +} + +// removeDups removes duplicate replace directives. +// +// Later replace directives take priority. +// +// require directives are not de-duplicated. That's left up to higher-level +// logic (MVS). +// +// retract directives are not de-duplicated since comments are +// meaningful, and versions may be retracted multiple times. +func (f *WorkFile) removeDups() { + removeDups(f.Syntax, nil, &f.Replace, nil) +} diff --git a/vendor/golang.org/x/mod/module/module.go b/vendor/golang.org/x/mod/module/module.go new file mode 100644 index 0000000000..2a364b229b --- /dev/null +++ b/vendor/golang.org/x/mod/module/module.go @@ -0,0 +1,841 @@ +// Copyright 2018 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 module defines the module.Version type along with support code. +// +// The [module.Version] type is a simple Path, Version pair: +// +// type Version struct { +// Path string +// Version string +// } +// +// There are no restrictions imposed directly by use of this structure, +// but additional checking functions, most notably [Check], verify that +// a particular path, version pair is valid. +// +// # Escaped Paths +// +// Module paths appear as substrings of file system paths +// (in the download cache) and of web server URLs in the proxy protocol. +// In general we cannot rely on file systems to be case-sensitive, +// nor can we rely on web servers, since they read from file systems. +// That is, we cannot rely on the file system to keep rsc.io/QUOTE +// and rsc.io/quote separate. Windows and macOS don't. +// Instead, we must never require two different casings of a file path. +// Because we want the download cache to match the proxy protocol, +// and because we want the proxy protocol to be possible to serve +// from a tree of static files (which might be stored on a case-insensitive +// file system), the proxy protocol must never require two different casings +// of a URL path either. +// +// One possibility would be to make the escaped form be the lowercase +// hexadecimal encoding of the actual path bytes. This would avoid ever +// needing different casings of a file path, but it would be fairly illegible +// to most programmers when those paths appeared in the file system +// (including in file paths in compiler errors and stack traces) +// in web server logs, and so on. Instead, we want a safe escaped form that +// leaves most paths unaltered. +// +// The safe escaped form is to replace every uppercase letter +// with an exclamation mark followed by the letter's lowercase equivalent. +// +// For example, +// +// github.com/Azure/azure-sdk-for-go -> github.com/!azure/azure-sdk-for-go. +// github.com/GoogleCloudPlatform/cloudsql-proxy -> github.com/!google!cloud!platform/cloudsql-proxy +// github.com/Sirupsen/logrus -> github.com/!sirupsen/logrus. +// +// Import paths that avoid upper-case letters are left unchanged. +// Note that because import paths are ASCII-only and avoid various +// problematic punctuation (like : < and >), the escaped form is also ASCII-only +// and avoids the same problematic punctuation. +// +// Import paths have never allowed exclamation marks, so there is no +// need to define how to escape a literal !. +// +// # Unicode Restrictions +// +// Today, paths are disallowed from using Unicode. +// +// Although paths are currently disallowed from using Unicode, +// we would like at some point to allow Unicode letters as well, to assume that +// file systems and URLs are Unicode-safe (storing UTF-8), and apply +// the !-for-uppercase convention for escaping them in the file system. +// But there are at least two subtle considerations. +// +// First, note that not all case-fold equivalent distinct runes +// form an upper/lower pair. +// For example, U+004B ('K'), U+006B ('k'), and U+212A ('K' for Kelvin) +// are three distinct runes that case-fold to each other. +// When we do add Unicode letters, we must not assume that upper/lower +// are the only case-equivalent pairs. +// Perhaps the Kelvin symbol would be disallowed entirely, for example. +// Or perhaps it would escape as "!!k", or perhaps as "(212A)". +// +// Second, it would be nice to allow Unicode marks as well as letters, +// but marks include combining marks, and then we must deal not +// only with case folding but also normalization: both U+00E9 ('é') +// and U+0065 U+0301 ('e' followed by combining acute accent) +// look the same on the page and are treated by some file systems +// as the same path. If we do allow Unicode marks in paths, there +// must be some kind of normalization to allow only one canonical +// encoding of any character used in an import path. +package module + +// IMPORTANT NOTE +// +// This file essentially defines the set of valid import paths for the go command. +// There are many subtle considerations, including Unicode ambiguity, +// security, network, and file system representations. +// +// This file also defines the set of valid module path and version combinations, +// another topic with many subtle considerations. +// +// Changes to the semantics in this file require approval from rsc. + +import ( + "errors" + "fmt" + "path" + "sort" + "strings" + "unicode" + "unicode/utf8" + + "golang.org/x/mod/semver" +) + +// A Version (for clients, a module.Version) is defined by a module path and version pair. +// These are stored in their plain (unescaped) form. +type Version struct { + // Path is a module path, like "golang.org/x/text" or "rsc.io/quote/v2". + Path string + + // Version is usually a semantic version in canonical form. + // There are three exceptions to this general rule. + // First, the top-level target of a build has no specific version + // and uses Version = "". + // Second, during MVS calculations the version "none" is used + // to represent the decision to take no version of a given module. + // Third, filesystem paths found in "replace" directives are + // represented by a path with an empty version. + Version string `json:",omitempty"` +} + +// String returns a representation of the Version suitable for logging +// (Path@Version, or just Path if Version is empty). +func (m Version) String() string { + if m.Version == "" { + return m.Path + } + return m.Path + "@" + m.Version +} + +// A ModuleError indicates an error specific to a module. +type ModuleError struct { + Path string + Version string + Err error +} + +// VersionError returns a [ModuleError] derived from a [Version] and error, +// or err itself if it is already such an error. +func VersionError(v Version, err error) error { + var mErr *ModuleError + if errors.As(err, &mErr) && mErr.Path == v.Path && mErr.Version == v.Version { + return err + } + return &ModuleError{ + Path: v.Path, + Version: v.Version, + Err: err, + } +} + +func (e *ModuleError) Error() string { + if v, ok := e.Err.(*InvalidVersionError); ok { + return fmt.Sprintf("%s@%s: invalid %s: %v", e.Path, v.Version, v.noun(), v.Err) + } + if e.Version != "" { + return fmt.Sprintf("%s@%s: %v", e.Path, e.Version, e.Err) + } + return fmt.Sprintf("module %s: %v", e.Path, e.Err) +} + +func (e *ModuleError) Unwrap() error { return e.Err } + +// An InvalidVersionError indicates an error specific to a version, with the +// module path unknown or specified externally. +// +// A [ModuleError] may wrap an InvalidVersionError, but an InvalidVersionError +// must not wrap a ModuleError. +type InvalidVersionError struct { + Version string + Pseudo bool + Err error +} + +// noun returns either "version" or "pseudo-version", depending on whether +// e.Version is a pseudo-version. +func (e *InvalidVersionError) noun() string { + if e.Pseudo { + return "pseudo-version" + } + return "version" +} + +func (e *InvalidVersionError) Error() string { + return fmt.Sprintf("%s %q invalid: %s", e.noun(), e.Version, e.Err) +} + +func (e *InvalidVersionError) Unwrap() error { return e.Err } + +// An InvalidPathError indicates a module, import, or file path doesn't +// satisfy all naming constraints. See [CheckPath], [CheckImportPath], +// and [CheckFilePath] for specific restrictions. +type InvalidPathError struct { + Kind string // "module", "import", or "file" + Path string + Err error +} + +func (e *InvalidPathError) Error() string { + return fmt.Sprintf("malformed %s path %q: %v", e.Kind, e.Path, e.Err) +} + +func (e *InvalidPathError) Unwrap() error { return e.Err } + +// Check checks that a given module path, version pair is valid. +// In addition to the path being a valid module path +// and the version being a valid semantic version, +// the two must correspond. +// For example, the path "yaml/v2" only corresponds to +// semantic versions beginning with "v2.". +func Check(path, version string) error { + if err := CheckPath(path); err != nil { + return err + } + if !semver.IsValid(version) { + return &ModuleError{ + Path: path, + Err: &InvalidVersionError{Version: version, Err: errors.New("not a semantic version")}, + } + } + _, pathMajor, _ := SplitPathVersion(path) + if err := CheckPathMajor(version, pathMajor); err != nil { + return &ModuleError{Path: path, Err: err} + } + return nil +} + +// firstPathOK reports whether r can appear in the first element of a module path. +// The first element of the path must be an LDH domain name, at least for now. +// To avoid case ambiguity, the domain name must be entirely lower case. +func firstPathOK(r rune) bool { + return r == '-' || r == '.' || + '0' <= r && r <= '9' || + 'a' <= r && r <= 'z' +} + +// modPathOK reports whether r can appear in a module path element. +// Paths can be ASCII letters, ASCII digits, and limited ASCII punctuation: - . _ and ~. +// +// This matches what "go get" has historically recognized in import paths, +// and avoids confusing sequences like '%20' or '+' that would change meaning +// if used in a URL. +// +// TODO(rsc): We would like to allow Unicode letters, but that requires additional +// care in the safe encoding (see "escaped paths" above). +func modPathOK(r rune) bool { + if r < utf8.RuneSelf { + return r == '-' || r == '.' || r == '_' || r == '~' || + '0' <= r && r <= '9' || + 'A' <= r && r <= 'Z' || + 'a' <= r && r <= 'z' + } + return false +} + +// importPathOK reports whether r can appear in a package import path element. +// +// Import paths are intermediate between module paths and file paths: we allow +// disallow characters that would be confusing or ambiguous as arguments to +// 'go get' (such as '@' and ' ' ), but allow certain characters that are +// otherwise-unambiguous on the command line and historically used for some +// binary names (such as '++' as a suffix for compiler binaries and wrappers). +func importPathOK(r rune) bool { + return modPathOK(r) || r == '+' +} + +// fileNameOK reports whether r can appear in a file name. +// For now we allow all Unicode letters but otherwise limit to pathOK plus a few more punctuation characters. +// If we expand the set of allowed characters here, we have to +// work harder at detecting potential case-folding and normalization collisions. +// See note about "escaped paths" above. +func fileNameOK(r rune) bool { + if r < utf8.RuneSelf { + // Entire set of ASCII punctuation, from which we remove characters: + // ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ + // We disallow some shell special characters: " ' * < > ? ` | + // (Note that some of those are disallowed by the Windows file system as well.) + // We also disallow path separators / : and \ (fileNameOK is only called on path element characters). + // We allow spaces (U+0020) in file names. + const allowed = "!#$%&()+,-.=@[]^_{}~ " + if '0' <= r && r <= '9' || 'A' <= r && r <= 'Z' || 'a' <= r && r <= 'z' { + return true + } + return strings.ContainsRune(allowed, r) + } + // It may be OK to add more ASCII punctuation here, but only carefully. + // For example Windows disallows < > \, and macOS disallows :, so we must not allow those. + return unicode.IsLetter(r) +} + +// CheckPath checks that a module path is valid. +// A valid module path is a valid import path, as checked by [CheckImportPath], +// with three additional constraints. +// First, the leading path element (up to the first slash, if any), +// by convention a domain name, must contain only lower-case ASCII letters, +// ASCII digits, dots (U+002E), and dashes (U+002D); +// it must contain at least one dot and cannot start with a dash. +// Second, for a final path element of the form /vN, where N looks numeric +// (ASCII digits and dots) must not begin with a leading zero, must not be /v1, +// and must not contain any dots. For paths beginning with "gopkg.in/", +// this second requirement is replaced by a requirement that the path +// follow the gopkg.in server's conventions. +// Third, no path element may begin with a dot. +func CheckPath(path string) (err error) { + defer func() { + if err != nil { + err = &InvalidPathError{Kind: "module", Path: path, Err: err} + } + }() + + if err := checkPath(path, modulePath); err != nil { + return err + } + i := strings.Index(path, "/") + if i < 0 { + i = len(path) + } + if i == 0 { + return fmt.Errorf("leading slash") + } + if !strings.Contains(path[:i], ".") { + return fmt.Errorf("missing dot in first path element") + } + if path[0] == '-' { + return fmt.Errorf("leading dash in first path element") + } + for _, r := range path[:i] { + if !firstPathOK(r) { + return fmt.Errorf("invalid char %q in first path element", r) + } + } + if _, _, ok := SplitPathVersion(path); !ok { + return fmt.Errorf("invalid version") + } + return nil +} + +// CheckImportPath checks that an import path is valid. +// +// A valid import path consists of one or more valid path elements +// separated by slashes (U+002F). (It must not begin with nor end in a slash.) +// +// A valid path element is a non-empty string made up of +// ASCII letters, ASCII digits, and limited ASCII punctuation: - . _ and ~. +// It must not end with a dot (U+002E), nor contain two dots in a row. +// +// The element prefix up to the first dot must not be a reserved file name +// on Windows, regardless of case (CON, com1, NuL, and so on). The element +// must not have a suffix of a tilde followed by one or more ASCII digits +// (to exclude paths elements that look like Windows short-names). +// +// CheckImportPath may be less restrictive in the future, but see the +// top-level package documentation for additional information about +// subtleties of Unicode. +func CheckImportPath(path string) error { + if err := checkPath(path, importPath); err != nil { + return &InvalidPathError{Kind: "import", Path: path, Err: err} + } + return nil +} + +// pathKind indicates what kind of path we're checking. Module paths, +// import paths, and file paths have different restrictions. +type pathKind int + +const ( + modulePath pathKind = iota + importPath + filePath +) + +// checkPath checks that a general path is valid. kind indicates what +// specific constraints should be applied. +// +// checkPath returns an error describing why the path is not valid. +// Because these checks apply to module, import, and file paths, +// and because other checks may be applied, the caller is expected to wrap +// this error with [InvalidPathError]. +func checkPath(path string, kind pathKind) error { + if !utf8.ValidString(path) { + return fmt.Errorf("invalid UTF-8") + } + if path == "" { + return fmt.Errorf("empty string") + } + if path[0] == '-' && kind != filePath { + return fmt.Errorf("leading dash") + } + if strings.Contains(path, "//") { + return fmt.Errorf("double slash") + } + if path[len(path)-1] == '/' { + return fmt.Errorf("trailing slash") + } + elemStart := 0 + for i, r := range path { + if r == '/' { + if err := checkElem(path[elemStart:i], kind); err != nil { + return err + } + elemStart = i + 1 + } + } + if err := checkElem(path[elemStart:], kind); err != nil { + return err + } + return nil +} + +// checkElem checks whether an individual path element is valid. +func checkElem(elem string, kind pathKind) error { + if elem == "" { + return fmt.Errorf("empty path element") + } + if strings.Count(elem, ".") == len(elem) { + return fmt.Errorf("invalid path element %q", elem) + } + if elem[0] == '.' && kind == modulePath { + return fmt.Errorf("leading dot in path element") + } + if elem[len(elem)-1] == '.' { + return fmt.Errorf("trailing dot in path element") + } + for _, r := range elem { + ok := false + switch kind { + case modulePath: + ok = modPathOK(r) + case importPath: + ok = importPathOK(r) + case filePath: + ok = fileNameOK(r) + default: + panic(fmt.Sprintf("internal error: invalid kind %v", kind)) + } + if !ok { + return fmt.Errorf("invalid char %q", r) + } + } + + // Windows disallows a bunch of path elements, sadly. + // See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file + short := elem + if i := strings.Index(short, "."); i >= 0 { + short = short[:i] + } + for _, bad := range badWindowsNames { + if strings.EqualFold(bad, short) { + return fmt.Errorf("%q disallowed as path element component on Windows", short) + } + } + + if kind == filePath { + // don't check for Windows short-names in file names. They're + // only an issue for import paths. + return nil + } + + // Reject path components that look like Windows short-names. + // Those usually end in a tilde followed by one or more ASCII digits. + if tilde := strings.LastIndexByte(short, '~'); tilde >= 0 && tilde < len(short)-1 { + suffix := short[tilde+1:] + suffixIsDigits := true + for _, r := range suffix { + if r < '0' || r > '9' { + suffixIsDigits = false + break + } + } + if suffixIsDigits { + return fmt.Errorf("trailing tilde and digits in path element") + } + } + + return nil +} + +// CheckFilePath checks that a slash-separated file path is valid. +// The definition of a valid file path is the same as the definition +// of a valid import path except that the set of allowed characters is larger: +// all Unicode letters, ASCII digits, the ASCII space character (U+0020), +// and the ASCII punctuation characters +// “!#$%&()+,-.=@[]^_{}~”. +// (The excluded punctuation characters, " * < > ? ` ' | / \ and :, +// have special meanings in certain shells or operating systems.) +// +// CheckFilePath may be less restrictive in the future, but see the +// top-level package documentation for additional information about +// subtleties of Unicode. +func CheckFilePath(path string) error { + if err := checkPath(path, filePath); err != nil { + return &InvalidPathError{Kind: "file", Path: path, Err: err} + } + return nil +} + +// badWindowsNames are the reserved file path elements on Windows. +// See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file +var badWindowsNames = []string{ + "CON", + "PRN", + "AUX", + "NUL", + "COM1", + "COM2", + "COM3", + "COM4", + "COM5", + "COM6", + "COM7", + "COM8", + "COM9", + "LPT1", + "LPT2", + "LPT3", + "LPT4", + "LPT5", + "LPT6", + "LPT7", + "LPT8", + "LPT9", +} + +// SplitPathVersion returns prefix and major version such that prefix+pathMajor == path +// and version is either empty or "/vN" for N >= 2. +// As a special case, gopkg.in paths are recognized directly; +// they require ".vN" instead of "/vN", and for all N, not just N >= 2. +// SplitPathVersion returns with ok = false when presented with +// a path whose last path element does not satisfy the constraints +// applied by [CheckPath], such as "example.com/pkg/v1" or "example.com/pkg/v1.2". +func SplitPathVersion(path string) (prefix, pathMajor string, ok bool) { + if strings.HasPrefix(path, "gopkg.in/") { + return splitGopkgIn(path) + } + + i := len(path) + dot := false + for i > 0 && ('0' <= path[i-1] && path[i-1] <= '9' || path[i-1] == '.') { + if path[i-1] == '.' { + dot = true + } + i-- + } + if i <= 1 || i == len(path) || path[i-1] != 'v' || path[i-2] != '/' { + return path, "", true + } + prefix, pathMajor = path[:i-2], path[i-2:] + if dot || len(pathMajor) <= 2 || pathMajor[2] == '0' || pathMajor == "/v1" { + return path, "", false + } + return prefix, pathMajor, true +} + +// splitGopkgIn is like SplitPathVersion but only for gopkg.in paths. +func splitGopkgIn(path string) (prefix, pathMajor string, ok bool) { + if !strings.HasPrefix(path, "gopkg.in/") { + return path, "", false + } + i := len(path) + if strings.HasSuffix(path, "-unstable") { + i -= len("-unstable") + } + for i > 0 && ('0' <= path[i-1] && path[i-1] <= '9') { + i-- + } + if i <= 1 || path[i-1] != 'v' || path[i-2] != '.' { + // All gopkg.in paths must end in vN for some N. + return path, "", false + } + prefix, pathMajor = path[:i-2], path[i-2:] + if len(pathMajor) <= 2 || pathMajor[2] == '0' && pathMajor != ".v0" { + return path, "", false + } + return prefix, pathMajor, true +} + +// MatchPathMajor reports whether the semantic version v +// matches the path major version pathMajor. +// +// MatchPathMajor returns true if and only if [CheckPathMajor] returns nil. +func MatchPathMajor(v, pathMajor string) bool { + return CheckPathMajor(v, pathMajor) == nil +} + +// CheckPathMajor returns a non-nil error if the semantic version v +// does not match the path major version pathMajor. +func CheckPathMajor(v, pathMajor string) error { + // TODO(jayconrod): return errors or panic for invalid inputs. This function + // (and others) was covered by integration tests for cmd/go, and surrounding + // code protected against invalid inputs like non-canonical versions. + if strings.HasPrefix(pathMajor, ".v") && strings.HasSuffix(pathMajor, "-unstable") { + pathMajor = strings.TrimSuffix(pathMajor, "-unstable") + } + if strings.HasPrefix(v, "v0.0.0-") && pathMajor == ".v1" { + // Allow old bug in pseudo-versions that generated v0.0.0- pseudoversion for gopkg .v1. + // For example, gopkg.in/yaml.v2@v2.2.1's go.mod requires gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405. + return nil + } + m := semver.Major(v) + if pathMajor == "" { + if m == "v0" || m == "v1" || semver.Build(v) == "+incompatible" { + return nil + } + pathMajor = "v0 or v1" + } else if pathMajor[0] == '/' || pathMajor[0] == '.' { + if m == pathMajor[1:] { + return nil + } + pathMajor = pathMajor[1:] + } + return &InvalidVersionError{ + Version: v, + Err: fmt.Errorf("should be %s, not %s", pathMajor, semver.Major(v)), + } +} + +// PathMajorPrefix returns the major-version tag prefix implied by pathMajor. +// An empty PathMajorPrefix allows either v0 or v1. +// +// Note that [MatchPathMajor] may accept some versions that do not actually begin +// with this prefix: namely, it accepts a 'v0.0.0-' prefix for a '.v1' +// pathMajor, even though that pathMajor implies 'v1' tagging. +func PathMajorPrefix(pathMajor string) string { + if pathMajor == "" { + return "" + } + if pathMajor[0] != '/' && pathMajor[0] != '.' { + panic("pathMajor suffix " + pathMajor + " passed to PathMajorPrefix lacks separator") + } + if strings.HasPrefix(pathMajor, ".v") && strings.HasSuffix(pathMajor, "-unstable") { + pathMajor = strings.TrimSuffix(pathMajor, "-unstable") + } + m := pathMajor[1:] + if m != semver.Major(m) { + panic("pathMajor suffix " + pathMajor + "passed to PathMajorPrefix is not a valid major version") + } + return m +} + +// CanonicalVersion returns the canonical form of the version string v. +// It is the same as [semver.Canonical] except that it preserves the special build suffix "+incompatible". +func CanonicalVersion(v string) string { + cv := semver.Canonical(v) + if semver.Build(v) == "+incompatible" { + cv += "+incompatible" + } + return cv +} + +// Sort sorts the list by Path, breaking ties by comparing [Version] fields. +// The Version fields are interpreted as semantic versions (using [semver.Compare]) +// optionally followed by a tie-breaking suffix introduced by a slash character, +// like in "v0.0.1/go.mod". +func Sort(list []Version) { + sort.Slice(list, func(i, j int) bool { + mi := list[i] + mj := list[j] + if mi.Path != mj.Path { + return mi.Path < mj.Path + } + // To help go.sum formatting, allow version/file. + // Compare semver prefix by semver rules, + // file by string order. + vi := mi.Version + vj := mj.Version + var fi, fj string + if k := strings.Index(vi, "/"); k >= 0 { + vi, fi = vi[:k], vi[k:] + } + if k := strings.Index(vj, "/"); k >= 0 { + vj, fj = vj[:k], vj[k:] + } + if vi != vj { + return semver.Compare(vi, vj) < 0 + } + return fi < fj + }) +} + +// EscapePath returns the escaped form of the given module path. +// It fails if the module path is invalid. +func EscapePath(path string) (escaped string, err error) { + if err := CheckPath(path); err != nil { + return "", err + } + + return escapeString(path) +} + +// EscapeVersion returns the escaped form of the given module version. +// Versions are allowed to be in non-semver form but must be valid file names +// and not contain exclamation marks. +func EscapeVersion(v string) (escaped string, err error) { + if err := checkElem(v, filePath); err != nil || strings.Contains(v, "!") { + return "", &InvalidVersionError{ + Version: v, + Err: fmt.Errorf("disallowed version string"), + } + } + return escapeString(v) +} + +func escapeString(s string) (escaped string, err error) { + haveUpper := false + for _, r := range s { + if r == '!' || r >= utf8.RuneSelf { + // This should be disallowed by CheckPath, but diagnose anyway. + // The correctness of the escaping loop below depends on it. + return "", fmt.Errorf("internal error: inconsistency in EscapePath") + } + if 'A' <= r && r <= 'Z' { + haveUpper = true + } + } + + if !haveUpper { + return s, nil + } + + var buf []byte + for _, r := range s { + if 'A' <= r && r <= 'Z' { + buf = append(buf, '!', byte(r+'a'-'A')) + } else { + buf = append(buf, byte(r)) + } + } + return string(buf), nil +} + +// UnescapePath returns the module path for the given escaped path. +// It fails if the escaped path is invalid or describes an invalid path. +func UnescapePath(escaped string) (path string, err error) { + path, ok := unescapeString(escaped) + if !ok { + return "", fmt.Errorf("invalid escaped module path %q", escaped) + } + if err := CheckPath(path); err != nil { + return "", fmt.Errorf("invalid escaped module path %q: %v", escaped, err) + } + return path, nil +} + +// UnescapeVersion returns the version string for the given escaped version. +// It fails if the escaped form is invalid or describes an invalid version. +// Versions are allowed to be in non-semver form but must be valid file names +// and not contain exclamation marks. +func UnescapeVersion(escaped string) (v string, err error) { + v, ok := unescapeString(escaped) + if !ok { + return "", fmt.Errorf("invalid escaped version %q", escaped) + } + if err := checkElem(v, filePath); err != nil { + return "", fmt.Errorf("invalid escaped version %q: %v", v, err) + } + return v, nil +} + +func unescapeString(escaped string) (string, bool) { + var buf []byte + + bang := false + for _, r := range escaped { + if r >= utf8.RuneSelf { + return "", false + } + if bang { + bang = false + if r < 'a' || 'z' < r { + return "", false + } + buf = append(buf, byte(r+'A'-'a')) + continue + } + if r == '!' { + bang = true + continue + } + if 'A' <= r && r <= 'Z' { + return "", false + } + buf = append(buf, byte(r)) + } + if bang { + return "", false + } + return string(buf), true +} + +// MatchPrefixPatterns reports whether any path prefix of target matches one of +// the glob patterns (as defined by [path.Match]) in the comma-separated globs +// list. This implements the algorithm used when matching a module path to the +// GOPRIVATE environment variable, as described by 'go help module-private'. +// +// It ignores any empty or malformed patterns in the list. +// Trailing slashes on patterns are ignored. +func MatchPrefixPatterns(globs, target string) bool { + for globs != "" { + // Extract next non-empty glob in comma-separated list. + var glob string + if i := strings.Index(globs, ","); i >= 0 { + glob, globs = globs[:i], globs[i+1:] + } else { + glob, globs = globs, "" + } + glob = strings.TrimSuffix(glob, "/") + if glob == "" { + continue + } + + // A glob with N+1 path elements (N slashes) needs to be matched + // against the first N+1 path elements of target, + // which end just before the N+1'th slash. + n := strings.Count(glob, "/") + prefix := target + // Walk target, counting slashes, truncating at the N+1'th slash. + for i := 0; i < len(target); i++ { + if target[i] == '/' { + if n == 0 { + prefix = target[:i] + break + } + n-- + } + } + if n > 0 { + // Not enough prefix elements. + continue + } + matched, _ := path.Match(glob, prefix) + if matched { + return true + } + } + return false +} diff --git a/vendor/golang.org/x/mod/module/pseudo.go b/vendor/golang.org/x/mod/module/pseudo.go new file mode 100644 index 0000000000..9cf19d3254 --- /dev/null +++ b/vendor/golang.org/x/mod/module/pseudo.go @@ -0,0 +1,250 @@ +// Copyright 2018 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. + +// Pseudo-versions +// +// Code authors are expected to tag the revisions they want users to use, +// including prereleases. However, not all authors tag versions at all, +// and not all commits a user might want to try will have tags. +// A pseudo-version is a version with a special form that allows us to +// address an untagged commit and order that version with respect to +// other versions we might encounter. +// +// A pseudo-version takes one of the general forms: +// +// (1) vX.0.0-yyyymmddhhmmss-abcdef123456 +// (2) vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 +// (3) vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456+incompatible +// (4) vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456 +// (5) vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456+incompatible +// +// If there is no recently tagged version with the right major version vX, +// then form (1) is used, creating a space of pseudo-versions at the bottom +// of the vX version range, less than any tagged version, including the unlikely v0.0.0. +// +// If the most recent tagged version before the target commit is vX.Y.Z or vX.Y.Z+incompatible, +// then the pseudo-version uses form (2) or (3), making it a prerelease for the next +// possible semantic version after vX.Y.Z. The leading 0 segment in the prerelease string +// ensures that the pseudo-version compares less than possible future explicit prereleases +// like vX.Y.(Z+1)-rc1 or vX.Y.(Z+1)-1. +// +// If the most recent tagged version before the target commit is vX.Y.Z-pre or vX.Y.Z-pre+incompatible, +// then the pseudo-version uses form (4) or (5), making it a slightly later prerelease. + +package module + +import ( + "errors" + "fmt" + "strings" + "time" + + "golang.org/x/mod/internal/lazyregexp" + "golang.org/x/mod/semver" +) + +var pseudoVersionRE = lazyregexp.New(`^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$`) + +const PseudoVersionTimestampFormat = "20060102150405" + +// PseudoVersion returns a pseudo-version for the given major version ("v1") +// preexisting older tagged version ("" or "v1.2.3" or "v1.2.3-pre"), revision time, +// and revision identifier (usually a 12-byte commit hash prefix). +func PseudoVersion(major, older string, t time.Time, rev string) string { + if major == "" { + major = "v0" + } + segment := fmt.Sprintf("%s-%s", t.UTC().Format(PseudoVersionTimestampFormat), rev) + build := semver.Build(older) + older = semver.Canonical(older) + if older == "" { + return major + ".0.0-" + segment // form (1) + } + if semver.Prerelease(older) != "" { + return older + ".0." + segment + build // form (4), (5) + } + + // Form (2), (3). + // Extract patch from vMAJOR.MINOR.PATCH + i := strings.LastIndex(older, ".") + 1 + v, patch := older[:i], older[i:] + + // Reassemble. + return v + incDecimal(patch) + "-0." + segment + build +} + +// ZeroPseudoVersion returns a pseudo-version with a zero timestamp and +// revision, which may be used as a placeholder. +func ZeroPseudoVersion(major string) string { + return PseudoVersion(major, "", time.Time{}, "000000000000") +} + +// incDecimal returns the decimal string incremented by 1. +func incDecimal(decimal string) string { + // Scan right to left turning 9s to 0s until you find a digit to increment. + digits := []byte(decimal) + i := len(digits) - 1 + for ; i >= 0 && digits[i] == '9'; i-- { + digits[i] = '0' + } + if i >= 0 { + digits[i]++ + } else { + // digits is all zeros + digits[0] = '1' + digits = append(digits, '0') + } + return string(digits) +} + +// decDecimal returns the decimal string decremented by 1, or the empty string +// if the decimal is all zeroes. +func decDecimal(decimal string) string { + // Scan right to left turning 0s to 9s until you find a digit to decrement. + digits := []byte(decimal) + i := len(digits) - 1 + for ; i >= 0 && digits[i] == '0'; i-- { + digits[i] = '9' + } + if i < 0 { + // decimal is all zeros + return "" + } + if i == 0 && digits[i] == '1' && len(digits) > 1 { + digits = digits[1:] + } else { + digits[i]-- + } + return string(digits) +} + +// IsPseudoVersion reports whether v is a pseudo-version. +func IsPseudoVersion(v string) bool { + return strings.Count(v, "-") >= 2 && semver.IsValid(v) && pseudoVersionRE.MatchString(v) +} + +// IsZeroPseudoVersion returns whether v is a pseudo-version with a zero base, +// timestamp, and revision, as returned by [ZeroPseudoVersion]. +func IsZeroPseudoVersion(v string) bool { + return v == ZeroPseudoVersion(semver.Major(v)) +} + +// PseudoVersionTime returns the time stamp of the pseudo-version v. +// It returns an error if v is not a pseudo-version or if the time stamp +// embedded in the pseudo-version is not a valid time. +func PseudoVersionTime(v string) (time.Time, error) { + _, timestamp, _, _, err := parsePseudoVersion(v) + if err != nil { + return time.Time{}, err + } + t, err := time.Parse("20060102150405", timestamp) + if err != nil { + return time.Time{}, &InvalidVersionError{ + Version: v, + Pseudo: true, + Err: fmt.Errorf("malformed time %q", timestamp), + } + } + return t, nil +} + +// PseudoVersionRev returns the revision identifier of the pseudo-version v. +// It returns an error if v is not a pseudo-version. +func PseudoVersionRev(v string) (rev string, err error) { + _, _, rev, _, err = parsePseudoVersion(v) + return +} + +// PseudoVersionBase returns the canonical parent version, if any, upon which +// the pseudo-version v is based. +// +// If v has no parent version (that is, if it is "vX.0.0-[…]"), +// PseudoVersionBase returns the empty string and a nil error. +func PseudoVersionBase(v string) (string, error) { + base, _, _, build, err := parsePseudoVersion(v) + if err != nil { + return "", err + } + + switch pre := semver.Prerelease(base); pre { + case "": + // vX.0.0-yyyymmddhhmmss-abcdef123456 → "" + if build != "" { + // Pseudo-versions of the form vX.0.0-yyyymmddhhmmss-abcdef123456+incompatible + // are nonsensical: the "vX.0.0-" prefix implies that there is no parent tag, + // but the "+incompatible" suffix implies that the major version of + // the parent tag is not compatible with the module's import path. + // + // There are a few such entries in the index generated by proxy.golang.org, + // but we believe those entries were generated by the proxy itself. + return "", &InvalidVersionError{ + Version: v, + Pseudo: true, + Err: fmt.Errorf("lacks base version, but has build metadata %q", build), + } + } + return "", nil + + case "-0": + // vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 → vX.Y.Z + // vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456+incompatible → vX.Y.Z+incompatible + base = strings.TrimSuffix(base, pre) + i := strings.LastIndexByte(base, '.') + if i < 0 { + panic("base from parsePseudoVersion missing patch number: " + base) + } + patch := decDecimal(base[i+1:]) + if patch == "" { + // vX.0.0-0 is invalid, but has been observed in the wild in the index + // generated by requests to proxy.golang.org. + // + // NOTE(bcmills): I cannot find a historical bug that accounts for + // pseudo-versions of this form, nor have I seen such versions in any + // actual go.mod files. If we find actual examples of this form and a + // reasonable theory of how they came into existence, it seems fine to + // treat them as equivalent to vX.0.0 (especially since the invalid + // pseudo-versions have lower precedence than the real ones). For now, we + // reject them. + return "", &InvalidVersionError{ + Version: v, + Pseudo: true, + Err: fmt.Errorf("version before %s would have negative patch number", base), + } + } + return base[:i+1] + patch + build, nil + + default: + // vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456 → vX.Y.Z-pre + // vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456+incompatible → vX.Y.Z-pre+incompatible + if !strings.HasSuffix(base, ".0") { + panic(`base from parsePseudoVersion missing ".0" before date: ` + base) + } + return strings.TrimSuffix(base, ".0") + build, nil + } +} + +var errPseudoSyntax = errors.New("syntax error") + +func parsePseudoVersion(v string) (base, timestamp, rev, build string, err error) { + if !IsPseudoVersion(v) { + return "", "", "", "", &InvalidVersionError{ + Version: v, + Pseudo: true, + Err: errPseudoSyntax, + } + } + build = semver.Build(v) + v = strings.TrimSuffix(v, build) + j := strings.LastIndex(v, "-") + v, rev = v[:j], v[j+1:] + i := strings.LastIndex(v, "-") + if j := strings.LastIndex(v, "."); j > i { + base = v[:j] // "vX.Y.Z-pre.0" or "vX.Y.(Z+1)-0" + timestamp = v[j+1:] + } else { + base = v[:i] // "vX.0.0" + timestamp = v[i+1:] + } + return base, timestamp, rev, build, nil +} diff --git a/vendor/golang.org/x/text/cases/cases.go b/vendor/golang.org/x/text/cases/cases.go new file mode 100644 index 0000000000..752cdf0316 --- /dev/null +++ b/vendor/golang.org/x/text/cases/cases.go @@ -0,0 +1,162 @@ +// Copyright 2014 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. + +//go:generate go run gen.go gen_trieval.go + +// Package cases provides general and language-specific case mappers. +package cases // import "golang.org/x/text/cases" + +import ( + "golang.org/x/text/language" + "golang.org/x/text/transform" +) + +// References: +// - Unicode Reference Manual Chapter 3.13, 4.2, and 5.18. +// - https://www.unicode.org/reports/tr29/ +// - https://www.unicode.org/Public/6.3.0/ucd/CaseFolding.txt +// - https://www.unicode.org/Public/6.3.0/ucd/SpecialCasing.txt +// - https://www.unicode.org/Public/6.3.0/ucd/DerivedCoreProperties.txt +// - https://www.unicode.org/Public/6.3.0/ucd/auxiliary/WordBreakProperty.txt +// - https://www.unicode.org/Public/6.3.0/ucd/auxiliary/WordBreakTest.txt +// - http://userguide.icu-project.org/transforms/casemappings + +// TODO: +// - Case folding +// - Wide and Narrow? +// - Segmenter option for title casing. +// - ASCII fast paths +// - Encode Soft-Dotted property within trie somehow. + +// A Caser transforms given input to a certain case. It implements +// transform.Transformer. +// +// A Caser may be stateful and should therefore not be shared between +// goroutines. +type Caser struct { + t transform.SpanningTransformer +} + +// Bytes returns a new byte slice with the result of converting b to the case +// form implemented by c. +func (c Caser) Bytes(b []byte) []byte { + b, _, _ = transform.Bytes(c.t, b) + return b +} + +// String returns a string with the result of transforming s to the case form +// implemented by c. +func (c Caser) String(s string) string { + s, _, _ = transform.String(c.t, s) + return s +} + +// Reset resets the Caser to be reused for new input after a previous call to +// Transform. +func (c Caser) Reset() { c.t.Reset() } + +// Transform implements the transform.Transformer interface and transforms the +// given input to the case form implemented by c. +func (c Caser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + return c.t.Transform(dst, src, atEOF) +} + +// Span implements the transform.SpanningTransformer interface. +func (c Caser) Span(src []byte, atEOF bool) (n int, err error) { + return c.t.Span(src, atEOF) +} + +// Upper returns a Caser for language-specific uppercasing. +func Upper(t language.Tag, opts ...Option) Caser { + return Caser{makeUpper(t, getOpts(opts...))} +} + +// Lower returns a Caser for language-specific lowercasing. +func Lower(t language.Tag, opts ...Option) Caser { + return Caser{makeLower(t, getOpts(opts...))} +} + +// Title returns a Caser for language-specific title casing. It uses an +// approximation of the default Unicode Word Break algorithm. +func Title(t language.Tag, opts ...Option) Caser { + return Caser{makeTitle(t, getOpts(opts...))} +} + +// Fold returns a Caser that implements Unicode case folding. The returned Caser +// is stateless and safe to use concurrently by multiple goroutines. +// +// Case folding does not normalize the input and may not preserve a normal form. +// Use the collate or search package for more convenient and linguistically +// sound comparisons. Use golang.org/x/text/secure/precis for string comparisons +// where security aspects are a concern. +func Fold(opts ...Option) Caser { + return Caser{makeFold(getOpts(opts...))} +} + +// An Option is used to modify the behavior of a Caser. +type Option func(o options) options + +// TODO: consider these options to take a boolean as well, like FinalSigma. +// The advantage of using this approach is that other providers of a lower-case +// algorithm could set different defaults by prefixing a user-provided slice +// of options with their own. This is handy, for instance, for the precis +// package which would override the default to not handle the Greek final sigma. + +var ( + // NoLower disables the lowercasing of non-leading letters for a title + // caser. + NoLower Option = noLower + + // Compact omits mappings in case folding for characters that would grow the + // input. (Unimplemented.) + Compact Option = compact +) + +// TODO: option to preserve a normal form, if applicable? + +type options struct { + noLower bool + simple bool + + // TODO: segmenter, max ignorable, alternative versions, etc. + + ignoreFinalSigma bool +} + +func getOpts(o ...Option) (res options) { + for _, f := range o { + res = f(res) + } + return +} + +func noLower(o options) options { + o.noLower = true + return o +} + +func compact(o options) options { + o.simple = true + return o +} + +// HandleFinalSigma specifies whether the special handling of Greek final sigma +// should be enabled. Unicode prescribes handling the Greek final sigma for all +// locales, but standards like IDNA and PRECIS override this default. +func HandleFinalSigma(enable bool) Option { + if enable { + return handleFinalSigma + } + return ignoreFinalSigma +} + +func ignoreFinalSigma(o options) options { + o.ignoreFinalSigma = true + return o +} + +func handleFinalSigma(o options) options { + o.ignoreFinalSigma = false + return o +} diff --git a/vendor/golang.org/x/text/cases/context.go b/vendor/golang.org/x/text/cases/context.go new file mode 100644 index 0000000000..e9aa9e1936 --- /dev/null +++ b/vendor/golang.org/x/text/cases/context.go @@ -0,0 +1,376 @@ +// Copyright 2014 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 cases + +import "golang.org/x/text/transform" + +// A context is used for iterating over source bytes, fetching case info and +// writing to a destination buffer. +// +// Casing operations may need more than one rune of context to decide how a rune +// should be cased. Casing implementations should call checkpoint on context +// whenever it is known to be safe to return the runes processed so far. +// +// It is recommended for implementations to not allow for more than 30 case +// ignorables as lookahead (analogous to the limit in norm) and to use state if +// unbounded lookahead is needed for cased runes. +type context struct { + dst, src []byte + atEOF bool + + pDst int // pDst points past the last written rune in dst. + pSrc int // pSrc points to the start of the currently scanned rune. + + // checkpoints safe to return in Transform, where nDst <= pDst and nSrc <= pSrc. + nDst, nSrc int + err error + + sz int // size of current rune + info info // case information of currently scanned rune + + // State preserved across calls to Transform. + isMidWord bool // false if next cased letter needs to be title-cased. +} + +func (c *context) Reset() { + c.isMidWord = false +} + +// ret returns the return values for the Transform method. It checks whether +// there were insufficient bytes in src to complete and introduces an error +// accordingly, if necessary. +func (c *context) ret() (nDst, nSrc int, err error) { + if c.err != nil || c.nSrc == len(c.src) { + return c.nDst, c.nSrc, c.err + } + // This point is only reached by mappers if there was no short destination + // buffer. This means that the source buffer was exhausted and that c.sz was + // set to 0 by next. + if c.atEOF && c.pSrc == len(c.src) { + return c.pDst, c.pSrc, nil + } + return c.nDst, c.nSrc, transform.ErrShortSrc +} + +// retSpan returns the return values for the Span method. It checks whether +// there were insufficient bytes in src to complete and introduces an error +// accordingly, if necessary. +func (c *context) retSpan() (n int, err error) { + _, nSrc, err := c.ret() + return nSrc, err +} + +// checkpoint sets the return value buffer points for Transform to the current +// positions. +func (c *context) checkpoint() { + if c.err == nil { + c.nDst, c.nSrc = c.pDst, c.pSrc+c.sz + } +} + +// unreadRune causes the last rune read by next to be reread on the next +// invocation of next. Only one unreadRune may be called after a call to next. +func (c *context) unreadRune() { + c.sz = 0 +} + +func (c *context) next() bool { + c.pSrc += c.sz + if c.pSrc == len(c.src) || c.err != nil { + c.info, c.sz = 0, 0 + return false + } + v, sz := trie.lookup(c.src[c.pSrc:]) + c.info, c.sz = info(v), sz + if c.sz == 0 { + if c.atEOF { + // A zero size means we have an incomplete rune. If we are atEOF, + // this means it is an illegal rune, which we will consume one + // byte at a time. + c.sz = 1 + } else { + c.err = transform.ErrShortSrc + return false + } + } + return true +} + +// writeBytes adds bytes to dst. +func (c *context) writeBytes(b []byte) bool { + if len(c.dst)-c.pDst < len(b) { + c.err = transform.ErrShortDst + return false + } + // This loop is faster than using copy. + for _, ch := range b { + c.dst[c.pDst] = ch + c.pDst++ + } + return true +} + +// writeString writes the given string to dst. +func (c *context) writeString(s string) bool { + if len(c.dst)-c.pDst < len(s) { + c.err = transform.ErrShortDst + return false + } + // This loop is faster than using copy. + for i := 0; i < len(s); i++ { + c.dst[c.pDst] = s[i] + c.pDst++ + } + return true +} + +// copy writes the current rune to dst. +func (c *context) copy() bool { + return c.writeBytes(c.src[c.pSrc : c.pSrc+c.sz]) +} + +// copyXOR copies the current rune to dst and modifies it by applying the XOR +// pattern of the case info. It is the responsibility of the caller to ensure +// that this is a rune with a XOR pattern defined. +func (c *context) copyXOR() bool { + if !c.copy() { + return false + } + if c.info&xorIndexBit == 0 { + // Fast path for 6-bit XOR pattern, which covers most cases. + c.dst[c.pDst-1] ^= byte(c.info >> xorShift) + } else { + // Interpret XOR bits as an index. + // TODO: test performance for unrolling this loop. Verify that we have + // at least two bytes and at most three. + idx := c.info >> xorShift + for p := c.pDst - 1; ; p-- { + c.dst[p] ^= xorData[idx] + idx-- + if xorData[idx] == 0 { + break + } + } + } + return true +} + +// hasPrefix returns true if src[pSrc:] starts with the given string. +func (c *context) hasPrefix(s string) bool { + b := c.src[c.pSrc:] + if len(b) < len(s) { + return false + } + for i, c := range b[:len(s)] { + if c != s[i] { + return false + } + } + return true +} + +// caseType returns an info with only the case bits, normalized to either +// cLower, cUpper, cTitle or cUncased. +func (c *context) caseType() info { + cm := c.info & 0x7 + if cm < 4 { + return cm + } + if cm >= cXORCase { + // xor the last bit of the rune with the case type bits. + b := c.src[c.pSrc+c.sz-1] + return info(b&1) ^ cm&0x3 + } + if cm == cIgnorableCased { + return cLower + } + return cUncased +} + +// lower writes the lowercase version of the current rune to dst. +func lower(c *context) bool { + ct := c.caseType() + if c.info&hasMappingMask == 0 || ct == cLower { + return c.copy() + } + if c.info&exceptionBit == 0 { + return c.copyXOR() + } + e := exceptions[c.info>>exceptionShift:] + offset := 2 + e[0]&lengthMask // size of header + fold string + if nLower := (e[1] >> lengthBits) & lengthMask; nLower != noChange { + return c.writeString(e[offset : offset+nLower]) + } + return c.copy() +} + +func isLower(c *context) bool { + ct := c.caseType() + if c.info&hasMappingMask == 0 || ct == cLower { + return true + } + if c.info&exceptionBit == 0 { + c.err = transform.ErrEndOfSpan + return false + } + e := exceptions[c.info>>exceptionShift:] + if nLower := (e[1] >> lengthBits) & lengthMask; nLower != noChange { + c.err = transform.ErrEndOfSpan + return false + } + return true +} + +// upper writes the uppercase version of the current rune to dst. +func upper(c *context) bool { + ct := c.caseType() + if c.info&hasMappingMask == 0 || ct == cUpper { + return c.copy() + } + if c.info&exceptionBit == 0 { + return c.copyXOR() + } + e := exceptions[c.info>>exceptionShift:] + offset := 2 + e[0]&lengthMask // size of header + fold string + // Get length of first special case mapping. + n := (e[1] >> lengthBits) & lengthMask + if ct == cTitle { + // The first special case mapping is for lower. Set n to the second. + if n == noChange { + n = 0 + } + n, e = e[1]&lengthMask, e[n:] + } + if n != noChange { + return c.writeString(e[offset : offset+n]) + } + return c.copy() +} + +// isUpper writes the isUppercase version of the current rune to dst. +func isUpper(c *context) bool { + ct := c.caseType() + if c.info&hasMappingMask == 0 || ct == cUpper { + return true + } + if c.info&exceptionBit == 0 { + c.err = transform.ErrEndOfSpan + return false + } + e := exceptions[c.info>>exceptionShift:] + // Get length of first special case mapping. + n := (e[1] >> lengthBits) & lengthMask + if ct == cTitle { + n = e[1] & lengthMask + } + if n != noChange { + c.err = transform.ErrEndOfSpan + return false + } + return true +} + +// title writes the title case version of the current rune to dst. +func title(c *context) bool { + ct := c.caseType() + if c.info&hasMappingMask == 0 || ct == cTitle { + return c.copy() + } + if c.info&exceptionBit == 0 { + if ct == cLower { + return c.copyXOR() + } + return c.copy() + } + // Get the exception data. + e := exceptions[c.info>>exceptionShift:] + offset := 2 + e[0]&lengthMask // size of header + fold string + + nFirst := (e[1] >> lengthBits) & lengthMask + if nTitle := e[1] & lengthMask; nTitle != noChange { + if nFirst != noChange { + e = e[nFirst:] + } + return c.writeString(e[offset : offset+nTitle]) + } + if ct == cLower && nFirst != noChange { + // Use the uppercase version instead. + return c.writeString(e[offset : offset+nFirst]) + } + // Already in correct case. + return c.copy() +} + +// isTitle reports whether the current rune is in title case. +func isTitle(c *context) bool { + ct := c.caseType() + if c.info&hasMappingMask == 0 || ct == cTitle { + return true + } + if c.info&exceptionBit == 0 { + if ct == cLower { + c.err = transform.ErrEndOfSpan + return false + } + return true + } + // Get the exception data. + e := exceptions[c.info>>exceptionShift:] + if nTitle := e[1] & lengthMask; nTitle != noChange { + c.err = transform.ErrEndOfSpan + return false + } + nFirst := (e[1] >> lengthBits) & lengthMask + if ct == cLower && nFirst != noChange { + c.err = transform.ErrEndOfSpan + return false + } + return true +} + +// foldFull writes the foldFull version of the current rune to dst. +func foldFull(c *context) bool { + if c.info&hasMappingMask == 0 { + return c.copy() + } + ct := c.caseType() + if c.info&exceptionBit == 0 { + if ct != cLower || c.info&inverseFoldBit != 0 { + return c.copyXOR() + } + return c.copy() + } + e := exceptions[c.info>>exceptionShift:] + n := e[0] & lengthMask + if n == 0 { + if ct == cLower { + return c.copy() + } + n = (e[1] >> lengthBits) & lengthMask + } + return c.writeString(e[2 : 2+n]) +} + +// isFoldFull reports whether the current run is mapped to foldFull +func isFoldFull(c *context) bool { + if c.info&hasMappingMask == 0 { + return true + } + ct := c.caseType() + if c.info&exceptionBit == 0 { + if ct != cLower || c.info&inverseFoldBit != 0 { + c.err = transform.ErrEndOfSpan + return false + } + return true + } + e := exceptions[c.info>>exceptionShift:] + n := e[0] & lengthMask + if n == 0 && ct == cLower { + return true + } + c.err = transform.ErrEndOfSpan + return false +} diff --git a/vendor/golang.org/x/text/cases/fold.go b/vendor/golang.org/x/text/cases/fold.go new file mode 100644 index 0000000000..85cc434fac --- /dev/null +++ b/vendor/golang.org/x/text/cases/fold.go @@ -0,0 +1,34 @@ +// Copyright 2016 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 cases + +import "golang.org/x/text/transform" + +type caseFolder struct{ transform.NopResetter } + +// caseFolder implements the Transformer interface for doing case folding. +func (t *caseFolder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + c := context{dst: dst, src: src, atEOF: atEOF} + for c.next() { + foldFull(&c) + c.checkpoint() + } + return c.ret() +} + +func (t *caseFolder) Span(src []byte, atEOF bool) (n int, err error) { + c := context{src: src, atEOF: atEOF} + for c.next() && isFoldFull(&c) { + c.checkpoint() + } + return c.retSpan() +} + +func makeFold(o options) transform.SpanningTransformer { + // TODO: Special case folding, through option Language, Special/Turkic, or + // both. + // TODO: Implement Compact options. + return &caseFolder{} +} diff --git a/vendor/golang.org/x/text/cases/icu.go b/vendor/golang.org/x/text/cases/icu.go new file mode 100644 index 0000000000..db7c237ccf --- /dev/null +++ b/vendor/golang.org/x/text/cases/icu.go @@ -0,0 +1,61 @@ +// Copyright 2016 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. + +//go:build icu + +package cases + +// Ideally these functions would be defined in a test file, but go test doesn't +// allow CGO in tests. The build tag should ensure either way that these +// functions will not end up in the package. + +// TODO: Ensure that the correct ICU version is set. + +/* +#cgo LDFLAGS: -licui18n.57 -licuuc.57 +#include +#include +#include +#include +#include +*/ +import "C" + +import "unsafe" + +func doICU(tag, caser, input string) string { + err := C.UErrorCode(0) + loc := C.CString(tag) + cm := C.ucasemap_open(loc, C.uint32_t(0), &err) + + buf := make([]byte, len(input)*4) + dst := (*C.char)(unsafe.Pointer(&buf[0])) + src := C.CString(input) + + cn := C.int32_t(0) + + switch caser { + case "fold": + cn = C.ucasemap_utf8FoldCase(cm, + dst, C.int32_t(len(buf)), + src, C.int32_t(len(input)), + &err) + case "lower": + cn = C.ucasemap_utf8ToLower(cm, + dst, C.int32_t(len(buf)), + src, C.int32_t(len(input)), + &err) + case "upper": + cn = C.ucasemap_utf8ToUpper(cm, + dst, C.int32_t(len(buf)), + src, C.int32_t(len(input)), + &err) + case "title": + cn = C.ucasemap_utf8ToTitle(cm, + dst, C.int32_t(len(buf)), + src, C.int32_t(len(input)), + &err) + } + return string(buf[:cn]) +} diff --git a/vendor/golang.org/x/text/cases/info.go b/vendor/golang.org/x/text/cases/info.go new file mode 100644 index 0000000000..87a7c3e955 --- /dev/null +++ b/vendor/golang.org/x/text/cases/info.go @@ -0,0 +1,82 @@ +// Copyright 2015 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 cases + +func (c info) cccVal() info { + if c&exceptionBit != 0 { + return info(exceptions[c>>exceptionShift]) & cccMask + } + return c & cccMask +} + +func (c info) cccType() info { + ccc := c.cccVal() + if ccc <= cccZero { + return cccZero + } + return ccc +} + +// TODO: Implement full Unicode breaking algorithm: +// 1) Implement breaking in separate package. +// 2) Use the breaker here. +// 3) Compare table size and performance of using the more generic breaker. +// +// Note that we can extend the current algorithm to be much more accurate. This +// only makes sense, though, if the performance and/or space penalty of using +// the generic breaker is big. Extra data will only be needed for non-cased +// runes, which means there are sufficient bits left in the caseType. +// ICU prohibits breaking in such cases as well. + +// For the purpose of title casing we use an approximation of the Unicode Word +// Breaking algorithm defined in Annex #29: +// https://www.unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table. +// +// For our approximation, we group the Word Break types into the following +// categories, with associated rules: +// +// 1) Letter: +// ALetter, Hebrew_Letter, Numeric, ExtendNumLet, Extend, Format_FE, ZWJ. +// Rule: Never break between consecutive runes of this category. +// +// 2) Mid: +// MidLetter, MidNumLet, Single_Quote. +// (Cf. case-ignorable: MidLetter, MidNumLet, Single_Quote or cat is Mn, +// Me, Cf, Lm or Sk). +// Rule: Don't break between Letter and Mid, but break between two Mids. +// +// 3) Break: +// Any other category: NewLine, MidNum, CR, LF, Double_Quote, Katakana, and +// Other. +// These categories should always result in a break between two cased letters. +// Rule: Always break. +// +// Note 1: the Katakana and MidNum categories can, in esoteric cases, result in +// preventing a break between two cased letters. For now we will ignore this +// (e.g. [ALetter] [ExtendNumLet] [Katakana] [ExtendNumLet] [ALetter] and +// [ALetter] [Numeric] [MidNum] [Numeric] [ALetter].) +// +// Note 2: the rule for Mid is very approximate, but works in most cases. To +// improve, we could store the categories in the trie value and use a FA to +// manage breaks. See TODO comment above. +// +// Note 3: according to the spec, it is possible for the Extend category to +// introduce breaks between other categories grouped in Letter. However, this +// is undesirable for our purposes. ICU prevents breaks in such cases as well. + +// isBreak returns whether this rune should introduce a break. +func (c info) isBreak() bool { + return c.cccVal() == cccBreak +} + +// isLetter returns whether the rune is of break type ALetter, Hebrew_Letter, +// Numeric, ExtendNumLet, or Extend. +func (c info) isLetter() bool { + ccc := c.cccVal() + if ccc == cccZero { + return !c.isCaseIgnorable() + } + return ccc != cccBreak +} diff --git a/vendor/golang.org/x/text/cases/map.go b/vendor/golang.org/x/text/cases/map.go new file mode 100644 index 0000000000..0f7c6a14bb --- /dev/null +++ b/vendor/golang.org/x/text/cases/map.go @@ -0,0 +1,816 @@ +// Copyright 2014 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 cases + +// This file contains the definitions of case mappings for all supported +// languages. The rules for the language-specific tailorings were taken and +// modified from the CLDR transform definitions in common/transforms. + +import ( + "strings" + "unicode" + "unicode/utf8" + + "golang.org/x/text/internal" + "golang.org/x/text/language" + "golang.org/x/text/transform" + "golang.org/x/text/unicode/norm" +) + +// A mapFunc takes a context set to the current rune and writes the mapped +// version to the same context. It may advance the context to the next rune. It +// returns whether a checkpoint is possible: whether the pDst bytes written to +// dst so far won't need changing as we see more source bytes. +type mapFunc func(*context) bool + +// A spanFunc takes a context set to the current rune and returns whether this +// rune would be altered when written to the output. It may advance the context +// to the next rune. It returns whether a checkpoint is possible. +type spanFunc func(*context) bool + +// maxIgnorable defines the maximum number of ignorables to consider for +// lookahead operations. +const maxIgnorable = 30 + +// supported lists the language tags for which we have tailorings. +const supported = "und af az el lt nl tr" + +func init() { + tags := []language.Tag{} + for _, s := range strings.Split(supported, " ") { + tags = append(tags, language.MustParse(s)) + } + matcher = internal.NewInheritanceMatcher(tags) + Supported = language.NewCoverage(tags) +} + +var ( + matcher *internal.InheritanceMatcher + + Supported language.Coverage + + // We keep the following lists separate, instead of having a single per- + // language struct, to give the compiler a chance to remove unused code. + + // Some uppercase mappers are stateless, so we can precompute the + // Transformers and save a bit on runtime allocations. + upperFunc = []struct { + upper mapFunc + span spanFunc + }{ + {nil, nil}, // und + {nil, nil}, // af + {aztrUpper(upper), isUpper}, // az + {elUpper, noSpan}, // el + {ltUpper(upper), noSpan}, // lt + {nil, nil}, // nl + {aztrUpper(upper), isUpper}, // tr + } + + undUpper transform.SpanningTransformer = &undUpperCaser{} + undLower transform.SpanningTransformer = &undLowerCaser{} + undLowerIgnoreSigma transform.SpanningTransformer = &undLowerIgnoreSigmaCaser{} + + lowerFunc = []mapFunc{ + nil, // und + nil, // af + aztrLower, // az + nil, // el + ltLower, // lt + nil, // nl + aztrLower, // tr + } + + titleInfos = []struct { + title mapFunc + lower mapFunc + titleSpan spanFunc + rewrite func(*context) + }{ + {title, lower, isTitle, nil}, // und + {title, lower, isTitle, afnlRewrite}, // af + {aztrUpper(title), aztrLower, isTitle, nil}, // az + {title, lower, isTitle, nil}, // el + {ltUpper(title), ltLower, noSpan, nil}, // lt + {nlTitle, lower, nlTitleSpan, afnlRewrite}, // nl + {aztrUpper(title), aztrLower, isTitle, nil}, // tr + } +) + +func makeUpper(t language.Tag, o options) transform.SpanningTransformer { + _, i, _ := matcher.Match(t) + f := upperFunc[i].upper + if f == nil { + return undUpper + } + return &simpleCaser{f: f, span: upperFunc[i].span} +} + +func makeLower(t language.Tag, o options) transform.SpanningTransformer { + _, i, _ := matcher.Match(t) + f := lowerFunc[i] + if f == nil { + if o.ignoreFinalSigma { + return undLowerIgnoreSigma + } + return undLower + } + if o.ignoreFinalSigma { + return &simpleCaser{f: f, span: isLower} + } + return &lowerCaser{ + first: f, + midWord: finalSigma(f), + } +} + +func makeTitle(t language.Tag, o options) transform.SpanningTransformer { + _, i, _ := matcher.Match(t) + x := &titleInfos[i] + lower := x.lower + if o.noLower { + lower = (*context).copy + } else if !o.ignoreFinalSigma { + lower = finalSigma(lower) + } + return &titleCaser{ + title: x.title, + lower: lower, + titleSpan: x.titleSpan, + rewrite: x.rewrite, + } +} + +func noSpan(c *context) bool { + c.err = transform.ErrEndOfSpan + return false +} + +// TODO: consider a similar special case for the fast majority lower case. This +// is a bit more involved so will require some more precise benchmarking to +// justify it. + +type undUpperCaser struct{ transform.NopResetter } + +// undUpperCaser implements the Transformer interface for doing an upper case +// mapping for the root locale (und). It eliminates the need for an allocation +// as it prevents escaping by not using function pointers. +func (t undUpperCaser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + c := context{dst: dst, src: src, atEOF: atEOF} + for c.next() { + upper(&c) + c.checkpoint() + } + return c.ret() +} + +func (t undUpperCaser) Span(src []byte, atEOF bool) (n int, err error) { + c := context{src: src, atEOF: atEOF} + for c.next() && isUpper(&c) { + c.checkpoint() + } + return c.retSpan() +} + +// undLowerIgnoreSigmaCaser implements the Transformer interface for doing +// a lower case mapping for the root locale (und) ignoring final sigma +// handling. This casing algorithm is used in some performance-critical packages +// like secure/precis and x/net/http/idna, which warrants its special-casing. +type undLowerIgnoreSigmaCaser struct{ transform.NopResetter } + +func (t undLowerIgnoreSigmaCaser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + c := context{dst: dst, src: src, atEOF: atEOF} + for c.next() && lower(&c) { + c.checkpoint() + } + return c.ret() + +} + +// Span implements a generic lower-casing. This is possible as isLower works +// for all lowercasing variants. All lowercase variants only vary in how they +// transform a non-lowercase letter. They will never change an already lowercase +// letter. In addition, there is no state. +func (t undLowerIgnoreSigmaCaser) Span(src []byte, atEOF bool) (n int, err error) { + c := context{src: src, atEOF: atEOF} + for c.next() && isLower(&c) { + c.checkpoint() + } + return c.retSpan() +} + +type simpleCaser struct { + context + f mapFunc + span spanFunc +} + +// simpleCaser implements the Transformer interface for doing a case operation +// on a rune-by-rune basis. +func (t *simpleCaser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + c := context{dst: dst, src: src, atEOF: atEOF} + for c.next() && t.f(&c) { + c.checkpoint() + } + return c.ret() +} + +func (t *simpleCaser) Span(src []byte, atEOF bool) (n int, err error) { + c := context{src: src, atEOF: atEOF} + for c.next() && t.span(&c) { + c.checkpoint() + } + return c.retSpan() +} + +// undLowerCaser implements the Transformer interface for doing a lower case +// mapping for the root locale (und) ignoring final sigma handling. This casing +// algorithm is used in some performance-critical packages like secure/precis +// and x/net/http/idna, which warrants its special-casing. +type undLowerCaser struct{ transform.NopResetter } + +func (t undLowerCaser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + c := context{dst: dst, src: src, atEOF: atEOF} + + for isInterWord := true; c.next(); { + if isInterWord { + if c.info.isCased() { + if !lower(&c) { + break + } + isInterWord = false + } else if !c.copy() { + break + } + } else { + if c.info.isNotCasedAndNotCaseIgnorable() { + if !c.copy() { + break + } + isInterWord = true + } else if !c.hasPrefix("Σ") { + if !lower(&c) { + break + } + } else if !finalSigmaBody(&c) { + break + } + } + c.checkpoint() + } + return c.ret() +} + +func (t undLowerCaser) Span(src []byte, atEOF bool) (n int, err error) { + c := context{src: src, atEOF: atEOF} + for c.next() && isLower(&c) { + c.checkpoint() + } + return c.retSpan() +} + +// lowerCaser implements the Transformer interface. The default Unicode lower +// casing requires different treatment for the first and subsequent characters +// of a word, most notably to handle the Greek final Sigma. +type lowerCaser struct { + undLowerIgnoreSigmaCaser + + context + + first, midWord mapFunc +} + +func (t *lowerCaser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + t.context = context{dst: dst, src: src, atEOF: atEOF} + c := &t.context + + for isInterWord := true; c.next(); { + if isInterWord { + if c.info.isCased() { + if !t.first(c) { + break + } + isInterWord = false + } else if !c.copy() { + break + } + } else { + if c.info.isNotCasedAndNotCaseIgnorable() { + if !c.copy() { + break + } + isInterWord = true + } else if !t.midWord(c) { + break + } + } + c.checkpoint() + } + return c.ret() +} + +// titleCaser implements the Transformer interface. Title casing algorithms +// distinguish between the first letter of a word and subsequent letters of the +// same word. It uses state to avoid requiring a potentially infinite lookahead. +type titleCaser struct { + context + + // rune mappings used by the actual casing algorithms. + title mapFunc + lower mapFunc + titleSpan spanFunc + + rewrite func(*context) +} + +// Transform implements the standard Unicode title case algorithm as defined in +// Chapter 3 of The Unicode Standard: +// toTitlecase(X): Find the word boundaries in X according to Unicode Standard +// Annex #29, "Unicode Text Segmentation." For each word boundary, find the +// first cased character F following the word boundary. If F exists, map F to +// Titlecase_Mapping(F); then map all characters C between F and the following +// word boundary to Lowercase_Mapping(C). +func (t *titleCaser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + t.context = context{dst: dst, src: src, atEOF: atEOF, isMidWord: t.isMidWord} + c := &t.context + + if !c.next() { + return c.ret() + } + + for { + p := c.info + if t.rewrite != nil { + t.rewrite(c) + } + + wasMid := p.isMid() + // Break out of this loop on failure to ensure we do not modify the + // state incorrectly. + if p.isCased() { + if !c.isMidWord { + if !t.title(c) { + break + } + c.isMidWord = true + } else if !t.lower(c) { + break + } + } else if !c.copy() { + break + } else if p.isBreak() { + c.isMidWord = false + } + + // As we save the state of the transformer, it is safe to call + // checkpoint after any successful write. + if !(c.isMidWord && wasMid) { + c.checkpoint() + } + + if !c.next() { + break + } + if wasMid && c.info.isMid() { + c.isMidWord = false + } + } + return c.ret() +} + +func (t *titleCaser) Span(src []byte, atEOF bool) (n int, err error) { + t.context = context{src: src, atEOF: atEOF, isMidWord: t.isMidWord} + c := &t.context + + if !c.next() { + return c.retSpan() + } + + for { + p := c.info + if t.rewrite != nil { + t.rewrite(c) + } + + wasMid := p.isMid() + // Break out of this loop on failure to ensure we do not modify the + // state incorrectly. + if p.isCased() { + if !c.isMidWord { + if !t.titleSpan(c) { + break + } + c.isMidWord = true + } else if !isLower(c) { + break + } + } else if p.isBreak() { + c.isMidWord = false + } + // As we save the state of the transformer, it is safe to call + // checkpoint after any successful write. + if !(c.isMidWord && wasMid) { + c.checkpoint() + } + + if !c.next() { + break + } + if wasMid && c.info.isMid() { + c.isMidWord = false + } + } + return c.retSpan() +} + +// finalSigma adds Greek final Sigma handing to another casing function. It +// determines whether a lowercased sigma should be σ or ς, by looking ahead for +// case-ignorables and a cased letters. +func finalSigma(f mapFunc) mapFunc { + return func(c *context) bool { + if !c.hasPrefix("Σ") { + return f(c) + } + return finalSigmaBody(c) + } +} + +func finalSigmaBody(c *context) bool { + // Current rune must be ∑. + + // ::NFD(); + // # 03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA + // Σ } [:case-ignorable:]* [:cased:] → σ; + // [:cased:] [:case-ignorable:]* { Σ → ς; + // ::Any-Lower; + // ::NFC(); + + p := c.pDst + c.writeString("ς") + + // TODO: we should do this here, but right now this will never have an + // effect as this is called when the prefix is Sigma, whereas Dutch and + // Afrikaans only test for an apostrophe. + // + // if t.rewrite != nil { + // t.rewrite(c) + // } + + // We need to do one more iteration after maxIgnorable, as a cased + // letter is not an ignorable and may modify the result. + wasMid := false + for i := 0; i < maxIgnorable+1; i++ { + if !c.next() { + return false + } + if !c.info.isCaseIgnorable() { + // All Midword runes are also case ignorable, so we are + // guaranteed to have a letter or word break here. As we are + // unreading the run, there is no need to unset c.isMidWord; + // the title caser will handle this. + if c.info.isCased() { + // p+1 is guaranteed to be in bounds: if writing ς was + // successful, p+1 will contain the second byte of ς. If not, + // this function will have returned after c.next returned false. + c.dst[p+1]++ // ς → σ + } + c.unreadRune() + return true + } + // A case ignorable may also introduce a word break, so we may need + // to continue searching even after detecting a break. + isMid := c.info.isMid() + if (wasMid && isMid) || c.info.isBreak() { + c.isMidWord = false + } + wasMid = isMid + c.copy() + } + return true +} + +// finalSigmaSpan would be the same as isLower. + +// elUpper implements Greek upper casing, which entails removing a predefined +// set of non-blocked modifiers. Note that these accents should not be removed +// for title casing! +// Example: "Οδός" -> "ΟΔΟΣ". +func elUpper(c *context) bool { + // From CLDR: + // [:Greek:] [^[:ccc=Not_Reordered:][:ccc=Above:]]*? { [\u0313\u0314\u0301\u0300\u0306\u0342\u0308\u0304] → ; + // [:Greek:] [^[:ccc=Not_Reordered:][:ccc=Iota_Subscript:]]*? { \u0345 → ; + + r, _ := utf8.DecodeRune(c.src[c.pSrc:]) + oldPDst := c.pDst + if !upper(c) { + return false + } + if !unicode.Is(unicode.Greek, r) { + return true + } + i := 0 + // Take the properties of the uppercased rune that is already written to the + // destination. This saves us the trouble of having to uppercase the + // decomposed rune again. + if b := norm.NFD.Properties(c.dst[oldPDst:]).Decomposition(); b != nil { + // Restore the destination position and process the decomposed rune. + r, sz := utf8.DecodeRune(b) + if r <= 0xFF { // See A.6.1 + return true + } + c.pDst = oldPDst + // Insert the first rune and ignore the modifiers. See A.6.2. + c.writeBytes(b[:sz]) + i = len(b[sz:]) / 2 // Greek modifiers are always of length 2. + } + + for ; i < maxIgnorable && c.next(); i++ { + switch r, _ := utf8.DecodeRune(c.src[c.pSrc:]); r { + // Above and Iota Subscript + case 0x0300, // U+0300 COMBINING GRAVE ACCENT + 0x0301, // U+0301 COMBINING ACUTE ACCENT + 0x0304, // U+0304 COMBINING MACRON + 0x0306, // U+0306 COMBINING BREVE + 0x0308, // U+0308 COMBINING DIAERESIS + 0x0313, // U+0313 COMBINING COMMA ABOVE + 0x0314, // U+0314 COMBINING REVERSED COMMA ABOVE + 0x0342, // U+0342 COMBINING GREEK PERISPOMENI + 0x0345: // U+0345 COMBINING GREEK YPOGEGRAMMENI + // No-op. Gobble the modifier. + + default: + switch v, _ := trie.lookup(c.src[c.pSrc:]); info(v).cccType() { + case cccZero: + c.unreadRune() + return true + + // We don't need to test for IotaSubscript as the only rune that + // qualifies (U+0345) was already excluded in the switch statement + // above. See A.4. + + case cccAbove: + return c.copy() + default: + // Some other modifier. We're still allowed to gobble Greek + // modifiers after this. + c.copy() + } + } + } + return i == maxIgnorable +} + +// TODO: implement elUpperSpan (low-priority: complex and infrequent). + +func ltLower(c *context) bool { + // From CLDR: + // # Introduce an explicit dot above when lowercasing capital I's and J's + // # whenever there are more accents above. + // # (of the accents used in Lithuanian: grave, acute, tilde above, and ogonek) + // # 0049; 0069 0307; 0049; 0049; lt More_Above; # LATIN CAPITAL LETTER I + // # 004A; 006A 0307; 004A; 004A; lt More_Above; # LATIN CAPITAL LETTER J + // # 012E; 012F 0307; 012E; 012E; lt More_Above; # LATIN CAPITAL LETTER I WITH OGONEK + // # 00CC; 0069 0307 0300; 00CC; 00CC; lt; # LATIN CAPITAL LETTER I WITH GRAVE + // # 00CD; 0069 0307 0301; 00CD; 00CD; lt; # LATIN CAPITAL LETTER I WITH ACUTE + // # 0128; 0069 0307 0303; 0128; 0128; lt; # LATIN CAPITAL LETTER I WITH TILDE + // ::NFD(); + // I } [^[:ccc=Not_Reordered:][:ccc=Above:]]* [:ccc=Above:] → i \u0307; + // J } [^[:ccc=Not_Reordered:][:ccc=Above:]]* [:ccc=Above:] → j \u0307; + // I \u0328 (Į) } [^[:ccc=Not_Reordered:][:ccc=Above:]]* [:ccc=Above:] → i \u0328 \u0307; + // I \u0300 (Ì) → i \u0307 \u0300; + // I \u0301 (Í) → i \u0307 \u0301; + // I \u0303 (Ĩ) → i \u0307 \u0303; + // ::Any-Lower(); + // ::NFC(); + + i := 0 + if r := c.src[c.pSrc]; r < utf8.RuneSelf { + lower(c) + if r != 'I' && r != 'J' { + return true + } + } else { + p := norm.NFD.Properties(c.src[c.pSrc:]) + if d := p.Decomposition(); len(d) >= 3 && (d[0] == 'I' || d[0] == 'J') { + // UTF-8 optimization: the decomposition will only have an above + // modifier if the last rune of the decomposition is in [U+300-U+311]. + // In all other cases, a decomposition starting with I is always + // an I followed by modifiers that are not cased themselves. See A.2. + if d[1] == 0xCC && d[2] <= 0x91 { // A.2.4. + if !c.writeBytes(d[:1]) { + return false + } + c.dst[c.pDst-1] += 'a' - 'A' // lower + + // Assumption: modifier never changes on lowercase. See A.1. + // Assumption: all modifiers added have CCC = Above. See A.2.3. + return c.writeString("\u0307") && c.writeBytes(d[1:]) + } + // In all other cases the additional modifiers will have a CCC + // that is less than 230 (Above). We will insert the U+0307, if + // needed, after these modifiers so that a string in FCD form + // will remain so. See A.2.2. + lower(c) + i = 1 + } else { + return lower(c) + } + } + + for ; i < maxIgnorable && c.next(); i++ { + switch c.info.cccType() { + case cccZero: + c.unreadRune() + return true + case cccAbove: + return c.writeString("\u0307") && c.copy() // See A.1. + default: + c.copy() // See A.1. + } + } + return i == maxIgnorable +} + +// ltLowerSpan would be the same as isLower. + +func ltUpper(f mapFunc) mapFunc { + return func(c *context) bool { + // Unicode: + // 0307; 0307; ; ; lt After_Soft_Dotted; # COMBINING DOT ABOVE + // + // From CLDR: + // # Remove \u0307 following soft-dotteds (i, j, and the like), with possible + // # intervening non-230 marks. + // ::NFD(); + // [:Soft_Dotted:] [^[:ccc=Not_Reordered:][:ccc=Above:]]* { \u0307 → ; + // ::Any-Upper(); + // ::NFC(); + + // TODO: See A.5. A soft-dotted rune never has an exception. This would + // allow us to overload the exception bit and encode this property in + // info. Need to measure performance impact of this. + r, _ := utf8.DecodeRune(c.src[c.pSrc:]) + oldPDst := c.pDst + if !f(c) { + return false + } + if !unicode.Is(unicode.Soft_Dotted, r) { + return true + } + + // We don't need to do an NFD normalization, as a soft-dotted rune never + // contains U+0307. See A.3. + + i := 0 + for ; i < maxIgnorable && c.next(); i++ { + switch c.info.cccType() { + case cccZero: + c.unreadRune() + return true + case cccAbove: + if c.hasPrefix("\u0307") { + // We don't do a full NFC, but rather combine runes for + // some of the common cases. (Returning NFC or + // preserving normal form is neither a requirement nor + // a possibility anyway). + if !c.next() { + return false + } + if c.dst[oldPDst] == 'I' && c.pDst == oldPDst+1 && c.src[c.pSrc] == 0xcc { + s := "" + switch c.src[c.pSrc+1] { + case 0x80: // U+0300 COMBINING GRAVE ACCENT + s = "\u00cc" // U+00CC LATIN CAPITAL LETTER I WITH GRAVE + case 0x81: // U+0301 COMBINING ACUTE ACCENT + s = "\u00cd" // U+00CD LATIN CAPITAL LETTER I WITH ACUTE + case 0x83: // U+0303 COMBINING TILDE + s = "\u0128" // U+0128 LATIN CAPITAL LETTER I WITH TILDE + case 0x88: // U+0308 COMBINING DIAERESIS + s = "\u00cf" // U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS + default: + } + if s != "" { + c.pDst = oldPDst + return c.writeString(s) + } + } + } + return c.copy() + default: + c.copy() + } + } + return i == maxIgnorable + } +} + +// TODO: implement ltUpperSpan (low priority: complex and infrequent). + +func aztrUpper(f mapFunc) mapFunc { + return func(c *context) bool { + // i→İ; + if c.src[c.pSrc] == 'i' { + return c.writeString("İ") + } + return f(c) + } +} + +func aztrLower(c *context) (done bool) { + // From CLDR: + // # I and i-dotless; I-dot and i are case pairs in Turkish and Azeri + // # 0130; 0069; 0130; 0130; tr; # LATIN CAPITAL LETTER I WITH DOT ABOVE + // İ→i; + // # When lowercasing, remove dot_above in the sequence I + dot_above, which will turn into i. + // # This matches the behavior of the canonically equivalent I-dot_above + // # 0307; ; 0307; 0307; tr After_I; # COMBINING DOT ABOVE + // # When lowercasing, unless an I is before a dot_above, it turns into a dotless i. + // # 0049; 0131; 0049; 0049; tr Not_Before_Dot; # LATIN CAPITAL LETTER I + // I([^[:ccc=Not_Reordered:][:ccc=Above:]]*)\u0307 → i$1 ; + // I→ı ; + // ::Any-Lower(); + if c.hasPrefix("\u0130") { // İ + return c.writeString("i") + } + if c.src[c.pSrc] != 'I' { + return lower(c) + } + + // We ignore the lower-case I for now, but insert it later when we know + // which form we need. + start := c.pSrc + c.sz + + i := 0 +Loop: + // We check for up to n ignorables before \u0307. As \u0307 is an + // ignorable as well, n is maxIgnorable-1. + for ; i < maxIgnorable && c.next(); i++ { + switch c.info.cccType() { + case cccAbove: + if c.hasPrefix("\u0307") { + return c.writeString("i") && c.writeBytes(c.src[start:c.pSrc]) // ignore U+0307 + } + done = true + break Loop + case cccZero: + c.unreadRune() + done = true + break Loop + default: + // We'll write this rune after we know which starter to use. + } + } + if i == maxIgnorable { + done = true + } + return c.writeString("ı") && c.writeBytes(c.src[start:c.pSrc+c.sz]) && done +} + +// aztrLowerSpan would be the same as isLower. + +func nlTitle(c *context) bool { + // From CLDR: + // # Special titlecasing for Dutch initial "ij". + // ::Any-Title(); + // # Fix up Ij at the beginning of a "word" (per Any-Title, notUAX #29) + // [:^WB=ALetter:] [:WB=Extend:]* [[:WB=MidLetter:][:WB=MidNumLet:]]? { Ij } → IJ ; + if c.src[c.pSrc] != 'I' && c.src[c.pSrc] != 'i' { + return title(c) + } + + if !c.writeString("I") || !c.next() { + return false + } + if c.src[c.pSrc] == 'j' || c.src[c.pSrc] == 'J' { + return c.writeString("J") + } + c.unreadRune() + return true +} + +func nlTitleSpan(c *context) bool { + // From CLDR: + // # Special titlecasing for Dutch initial "ij". + // ::Any-Title(); + // # Fix up Ij at the beginning of a "word" (per Any-Title, notUAX #29) + // [:^WB=ALetter:] [:WB=Extend:]* [[:WB=MidLetter:][:WB=MidNumLet:]]? { Ij } → IJ ; + if c.src[c.pSrc] != 'I' { + return isTitle(c) + } + if !c.next() || c.src[c.pSrc] == 'j' { + return false + } + if c.src[c.pSrc] != 'J' { + c.unreadRune() + } + return true +} + +// Not part of CLDR, but see https://unicode.org/cldr/trac/ticket/7078. +func afnlRewrite(c *context) { + if c.hasPrefix("'") || c.hasPrefix("’") { + c.isMidWord = true + } +} diff --git a/vendor/golang.org/x/text/cases/tables10.0.0.go b/vendor/golang.org/x/text/cases/tables10.0.0.go new file mode 100644 index 0000000000..bd28ae145d --- /dev/null +++ b/vendor/golang.org/x/text/cases/tables10.0.0.go @@ -0,0 +1,2255 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +//go:build go1.10 && !go1.13 + +package cases + +// UnicodeVersion is the Unicode version from which the tables in this package are derived. +const UnicodeVersion = "10.0.0" + +var xorData string = "" + // Size: 185 bytes + "\x00\x06\x07\x00\x01?\x00\x0f\x03\x00\x0f\x12\x00\x0f\x1f\x00\x0f\x1d" + + "\x00\x01\x13\x00\x0f\x16\x00\x0f\x0b\x00\x0f3\x00\x0f7\x00\x01#\x00\x0f?" + + "\x00\x0e'\x00\x0f/\x00\x0e>\x00\x0f*\x00\x0c&\x00\x0c*\x00\x0c;\x00\x0c9" + + "\x00\x0c%\x00\x01\x08\x00\x03\x0d\x00\x03\x09\x00\x02\x06\x00\x02\x02" + + "\x00\x02\x0c\x00\x01\x00\x00\x01\x03\x00\x01\x01\x00\x01 \x00\x01\x0c" + + "\x00\x01\x10\x00\x03\x10\x00\x036 \x00\x037 \x00\x0b#\x10\x00\x0b 0\x00" + + "\x0b!\x10\x00\x0b!0\x00\x0b(\x04\x00\x03\x04\x1e\x00\x03\x0a\x00\x02:" + + "\x00\x02>\x00\x02,\x00\x02\x00\x00\x02\x10\x00\x01<\x00\x01&\x00\x01*" + + "\x00\x01.\x00\x010\x003 \x00\x01\x18\x00\x01(\x00\x01\x1e\x00\x01\x22" + +var exceptions string = "" + // Size: 2068 bytes + "\x00\x12\x12μΜΜ\x12\x12ssSSSs\x13\x18i̇i̇\x10\x09II\x13\x1bʼnʼNʼN\x11" + + "\x09sSS\x12\x12dždžDž\x12\x12dždžDŽ\x10\x12DŽDž\x12\x12ljljLj\x12\x12ljljLJ\x10\x12LJLj" + + "\x12\x12njnjNj\x12\x12njnjNJ\x10\x12NJNj\x13\x1bǰJ̌J̌\x12\x12dzdzDz\x12\x12dzdzDZ\x10" + + "\x12DZDz\x13\x18ⱥⱥ\x13\x18ⱦⱦ\x10\x1bⱾⱾ\x10\x1bⱿⱿ\x10\x1bⱯⱯ\x10\x1bⱭⱭ\x10" + + "\x1bⱰⱰ\x10\x1bꞫꞫ\x10\x1bꞬꞬ\x10\x1bꞍꞍ\x10\x1bꞪꞪ\x10\x1bꞮꞮ\x10\x1bⱢⱢ\x10" + + "\x1bꞭꞭ\x10\x1bⱮⱮ\x10\x1bⱤⱤ\x10\x1bꞱꞱ\x10\x1bꞲꞲ\x10\x1bꞰꞰ2\x12ιΙΙ\x166ΐ" + + "Ϊ́Ϊ́\x166ΰΫ́Ϋ́\x12\x12σΣΣ\x12\x12βΒΒ\x12\x12θΘΘ\x12\x12φΦΦ\x12" + + "\x12πΠΠ\x12\x12κΚΚ\x12\x12ρΡΡ\x12\x12εΕΕ\x14$եւԵՒԵւ\x12\x12вВВ\x12\x12дД" + + "Д\x12\x12оОО\x12\x12сСС\x12\x12тТТ\x12\x12тТТ\x12\x12ъЪЪ\x12\x12ѣѢѢ\x13" + + "\x1bꙋꙊꙊ\x13\x1bẖH̱H̱\x13\x1bẗT̈T̈\x13\x1bẘW̊W̊\x13\x1bẙY̊Y̊\x13\x1ba" + + "ʾAʾAʾ\x13\x1bṡṠṠ\x12\x10ssß\x14$ὐΥ̓Υ̓\x166ὒΥ̓̀Υ̓̀\x166ὔΥ̓́Υ̓́\x166" + + "ὖΥ̓͂Υ̓͂\x15+ἀιἈΙᾈ\x15+ἁιἉΙᾉ\x15+ἂιἊΙᾊ\x15+ἃιἋΙᾋ\x15+ἄιἌΙᾌ\x15+ἅιἍΙᾍ" + + "\x15+ἆιἎΙᾎ\x15+ἇιἏΙᾏ\x15\x1dἀιᾀἈΙ\x15\x1dἁιᾁἉΙ\x15\x1dἂιᾂἊΙ\x15\x1dἃιᾃἋΙ" + + "\x15\x1dἄιᾄἌΙ\x15\x1dἅιᾅἍΙ\x15\x1dἆιᾆἎΙ\x15\x1dἇιᾇἏΙ\x15+ἠιἨΙᾘ\x15+ἡιἩΙᾙ" + + "\x15+ἢιἪΙᾚ\x15+ἣιἫΙᾛ\x15+ἤιἬΙᾜ\x15+ἥιἭΙᾝ\x15+ἦιἮΙᾞ\x15+ἧιἯΙᾟ\x15\x1dἠιᾐἨ" + + "Ι\x15\x1dἡιᾑἩΙ\x15\x1dἢιᾒἪΙ\x15\x1dἣιᾓἫΙ\x15\x1dἤιᾔἬΙ\x15\x1dἥιᾕἭΙ\x15" + + "\x1dἦιᾖἮΙ\x15\x1dἧιᾗἯΙ\x15+ὠιὨΙᾨ\x15+ὡιὩΙᾩ\x15+ὢιὪΙᾪ\x15+ὣιὫΙᾫ\x15+ὤιὬΙᾬ" + + "\x15+ὥιὭΙᾭ\x15+ὦιὮΙᾮ\x15+ὧιὯΙᾯ\x15\x1dὠιᾠὨΙ\x15\x1dὡιᾡὩΙ\x15\x1dὢιᾢὪΙ" + + "\x15\x1dὣιᾣὫΙ\x15\x1dὤιᾤὬΙ\x15\x1dὥιᾥὭΙ\x15\x1dὦιᾦὮΙ\x15\x1dὧιᾧὯΙ\x15-ὰι" + + "ᾺΙᾺͅ\x14#αιΑΙᾼ\x14$άιΆΙΆͅ\x14$ᾶΑ͂Α͂\x166ᾶιΑ͂Ιᾼ͂\x14\x1cαιᾳΑΙ\x12" + + "\x12ιΙΙ\x15-ὴιῊΙῊͅ\x14#ηιΗΙῌ\x14$ήιΉΙΉͅ\x14$ῆΗ͂Η͂\x166ῆιΗ͂Ιῌ͂\x14\x1c" + + "ηιῃΗΙ\x166ῒΪ̀Ϊ̀\x166ΐΪ́Ϊ́\x14$ῖΙ͂Ι͂\x166ῗΪ͂Ϊ͂\x166ῢΫ̀Ϋ" + + "̀\x166ΰΫ́Ϋ́\x14$ῤΡ̓Ρ̓\x14$ῦΥ͂Υ͂\x166ῧΫ͂Ϋ͂\x15-ὼιῺΙῺͅ\x14#ωιΩΙ" + + "ῼ\x14$ώιΏΙΏͅ\x14$ῶΩ͂Ω͂\x166ῶιΩ͂Ιῼ͂\x14\x1cωιῳΩΙ\x12\x10ωω\x11\x08kk" + + "\x12\x10åå\x12\x10ɫɫ\x12\x10ɽɽ\x10\x12ȺȺ\x10\x12ȾȾ\x12\x10ɑɑ\x12\x10ɱɱ" + + "\x12\x10ɐɐ\x12\x10ɒɒ\x12\x10ȿȿ\x12\x10ɀɀ\x12\x10ɥɥ\x12\x10ɦɦ\x12\x10ɜɜ" + + "\x12\x10ɡɡ\x12\x10ɬɬ\x12\x10ɪɪ\x12\x10ʞʞ\x12\x10ʇʇ\x12\x10ʝʝ\x12\x12ffFF" + + "Ff\x12\x12fiFIFi\x12\x12flFLFl\x13\x1bffiFFIFfi\x13\x1bfflFFLFfl\x12\x12" + + "stSTSt\x12\x12stSTSt\x14$մնՄՆՄն\x14$մեՄԵՄե\x14$միՄԻՄի\x14$վնՎՆՎն\x14$մխՄ" + + "ԽՄխ" + +// lookup returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookup(s []byte) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupUnsafe(s []byte) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// lookupString returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookupString(s string) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupStringUnsafe(s string) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// caseTrie. Total size: 11892 bytes (11.61 KiB). Checksum: c6f15484b7653775. +type caseTrie struct{} + +func newCaseTrie(i int) *caseTrie { + return &caseTrie{} +} + +// lookupValue determines the type of block n and looks up the value for b. +func (t *caseTrie) lookupValue(n uint32, b byte) uint16 { + switch { + case n < 18: + return uint16(caseValues[n<<6+uint32(b)]) + default: + n -= 18 + return uint16(sparse.lookup(n, b)) + } +} + +// caseValues: 20 blocks, 1280 entries, 2560 bytes +// The third block is the zero block. +var caseValues = [1280]uint16{ + // Block 0x0, offset 0x0 + 0x27: 0x0054, + 0x2e: 0x0054, + 0x30: 0x0010, 0x31: 0x0010, 0x32: 0x0010, 0x33: 0x0010, 0x34: 0x0010, 0x35: 0x0010, + 0x36: 0x0010, 0x37: 0x0010, 0x38: 0x0010, 0x39: 0x0010, 0x3a: 0x0054, + // Block 0x1, offset 0x40 + 0x41: 0x2013, 0x42: 0x2013, 0x43: 0x2013, 0x44: 0x2013, 0x45: 0x2013, + 0x46: 0x2013, 0x47: 0x2013, 0x48: 0x2013, 0x49: 0x2013, 0x4a: 0x2013, 0x4b: 0x2013, + 0x4c: 0x2013, 0x4d: 0x2013, 0x4e: 0x2013, 0x4f: 0x2013, 0x50: 0x2013, 0x51: 0x2013, + 0x52: 0x2013, 0x53: 0x2013, 0x54: 0x2013, 0x55: 0x2013, 0x56: 0x2013, 0x57: 0x2013, + 0x58: 0x2013, 0x59: 0x2013, 0x5a: 0x2013, + 0x5e: 0x0004, 0x5f: 0x0010, 0x60: 0x0004, 0x61: 0x2012, 0x62: 0x2012, 0x63: 0x2012, + 0x64: 0x2012, 0x65: 0x2012, 0x66: 0x2012, 0x67: 0x2012, 0x68: 0x2012, 0x69: 0x2012, + 0x6a: 0x2012, 0x6b: 0x2012, 0x6c: 0x2012, 0x6d: 0x2012, 0x6e: 0x2012, 0x6f: 0x2012, + 0x70: 0x2012, 0x71: 0x2012, 0x72: 0x2012, 0x73: 0x2012, 0x74: 0x2012, 0x75: 0x2012, + 0x76: 0x2012, 0x77: 0x2012, 0x78: 0x2012, 0x79: 0x2012, 0x7a: 0x2012, + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc0: 0x0852, 0xc1: 0x0b53, 0xc2: 0x0113, 0xc3: 0x0112, 0xc4: 0x0113, 0xc5: 0x0112, + 0xc6: 0x0b53, 0xc7: 0x0f13, 0xc8: 0x0f12, 0xc9: 0x0e53, 0xca: 0x1153, 0xcb: 0x0713, + 0xcc: 0x0712, 0xcd: 0x0012, 0xce: 0x1453, 0xcf: 0x1753, 0xd0: 0x1a53, 0xd1: 0x0313, + 0xd2: 0x0312, 0xd3: 0x1d53, 0xd4: 0x2053, 0xd5: 0x2352, 0xd6: 0x2653, 0xd7: 0x2653, + 0xd8: 0x0113, 0xd9: 0x0112, 0xda: 0x2952, 0xdb: 0x0012, 0xdc: 0x1d53, 0xdd: 0x2c53, + 0xde: 0x2f52, 0xdf: 0x3253, 0xe0: 0x0113, 0xe1: 0x0112, 0xe2: 0x0113, 0xe3: 0x0112, + 0xe4: 0x0113, 0xe5: 0x0112, 0xe6: 0x3553, 0xe7: 0x0f13, 0xe8: 0x0f12, 0xe9: 0x3853, + 0xea: 0x0012, 0xeb: 0x0012, 0xec: 0x0113, 0xed: 0x0112, 0xee: 0x3553, 0xef: 0x1f13, + 0xf0: 0x1f12, 0xf1: 0x3b53, 0xf2: 0x3e53, 0xf3: 0x0713, 0xf4: 0x0712, 0xf5: 0x0313, + 0xf6: 0x0312, 0xf7: 0x4153, 0xf8: 0x0113, 0xf9: 0x0112, 0xfa: 0x0012, 0xfb: 0x0010, + 0xfc: 0x0113, 0xfd: 0x0112, 0xfe: 0x0012, 0xff: 0x4452, + // Block 0x4, offset 0x100 + 0x100: 0x0010, 0x101: 0x0010, 0x102: 0x0010, 0x103: 0x0010, 0x104: 0x02db, 0x105: 0x0359, + 0x106: 0x03da, 0x107: 0x043b, 0x108: 0x04b9, 0x109: 0x053a, 0x10a: 0x059b, 0x10b: 0x0619, + 0x10c: 0x069a, 0x10d: 0x0313, 0x10e: 0x0312, 0x10f: 0x1f13, 0x110: 0x1f12, 0x111: 0x0313, + 0x112: 0x0312, 0x113: 0x0713, 0x114: 0x0712, 0x115: 0x0313, 0x116: 0x0312, 0x117: 0x0f13, + 0x118: 0x0f12, 0x119: 0x0313, 0x11a: 0x0312, 0x11b: 0x0713, 0x11c: 0x0712, 0x11d: 0x1452, + 0x11e: 0x0113, 0x11f: 0x0112, 0x120: 0x0113, 0x121: 0x0112, 0x122: 0x0113, 0x123: 0x0112, + 0x124: 0x0113, 0x125: 0x0112, 0x126: 0x0113, 0x127: 0x0112, 0x128: 0x0113, 0x129: 0x0112, + 0x12a: 0x0113, 0x12b: 0x0112, 0x12c: 0x0113, 0x12d: 0x0112, 0x12e: 0x0113, 0x12f: 0x0112, + 0x130: 0x06fa, 0x131: 0x07ab, 0x132: 0x0829, 0x133: 0x08aa, 0x134: 0x0113, 0x135: 0x0112, + 0x136: 0x2353, 0x137: 0x4453, 0x138: 0x0113, 0x139: 0x0112, 0x13a: 0x0113, 0x13b: 0x0112, + 0x13c: 0x0113, 0x13d: 0x0112, 0x13e: 0x0113, 0x13f: 0x0112, + // Block 0x5, offset 0x140 + 0x140: 0x0a8a, 0x141: 0x0313, 0x142: 0x0312, 0x143: 0x0853, 0x144: 0x4753, 0x145: 0x4a53, + 0x146: 0x0113, 0x147: 0x0112, 0x148: 0x0113, 0x149: 0x0112, 0x14a: 0x0113, 0x14b: 0x0112, + 0x14c: 0x0113, 0x14d: 0x0112, 0x14e: 0x0113, 0x14f: 0x0112, 0x150: 0x0b0a, 0x151: 0x0b8a, + 0x152: 0x0c0a, 0x153: 0x0b52, 0x154: 0x0b52, 0x155: 0x0012, 0x156: 0x0e52, 0x157: 0x1152, + 0x158: 0x0012, 0x159: 0x1752, 0x15a: 0x0012, 0x15b: 0x1a52, 0x15c: 0x0c8a, 0x15d: 0x0012, + 0x15e: 0x0012, 0x15f: 0x0012, 0x160: 0x1d52, 0x161: 0x0d0a, 0x162: 0x0012, 0x163: 0x2052, + 0x164: 0x0012, 0x165: 0x0d8a, 0x166: 0x0e0a, 0x167: 0x0012, 0x168: 0x2652, 0x169: 0x2652, + 0x16a: 0x0e8a, 0x16b: 0x0f0a, 0x16c: 0x0f8a, 0x16d: 0x0012, 0x16e: 0x0012, 0x16f: 0x1d52, + 0x170: 0x0012, 0x171: 0x100a, 0x172: 0x2c52, 0x173: 0x0012, 0x174: 0x0012, 0x175: 0x3252, + 0x176: 0x0012, 0x177: 0x0012, 0x178: 0x0012, 0x179: 0x0012, 0x17a: 0x0012, 0x17b: 0x0012, + 0x17c: 0x0012, 0x17d: 0x108a, 0x17e: 0x0012, 0x17f: 0x0012, + // Block 0x6, offset 0x180 + 0x180: 0x3552, 0x181: 0x0012, 0x182: 0x0012, 0x183: 0x3852, 0x184: 0x0012, 0x185: 0x0012, + 0x186: 0x0012, 0x187: 0x110a, 0x188: 0x3552, 0x189: 0x4752, 0x18a: 0x3b52, 0x18b: 0x3e52, + 0x18c: 0x4a52, 0x18d: 0x0012, 0x18e: 0x0012, 0x18f: 0x0012, 0x190: 0x0012, 0x191: 0x0012, + 0x192: 0x4152, 0x193: 0x0012, 0x194: 0x0010, 0x195: 0x0012, 0x196: 0x0012, 0x197: 0x0012, + 0x198: 0x0012, 0x199: 0x0012, 0x19a: 0x0012, 0x19b: 0x0012, 0x19c: 0x0012, 0x19d: 0x118a, + 0x19e: 0x120a, 0x19f: 0x0012, 0x1a0: 0x0012, 0x1a1: 0x0012, 0x1a2: 0x0012, 0x1a3: 0x0012, + 0x1a4: 0x0012, 0x1a5: 0x0012, 0x1a6: 0x0012, 0x1a7: 0x0012, 0x1a8: 0x0012, 0x1a9: 0x0012, + 0x1aa: 0x0012, 0x1ab: 0x0012, 0x1ac: 0x0012, 0x1ad: 0x0012, 0x1ae: 0x0012, 0x1af: 0x0012, + 0x1b0: 0x0015, 0x1b1: 0x0015, 0x1b2: 0x0015, 0x1b3: 0x0015, 0x1b4: 0x0015, 0x1b5: 0x0015, + 0x1b6: 0x0015, 0x1b7: 0x0015, 0x1b8: 0x0015, 0x1b9: 0x0014, 0x1ba: 0x0014, 0x1bb: 0x0014, + 0x1bc: 0x0014, 0x1bd: 0x0014, 0x1be: 0x0014, 0x1bf: 0x0014, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x0024, 0x1c1: 0x0024, 0x1c2: 0x0024, 0x1c3: 0x0024, 0x1c4: 0x0024, 0x1c5: 0x128d, + 0x1c6: 0x0024, 0x1c7: 0x0034, 0x1c8: 0x0034, 0x1c9: 0x0034, 0x1ca: 0x0024, 0x1cb: 0x0024, + 0x1cc: 0x0024, 0x1cd: 0x0034, 0x1ce: 0x0034, 0x1cf: 0x0014, 0x1d0: 0x0024, 0x1d1: 0x0024, + 0x1d2: 0x0024, 0x1d3: 0x0034, 0x1d4: 0x0034, 0x1d5: 0x0034, 0x1d6: 0x0034, 0x1d7: 0x0024, + 0x1d8: 0x0034, 0x1d9: 0x0034, 0x1da: 0x0034, 0x1db: 0x0024, 0x1dc: 0x0034, 0x1dd: 0x0034, + 0x1de: 0x0034, 0x1df: 0x0034, 0x1e0: 0x0034, 0x1e1: 0x0034, 0x1e2: 0x0034, 0x1e3: 0x0024, + 0x1e4: 0x0024, 0x1e5: 0x0024, 0x1e6: 0x0024, 0x1e7: 0x0024, 0x1e8: 0x0024, 0x1e9: 0x0024, + 0x1ea: 0x0024, 0x1eb: 0x0024, 0x1ec: 0x0024, 0x1ed: 0x0024, 0x1ee: 0x0024, 0x1ef: 0x0024, + 0x1f0: 0x0113, 0x1f1: 0x0112, 0x1f2: 0x0113, 0x1f3: 0x0112, 0x1f4: 0x0014, 0x1f5: 0x0004, + 0x1f6: 0x0113, 0x1f7: 0x0112, 0x1fa: 0x0015, 0x1fb: 0x4d52, + 0x1fc: 0x5052, 0x1fd: 0x5052, 0x1ff: 0x5353, + // Block 0x8, offset 0x200 + 0x204: 0x0004, 0x205: 0x0004, + 0x206: 0x2a13, 0x207: 0x0054, 0x208: 0x2513, 0x209: 0x2713, 0x20a: 0x2513, + 0x20c: 0x5653, 0x20e: 0x5953, 0x20f: 0x5c53, 0x210: 0x130a, 0x211: 0x2013, + 0x212: 0x2013, 0x213: 0x2013, 0x214: 0x2013, 0x215: 0x2013, 0x216: 0x2013, 0x217: 0x2013, + 0x218: 0x2013, 0x219: 0x2013, 0x21a: 0x2013, 0x21b: 0x2013, 0x21c: 0x2013, 0x21d: 0x2013, + 0x21e: 0x2013, 0x21f: 0x2013, 0x220: 0x5f53, 0x221: 0x5f53, 0x223: 0x5f53, + 0x224: 0x5f53, 0x225: 0x5f53, 0x226: 0x5f53, 0x227: 0x5f53, 0x228: 0x5f53, 0x229: 0x5f53, + 0x22a: 0x5f53, 0x22b: 0x5f53, 0x22c: 0x2a12, 0x22d: 0x2512, 0x22e: 0x2712, 0x22f: 0x2512, + 0x230: 0x144a, 0x231: 0x2012, 0x232: 0x2012, 0x233: 0x2012, 0x234: 0x2012, 0x235: 0x2012, + 0x236: 0x2012, 0x237: 0x2012, 0x238: 0x2012, 0x239: 0x2012, 0x23a: 0x2012, 0x23b: 0x2012, + 0x23c: 0x2012, 0x23d: 0x2012, 0x23e: 0x2012, 0x23f: 0x2012, + // Block 0x9, offset 0x240 + 0x240: 0x5f52, 0x241: 0x5f52, 0x242: 0x158a, 0x243: 0x5f52, 0x244: 0x5f52, 0x245: 0x5f52, + 0x246: 0x5f52, 0x247: 0x5f52, 0x248: 0x5f52, 0x249: 0x5f52, 0x24a: 0x5f52, 0x24b: 0x5f52, + 0x24c: 0x5652, 0x24d: 0x5952, 0x24e: 0x5c52, 0x24f: 0x1813, 0x250: 0x160a, 0x251: 0x168a, + 0x252: 0x0013, 0x253: 0x0013, 0x254: 0x0013, 0x255: 0x170a, 0x256: 0x178a, 0x257: 0x1812, + 0x258: 0x0113, 0x259: 0x0112, 0x25a: 0x0113, 0x25b: 0x0112, 0x25c: 0x0113, 0x25d: 0x0112, + 0x25e: 0x0113, 0x25f: 0x0112, 0x260: 0x0113, 0x261: 0x0112, 0x262: 0x0113, 0x263: 0x0112, + 0x264: 0x0113, 0x265: 0x0112, 0x266: 0x0113, 0x267: 0x0112, 0x268: 0x0113, 0x269: 0x0112, + 0x26a: 0x0113, 0x26b: 0x0112, 0x26c: 0x0113, 0x26d: 0x0112, 0x26e: 0x0113, 0x26f: 0x0112, + 0x270: 0x180a, 0x271: 0x188a, 0x272: 0x0b12, 0x273: 0x5352, 0x274: 0x6253, 0x275: 0x190a, + 0x277: 0x0f13, 0x278: 0x0f12, 0x279: 0x0b13, 0x27a: 0x0113, 0x27b: 0x0112, + 0x27c: 0x0012, 0x27d: 0x4d53, 0x27e: 0x5053, 0x27f: 0x5053, + // Block 0xa, offset 0x280 + 0x280: 0x0812, 0x281: 0x0812, 0x282: 0x0812, 0x283: 0x0812, 0x284: 0x0812, 0x285: 0x0812, + 0x288: 0x0813, 0x289: 0x0813, 0x28a: 0x0813, 0x28b: 0x0813, + 0x28c: 0x0813, 0x28d: 0x0813, 0x290: 0x239a, 0x291: 0x0812, + 0x292: 0x247a, 0x293: 0x0812, 0x294: 0x25ba, 0x295: 0x0812, 0x296: 0x26fa, 0x297: 0x0812, + 0x299: 0x0813, 0x29b: 0x0813, 0x29d: 0x0813, + 0x29f: 0x0813, 0x2a0: 0x0812, 0x2a1: 0x0812, 0x2a2: 0x0812, 0x2a3: 0x0812, + 0x2a4: 0x0812, 0x2a5: 0x0812, 0x2a6: 0x0812, 0x2a7: 0x0812, 0x2a8: 0x0813, 0x2a9: 0x0813, + 0x2aa: 0x0813, 0x2ab: 0x0813, 0x2ac: 0x0813, 0x2ad: 0x0813, 0x2ae: 0x0813, 0x2af: 0x0813, + 0x2b0: 0x8b52, 0x2b1: 0x8b52, 0x2b2: 0x8e52, 0x2b3: 0x8e52, 0x2b4: 0x9152, 0x2b5: 0x9152, + 0x2b6: 0x9452, 0x2b7: 0x9452, 0x2b8: 0x9752, 0x2b9: 0x9752, 0x2ba: 0x9a52, 0x2bb: 0x9a52, + 0x2bc: 0x4d52, 0x2bd: 0x4d52, + // Block 0xb, offset 0x2c0 + 0x2c0: 0x283a, 0x2c1: 0x292a, 0x2c2: 0x2a1a, 0x2c3: 0x2b0a, 0x2c4: 0x2bfa, 0x2c5: 0x2cea, + 0x2c6: 0x2dda, 0x2c7: 0x2eca, 0x2c8: 0x2fb9, 0x2c9: 0x30a9, 0x2ca: 0x3199, 0x2cb: 0x3289, + 0x2cc: 0x3379, 0x2cd: 0x3469, 0x2ce: 0x3559, 0x2cf: 0x3649, 0x2d0: 0x373a, 0x2d1: 0x382a, + 0x2d2: 0x391a, 0x2d3: 0x3a0a, 0x2d4: 0x3afa, 0x2d5: 0x3bea, 0x2d6: 0x3cda, 0x2d7: 0x3dca, + 0x2d8: 0x3eb9, 0x2d9: 0x3fa9, 0x2da: 0x4099, 0x2db: 0x4189, 0x2dc: 0x4279, 0x2dd: 0x4369, + 0x2de: 0x4459, 0x2df: 0x4549, 0x2e0: 0x463a, 0x2e1: 0x472a, 0x2e2: 0x481a, 0x2e3: 0x490a, + 0x2e4: 0x49fa, 0x2e5: 0x4aea, 0x2e6: 0x4bda, 0x2e7: 0x4cca, 0x2e8: 0x4db9, 0x2e9: 0x4ea9, + 0x2ea: 0x4f99, 0x2eb: 0x5089, 0x2ec: 0x5179, 0x2ed: 0x5269, 0x2ee: 0x5359, 0x2ef: 0x5449, + 0x2f0: 0x0812, 0x2f1: 0x0812, 0x2f2: 0x553a, 0x2f3: 0x564a, 0x2f4: 0x571a, + 0x2f6: 0x57fa, 0x2f7: 0x58da, 0x2f8: 0x0813, 0x2f9: 0x0813, 0x2fa: 0x8b53, 0x2fb: 0x8b53, + 0x2fc: 0x5a19, 0x2fd: 0x0004, 0x2fe: 0x5aea, 0x2ff: 0x0004, + // Block 0xc, offset 0x300 + 0x300: 0x0004, 0x301: 0x0004, 0x302: 0x5b6a, 0x303: 0x5c7a, 0x304: 0x5d4a, + 0x306: 0x5e2a, 0x307: 0x5f0a, 0x308: 0x8e53, 0x309: 0x8e53, 0x30a: 0x9153, 0x30b: 0x9153, + 0x30c: 0x6049, 0x30d: 0x0004, 0x30e: 0x0004, 0x30f: 0x0004, 0x310: 0x0812, 0x311: 0x0812, + 0x312: 0x611a, 0x313: 0x625a, 0x316: 0x639a, 0x317: 0x647a, + 0x318: 0x0813, 0x319: 0x0813, 0x31a: 0x9453, 0x31b: 0x9453, 0x31d: 0x0004, + 0x31e: 0x0004, 0x31f: 0x0004, 0x320: 0x0812, 0x321: 0x0812, 0x322: 0x65ba, 0x323: 0x66fa, + 0x324: 0x683a, 0x325: 0x0912, 0x326: 0x691a, 0x327: 0x69fa, 0x328: 0x0813, 0x329: 0x0813, + 0x32a: 0x9a53, 0x32b: 0x9a53, 0x32c: 0x0913, 0x32d: 0x0004, 0x32e: 0x0004, 0x32f: 0x0004, + 0x332: 0x6b3a, 0x333: 0x6c4a, 0x334: 0x6d1a, + 0x336: 0x6dfa, 0x337: 0x6eda, 0x338: 0x9753, 0x339: 0x9753, 0x33a: 0x4d53, 0x33b: 0x4d53, + 0x33c: 0x7019, 0x33d: 0x0004, 0x33e: 0x0004, + // Block 0xd, offset 0x340 + 0x342: 0x0013, + 0x347: 0x0013, 0x34a: 0x0012, 0x34b: 0x0013, + 0x34c: 0x0013, 0x34d: 0x0013, 0x34e: 0x0012, 0x34f: 0x0012, 0x350: 0x0013, 0x351: 0x0013, + 0x352: 0x0013, 0x353: 0x0012, 0x355: 0x0013, + 0x359: 0x0013, 0x35a: 0x0013, 0x35b: 0x0013, 0x35c: 0x0013, 0x35d: 0x0013, + 0x364: 0x0013, 0x366: 0x70eb, 0x368: 0x0013, + 0x36a: 0x714b, 0x36b: 0x718b, 0x36c: 0x0013, 0x36d: 0x0013, 0x36f: 0x0012, + 0x370: 0x0013, 0x371: 0x0013, 0x372: 0x9d53, 0x373: 0x0013, 0x374: 0x0012, 0x375: 0x0010, + 0x376: 0x0010, 0x377: 0x0010, 0x378: 0x0010, 0x379: 0x0012, + 0x37c: 0x0012, 0x37d: 0x0012, 0x37e: 0x0013, 0x37f: 0x0013, + // Block 0xe, offset 0x380 + 0x380: 0x1a13, 0x381: 0x1a13, 0x382: 0x1e13, 0x383: 0x1e13, 0x384: 0x1a13, 0x385: 0x1a13, + 0x386: 0x2613, 0x387: 0x2613, 0x388: 0x2a13, 0x389: 0x2a13, 0x38a: 0x2e13, 0x38b: 0x2e13, + 0x38c: 0x2a13, 0x38d: 0x2a13, 0x38e: 0x2613, 0x38f: 0x2613, 0x390: 0xa052, 0x391: 0xa052, + 0x392: 0xa352, 0x393: 0xa352, 0x394: 0xa652, 0x395: 0xa652, 0x396: 0xa352, 0x397: 0xa352, + 0x398: 0xa052, 0x399: 0xa052, 0x39a: 0x1a12, 0x39b: 0x1a12, 0x39c: 0x1e12, 0x39d: 0x1e12, + 0x39e: 0x1a12, 0x39f: 0x1a12, 0x3a0: 0x2612, 0x3a1: 0x2612, 0x3a2: 0x2a12, 0x3a3: 0x2a12, + 0x3a4: 0x2e12, 0x3a5: 0x2e12, 0x3a6: 0x2a12, 0x3a7: 0x2a12, 0x3a8: 0x2612, 0x3a9: 0x2612, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x6552, 0x3c1: 0x6552, 0x3c2: 0x6552, 0x3c3: 0x6552, 0x3c4: 0x6552, 0x3c5: 0x6552, + 0x3c6: 0x6552, 0x3c7: 0x6552, 0x3c8: 0x6552, 0x3c9: 0x6552, 0x3ca: 0x6552, 0x3cb: 0x6552, + 0x3cc: 0x6552, 0x3cd: 0x6552, 0x3ce: 0x6552, 0x3cf: 0x6552, 0x3d0: 0xa952, 0x3d1: 0xa952, + 0x3d2: 0xa952, 0x3d3: 0xa952, 0x3d4: 0xa952, 0x3d5: 0xa952, 0x3d6: 0xa952, 0x3d7: 0xa952, + 0x3d8: 0xa952, 0x3d9: 0xa952, 0x3da: 0xa952, 0x3db: 0xa952, 0x3dc: 0xa952, 0x3dd: 0xa952, + 0x3de: 0xa952, 0x3e0: 0x0113, 0x3e1: 0x0112, 0x3e2: 0x71eb, 0x3e3: 0x8853, + 0x3e4: 0x724b, 0x3e5: 0x72aa, 0x3e6: 0x730a, 0x3e7: 0x0f13, 0x3e8: 0x0f12, 0x3e9: 0x0313, + 0x3ea: 0x0312, 0x3eb: 0x0713, 0x3ec: 0x0712, 0x3ed: 0x736b, 0x3ee: 0x73cb, 0x3ef: 0x742b, + 0x3f0: 0x748b, 0x3f1: 0x0012, 0x3f2: 0x0113, 0x3f3: 0x0112, 0x3f4: 0x0012, 0x3f5: 0x0313, + 0x3f6: 0x0312, 0x3f7: 0x0012, 0x3f8: 0x0012, 0x3f9: 0x0012, 0x3fa: 0x0012, 0x3fb: 0x0012, + 0x3fc: 0x0015, 0x3fd: 0x0015, 0x3fe: 0x74eb, 0x3ff: 0x754b, + // Block 0x10, offset 0x400 + 0x400: 0x0113, 0x401: 0x0112, 0x402: 0x0113, 0x403: 0x0112, 0x404: 0x0113, 0x405: 0x0112, + 0x406: 0x0113, 0x407: 0x0112, 0x408: 0x0014, 0x409: 0x0014, 0x40a: 0x0014, 0x40b: 0x0713, + 0x40c: 0x0712, 0x40d: 0x75ab, 0x40e: 0x0012, 0x40f: 0x0010, 0x410: 0x0113, 0x411: 0x0112, + 0x412: 0x0113, 0x413: 0x0112, 0x414: 0x0012, 0x415: 0x0012, 0x416: 0x0113, 0x417: 0x0112, + 0x418: 0x0113, 0x419: 0x0112, 0x41a: 0x0113, 0x41b: 0x0112, 0x41c: 0x0113, 0x41d: 0x0112, + 0x41e: 0x0113, 0x41f: 0x0112, 0x420: 0x0113, 0x421: 0x0112, 0x422: 0x0113, 0x423: 0x0112, + 0x424: 0x0113, 0x425: 0x0112, 0x426: 0x0113, 0x427: 0x0112, 0x428: 0x0113, 0x429: 0x0112, + 0x42a: 0x760b, 0x42b: 0x766b, 0x42c: 0x76cb, 0x42d: 0x772b, 0x42e: 0x778b, + 0x430: 0x77eb, 0x431: 0x784b, 0x432: 0x78ab, 0x433: 0xac53, 0x434: 0x0113, 0x435: 0x0112, + 0x436: 0x0113, 0x437: 0x0112, + // Block 0x11, offset 0x440 + 0x440: 0x790a, 0x441: 0x798a, 0x442: 0x7a0a, 0x443: 0x7a8a, 0x444: 0x7b3a, 0x445: 0x7bea, + 0x446: 0x7c6a, + 0x453: 0x7cea, 0x454: 0x7dca, 0x455: 0x7eaa, 0x456: 0x7f8a, 0x457: 0x806a, + 0x45d: 0x0010, + 0x45e: 0x0034, 0x45f: 0x0010, 0x460: 0x0010, 0x461: 0x0010, 0x462: 0x0010, 0x463: 0x0010, + 0x464: 0x0010, 0x465: 0x0010, 0x466: 0x0010, 0x467: 0x0010, 0x468: 0x0010, + 0x46a: 0x0010, 0x46b: 0x0010, 0x46c: 0x0010, 0x46d: 0x0010, 0x46e: 0x0010, 0x46f: 0x0010, + 0x470: 0x0010, 0x471: 0x0010, 0x472: 0x0010, 0x473: 0x0010, 0x474: 0x0010, 0x475: 0x0010, + 0x476: 0x0010, 0x478: 0x0010, 0x479: 0x0010, 0x47a: 0x0010, 0x47b: 0x0010, + 0x47c: 0x0010, 0x47e: 0x0010, + // Block 0x12, offset 0x480 + 0x480: 0x2213, 0x481: 0x2213, 0x482: 0x2613, 0x483: 0x2613, 0x484: 0x2213, 0x485: 0x2213, + 0x486: 0x2e13, 0x487: 0x2e13, 0x488: 0x2213, 0x489: 0x2213, 0x48a: 0x2613, 0x48b: 0x2613, + 0x48c: 0x2213, 0x48d: 0x2213, 0x48e: 0x3e13, 0x48f: 0x3e13, 0x490: 0x2213, 0x491: 0x2213, + 0x492: 0x2613, 0x493: 0x2613, 0x494: 0x2213, 0x495: 0x2213, 0x496: 0x2e13, 0x497: 0x2e13, + 0x498: 0x2213, 0x499: 0x2213, 0x49a: 0x2613, 0x49b: 0x2613, 0x49c: 0x2213, 0x49d: 0x2213, + 0x49e: 0xb553, 0x49f: 0xb553, 0x4a0: 0xb853, 0x4a1: 0xb853, 0x4a2: 0x2212, 0x4a3: 0x2212, + 0x4a4: 0x2612, 0x4a5: 0x2612, 0x4a6: 0x2212, 0x4a7: 0x2212, 0x4a8: 0x2e12, 0x4a9: 0x2e12, + 0x4aa: 0x2212, 0x4ab: 0x2212, 0x4ac: 0x2612, 0x4ad: 0x2612, 0x4ae: 0x2212, 0x4af: 0x2212, + 0x4b0: 0x3e12, 0x4b1: 0x3e12, 0x4b2: 0x2212, 0x4b3: 0x2212, 0x4b4: 0x2612, 0x4b5: 0x2612, + 0x4b6: 0x2212, 0x4b7: 0x2212, 0x4b8: 0x2e12, 0x4b9: 0x2e12, 0x4ba: 0x2212, 0x4bb: 0x2212, + 0x4bc: 0x2612, 0x4bd: 0x2612, 0x4be: 0x2212, 0x4bf: 0x2212, + // Block 0x13, offset 0x4c0 + 0x4c2: 0x0010, + 0x4c7: 0x0010, 0x4c9: 0x0010, 0x4cb: 0x0010, + 0x4cd: 0x0010, 0x4ce: 0x0010, 0x4cf: 0x0010, 0x4d1: 0x0010, + 0x4d2: 0x0010, 0x4d4: 0x0010, 0x4d7: 0x0010, + 0x4d9: 0x0010, 0x4db: 0x0010, 0x4dd: 0x0010, + 0x4df: 0x0010, 0x4e1: 0x0010, 0x4e2: 0x0010, + 0x4e4: 0x0010, 0x4e7: 0x0010, 0x4e8: 0x0010, 0x4e9: 0x0010, + 0x4ea: 0x0010, 0x4ec: 0x0010, 0x4ed: 0x0010, 0x4ee: 0x0010, 0x4ef: 0x0010, + 0x4f0: 0x0010, 0x4f1: 0x0010, 0x4f2: 0x0010, 0x4f4: 0x0010, 0x4f5: 0x0010, + 0x4f6: 0x0010, 0x4f7: 0x0010, 0x4f9: 0x0010, 0x4fa: 0x0010, 0x4fb: 0x0010, + 0x4fc: 0x0010, 0x4fe: 0x0010, +} + +// caseIndex: 25 blocks, 1600 entries, 3200 bytes +// Block 0 is the zero block. +var caseIndex = [1600]uint16{ + // Block 0x0, offset 0x0 + // Block 0x1, offset 0x40 + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc2: 0x12, 0xc3: 0x13, 0xc4: 0x14, 0xc5: 0x15, 0xc6: 0x01, 0xc7: 0x02, + 0xc8: 0x16, 0xc9: 0x03, 0xca: 0x04, 0xcb: 0x17, 0xcc: 0x18, 0xcd: 0x05, 0xce: 0x06, 0xcf: 0x07, + 0xd0: 0x19, 0xd1: 0x1a, 0xd2: 0x1b, 0xd3: 0x1c, 0xd4: 0x1d, 0xd5: 0x1e, 0xd6: 0x1f, 0xd7: 0x20, + 0xd8: 0x21, 0xd9: 0x22, 0xda: 0x23, 0xdb: 0x24, 0xdc: 0x25, 0xdd: 0x26, 0xde: 0x27, 0xdf: 0x28, + 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, + 0xea: 0x06, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x08, 0xef: 0x09, + 0xf0: 0x14, 0xf3: 0x16, + // Block 0x4, offset 0x100 + 0x120: 0x29, 0x121: 0x2a, 0x122: 0x2b, 0x123: 0x2c, 0x124: 0x2d, 0x125: 0x2e, 0x126: 0x2f, 0x127: 0x30, + 0x128: 0x31, 0x129: 0x32, 0x12a: 0x33, 0x12b: 0x34, 0x12c: 0x35, 0x12d: 0x36, 0x12e: 0x37, 0x12f: 0x38, + 0x130: 0x39, 0x131: 0x3a, 0x132: 0x3b, 0x133: 0x3c, 0x134: 0x3d, 0x135: 0x3e, 0x136: 0x3f, 0x137: 0x40, + 0x138: 0x41, 0x139: 0x42, 0x13a: 0x43, 0x13b: 0x44, 0x13c: 0x45, 0x13d: 0x46, 0x13e: 0x47, 0x13f: 0x48, + // Block 0x5, offset 0x140 + 0x140: 0x49, 0x141: 0x4a, 0x142: 0x4b, 0x143: 0x4c, 0x144: 0x23, 0x145: 0x23, 0x146: 0x23, 0x147: 0x23, + 0x148: 0x23, 0x149: 0x4d, 0x14a: 0x4e, 0x14b: 0x4f, 0x14c: 0x50, 0x14d: 0x51, 0x14e: 0x52, 0x14f: 0x53, + 0x150: 0x54, 0x151: 0x23, 0x152: 0x23, 0x153: 0x23, 0x154: 0x23, 0x155: 0x23, 0x156: 0x23, 0x157: 0x23, + 0x158: 0x23, 0x159: 0x55, 0x15a: 0x56, 0x15b: 0x57, 0x15c: 0x58, 0x15d: 0x59, 0x15e: 0x5a, 0x15f: 0x5b, + 0x160: 0x5c, 0x161: 0x5d, 0x162: 0x5e, 0x163: 0x5f, 0x164: 0x60, 0x165: 0x61, 0x167: 0x62, + 0x168: 0x63, 0x169: 0x64, 0x16a: 0x65, 0x16c: 0x66, 0x16d: 0x67, 0x16e: 0x68, 0x16f: 0x69, + 0x170: 0x6a, 0x171: 0x6b, 0x172: 0x6c, 0x173: 0x6d, 0x174: 0x6e, 0x175: 0x6f, 0x176: 0x70, 0x177: 0x71, + 0x178: 0x72, 0x179: 0x72, 0x17a: 0x73, 0x17b: 0x72, 0x17c: 0x74, 0x17d: 0x08, 0x17e: 0x09, 0x17f: 0x0a, + // Block 0x6, offset 0x180 + 0x180: 0x75, 0x181: 0x76, 0x182: 0x77, 0x183: 0x78, 0x184: 0x0b, 0x185: 0x79, 0x186: 0x7a, + 0x192: 0x7b, 0x193: 0x0c, + 0x1b0: 0x7c, 0x1b1: 0x0d, 0x1b2: 0x72, 0x1b3: 0x7d, 0x1b4: 0x7e, 0x1b5: 0x7f, 0x1b6: 0x80, 0x1b7: 0x81, + 0x1b8: 0x82, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x83, 0x1c2: 0x84, 0x1c3: 0x85, 0x1c4: 0x86, 0x1c5: 0x23, 0x1c6: 0x87, + // Block 0x8, offset 0x200 + 0x200: 0x88, 0x201: 0x23, 0x202: 0x23, 0x203: 0x23, 0x204: 0x23, 0x205: 0x23, 0x206: 0x23, 0x207: 0x23, + 0x208: 0x23, 0x209: 0x23, 0x20a: 0x23, 0x20b: 0x23, 0x20c: 0x23, 0x20d: 0x23, 0x20e: 0x23, 0x20f: 0x23, + 0x210: 0x23, 0x211: 0x23, 0x212: 0x89, 0x213: 0x8a, 0x214: 0x23, 0x215: 0x23, 0x216: 0x23, 0x217: 0x23, + 0x218: 0x8b, 0x219: 0x8c, 0x21a: 0x8d, 0x21b: 0x8e, 0x21c: 0x8f, 0x21d: 0x90, 0x21e: 0x0e, 0x21f: 0x91, + 0x220: 0x92, 0x221: 0x93, 0x222: 0x23, 0x223: 0x94, 0x224: 0x95, 0x225: 0x96, 0x226: 0x97, 0x227: 0x98, + 0x228: 0x99, 0x229: 0x9a, 0x22a: 0x9b, 0x22b: 0x9c, 0x22c: 0x9d, 0x22d: 0x9e, 0x22e: 0x9f, 0x22f: 0xa0, + 0x230: 0x23, 0x231: 0x23, 0x232: 0x23, 0x233: 0x23, 0x234: 0x23, 0x235: 0x23, 0x236: 0x23, 0x237: 0x23, + 0x238: 0x23, 0x239: 0x23, 0x23a: 0x23, 0x23b: 0x23, 0x23c: 0x23, 0x23d: 0x23, 0x23e: 0x23, 0x23f: 0x23, + // Block 0x9, offset 0x240 + 0x240: 0x23, 0x241: 0x23, 0x242: 0x23, 0x243: 0x23, 0x244: 0x23, 0x245: 0x23, 0x246: 0x23, 0x247: 0x23, + 0x248: 0x23, 0x249: 0x23, 0x24a: 0x23, 0x24b: 0x23, 0x24c: 0x23, 0x24d: 0x23, 0x24e: 0x23, 0x24f: 0x23, + 0x250: 0x23, 0x251: 0x23, 0x252: 0x23, 0x253: 0x23, 0x254: 0x23, 0x255: 0x23, 0x256: 0x23, 0x257: 0x23, + 0x258: 0x23, 0x259: 0x23, 0x25a: 0x23, 0x25b: 0x23, 0x25c: 0x23, 0x25d: 0x23, 0x25e: 0x23, 0x25f: 0x23, + 0x260: 0x23, 0x261: 0x23, 0x262: 0x23, 0x263: 0x23, 0x264: 0x23, 0x265: 0x23, 0x266: 0x23, 0x267: 0x23, + 0x268: 0x23, 0x269: 0x23, 0x26a: 0x23, 0x26b: 0x23, 0x26c: 0x23, 0x26d: 0x23, 0x26e: 0x23, 0x26f: 0x23, + 0x270: 0x23, 0x271: 0x23, 0x272: 0x23, 0x273: 0x23, 0x274: 0x23, 0x275: 0x23, 0x276: 0x23, 0x277: 0x23, + 0x278: 0x23, 0x279: 0x23, 0x27a: 0x23, 0x27b: 0x23, 0x27c: 0x23, 0x27d: 0x23, 0x27e: 0x23, 0x27f: 0x23, + // Block 0xa, offset 0x280 + 0x280: 0x23, 0x281: 0x23, 0x282: 0x23, 0x283: 0x23, 0x284: 0x23, 0x285: 0x23, 0x286: 0x23, 0x287: 0x23, + 0x288: 0x23, 0x289: 0x23, 0x28a: 0x23, 0x28b: 0x23, 0x28c: 0x23, 0x28d: 0x23, 0x28e: 0x23, 0x28f: 0x23, + 0x290: 0x23, 0x291: 0x23, 0x292: 0x23, 0x293: 0x23, 0x294: 0x23, 0x295: 0x23, 0x296: 0x23, 0x297: 0x23, + 0x298: 0x23, 0x299: 0x23, 0x29a: 0x23, 0x29b: 0x23, 0x29c: 0x23, 0x29d: 0x23, 0x29e: 0xa1, 0x29f: 0xa2, + // Block 0xb, offset 0x2c0 + 0x2ec: 0x0f, 0x2ed: 0xa3, 0x2ee: 0xa4, 0x2ef: 0xa5, + 0x2f0: 0x23, 0x2f1: 0x23, 0x2f2: 0x23, 0x2f3: 0x23, 0x2f4: 0xa6, 0x2f5: 0xa7, 0x2f6: 0xa8, 0x2f7: 0xa9, + 0x2f8: 0xaa, 0x2f9: 0xab, 0x2fa: 0x23, 0x2fb: 0xac, 0x2fc: 0xad, 0x2fd: 0xae, 0x2fe: 0xaf, 0x2ff: 0xb0, + // Block 0xc, offset 0x300 + 0x300: 0xb1, 0x301: 0xb2, 0x302: 0x23, 0x303: 0xb3, 0x305: 0xb4, 0x307: 0xb5, + 0x30a: 0xb6, 0x30b: 0xb7, 0x30c: 0xb8, 0x30d: 0xb9, 0x30e: 0xba, 0x30f: 0xbb, + 0x310: 0xbc, 0x311: 0xbd, 0x312: 0xbe, 0x313: 0xbf, 0x314: 0xc0, 0x315: 0xc1, + 0x318: 0x23, 0x319: 0x23, 0x31a: 0x23, 0x31b: 0x23, 0x31c: 0xc2, 0x31d: 0xc3, + 0x320: 0xc4, 0x321: 0xc5, 0x322: 0xc6, 0x323: 0xc7, 0x324: 0xc8, 0x326: 0xc9, + 0x328: 0xca, 0x329: 0xcb, 0x32a: 0xcc, 0x32b: 0xcd, 0x32c: 0x5f, 0x32d: 0xce, 0x32e: 0xcf, + 0x330: 0x23, 0x331: 0xd0, 0x332: 0xd1, 0x333: 0xd2, + // Block 0xd, offset 0x340 + 0x340: 0xd3, 0x341: 0xd4, 0x342: 0xd5, 0x343: 0xd6, 0x344: 0xd7, 0x345: 0xd8, 0x346: 0xd9, 0x347: 0xda, + 0x348: 0xdb, 0x34a: 0xdc, 0x34b: 0xdd, 0x34c: 0xde, 0x34d: 0xdf, + 0x350: 0xe0, 0x351: 0xe1, 0x352: 0xe2, 0x353: 0xe3, 0x356: 0xe4, 0x357: 0xe5, + 0x358: 0xe6, 0x359: 0xe7, 0x35a: 0xe8, 0x35b: 0xe9, 0x35c: 0xea, + 0x362: 0xeb, 0x363: 0xec, + 0x368: 0xed, 0x369: 0xee, 0x36a: 0xef, 0x36b: 0xf0, + 0x370: 0xf1, 0x371: 0xf2, 0x372: 0xf3, 0x374: 0xf4, 0x375: 0xf5, + // Block 0xe, offset 0x380 + 0x380: 0x23, 0x381: 0x23, 0x382: 0x23, 0x383: 0x23, 0x384: 0x23, 0x385: 0x23, 0x386: 0x23, 0x387: 0x23, + 0x388: 0x23, 0x389: 0x23, 0x38a: 0x23, 0x38b: 0x23, 0x38c: 0x23, 0x38d: 0x23, 0x38e: 0xf6, + 0x390: 0x23, 0x391: 0xf7, 0x392: 0x23, 0x393: 0x23, 0x394: 0x23, 0x395: 0xf8, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x23, 0x3c1: 0x23, 0x3c2: 0x23, 0x3c3: 0x23, 0x3c4: 0x23, 0x3c5: 0x23, 0x3c6: 0x23, 0x3c7: 0x23, + 0x3c8: 0x23, 0x3c9: 0x23, 0x3ca: 0x23, 0x3cb: 0x23, 0x3cc: 0x23, 0x3cd: 0x23, 0x3ce: 0x23, 0x3cf: 0x23, + 0x3d0: 0xf7, + // Block 0x10, offset 0x400 + 0x410: 0x23, 0x411: 0x23, 0x412: 0x23, 0x413: 0x23, 0x414: 0x23, 0x415: 0x23, 0x416: 0x23, 0x417: 0x23, + 0x418: 0x23, 0x419: 0xf9, + // Block 0x11, offset 0x440 + 0x460: 0x23, 0x461: 0x23, 0x462: 0x23, 0x463: 0x23, 0x464: 0x23, 0x465: 0x23, 0x466: 0x23, 0x467: 0x23, + 0x468: 0xf0, 0x469: 0xfa, 0x46b: 0xfb, 0x46c: 0xfc, 0x46d: 0xfd, 0x46e: 0xfe, + 0x47c: 0x23, 0x47d: 0xff, 0x47e: 0x100, 0x47f: 0x101, + // Block 0x12, offset 0x480 + 0x4b0: 0x23, 0x4b1: 0x102, 0x4b2: 0x103, + // Block 0x13, offset 0x4c0 + 0x4c5: 0x104, 0x4c6: 0x105, + 0x4c9: 0x106, + 0x4d0: 0x107, 0x4d1: 0x108, 0x4d2: 0x109, 0x4d3: 0x10a, 0x4d4: 0x10b, 0x4d5: 0x10c, 0x4d6: 0x10d, 0x4d7: 0x10e, + 0x4d8: 0x10f, 0x4d9: 0x110, 0x4da: 0x111, 0x4db: 0x112, 0x4dc: 0x113, 0x4dd: 0x114, 0x4de: 0x115, 0x4df: 0x116, + 0x4e8: 0x117, 0x4e9: 0x118, 0x4ea: 0x119, + // Block 0x14, offset 0x500 + 0x500: 0x11a, + 0x520: 0x23, 0x521: 0x23, 0x522: 0x23, 0x523: 0x11b, 0x524: 0x10, 0x525: 0x11c, + 0x538: 0x11d, 0x539: 0x11, 0x53a: 0x11e, + // Block 0x15, offset 0x540 + 0x544: 0x11f, 0x545: 0x120, 0x546: 0x121, + 0x54f: 0x122, + // Block 0x16, offset 0x580 + 0x590: 0x0a, 0x591: 0x0b, 0x592: 0x0c, 0x593: 0x0d, 0x594: 0x0e, 0x596: 0x0f, + 0x59b: 0x10, 0x59d: 0x11, 0x59e: 0x12, 0x59f: 0x13, + // Block 0x17, offset 0x5c0 + 0x5c0: 0x123, 0x5c1: 0x124, 0x5c4: 0x124, 0x5c5: 0x124, 0x5c6: 0x124, 0x5c7: 0x125, + // Block 0x18, offset 0x600 + 0x620: 0x15, +} + +// sparseOffsets: 277 entries, 554 bytes +var sparseOffsets = []uint16{0x0, 0x9, 0xf, 0x18, 0x24, 0x2e, 0x35, 0x38, 0x3c, 0x3f, 0x43, 0x4d, 0x4f, 0x54, 0x64, 0x6b, 0x70, 0x7e, 0x7f, 0x8d, 0x9c, 0xa6, 0xa9, 0xaf, 0xb7, 0xba, 0xbc, 0xca, 0xd0, 0xde, 0xe9, 0xf5, 0x100, 0x10c, 0x116, 0x122, 0x12d, 0x139, 0x145, 0x14d, 0x155, 0x15f, 0x16a, 0x176, 0x17d, 0x188, 0x18d, 0x195, 0x198, 0x19d, 0x1a1, 0x1a5, 0x1ac, 0x1b5, 0x1bd, 0x1be, 0x1c7, 0x1ce, 0x1d6, 0x1dc, 0x1e2, 0x1e7, 0x1eb, 0x1ee, 0x1f0, 0x1f3, 0x1f8, 0x1f9, 0x1fb, 0x1fd, 0x1ff, 0x206, 0x20b, 0x20f, 0x218, 0x21b, 0x21e, 0x224, 0x225, 0x230, 0x231, 0x232, 0x237, 0x244, 0x24c, 0x254, 0x25d, 0x266, 0x26f, 0x274, 0x277, 0x280, 0x28d, 0x28f, 0x296, 0x298, 0x2a4, 0x2a5, 0x2b0, 0x2b8, 0x2c0, 0x2c6, 0x2c7, 0x2d5, 0x2da, 0x2dd, 0x2e2, 0x2e6, 0x2ec, 0x2f1, 0x2f4, 0x2f9, 0x2fe, 0x2ff, 0x305, 0x307, 0x308, 0x30a, 0x30c, 0x30f, 0x310, 0x312, 0x315, 0x31b, 0x31f, 0x321, 0x326, 0x32d, 0x331, 0x33a, 0x33b, 0x343, 0x347, 0x34c, 0x354, 0x35a, 0x360, 0x36a, 0x36f, 0x378, 0x37e, 0x385, 0x389, 0x391, 0x393, 0x395, 0x398, 0x39a, 0x39c, 0x39d, 0x39e, 0x3a0, 0x3a2, 0x3a8, 0x3ad, 0x3af, 0x3b5, 0x3b8, 0x3ba, 0x3c0, 0x3c5, 0x3c7, 0x3c8, 0x3c9, 0x3ca, 0x3cc, 0x3ce, 0x3d0, 0x3d3, 0x3d5, 0x3d8, 0x3e0, 0x3e3, 0x3e7, 0x3ef, 0x3f1, 0x3f2, 0x3f3, 0x3f5, 0x3fb, 0x3fd, 0x3fe, 0x400, 0x402, 0x404, 0x411, 0x412, 0x413, 0x417, 0x419, 0x41a, 0x41b, 0x41c, 0x41d, 0x421, 0x425, 0x42b, 0x42d, 0x434, 0x437, 0x43b, 0x441, 0x44a, 0x450, 0x456, 0x460, 0x46a, 0x46c, 0x473, 0x479, 0x47f, 0x485, 0x488, 0x48e, 0x491, 0x499, 0x49a, 0x4a1, 0x4a2, 0x4a5, 0x4af, 0x4b5, 0x4bb, 0x4bc, 0x4c2, 0x4c5, 0x4cd, 0x4d4, 0x4db, 0x4dc, 0x4dd, 0x4de, 0x4df, 0x4e1, 0x4e3, 0x4e5, 0x4e9, 0x4ea, 0x4ec, 0x4ed, 0x4ee, 0x4f0, 0x4f5, 0x4fa, 0x4fe, 0x4ff, 0x502, 0x506, 0x511, 0x515, 0x51d, 0x522, 0x526, 0x529, 0x52d, 0x530, 0x533, 0x538, 0x53c, 0x540, 0x544, 0x548, 0x54a, 0x54c, 0x54f, 0x554, 0x556, 0x55b, 0x564, 0x569, 0x56a, 0x56d, 0x56e, 0x56f, 0x571, 0x572, 0x573} + +// sparseValues: 1395 entries, 5580 bytes +var sparseValues = [1395]valueRange{ + // Block 0x0, offset 0x0 + {value: 0x0004, lo: 0xa8, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xaa}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0004, lo: 0xaf, hi: 0xaf}, + {value: 0x0004, lo: 0xb4, hi: 0xb4}, + {value: 0x001a, lo: 0xb5, hi: 0xb5}, + {value: 0x0054, lo: 0xb7, hi: 0xb7}, + {value: 0x0004, lo: 0xb8, hi: 0xb8}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + // Block 0x1, offset 0x9 + {value: 0x2013, lo: 0x80, hi: 0x96}, + {value: 0x2013, lo: 0x98, hi: 0x9e}, + {value: 0x009a, lo: 0x9f, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xb6}, + {value: 0x2012, lo: 0xb8, hi: 0xbe}, + {value: 0x0252, lo: 0xbf, hi: 0xbf}, + // Block 0x2, offset 0xf + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x011b, lo: 0xb0, hi: 0xb0}, + {value: 0x019a, lo: 0xb1, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb7}, + {value: 0x0012, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x0553, lo: 0xbf, hi: 0xbf}, + // Block 0x3, offset 0x18 + {value: 0x0552, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x01da, lo: 0x89, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xb7}, + {value: 0x0253, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x028a, lo: 0xbf, hi: 0xbf}, + // Block 0x4, offset 0x24 + {value: 0x0117, lo: 0x80, hi: 0x9f}, + {value: 0x2f53, lo: 0xa0, hi: 0xa0}, + {value: 0x0012, lo: 0xa1, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xb3}, + {value: 0x0012, lo: 0xb4, hi: 0xb9}, + {value: 0x090b, lo: 0xba, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x2953, lo: 0xbd, hi: 0xbd}, + {value: 0x098b, lo: 0xbe, hi: 0xbe}, + {value: 0x0a0a, lo: 0xbf, hi: 0xbf}, + // Block 0x5, offset 0x2e + {value: 0x0015, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x97}, + {value: 0x0004, lo: 0x98, hi: 0x9d}, + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0015, lo: 0xa0, hi: 0xa4}, + {value: 0x0004, lo: 0xa5, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xbf}, + // Block 0x6, offset 0x35 + {value: 0x0024, lo: 0x80, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbf}, + // Block 0x7, offset 0x38 + {value: 0x6553, lo: 0x80, hi: 0x8f}, + {value: 0x2013, lo: 0x90, hi: 0x9f}, + {value: 0x5f53, lo: 0xa0, hi: 0xaf}, + {value: 0x2012, lo: 0xb0, hi: 0xbf}, + // Block 0x8, offset 0x3c + {value: 0x5f52, lo: 0x80, hi: 0x8f}, + {value: 0x6552, lo: 0x90, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x9, offset 0x3f + {value: 0x0117, lo: 0x80, hi: 0x81}, + {value: 0x0024, lo: 0x83, hi: 0x87}, + {value: 0x0014, lo: 0x88, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xbf}, + // Block 0xa, offset 0x43 + {value: 0x0f13, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x0316, lo: 0x89, hi: 0x8a}, + {value: 0x0716, lo: 0x8b, hi: 0x8c}, + {value: 0x0316, lo: 0x8d, hi: 0x8e}, + {value: 0x0f12, lo: 0x8f, hi: 0x8f}, + {value: 0x0117, lo: 0x90, hi: 0xbf}, + // Block 0xb, offset 0x4d + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x6553, lo: 0xb1, hi: 0xbf}, + // Block 0xc, offset 0x4f + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6853, lo: 0x90, hi: 0x96}, + {value: 0x0014, lo: 0x99, hi: 0x99}, + {value: 0x6552, lo: 0xa1, hi: 0xaf}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0xd, offset 0x54 + {value: 0x6852, lo: 0x80, hi: 0x86}, + {value: 0x198a, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x91, hi: 0x91}, + {value: 0x0024, lo: 0x92, hi: 0x95}, + {value: 0x0034, lo: 0x96, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x99}, + {value: 0x0034, lo: 0x9a, hi: 0x9b}, + {value: 0x0024, lo: 0x9c, hi: 0xa1}, + {value: 0x0034, lo: 0xa2, hi: 0xa7}, + {value: 0x0024, lo: 0xa8, hi: 0xa9}, + {value: 0x0034, lo: 0xaa, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xaf}, + {value: 0x0034, lo: 0xb0, hi: 0xbd}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xe, offset 0x64 + {value: 0x0034, lo: 0x81, hi: 0x82}, + {value: 0x0024, lo: 0x84, hi: 0x84}, + {value: 0x0034, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xb3}, + {value: 0x0054, lo: 0xb4, hi: 0xb4}, + // Block 0xf, offset 0x6b + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0024, lo: 0x90, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0014, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x10, offset 0x70 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9c}, + {value: 0x0024, lo: 0x9d, hi: 0x9e}, + {value: 0x0034, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0034, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x11, offset 0x7e + {value: 0x0010, lo: 0x80, hi: 0xbf}, + // Block 0x12, offset 0x7f + {value: 0x0010, lo: 0x80, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0024, lo: 0x9f, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xaa, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x13, offset 0x8d + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0034, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0034, lo: 0xb1, hi: 0xb1}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbd}, + {value: 0x0034, lo: 0xbe, hi: 0xbe}, + {value: 0x0024, lo: 0xbf, hi: 0xbf}, + // Block 0x14, offset 0x9c + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0024, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x88}, + {value: 0x0024, lo: 0x89, hi: 0x8a}, + {value: 0x0010, lo: 0x8d, hi: 0xbf}, + // Block 0x15, offset 0xa6 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x16, offset 0xa9 + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xb1}, + {value: 0x0034, lo: 0xb2, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + // Block 0x17, offset 0xaf + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x99}, + {value: 0x0014, lo: 0x9a, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0xa3}, + {value: 0x0014, lo: 0xa4, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xad}, + // Block 0x18, offset 0xb7 + {value: 0x0010, lo: 0x80, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0xa0, hi: 0xaa}, + // Block 0x19, offset 0xba + {value: 0x0010, lo: 0xa0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbd}, + // Block 0x1a, offset 0xbc + {value: 0x0024, lo: 0x94, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0024, lo: 0xaa, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbf}, + // Block 0x1b, offset 0xca + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1c, offset 0xd0 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0x1d, offset 0xde + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb6, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1e, offset 0xe9 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xb1}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + // Block 0x1f, offset 0xf5 + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x20, offset 0x100 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x99, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x21, offset 0x10c + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x22, offset 0x116 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x85}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xbf}, + // Block 0x23, offset 0x122 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x24, offset 0x12d + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x25, offset 0x139 + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0010, lo: 0xa8, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x26, offset 0x145 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x27, offset 0x14d + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb9}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbf}, + // Block 0x28, offset 0x155 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x88}, + {value: 0x0014, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x29, offset 0x15f + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x2a, offset 0x16a + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb2}, + // Block 0x2b, offset 0x176 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x2c, offset 0x17d + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x94, hi: 0x97}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xba, hi: 0xbf}, + // Block 0x2d, offset 0x188 + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x96}, + {value: 0x0010, lo: 0x9a, hi: 0xb1}, + {value: 0x0010, lo: 0xb3, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x2e, offset 0x18d + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x94}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9f}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + // Block 0x2f, offset 0x195 + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xba}, + // Block 0x30, offset 0x198 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x31, offset 0x19d + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xb9}, + {value: 0x0014, lo: 0xbb, hi: 0xbc}, + // Block 0x32, offset 0x1a1 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x33, offset 0x1a5 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0034, lo: 0x98, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0034, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x34, offset 0x1ac + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xac}, + {value: 0x0034, lo: 0xb1, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xba, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x35, offset 0x1b5 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0024, lo: 0x82, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x86, hi: 0x87}, + {value: 0x0010, lo: 0x88, hi: 0x8c}, + {value: 0x0014, lo: 0x8d, hi: 0x97}, + {value: 0x0014, lo: 0x99, hi: 0xbc}, + // Block 0x36, offset 0x1bd + {value: 0x0034, lo: 0x86, hi: 0x86}, + // Block 0x37, offset 0x1be + {value: 0x0010, lo: 0xab, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbe}, + // Block 0x38, offset 0x1c7 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x96, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x99}, + {value: 0x0014, lo: 0x9e, hi: 0xa0}, + {value: 0x0010, lo: 0xa2, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xad}, + {value: 0x0014, lo: 0xb1, hi: 0xb4}, + // Block 0x39, offset 0x1ce + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x6c53, lo: 0xa0, hi: 0xbf}, + // Block 0x3a, offset 0x1d6 + {value: 0x7053, lo: 0x80, hi: 0x85}, + {value: 0x7053, lo: 0x87, hi: 0x87}, + {value: 0x7053, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xba}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x3b, offset 0x1dc + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x9a, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x3c, offset 0x1e2 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x3d, offset 0x1e7 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x82, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3e, offset 0x1eb + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3f, offset 0x1ee + {value: 0x0010, lo: 0x80, hi: 0x9a}, + {value: 0x0024, lo: 0x9d, hi: 0x9f}, + // Block 0x40, offset 0x1f0 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x7453, lo: 0xa0, hi: 0xaf}, + {value: 0x7853, lo: 0xb0, hi: 0xbf}, + // Block 0x41, offset 0x1f3 + {value: 0x7c53, lo: 0x80, hi: 0x8f}, + {value: 0x8053, lo: 0x90, hi: 0x9f}, + {value: 0x7c53, lo: 0xa0, hi: 0xaf}, + {value: 0x0813, lo: 0xb0, hi: 0xb5}, + {value: 0x0892, lo: 0xb8, hi: 0xbd}, + // Block 0x42, offset 0x1f8 + {value: 0x0010, lo: 0x81, hi: 0xbf}, + // Block 0x43, offset 0x1f9 + {value: 0x0010, lo: 0x80, hi: 0xac}, + {value: 0x0010, lo: 0xaf, hi: 0xbf}, + // Block 0x44, offset 0x1fb + {value: 0x0010, lo: 0x81, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x45, offset 0x1fd + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb8}, + // Block 0x46, offset 0x1ff + {value: 0x0010, lo: 0x80, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0034, lo: 0x94, hi: 0x94}, + {value: 0x0010, lo: 0xa0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + // Block 0x47, offset 0x206 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xac}, + {value: 0x0010, lo: 0xae, hi: 0xb0}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + // Block 0x48, offset 0x20b + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x49, offset 0x20f + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x89, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0014, lo: 0x93, hi: 0x93}, + {value: 0x0004, lo: 0x97, hi: 0x97}, + {value: 0x0024, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0x4a, offset 0x218 + {value: 0x0014, lo: 0x8b, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x4b, offset 0x21b + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb7}, + // Block 0x4c, offset 0x21e + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x4d, offset 0x224 + {value: 0x0010, lo: 0x80, hi: 0xb5}, + // Block 0x4e, offset 0x225 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbb}, + // Block 0x4f, offset 0x230 + {value: 0x0010, lo: 0x86, hi: 0x8f}, + // Block 0x50, offset 0x231 + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x51, offset 0x232 + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + // Block 0x52, offset 0x237 + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x9e}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xac}, + {value: 0x0010, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xbc}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x53, offset 0x244 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xa7, hi: 0xa7}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + {value: 0x0034, lo: 0xb5, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbc}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + // Block 0x54, offset 0x24c + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x55, offset 0x254 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0030, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8b}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xab, hi: 0xab}, + {value: 0x0034, lo: 0xac, hi: 0xac}, + {value: 0x0024, lo: 0xad, hi: 0xb3}, + // Block 0x56, offset 0x25d + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0030, lo: 0xaa, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbf}, + // Block 0x57, offset 0x266 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0030, lo: 0xb2, hi: 0xb3}, + // Block 0x58, offset 0x26f + {value: 0x0010, lo: 0x80, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + // Block 0x59, offset 0x274 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8d, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x5a, offset 0x277 + {value: 0x1a6a, lo: 0x80, hi: 0x80}, + {value: 0x1aea, lo: 0x81, hi: 0x81}, + {value: 0x1b6a, lo: 0x82, hi: 0x82}, + {value: 0x1bea, lo: 0x83, hi: 0x83}, + {value: 0x1c6a, lo: 0x84, hi: 0x84}, + {value: 0x1cea, lo: 0x85, hi: 0x85}, + {value: 0x1d6a, lo: 0x86, hi: 0x86}, + {value: 0x1dea, lo: 0x87, hi: 0x87}, + {value: 0x1e6a, lo: 0x88, hi: 0x88}, + // Block 0x5b, offset 0x280 + {value: 0x0024, lo: 0x90, hi: 0x92}, + {value: 0x0034, lo: 0x94, hi: 0x99}, + {value: 0x0024, lo: 0x9a, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9f}, + {value: 0x0024, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0034, lo: 0xa2, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xb3}, + {value: 0x0024, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb7}, + {value: 0x0024, lo: 0xb8, hi: 0xb9}, + // Block 0x5c, offset 0x28d + {value: 0x0012, lo: 0x80, hi: 0xab}, + {value: 0x0015, lo: 0xac, hi: 0xbf}, + // Block 0x5d, offset 0x28f + {value: 0x0015, lo: 0x80, hi: 0xaa}, + {value: 0x0012, lo: 0xab, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb8}, + {value: 0x8452, lo: 0xb9, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbc}, + {value: 0x8852, lo: 0xbd, hi: 0xbd}, + {value: 0x0012, lo: 0xbe, hi: 0xbf}, + // Block 0x5e, offset 0x296 + {value: 0x0012, lo: 0x80, hi: 0x9a}, + {value: 0x0015, lo: 0x9b, hi: 0xbf}, + // Block 0x5f, offset 0x298 + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0024, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb9}, + {value: 0x0024, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbd}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x60, offset 0x2a4 + {value: 0x0117, lo: 0x80, hi: 0xbf}, + // Block 0x61, offset 0x2a5 + {value: 0x0117, lo: 0x80, hi: 0x95}, + {value: 0x1f1a, lo: 0x96, hi: 0x96}, + {value: 0x1fca, lo: 0x97, hi: 0x97}, + {value: 0x207a, lo: 0x98, hi: 0x98}, + {value: 0x212a, lo: 0x99, hi: 0x99}, + {value: 0x21da, lo: 0x9a, hi: 0x9a}, + {value: 0x228a, lo: 0x9b, hi: 0x9b}, + {value: 0x0012, lo: 0x9c, hi: 0x9d}, + {value: 0x233b, lo: 0x9e, hi: 0x9e}, + {value: 0x0012, lo: 0x9f, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x62, offset 0x2b0 + {value: 0x0812, lo: 0x80, hi: 0x87}, + {value: 0x0813, lo: 0x88, hi: 0x8f}, + {value: 0x0812, lo: 0x90, hi: 0x95}, + {value: 0x0813, lo: 0x98, hi: 0x9d}, + {value: 0x0812, lo: 0xa0, hi: 0xa7}, + {value: 0x0813, lo: 0xa8, hi: 0xaf}, + {value: 0x0812, lo: 0xb0, hi: 0xb7}, + {value: 0x0813, lo: 0xb8, hi: 0xbf}, + // Block 0x63, offset 0x2b8 + {value: 0x0004, lo: 0x8b, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8f}, + {value: 0x0054, lo: 0x98, hi: 0x99}, + {value: 0x0054, lo: 0xa4, hi: 0xa4}, + {value: 0x0054, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xaa, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xaf}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x64, offset 0x2c0 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x94, hi: 0x94}, + {value: 0x0014, lo: 0xa0, hi: 0xa4}, + {value: 0x0014, lo: 0xa6, hi: 0xaf}, + {value: 0x0015, lo: 0xb1, hi: 0xb1}, + {value: 0x0015, lo: 0xbf, hi: 0xbf}, + // Block 0x65, offset 0x2c6 + {value: 0x0015, lo: 0x90, hi: 0x9c}, + // Block 0x66, offset 0x2c7 + {value: 0x0024, lo: 0x90, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x93}, + {value: 0x0024, lo: 0x94, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0xa0}, + {value: 0x0024, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa4}, + {value: 0x0034, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa7}, + {value: 0x0034, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xa9}, + {value: 0x0034, lo: 0xaa, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + // Block 0x67, offset 0x2d5 + {value: 0x0016, lo: 0x85, hi: 0x86}, + {value: 0x0012, lo: 0x87, hi: 0x89}, + {value: 0x9d52, lo: 0x8e, hi: 0x8e}, + {value: 0x1013, lo: 0xa0, hi: 0xaf}, + {value: 0x1012, lo: 0xb0, hi: 0xbf}, + // Block 0x68, offset 0x2da + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x88}, + // Block 0x69, offset 0x2dd + {value: 0xa053, lo: 0xb6, hi: 0xb7}, + {value: 0xa353, lo: 0xb8, hi: 0xb9}, + {value: 0xa653, lo: 0xba, hi: 0xbb}, + {value: 0xa353, lo: 0xbc, hi: 0xbd}, + {value: 0xa053, lo: 0xbe, hi: 0xbf}, + // Block 0x6a, offset 0x2e2 + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6553, lo: 0x90, hi: 0x9f}, + {value: 0xa953, lo: 0xa0, hi: 0xae}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0x6b, offset 0x2e6 + {value: 0x0117, lo: 0x80, hi: 0xa3}, + {value: 0x0012, lo: 0xa4, hi: 0xa4}, + {value: 0x0716, lo: 0xab, hi: 0xac}, + {value: 0x0316, lo: 0xad, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb3}, + // Block 0x6c, offset 0x2ec + {value: 0x6c52, lo: 0x80, hi: 0x9f}, + {value: 0x7052, lo: 0xa0, hi: 0xa5}, + {value: 0x7052, lo: 0xa7, hi: 0xa7}, + {value: 0x7052, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x6d, offset 0x2f1 + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x6e, offset 0x2f4 + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0010, lo: 0xb0, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x6f, offset 0x2f9 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9e}, + {value: 0x0024, lo: 0xa0, hi: 0xbf}, + // Block 0x70, offset 0x2fe + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + // Block 0x71, offset 0x2ff + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0xaa, hi: 0xad}, + {value: 0x0030, lo: 0xae, hi: 0xaf}, + {value: 0x0004, lo: 0xb1, hi: 0xb5}, + {value: 0x0014, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + // Block 0x72, offset 0x305 + {value: 0x0034, lo: 0x99, hi: 0x9a}, + {value: 0x0004, lo: 0x9b, hi: 0x9e}, + // Block 0x73, offset 0x307 + {value: 0x0004, lo: 0xbc, hi: 0xbe}, + // Block 0x74, offset 0x308 + {value: 0x0010, lo: 0x85, hi: 0xae}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x75, offset 0x30a + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0010, lo: 0xa0, hi: 0xba}, + // Block 0x76, offset 0x30c + {value: 0x0010, lo: 0x80, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0xbf}, + // Block 0x77, offset 0x30f + {value: 0x0010, lo: 0x80, hi: 0x8c}, + // Block 0x78, offset 0x310 + {value: 0x0010, lo: 0x90, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x79, offset 0x312 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0xab}, + // Block 0x7a, offset 0x315 + {value: 0x0117, lo: 0x80, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb2}, + {value: 0x0024, lo: 0xb4, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x7b, offset 0x31b + {value: 0x0117, lo: 0x80, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9d}, + {value: 0x0024, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x7c, offset 0x31f + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb1}, + // Block 0x7d, offset 0x321 + {value: 0x0004, lo: 0x80, hi: 0x96}, + {value: 0x0014, lo: 0x97, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xaf}, + {value: 0x0012, lo: 0xb0, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xbf}, + // Block 0x7e, offset 0x326 + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x0015, lo: 0xb0, hi: 0xb0}, + {value: 0x0012, lo: 0xb1, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x8453, lo: 0xbd, hi: 0xbd}, + {value: 0x0117, lo: 0xbe, hi: 0xbf}, + // Block 0x7f, offset 0x32d + {value: 0x0010, lo: 0xb7, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbf}, + // Block 0x80, offset 0x331 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8b}, + {value: 0x0010, lo: 0x8c, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + // Block 0x81, offset 0x33a + {value: 0x0010, lo: 0x80, hi: 0xb3}, + // Block 0x82, offset 0x33b + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xa0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb7}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x83, offset 0x343 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x84, offset 0x347 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0x92}, + {value: 0x0030, lo: 0x93, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0x85, offset 0x34c + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb9}, + {value: 0x0010, lo: 0xba, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x86, offset 0x354 + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0004, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x87, offset 0x35a + {value: 0x0010, lo: 0x80, hi: 0xa8}, + {value: 0x0014, lo: 0xa9, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0x88, offset 0x360 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x89, offset 0x36a + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0024, lo: 0xbe, hi: 0xbf}, + // Block 0x8a, offset 0x36f + {value: 0x0024, lo: 0x81, hi: 0x81}, + {value: 0x0004, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + // Block 0x8b, offset 0x378 + {value: 0x0010, lo: 0x81, hi: 0x86}, + {value: 0x0010, lo: 0x89, hi: 0x8e}, + {value: 0x0010, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x8c, offset 0x37e + {value: 0x0012, lo: 0x80, hi: 0x92}, + {value: 0xac52, lo: 0x93, hi: 0x93}, + {value: 0x0012, lo: 0x94, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9f}, + {value: 0x0012, lo: 0xa0, hi: 0xa5}, + {value: 0x74d2, lo: 0xb0, hi: 0xbf}, + // Block 0x8d, offset 0x385 + {value: 0x78d2, lo: 0x80, hi: 0x8f}, + {value: 0x7cd2, lo: 0x90, hi: 0x9f}, + {value: 0x80d2, lo: 0xa0, hi: 0xaf}, + {value: 0x7cd2, lo: 0xb0, hi: 0xbf}, + // Block 0x8e, offset 0x389 + {value: 0x0010, lo: 0x80, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x8f, offset 0x391 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x90, offset 0x393 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x8b, hi: 0xbb}, + // Block 0x91, offset 0x395 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0xbf}, + // Block 0x92, offset 0x398 + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0004, lo: 0xb2, hi: 0xbf}, + // Block 0x93, offset 0x39a + {value: 0x0004, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x93, hi: 0xbf}, + // Block 0x94, offset 0x39c + {value: 0x0010, lo: 0x80, hi: 0xbd}, + // Block 0x95, offset 0x39d + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0x96, offset 0x39e + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0xbf}, + // Block 0x97, offset 0x3a0 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0xb0, hi: 0xbb}, + // Block 0x98, offset 0x3a2 + {value: 0x0014, lo: 0x80, hi: 0x8f}, + {value: 0x0054, lo: 0x93, hi: 0x93}, + {value: 0x0024, lo: 0xa0, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xad}, + {value: 0x0024, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + // Block 0x99, offset 0x3a8 + {value: 0x0010, lo: 0x8d, hi: 0x8f}, + {value: 0x0054, lo: 0x92, hi: 0x92}, + {value: 0x0054, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0xb0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0x9a, offset 0x3ad + {value: 0x0010, lo: 0x80, hi: 0xbc}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x9b, offset 0x3af + {value: 0x0054, lo: 0x87, hi: 0x87}, + {value: 0x0054, lo: 0x8e, hi: 0x8e}, + {value: 0x0054, lo: 0x9a, hi: 0x9a}, + {value: 0x5f53, lo: 0xa1, hi: 0xba}, + {value: 0x0004, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9c, offset 0x3b5 + {value: 0x0004, lo: 0x80, hi: 0x80}, + {value: 0x5f52, lo: 0x81, hi: 0x9a}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + // Block 0x9d, offset 0x3b8 + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbe}, + // Block 0x9e, offset 0x3ba + {value: 0x0010, lo: 0x82, hi: 0x87}, + {value: 0x0010, lo: 0x8a, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0x97}, + {value: 0x0010, lo: 0x9a, hi: 0x9c}, + {value: 0x0004, lo: 0xa3, hi: 0xa3}, + {value: 0x0014, lo: 0xb9, hi: 0xbb}, + // Block 0x9f, offset 0x3c0 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0010, lo: 0x8d, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xba}, + {value: 0x0010, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xa0, offset 0x3c5 + {value: 0x0010, lo: 0x80, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x9d}, + // Block 0xa1, offset 0x3c7 + {value: 0x0010, lo: 0x80, hi: 0xba}, + // Block 0xa2, offset 0x3c8 + {value: 0x0010, lo: 0x80, hi: 0xb4}, + // Block 0xa3, offset 0x3c9 + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0xa4, offset 0x3ca + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa5, offset 0x3cc + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + // Block 0xa6, offset 0x3ce + {value: 0x0010, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xad, hi: 0xbf}, + // Block 0xa7, offset 0x3d0 + {value: 0x0010, lo: 0x80, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0xb5}, + {value: 0x0024, lo: 0xb6, hi: 0xba}, + // Block 0xa8, offset 0x3d3 + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa9, offset 0x3d5 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x91, hi: 0x95}, + // Block 0xaa, offset 0x3d8 + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x97}, + {value: 0xaf53, lo: 0x98, hi: 0x9f}, + {value: 0xb253, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbf}, + // Block 0xab, offset 0x3e0 + {value: 0xaf52, lo: 0x80, hi: 0x87}, + {value: 0xb252, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0xac, offset 0x3e3 + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0xb253, lo: 0xb0, hi: 0xb7}, + {value: 0xaf53, lo: 0xb8, hi: 0xbf}, + // Block 0xad, offset 0x3e7 + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x93}, + {value: 0xb252, lo: 0x98, hi: 0x9f}, + {value: 0xaf52, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbb}, + // Block 0xae, offset 0x3ef + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xaf, offset 0x3f1 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + // Block 0xb0, offset 0x3f2 + {value: 0x0010, lo: 0x80, hi: 0xb6}, + // Block 0xb1, offset 0x3f3 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xa7}, + // Block 0xb2, offset 0x3f5 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xb5}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xb3, offset 0x3fb + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb6}, + // Block 0xb4, offset 0x3fd + {value: 0x0010, lo: 0x80, hi: 0x9e}, + // Block 0xb5, offset 0x3fe + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + // Block 0xb6, offset 0x400 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb9}, + // Block 0xb7, offset 0x402 + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0xb8, offset 0x404 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x8e, hi: 0x8e}, + {value: 0x0024, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x99, hi: 0xb3}, + {value: 0x0024, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xb9, offset 0x411 + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0xba, offset 0x412 + {value: 0x0010, lo: 0x80, hi: 0x9c}, + // Block 0xbb, offset 0x413 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + // Block 0xbc, offset 0x417 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + // Block 0xbd, offset 0x419 + {value: 0x0010, lo: 0x80, hi: 0x91}, + // Block 0xbe, offset 0x41a + {value: 0x0010, lo: 0x80, hi: 0x88}, + // Block 0xbf, offset 0x41b + {value: 0x5653, lo: 0x80, hi: 0xb2}, + // Block 0xc0, offset 0x41c + {value: 0x5652, lo: 0x80, hi: 0xb2}, + // Block 0xc1, offset 0x41d + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xc2, offset 0x421 + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xc3, offset 0x425 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb6}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + // Block 0xc4, offset 0x42b + {value: 0x0010, lo: 0x90, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xc5, offset 0x42d + {value: 0x0024, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0xc6, offset 0x434 + {value: 0x0010, lo: 0x90, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + // Block 0xc7, offset 0x437 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xc8, offset 0x43b + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + // Block 0xc9, offset 0x441 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb4}, + {value: 0x0030, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xb7}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + // Block 0xca, offset 0x44a + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xcb, offset 0x450 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa2}, + {value: 0x0014, lo: 0xa3, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xcc, offset 0x456 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xcd, offset 0x460 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0030, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9d, hi: 0xa3}, + {value: 0x0024, lo: 0xa6, hi: 0xac}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + // Block 0xce, offset 0x46a + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xcf, offset 0x46c + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd0, offset 0x473 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xd1, offset 0x479 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd2, offset 0x47f + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xd3, offset 0x485 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x98, hi: 0x9b}, + {value: 0x0014, lo: 0x9c, hi: 0x9d}, + // Block 0xd4, offset 0x488 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xd5, offset 0x48e + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd6, offset 0x491 + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0014, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb5}, + {value: 0x0030, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + // Block 0xd7, offset 0x499 + {value: 0x0010, lo: 0x80, hi: 0x89}, + // Block 0xd8, offset 0x49a + {value: 0x0014, lo: 0x9d, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xd9, offset 0x4a1 + {value: 0x5f53, lo: 0xa0, hi: 0xbf}, + // Block 0xda, offset 0x4a2 + {value: 0x5f52, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xdb, offset 0x4a5 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x89, hi: 0x8a}, + {value: 0x0010, lo: 0x8b, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbb, hi: 0xbe}, + // Block 0xdc, offset 0x4af + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0014, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x98}, + {value: 0x0014, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0x9c, hi: 0xbf}, + // Block 0xdd, offset 0x4b5 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x86, hi: 0x89}, + {value: 0x0014, lo: 0x8a, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x99}, + // Block 0xde, offset 0x4bb + {value: 0x0010, lo: 0x80, hi: 0xb8}, + // Block 0xdf, offset 0x4bc + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb6}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xe0, offset 0x4c2 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0xe1, offset 0x4c5 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0014, lo: 0x92, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xa9}, + {value: 0x0014, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0xe2, offset 0x4cd + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb6}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xe3, offset 0x4d4 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xe4, offset 0x4db + {value: 0x0010, lo: 0x80, hi: 0x99}, + // Block 0xe5, offset 0x4dc + {value: 0x0010, lo: 0x80, hi: 0xae}, + // Block 0xe6, offset 0x4dd + {value: 0x0010, lo: 0x80, hi: 0x83}, + // Block 0xe7, offset 0x4de + {value: 0x0010, lo: 0x80, hi: 0x86}, + // Block 0xe8, offset 0x4df + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0xe9, offset 0x4e1 + {value: 0x0010, lo: 0x90, hi: 0xad}, + {value: 0x0034, lo: 0xb0, hi: 0xb4}, + // Block 0xea, offset 0x4e3 + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb6}, + // Block 0xeb, offset 0x4e5 + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa3, hi: 0xb7}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xec, offset 0x4e9 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + // Block 0xed, offset 0x4ea + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0010, lo: 0x90, hi: 0xbe}, + // Block 0xee, offset 0x4ec + {value: 0x0014, lo: 0x8f, hi: 0x9f}, + // Block 0xef, offset 0x4ed + {value: 0x0014, lo: 0xa0, hi: 0xa1}, + // Block 0xf0, offset 0x4ee + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbc}, + // Block 0xf1, offset 0x4f0 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0034, lo: 0x9e, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa3}, + // Block 0xf2, offset 0x4f5 + {value: 0x0030, lo: 0xa5, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xa9}, + {value: 0x0030, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbf}, + // Block 0xf3, offset 0x4fa + {value: 0x0034, lo: 0x80, hi: 0x82}, + {value: 0x0024, lo: 0x85, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8b}, + {value: 0x0024, lo: 0xaa, hi: 0xad}, + // Block 0xf4, offset 0x4fe + {value: 0x0024, lo: 0x82, hi: 0x84}, + // Block 0xf5, offset 0x4ff + {value: 0x0013, lo: 0x80, hi: 0x99}, + {value: 0x0012, lo: 0x9a, hi: 0xb3}, + {value: 0x0013, lo: 0xb4, hi: 0xbf}, + // Block 0xf6, offset 0x502 + {value: 0x0013, lo: 0x80, hi: 0x8d}, + {value: 0x0012, lo: 0x8e, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0xa7}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0xf7, offset 0x506 + {value: 0x0013, lo: 0x80, hi: 0x81}, + {value: 0x0012, lo: 0x82, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0x9c}, + {value: 0x0013, lo: 0x9e, hi: 0x9f}, + {value: 0x0013, lo: 0xa2, hi: 0xa2}, + {value: 0x0013, lo: 0xa5, hi: 0xa6}, + {value: 0x0013, lo: 0xa9, hi: 0xac}, + {value: 0x0013, lo: 0xae, hi: 0xb5}, + {value: 0x0012, lo: 0xb6, hi: 0xb9}, + {value: 0x0012, lo: 0xbb, hi: 0xbb}, + {value: 0x0012, lo: 0xbd, hi: 0xbf}, + // Block 0xf8, offset 0x511 + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0012, lo: 0x85, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0xf9, offset 0x515 + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0013, lo: 0x84, hi: 0x85}, + {value: 0x0013, lo: 0x87, hi: 0x8a}, + {value: 0x0013, lo: 0x8d, hi: 0x94}, + {value: 0x0013, lo: 0x96, hi: 0x9c}, + {value: 0x0012, lo: 0x9e, hi: 0xb7}, + {value: 0x0013, lo: 0xb8, hi: 0xb9}, + {value: 0x0013, lo: 0xbb, hi: 0xbe}, + // Block 0xfa, offset 0x51d + {value: 0x0013, lo: 0x80, hi: 0x84}, + {value: 0x0013, lo: 0x86, hi: 0x86}, + {value: 0x0013, lo: 0x8a, hi: 0x90}, + {value: 0x0012, lo: 0x92, hi: 0xab}, + {value: 0x0013, lo: 0xac, hi: 0xbf}, + // Block 0xfb, offset 0x522 + {value: 0x0013, lo: 0x80, hi: 0x85}, + {value: 0x0012, lo: 0x86, hi: 0x9f}, + {value: 0x0013, lo: 0xa0, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbf}, + // Block 0xfc, offset 0x526 + {value: 0x0012, lo: 0x80, hi: 0x93}, + {value: 0x0013, lo: 0x94, hi: 0xad}, + {value: 0x0012, lo: 0xae, hi: 0xbf}, + // Block 0xfd, offset 0x529 + {value: 0x0012, lo: 0x80, hi: 0x87}, + {value: 0x0013, lo: 0x88, hi: 0xa1}, + {value: 0x0012, lo: 0xa2, hi: 0xbb}, + {value: 0x0013, lo: 0xbc, hi: 0xbf}, + // Block 0xfe, offset 0x52d + {value: 0x0013, lo: 0x80, hi: 0x95}, + {value: 0x0012, lo: 0x96, hi: 0xaf}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0xff, offset 0x530 + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0012, lo: 0x8a, hi: 0xa5}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0x100, offset 0x533 + {value: 0x0013, lo: 0x80, hi: 0x80}, + {value: 0x0012, lo: 0x82, hi: 0x9a}, + {value: 0x0012, lo: 0x9c, hi: 0xa1}, + {value: 0x0013, lo: 0xa2, hi: 0xba}, + {value: 0x0012, lo: 0xbc, hi: 0xbf}, + // Block 0x101, offset 0x538 + {value: 0x0012, lo: 0x80, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0xb4}, + {value: 0x0012, lo: 0xb6, hi: 0xbf}, + // Block 0x102, offset 0x53c + {value: 0x0012, lo: 0x80, hi: 0x8e}, + {value: 0x0012, lo: 0x90, hi: 0x95}, + {value: 0x0013, lo: 0x96, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x103, offset 0x540 + {value: 0x0012, lo: 0x80, hi: 0x88}, + {value: 0x0012, lo: 0x8a, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0x104, offset 0x544 + {value: 0x0012, lo: 0x80, hi: 0x82}, + {value: 0x0012, lo: 0x84, hi: 0x89}, + {value: 0x0017, lo: 0x8a, hi: 0x8b}, + {value: 0x0010, lo: 0x8e, hi: 0xbf}, + // Block 0x105, offset 0x548 + {value: 0x0014, lo: 0x80, hi: 0xb6}, + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x106, offset 0x54a + {value: 0x0014, lo: 0x80, hi: 0xac}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x107, offset 0x54c + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x9b, hi: 0x9f}, + {value: 0x0014, lo: 0xa1, hi: 0xaf}, + // Block 0x108, offset 0x54f + {value: 0x0024, lo: 0x80, hi: 0x86}, + {value: 0x0024, lo: 0x88, hi: 0x98}, + {value: 0x0024, lo: 0x9b, hi: 0xa1}, + {value: 0x0024, lo: 0xa3, hi: 0xa4}, + {value: 0x0024, lo: 0xa6, hi: 0xaa}, + // Block 0x109, offset 0x554 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0034, lo: 0x90, hi: 0x96}, + // Block 0x10a, offset 0x556 + {value: 0xb552, lo: 0x80, hi: 0x81}, + {value: 0xb852, lo: 0x82, hi: 0x83}, + {value: 0x0024, lo: 0x84, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x10b, offset 0x55b + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x9f}, + {value: 0x0010, lo: 0xa1, hi: 0xa2}, + {value: 0x0010, lo: 0xa4, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb7}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + // Block 0x10c, offset 0x564 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x9b}, + {value: 0x0010, lo: 0xa1, hi: 0xa3}, + {value: 0x0010, lo: 0xa5, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xbb}, + // Block 0x10d, offset 0x569 + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x10e, offset 0x56a + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x10f, offset 0x56d + {value: 0x0013, lo: 0x80, hi: 0x89}, + // Block 0x110, offset 0x56e + {value: 0x0004, lo: 0xbb, hi: 0xbf}, + // Block 0x111, offset 0x56f + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0014, lo: 0xa0, hi: 0xbf}, + // Block 0x112, offset 0x571 + {value: 0x0014, lo: 0x80, hi: 0xbf}, + // Block 0x113, offset 0x572 + {value: 0x0014, lo: 0x80, hi: 0xaf}, +} + +// Total table size 14177 bytes (13KiB); checksum: F17D40E8 diff --git a/vendor/golang.org/x/text/cases/tables11.0.0.go b/vendor/golang.org/x/text/cases/tables11.0.0.go new file mode 100644 index 0000000000..ce00ce3725 --- /dev/null +++ b/vendor/golang.org/x/text/cases/tables11.0.0.go @@ -0,0 +1,2316 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +//go:build go1.13 && !go1.14 + +package cases + +// UnicodeVersion is the Unicode version from which the tables in this package are derived. +const UnicodeVersion = "11.0.0" + +var xorData string = "" + // Size: 188 bytes + "\x00\x06\x07\x00\x01?\x00\x0f\x03\x00\x0f\x12\x00\x0f\x1f\x00\x0f\x1d" + + "\x00\x01\x13\x00\x0f\x16\x00\x0f\x0b\x00\x0f3\x00\x0f7\x00\x01#\x00\x0f?" + + "\x00\x0e'\x00\x0f/\x00\x0e>\x00\x0f*\x00\x0c&\x00\x0c*\x00\x0c;\x00\x0c9" + + "\x00\x0c%\x00\x01\x08\x00\x03\x0d\x00\x03\x09\x00\x02\x06\x00\x02\x02" + + "\x00\x02\x0c\x00\x01\x00\x00\x01\x03\x00\x01\x01\x00\x01 \x00\x01\x0c" + + "\x00\x01\x10\x00\x03\x10\x00\x036 \x00\x037 \x00\x0b#\x10\x00\x0b 0\x00" + + "\x0b!\x10\x00\x0b!0\x001\x00\x00\x0b(\x04\x00\x03\x04\x1e\x00\x03\x0a" + + "\x00\x02:\x00\x02>\x00\x02,\x00\x02\x00\x00\x02\x10\x00\x01<\x00\x01&" + + "\x00\x01*\x00\x01.\x00\x010\x003 \x00\x01\x18\x00\x01(\x00\x01\x1e\x00" + + "\x01\x22" + +var exceptions string = "" + // Size: 2436 bytes + "\x00\x12\x12μΜΜ\x12\x12ssSSSs\x13\x18i̇i̇\x10\x09II\x13\x1bʼnʼNʼN\x11" + + "\x09sSS\x12\x12dždžDž\x12\x12dždžDŽ\x10\x12DŽDž\x12\x12ljljLj\x12\x12ljljLJ\x10\x12LJLj" + + "\x12\x12njnjNj\x12\x12njnjNJ\x10\x12NJNj\x13\x1bǰJ̌J̌\x12\x12dzdzDz\x12\x12dzdzDZ\x10" + + "\x12DZDz\x13\x18ⱥⱥ\x13\x18ⱦⱦ\x10\x1bⱾⱾ\x10\x1bⱿⱿ\x10\x1bⱯⱯ\x10\x1bⱭⱭ\x10" + + "\x1bⱰⱰ\x10\x1bꞫꞫ\x10\x1bꞬꞬ\x10\x1bꞍꞍ\x10\x1bꞪꞪ\x10\x1bꞮꞮ\x10\x1bⱢⱢ\x10" + + "\x1bꞭꞭ\x10\x1bⱮⱮ\x10\x1bⱤⱤ\x10\x1bꞱꞱ\x10\x1bꞲꞲ\x10\x1bꞰꞰ2\x12ιΙΙ\x166ΐ" + + "Ϊ́Ϊ́\x166ΰΫ́Ϋ́\x12\x12σΣΣ\x12\x12βΒΒ\x12\x12θΘΘ\x12\x12φΦΦ\x12" + + "\x12πΠΠ\x12\x12κΚΚ\x12\x12ρΡΡ\x12\x12εΕΕ\x14$եւԵՒԵւ\x10\x1bᲐა\x10\x1bᲑბ" + + "\x10\x1bᲒგ\x10\x1bᲓდ\x10\x1bᲔე\x10\x1bᲕვ\x10\x1bᲖზ\x10\x1bᲗთ\x10\x1bᲘი" + + "\x10\x1bᲙკ\x10\x1bᲚლ\x10\x1bᲛმ\x10\x1bᲜნ\x10\x1bᲝო\x10\x1bᲞპ\x10\x1bᲟჟ" + + "\x10\x1bᲠრ\x10\x1bᲡს\x10\x1bᲢტ\x10\x1bᲣუ\x10\x1bᲤფ\x10\x1bᲥქ\x10\x1bᲦღ" + + "\x10\x1bᲧყ\x10\x1bᲨშ\x10\x1bᲩჩ\x10\x1bᲪც\x10\x1bᲫძ\x10\x1bᲬწ\x10\x1bᲭჭ" + + "\x10\x1bᲮხ\x10\x1bᲯჯ\x10\x1bᲰჰ\x10\x1bᲱჱ\x10\x1bᲲჲ\x10\x1bᲳჳ\x10\x1bᲴჴ" + + "\x10\x1bᲵჵ\x10\x1bᲶჶ\x10\x1bᲷჷ\x10\x1bᲸჸ\x10\x1bᲹჹ\x10\x1bᲺჺ\x10\x1bᲽჽ" + + "\x10\x1bᲾჾ\x10\x1bᲿჿ\x12\x12вВВ\x12\x12дДД\x12\x12оОО\x12\x12сСС\x12\x12" + + "тТТ\x12\x12тТТ\x12\x12ъЪЪ\x12\x12ѣѢѢ\x13\x1bꙋꙊꙊ\x13\x1bẖH̱H̱\x13\x1bẗ" + + "T̈T̈\x13\x1bẘW̊W̊\x13\x1bẙY̊Y̊\x13\x1baʾAʾAʾ\x13\x1bṡṠṠ\x12\x10ssß\x14" + + "$ὐΥ̓Υ̓\x166ὒΥ̓̀Υ̓̀\x166ὔΥ̓́Υ̓́\x166ὖΥ̓͂Υ̓͂\x15+ἀιἈΙᾈ\x15+ἁιἉΙᾉ" + + "\x15+ἂιἊΙᾊ\x15+ἃιἋΙᾋ\x15+ἄιἌΙᾌ\x15+ἅιἍΙᾍ\x15+ἆιἎΙᾎ\x15+ἇιἏΙᾏ\x15\x1dἀιᾀἈ" + + "Ι\x15\x1dἁιᾁἉΙ\x15\x1dἂιᾂἊΙ\x15\x1dἃιᾃἋΙ\x15\x1dἄιᾄἌΙ\x15\x1dἅιᾅἍΙ\x15" + + "\x1dἆιᾆἎΙ\x15\x1dἇιᾇἏΙ\x15+ἠιἨΙᾘ\x15+ἡιἩΙᾙ\x15+ἢιἪΙᾚ\x15+ἣιἫΙᾛ\x15+ἤιἬΙᾜ" + + "\x15+ἥιἭΙᾝ\x15+ἦιἮΙᾞ\x15+ἧιἯΙᾟ\x15\x1dἠιᾐἨΙ\x15\x1dἡιᾑἩΙ\x15\x1dἢιᾒἪΙ" + + "\x15\x1dἣιᾓἫΙ\x15\x1dἤιᾔἬΙ\x15\x1dἥιᾕἭΙ\x15\x1dἦιᾖἮΙ\x15\x1dἧιᾗἯΙ\x15+ὠι" + + "ὨΙᾨ\x15+ὡιὩΙᾩ\x15+ὢιὪΙᾪ\x15+ὣιὫΙᾫ\x15+ὤιὬΙᾬ\x15+ὥιὭΙᾭ\x15+ὦιὮΙᾮ\x15+ὧι" + + "ὯΙᾯ\x15\x1dὠιᾠὨΙ\x15\x1dὡιᾡὩΙ\x15\x1dὢιᾢὪΙ\x15\x1dὣιᾣὫΙ\x15\x1dὤιᾤὬΙ" + + "\x15\x1dὥιᾥὭΙ\x15\x1dὦιᾦὮΙ\x15\x1dὧιᾧὯΙ\x15-ὰιᾺΙᾺͅ\x14#αιΑΙᾼ\x14$άιΆΙΆͅ" + + "\x14$ᾶΑ͂Α͂\x166ᾶιΑ͂Ιᾼ͂\x14\x1cαιᾳΑΙ\x12\x12ιΙΙ\x15-ὴιῊΙῊͅ\x14#ηιΗΙῌ" + + "\x14$ήιΉΙΉͅ\x14$ῆΗ͂Η͂\x166ῆιΗ͂Ιῌ͂\x14\x1cηιῃΗΙ\x166ῒΪ̀Ϊ̀\x166ΐΙ" + + "̈́Ϊ́\x14$ῖΙ͂Ι͂\x166ῗΪ͂Ϊ͂\x166ῢΫ̀Ϋ̀\x166ΰΫ́Ϋ́\x14$ῤΡ̓Ρ̓" + + "\x14$ῦΥ͂Υ͂\x166ῧΫ͂Ϋ͂\x15-ὼιῺΙῺͅ\x14#ωιΩΙῼ\x14$ώιΏΙΏͅ\x14$ῶΩ͂Ω͂\x16" + + "6ῶιΩ͂Ιῼ͂\x14\x1cωιῳΩΙ\x12\x10ωω\x11\x08kk\x12\x10åå\x12\x10ɫɫ\x12\x10ɽ" + + "ɽ\x10\x12ȺȺ\x10\x12ȾȾ\x12\x10ɑɑ\x12\x10ɱɱ\x12\x10ɐɐ\x12\x10ɒɒ\x12\x10ȿȿ" + + "\x12\x10ɀɀ\x12\x10ɥɥ\x12\x10ɦɦ\x12\x10ɜɜ\x12\x10ɡɡ\x12\x10ɬɬ\x12\x10ɪɪ" + + "\x12\x10ʞʞ\x12\x10ʇʇ\x12\x10ʝʝ\x12\x12ffFFFf\x12\x12fiFIFi\x12\x12flFLFl" + + "\x13\x1bffiFFIFfi\x13\x1bfflFFLFfl\x12\x12stSTSt\x12\x12stSTSt\x14$մնՄՆՄ" + + "ն\x14$մեՄԵՄե\x14$միՄԻՄի\x14$վնՎՆՎն\x14$մխՄԽՄխ" + +// lookup returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookup(s []byte) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupUnsafe(s []byte) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// lookupString returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookupString(s string) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupStringUnsafe(s string) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// caseTrie. Total size: 12250 bytes (11.96 KiB). Checksum: 53ff6cb7321675e1. +type caseTrie struct{} + +func newCaseTrie(i int) *caseTrie { + return &caseTrie{} +} + +// lookupValue determines the type of block n and looks up the value for b. +func (t *caseTrie) lookupValue(n uint32, b byte) uint16 { + switch { + case n < 20: + return uint16(caseValues[n<<6+uint32(b)]) + default: + n -= 20 + return uint16(sparse.lookup(n, b)) + } +} + +// caseValues: 22 blocks, 1408 entries, 2816 bytes +// The third block is the zero block. +var caseValues = [1408]uint16{ + // Block 0x0, offset 0x0 + 0x27: 0x0054, + 0x2e: 0x0054, + 0x30: 0x0010, 0x31: 0x0010, 0x32: 0x0010, 0x33: 0x0010, 0x34: 0x0010, 0x35: 0x0010, + 0x36: 0x0010, 0x37: 0x0010, 0x38: 0x0010, 0x39: 0x0010, 0x3a: 0x0054, + // Block 0x1, offset 0x40 + 0x41: 0x2013, 0x42: 0x2013, 0x43: 0x2013, 0x44: 0x2013, 0x45: 0x2013, + 0x46: 0x2013, 0x47: 0x2013, 0x48: 0x2013, 0x49: 0x2013, 0x4a: 0x2013, 0x4b: 0x2013, + 0x4c: 0x2013, 0x4d: 0x2013, 0x4e: 0x2013, 0x4f: 0x2013, 0x50: 0x2013, 0x51: 0x2013, + 0x52: 0x2013, 0x53: 0x2013, 0x54: 0x2013, 0x55: 0x2013, 0x56: 0x2013, 0x57: 0x2013, + 0x58: 0x2013, 0x59: 0x2013, 0x5a: 0x2013, + 0x5e: 0x0004, 0x5f: 0x0010, 0x60: 0x0004, 0x61: 0x2012, 0x62: 0x2012, 0x63: 0x2012, + 0x64: 0x2012, 0x65: 0x2012, 0x66: 0x2012, 0x67: 0x2012, 0x68: 0x2012, 0x69: 0x2012, + 0x6a: 0x2012, 0x6b: 0x2012, 0x6c: 0x2012, 0x6d: 0x2012, 0x6e: 0x2012, 0x6f: 0x2012, + 0x70: 0x2012, 0x71: 0x2012, 0x72: 0x2012, 0x73: 0x2012, 0x74: 0x2012, 0x75: 0x2012, + 0x76: 0x2012, 0x77: 0x2012, 0x78: 0x2012, 0x79: 0x2012, 0x7a: 0x2012, + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc0: 0x0852, 0xc1: 0x0b53, 0xc2: 0x0113, 0xc3: 0x0112, 0xc4: 0x0113, 0xc5: 0x0112, + 0xc6: 0x0b53, 0xc7: 0x0f13, 0xc8: 0x0f12, 0xc9: 0x0e53, 0xca: 0x1153, 0xcb: 0x0713, + 0xcc: 0x0712, 0xcd: 0x0012, 0xce: 0x1453, 0xcf: 0x1753, 0xd0: 0x1a53, 0xd1: 0x0313, + 0xd2: 0x0312, 0xd3: 0x1d53, 0xd4: 0x2053, 0xd5: 0x2352, 0xd6: 0x2653, 0xd7: 0x2653, + 0xd8: 0x0113, 0xd9: 0x0112, 0xda: 0x2952, 0xdb: 0x0012, 0xdc: 0x1d53, 0xdd: 0x2c53, + 0xde: 0x2f52, 0xdf: 0x3253, 0xe0: 0x0113, 0xe1: 0x0112, 0xe2: 0x0113, 0xe3: 0x0112, + 0xe4: 0x0113, 0xe5: 0x0112, 0xe6: 0x3553, 0xe7: 0x0f13, 0xe8: 0x0f12, 0xe9: 0x3853, + 0xea: 0x0012, 0xeb: 0x0012, 0xec: 0x0113, 0xed: 0x0112, 0xee: 0x3553, 0xef: 0x1f13, + 0xf0: 0x1f12, 0xf1: 0x3b53, 0xf2: 0x3e53, 0xf3: 0x0713, 0xf4: 0x0712, 0xf5: 0x0313, + 0xf6: 0x0312, 0xf7: 0x4153, 0xf8: 0x0113, 0xf9: 0x0112, 0xfa: 0x0012, 0xfb: 0x0010, + 0xfc: 0x0113, 0xfd: 0x0112, 0xfe: 0x0012, 0xff: 0x4452, + // Block 0x4, offset 0x100 + 0x100: 0x0010, 0x101: 0x0010, 0x102: 0x0010, 0x103: 0x0010, 0x104: 0x02db, 0x105: 0x0359, + 0x106: 0x03da, 0x107: 0x043b, 0x108: 0x04b9, 0x109: 0x053a, 0x10a: 0x059b, 0x10b: 0x0619, + 0x10c: 0x069a, 0x10d: 0x0313, 0x10e: 0x0312, 0x10f: 0x1f13, 0x110: 0x1f12, 0x111: 0x0313, + 0x112: 0x0312, 0x113: 0x0713, 0x114: 0x0712, 0x115: 0x0313, 0x116: 0x0312, 0x117: 0x0f13, + 0x118: 0x0f12, 0x119: 0x0313, 0x11a: 0x0312, 0x11b: 0x0713, 0x11c: 0x0712, 0x11d: 0x1452, + 0x11e: 0x0113, 0x11f: 0x0112, 0x120: 0x0113, 0x121: 0x0112, 0x122: 0x0113, 0x123: 0x0112, + 0x124: 0x0113, 0x125: 0x0112, 0x126: 0x0113, 0x127: 0x0112, 0x128: 0x0113, 0x129: 0x0112, + 0x12a: 0x0113, 0x12b: 0x0112, 0x12c: 0x0113, 0x12d: 0x0112, 0x12e: 0x0113, 0x12f: 0x0112, + 0x130: 0x06fa, 0x131: 0x07ab, 0x132: 0x0829, 0x133: 0x08aa, 0x134: 0x0113, 0x135: 0x0112, + 0x136: 0x2353, 0x137: 0x4453, 0x138: 0x0113, 0x139: 0x0112, 0x13a: 0x0113, 0x13b: 0x0112, + 0x13c: 0x0113, 0x13d: 0x0112, 0x13e: 0x0113, 0x13f: 0x0112, + // Block 0x5, offset 0x140 + 0x140: 0x0a8a, 0x141: 0x0313, 0x142: 0x0312, 0x143: 0x0853, 0x144: 0x4753, 0x145: 0x4a53, + 0x146: 0x0113, 0x147: 0x0112, 0x148: 0x0113, 0x149: 0x0112, 0x14a: 0x0113, 0x14b: 0x0112, + 0x14c: 0x0113, 0x14d: 0x0112, 0x14e: 0x0113, 0x14f: 0x0112, 0x150: 0x0b0a, 0x151: 0x0b8a, + 0x152: 0x0c0a, 0x153: 0x0b52, 0x154: 0x0b52, 0x155: 0x0012, 0x156: 0x0e52, 0x157: 0x1152, + 0x158: 0x0012, 0x159: 0x1752, 0x15a: 0x0012, 0x15b: 0x1a52, 0x15c: 0x0c8a, 0x15d: 0x0012, + 0x15e: 0x0012, 0x15f: 0x0012, 0x160: 0x1d52, 0x161: 0x0d0a, 0x162: 0x0012, 0x163: 0x2052, + 0x164: 0x0012, 0x165: 0x0d8a, 0x166: 0x0e0a, 0x167: 0x0012, 0x168: 0x2652, 0x169: 0x2652, + 0x16a: 0x0e8a, 0x16b: 0x0f0a, 0x16c: 0x0f8a, 0x16d: 0x0012, 0x16e: 0x0012, 0x16f: 0x1d52, + 0x170: 0x0012, 0x171: 0x100a, 0x172: 0x2c52, 0x173: 0x0012, 0x174: 0x0012, 0x175: 0x3252, + 0x176: 0x0012, 0x177: 0x0012, 0x178: 0x0012, 0x179: 0x0012, 0x17a: 0x0012, 0x17b: 0x0012, + 0x17c: 0x0012, 0x17d: 0x108a, 0x17e: 0x0012, 0x17f: 0x0012, + // Block 0x6, offset 0x180 + 0x180: 0x3552, 0x181: 0x0012, 0x182: 0x0012, 0x183: 0x3852, 0x184: 0x0012, 0x185: 0x0012, + 0x186: 0x0012, 0x187: 0x110a, 0x188: 0x3552, 0x189: 0x4752, 0x18a: 0x3b52, 0x18b: 0x3e52, + 0x18c: 0x4a52, 0x18d: 0x0012, 0x18e: 0x0012, 0x18f: 0x0012, 0x190: 0x0012, 0x191: 0x0012, + 0x192: 0x4152, 0x193: 0x0012, 0x194: 0x0010, 0x195: 0x0012, 0x196: 0x0012, 0x197: 0x0012, + 0x198: 0x0012, 0x199: 0x0012, 0x19a: 0x0012, 0x19b: 0x0012, 0x19c: 0x0012, 0x19d: 0x118a, + 0x19e: 0x120a, 0x19f: 0x0012, 0x1a0: 0x0012, 0x1a1: 0x0012, 0x1a2: 0x0012, 0x1a3: 0x0012, + 0x1a4: 0x0012, 0x1a5: 0x0012, 0x1a6: 0x0012, 0x1a7: 0x0012, 0x1a8: 0x0012, 0x1a9: 0x0012, + 0x1aa: 0x0012, 0x1ab: 0x0012, 0x1ac: 0x0012, 0x1ad: 0x0012, 0x1ae: 0x0012, 0x1af: 0x0012, + 0x1b0: 0x0015, 0x1b1: 0x0015, 0x1b2: 0x0015, 0x1b3: 0x0015, 0x1b4: 0x0015, 0x1b5: 0x0015, + 0x1b6: 0x0015, 0x1b7: 0x0015, 0x1b8: 0x0015, 0x1b9: 0x0014, 0x1ba: 0x0014, 0x1bb: 0x0014, + 0x1bc: 0x0014, 0x1bd: 0x0014, 0x1be: 0x0014, 0x1bf: 0x0014, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x0024, 0x1c1: 0x0024, 0x1c2: 0x0024, 0x1c3: 0x0024, 0x1c4: 0x0024, 0x1c5: 0x128d, + 0x1c6: 0x0024, 0x1c7: 0x0034, 0x1c8: 0x0034, 0x1c9: 0x0034, 0x1ca: 0x0024, 0x1cb: 0x0024, + 0x1cc: 0x0024, 0x1cd: 0x0034, 0x1ce: 0x0034, 0x1cf: 0x0014, 0x1d0: 0x0024, 0x1d1: 0x0024, + 0x1d2: 0x0024, 0x1d3: 0x0034, 0x1d4: 0x0034, 0x1d5: 0x0034, 0x1d6: 0x0034, 0x1d7: 0x0024, + 0x1d8: 0x0034, 0x1d9: 0x0034, 0x1da: 0x0034, 0x1db: 0x0024, 0x1dc: 0x0034, 0x1dd: 0x0034, + 0x1de: 0x0034, 0x1df: 0x0034, 0x1e0: 0x0034, 0x1e1: 0x0034, 0x1e2: 0x0034, 0x1e3: 0x0024, + 0x1e4: 0x0024, 0x1e5: 0x0024, 0x1e6: 0x0024, 0x1e7: 0x0024, 0x1e8: 0x0024, 0x1e9: 0x0024, + 0x1ea: 0x0024, 0x1eb: 0x0024, 0x1ec: 0x0024, 0x1ed: 0x0024, 0x1ee: 0x0024, 0x1ef: 0x0024, + 0x1f0: 0x0113, 0x1f1: 0x0112, 0x1f2: 0x0113, 0x1f3: 0x0112, 0x1f4: 0x0014, 0x1f5: 0x0004, + 0x1f6: 0x0113, 0x1f7: 0x0112, 0x1fa: 0x0015, 0x1fb: 0x4d52, + 0x1fc: 0x5052, 0x1fd: 0x5052, 0x1ff: 0x5353, + // Block 0x8, offset 0x200 + 0x204: 0x0004, 0x205: 0x0004, + 0x206: 0x2a13, 0x207: 0x0054, 0x208: 0x2513, 0x209: 0x2713, 0x20a: 0x2513, + 0x20c: 0x5653, 0x20e: 0x5953, 0x20f: 0x5c53, 0x210: 0x130a, 0x211: 0x2013, + 0x212: 0x2013, 0x213: 0x2013, 0x214: 0x2013, 0x215: 0x2013, 0x216: 0x2013, 0x217: 0x2013, + 0x218: 0x2013, 0x219: 0x2013, 0x21a: 0x2013, 0x21b: 0x2013, 0x21c: 0x2013, 0x21d: 0x2013, + 0x21e: 0x2013, 0x21f: 0x2013, 0x220: 0x5f53, 0x221: 0x5f53, 0x223: 0x5f53, + 0x224: 0x5f53, 0x225: 0x5f53, 0x226: 0x5f53, 0x227: 0x5f53, 0x228: 0x5f53, 0x229: 0x5f53, + 0x22a: 0x5f53, 0x22b: 0x5f53, 0x22c: 0x2a12, 0x22d: 0x2512, 0x22e: 0x2712, 0x22f: 0x2512, + 0x230: 0x144a, 0x231: 0x2012, 0x232: 0x2012, 0x233: 0x2012, 0x234: 0x2012, 0x235: 0x2012, + 0x236: 0x2012, 0x237: 0x2012, 0x238: 0x2012, 0x239: 0x2012, 0x23a: 0x2012, 0x23b: 0x2012, + 0x23c: 0x2012, 0x23d: 0x2012, 0x23e: 0x2012, 0x23f: 0x2012, + // Block 0x9, offset 0x240 + 0x240: 0x5f52, 0x241: 0x5f52, 0x242: 0x158a, 0x243: 0x5f52, 0x244: 0x5f52, 0x245: 0x5f52, + 0x246: 0x5f52, 0x247: 0x5f52, 0x248: 0x5f52, 0x249: 0x5f52, 0x24a: 0x5f52, 0x24b: 0x5f52, + 0x24c: 0x5652, 0x24d: 0x5952, 0x24e: 0x5c52, 0x24f: 0x1813, 0x250: 0x160a, 0x251: 0x168a, + 0x252: 0x0013, 0x253: 0x0013, 0x254: 0x0013, 0x255: 0x170a, 0x256: 0x178a, 0x257: 0x1812, + 0x258: 0x0113, 0x259: 0x0112, 0x25a: 0x0113, 0x25b: 0x0112, 0x25c: 0x0113, 0x25d: 0x0112, + 0x25e: 0x0113, 0x25f: 0x0112, 0x260: 0x0113, 0x261: 0x0112, 0x262: 0x0113, 0x263: 0x0112, + 0x264: 0x0113, 0x265: 0x0112, 0x266: 0x0113, 0x267: 0x0112, 0x268: 0x0113, 0x269: 0x0112, + 0x26a: 0x0113, 0x26b: 0x0112, 0x26c: 0x0113, 0x26d: 0x0112, 0x26e: 0x0113, 0x26f: 0x0112, + 0x270: 0x180a, 0x271: 0x188a, 0x272: 0x0b12, 0x273: 0x5352, 0x274: 0x6253, 0x275: 0x190a, + 0x277: 0x0f13, 0x278: 0x0f12, 0x279: 0x0b13, 0x27a: 0x0113, 0x27b: 0x0112, + 0x27c: 0x0012, 0x27d: 0x4d53, 0x27e: 0x5053, 0x27f: 0x5053, + // Block 0xa, offset 0x280 + 0x280: 0x6852, 0x281: 0x6852, 0x282: 0x6852, 0x283: 0x6852, 0x284: 0x6852, 0x285: 0x6852, + 0x286: 0x6852, 0x287: 0x198a, 0x288: 0x0012, + 0x291: 0x0034, + 0x292: 0x0024, 0x293: 0x0024, 0x294: 0x0024, 0x295: 0x0024, 0x296: 0x0034, 0x297: 0x0024, + 0x298: 0x0024, 0x299: 0x0024, 0x29a: 0x0034, 0x29b: 0x0034, 0x29c: 0x0024, 0x29d: 0x0024, + 0x29e: 0x0024, 0x29f: 0x0024, 0x2a0: 0x0024, 0x2a1: 0x0024, 0x2a2: 0x0034, 0x2a3: 0x0034, + 0x2a4: 0x0034, 0x2a5: 0x0034, 0x2a6: 0x0034, 0x2a7: 0x0034, 0x2a8: 0x0024, 0x2a9: 0x0024, + 0x2aa: 0x0034, 0x2ab: 0x0024, 0x2ac: 0x0024, 0x2ad: 0x0034, 0x2ae: 0x0034, 0x2af: 0x0024, + 0x2b0: 0x0034, 0x2b1: 0x0034, 0x2b2: 0x0034, 0x2b3: 0x0034, 0x2b4: 0x0034, 0x2b5: 0x0034, + 0x2b6: 0x0034, 0x2b7: 0x0034, 0x2b8: 0x0034, 0x2b9: 0x0034, 0x2ba: 0x0034, 0x2bb: 0x0034, + 0x2bc: 0x0034, 0x2bd: 0x0034, 0x2bf: 0x0034, + // Block 0xb, offset 0x2c0 + 0x2c0: 0x7053, 0x2c1: 0x7053, 0x2c2: 0x7053, 0x2c3: 0x7053, 0x2c4: 0x7053, 0x2c5: 0x7053, + 0x2c7: 0x7053, + 0x2cd: 0x7053, 0x2d0: 0x1a6a, 0x2d1: 0x1aea, + 0x2d2: 0x1b6a, 0x2d3: 0x1bea, 0x2d4: 0x1c6a, 0x2d5: 0x1cea, 0x2d6: 0x1d6a, 0x2d7: 0x1dea, + 0x2d8: 0x1e6a, 0x2d9: 0x1eea, 0x2da: 0x1f6a, 0x2db: 0x1fea, 0x2dc: 0x206a, 0x2dd: 0x20ea, + 0x2de: 0x216a, 0x2df: 0x21ea, 0x2e0: 0x226a, 0x2e1: 0x22ea, 0x2e2: 0x236a, 0x2e3: 0x23ea, + 0x2e4: 0x246a, 0x2e5: 0x24ea, 0x2e6: 0x256a, 0x2e7: 0x25ea, 0x2e8: 0x266a, 0x2e9: 0x26ea, + 0x2ea: 0x276a, 0x2eb: 0x27ea, 0x2ec: 0x286a, 0x2ed: 0x28ea, 0x2ee: 0x296a, 0x2ef: 0x29ea, + 0x2f0: 0x2a6a, 0x2f1: 0x2aea, 0x2f2: 0x2b6a, 0x2f3: 0x2bea, 0x2f4: 0x2c6a, 0x2f5: 0x2cea, + 0x2f6: 0x2d6a, 0x2f7: 0x2dea, 0x2f8: 0x2e6a, 0x2f9: 0x2eea, 0x2fa: 0x2f6a, + 0x2fc: 0x0014, 0x2fd: 0x2fea, 0x2fe: 0x306a, 0x2ff: 0x30ea, + // Block 0xc, offset 0x300 + 0x300: 0x0812, 0x301: 0x0812, 0x302: 0x0812, 0x303: 0x0812, 0x304: 0x0812, 0x305: 0x0812, + 0x308: 0x0813, 0x309: 0x0813, 0x30a: 0x0813, 0x30b: 0x0813, + 0x30c: 0x0813, 0x30d: 0x0813, 0x310: 0x3a9a, 0x311: 0x0812, + 0x312: 0x3b7a, 0x313: 0x0812, 0x314: 0x3cba, 0x315: 0x0812, 0x316: 0x3dfa, 0x317: 0x0812, + 0x319: 0x0813, 0x31b: 0x0813, 0x31d: 0x0813, + 0x31f: 0x0813, 0x320: 0x0812, 0x321: 0x0812, 0x322: 0x0812, 0x323: 0x0812, + 0x324: 0x0812, 0x325: 0x0812, 0x326: 0x0812, 0x327: 0x0812, 0x328: 0x0813, 0x329: 0x0813, + 0x32a: 0x0813, 0x32b: 0x0813, 0x32c: 0x0813, 0x32d: 0x0813, 0x32e: 0x0813, 0x32f: 0x0813, + 0x330: 0x8e52, 0x331: 0x8e52, 0x332: 0x9152, 0x333: 0x9152, 0x334: 0x9452, 0x335: 0x9452, + 0x336: 0x9752, 0x337: 0x9752, 0x338: 0x9a52, 0x339: 0x9a52, 0x33a: 0x9d52, 0x33b: 0x9d52, + 0x33c: 0x4d52, 0x33d: 0x4d52, + // Block 0xd, offset 0x340 + 0x340: 0x3f3a, 0x341: 0x402a, 0x342: 0x411a, 0x343: 0x420a, 0x344: 0x42fa, 0x345: 0x43ea, + 0x346: 0x44da, 0x347: 0x45ca, 0x348: 0x46b9, 0x349: 0x47a9, 0x34a: 0x4899, 0x34b: 0x4989, + 0x34c: 0x4a79, 0x34d: 0x4b69, 0x34e: 0x4c59, 0x34f: 0x4d49, 0x350: 0x4e3a, 0x351: 0x4f2a, + 0x352: 0x501a, 0x353: 0x510a, 0x354: 0x51fa, 0x355: 0x52ea, 0x356: 0x53da, 0x357: 0x54ca, + 0x358: 0x55b9, 0x359: 0x56a9, 0x35a: 0x5799, 0x35b: 0x5889, 0x35c: 0x5979, 0x35d: 0x5a69, + 0x35e: 0x5b59, 0x35f: 0x5c49, 0x360: 0x5d3a, 0x361: 0x5e2a, 0x362: 0x5f1a, 0x363: 0x600a, + 0x364: 0x60fa, 0x365: 0x61ea, 0x366: 0x62da, 0x367: 0x63ca, 0x368: 0x64b9, 0x369: 0x65a9, + 0x36a: 0x6699, 0x36b: 0x6789, 0x36c: 0x6879, 0x36d: 0x6969, 0x36e: 0x6a59, 0x36f: 0x6b49, + 0x370: 0x0812, 0x371: 0x0812, 0x372: 0x6c3a, 0x373: 0x6d4a, 0x374: 0x6e1a, + 0x376: 0x6efa, 0x377: 0x6fda, 0x378: 0x0813, 0x379: 0x0813, 0x37a: 0x8e53, 0x37b: 0x8e53, + 0x37c: 0x7119, 0x37d: 0x0004, 0x37e: 0x71ea, 0x37f: 0x0004, + // Block 0xe, offset 0x380 + 0x380: 0x0004, 0x381: 0x0004, 0x382: 0x726a, 0x383: 0x737a, 0x384: 0x744a, + 0x386: 0x752a, 0x387: 0x760a, 0x388: 0x9153, 0x389: 0x9153, 0x38a: 0x9453, 0x38b: 0x9453, + 0x38c: 0x7749, 0x38d: 0x0004, 0x38e: 0x0004, 0x38f: 0x0004, 0x390: 0x0812, 0x391: 0x0812, + 0x392: 0x781a, 0x393: 0x795a, 0x396: 0x7a9a, 0x397: 0x7b7a, + 0x398: 0x0813, 0x399: 0x0813, 0x39a: 0x9753, 0x39b: 0x9753, 0x39d: 0x0004, + 0x39e: 0x0004, 0x39f: 0x0004, 0x3a0: 0x0812, 0x3a1: 0x0812, 0x3a2: 0x7cba, 0x3a3: 0x7dfa, + 0x3a4: 0x7f3a, 0x3a5: 0x0912, 0x3a6: 0x801a, 0x3a7: 0x80fa, 0x3a8: 0x0813, 0x3a9: 0x0813, + 0x3aa: 0x9d53, 0x3ab: 0x9d53, 0x3ac: 0x0913, 0x3ad: 0x0004, 0x3ae: 0x0004, 0x3af: 0x0004, + 0x3b2: 0x823a, 0x3b3: 0x834a, 0x3b4: 0x841a, + 0x3b6: 0x84fa, 0x3b7: 0x85da, 0x3b8: 0x9a53, 0x3b9: 0x9a53, 0x3ba: 0x4d53, 0x3bb: 0x4d53, + 0x3bc: 0x8719, 0x3bd: 0x0004, 0x3be: 0x0004, + // Block 0xf, offset 0x3c0 + 0x3c2: 0x0013, + 0x3c7: 0x0013, 0x3ca: 0x0012, 0x3cb: 0x0013, + 0x3cc: 0x0013, 0x3cd: 0x0013, 0x3ce: 0x0012, 0x3cf: 0x0012, 0x3d0: 0x0013, 0x3d1: 0x0013, + 0x3d2: 0x0013, 0x3d3: 0x0012, 0x3d5: 0x0013, + 0x3d9: 0x0013, 0x3da: 0x0013, 0x3db: 0x0013, 0x3dc: 0x0013, 0x3dd: 0x0013, + 0x3e4: 0x0013, 0x3e6: 0x87eb, 0x3e8: 0x0013, + 0x3ea: 0x884b, 0x3eb: 0x888b, 0x3ec: 0x0013, 0x3ed: 0x0013, 0x3ef: 0x0012, + 0x3f0: 0x0013, 0x3f1: 0x0013, 0x3f2: 0xa053, 0x3f3: 0x0013, 0x3f4: 0x0012, 0x3f5: 0x0010, + 0x3f6: 0x0010, 0x3f7: 0x0010, 0x3f8: 0x0010, 0x3f9: 0x0012, + 0x3fc: 0x0012, 0x3fd: 0x0012, 0x3fe: 0x0013, 0x3ff: 0x0013, + // Block 0x10, offset 0x400 + 0x400: 0x1a13, 0x401: 0x1a13, 0x402: 0x1e13, 0x403: 0x1e13, 0x404: 0x1a13, 0x405: 0x1a13, + 0x406: 0x2613, 0x407: 0x2613, 0x408: 0x2a13, 0x409: 0x2a13, 0x40a: 0x2e13, 0x40b: 0x2e13, + 0x40c: 0x2a13, 0x40d: 0x2a13, 0x40e: 0x2613, 0x40f: 0x2613, 0x410: 0xa352, 0x411: 0xa352, + 0x412: 0xa652, 0x413: 0xa652, 0x414: 0xa952, 0x415: 0xa952, 0x416: 0xa652, 0x417: 0xa652, + 0x418: 0xa352, 0x419: 0xa352, 0x41a: 0x1a12, 0x41b: 0x1a12, 0x41c: 0x1e12, 0x41d: 0x1e12, + 0x41e: 0x1a12, 0x41f: 0x1a12, 0x420: 0x2612, 0x421: 0x2612, 0x422: 0x2a12, 0x423: 0x2a12, + 0x424: 0x2e12, 0x425: 0x2e12, 0x426: 0x2a12, 0x427: 0x2a12, 0x428: 0x2612, 0x429: 0x2612, + // Block 0x11, offset 0x440 + 0x440: 0x6552, 0x441: 0x6552, 0x442: 0x6552, 0x443: 0x6552, 0x444: 0x6552, 0x445: 0x6552, + 0x446: 0x6552, 0x447: 0x6552, 0x448: 0x6552, 0x449: 0x6552, 0x44a: 0x6552, 0x44b: 0x6552, + 0x44c: 0x6552, 0x44d: 0x6552, 0x44e: 0x6552, 0x44f: 0x6552, 0x450: 0xac52, 0x451: 0xac52, + 0x452: 0xac52, 0x453: 0xac52, 0x454: 0xac52, 0x455: 0xac52, 0x456: 0xac52, 0x457: 0xac52, + 0x458: 0xac52, 0x459: 0xac52, 0x45a: 0xac52, 0x45b: 0xac52, 0x45c: 0xac52, 0x45d: 0xac52, + 0x45e: 0xac52, 0x460: 0x0113, 0x461: 0x0112, 0x462: 0x88eb, 0x463: 0x8b53, + 0x464: 0x894b, 0x465: 0x89aa, 0x466: 0x8a0a, 0x467: 0x0f13, 0x468: 0x0f12, 0x469: 0x0313, + 0x46a: 0x0312, 0x46b: 0x0713, 0x46c: 0x0712, 0x46d: 0x8a6b, 0x46e: 0x8acb, 0x46f: 0x8b2b, + 0x470: 0x8b8b, 0x471: 0x0012, 0x472: 0x0113, 0x473: 0x0112, 0x474: 0x0012, 0x475: 0x0313, + 0x476: 0x0312, 0x477: 0x0012, 0x478: 0x0012, 0x479: 0x0012, 0x47a: 0x0012, 0x47b: 0x0012, + 0x47c: 0x0015, 0x47d: 0x0015, 0x47e: 0x8beb, 0x47f: 0x8c4b, + // Block 0x12, offset 0x480 + 0x480: 0x0113, 0x481: 0x0112, 0x482: 0x0113, 0x483: 0x0112, 0x484: 0x0113, 0x485: 0x0112, + 0x486: 0x0113, 0x487: 0x0112, 0x488: 0x0014, 0x489: 0x0014, 0x48a: 0x0014, 0x48b: 0x0713, + 0x48c: 0x0712, 0x48d: 0x8cab, 0x48e: 0x0012, 0x48f: 0x0010, 0x490: 0x0113, 0x491: 0x0112, + 0x492: 0x0113, 0x493: 0x0112, 0x494: 0x0012, 0x495: 0x0012, 0x496: 0x0113, 0x497: 0x0112, + 0x498: 0x0113, 0x499: 0x0112, 0x49a: 0x0113, 0x49b: 0x0112, 0x49c: 0x0113, 0x49d: 0x0112, + 0x49e: 0x0113, 0x49f: 0x0112, 0x4a0: 0x0113, 0x4a1: 0x0112, 0x4a2: 0x0113, 0x4a3: 0x0112, + 0x4a4: 0x0113, 0x4a5: 0x0112, 0x4a6: 0x0113, 0x4a7: 0x0112, 0x4a8: 0x0113, 0x4a9: 0x0112, + 0x4aa: 0x8d0b, 0x4ab: 0x8d6b, 0x4ac: 0x8dcb, 0x4ad: 0x8e2b, 0x4ae: 0x8e8b, 0x4af: 0x0012, + 0x4b0: 0x8eeb, 0x4b1: 0x8f4b, 0x4b2: 0x8fab, 0x4b3: 0xaf53, 0x4b4: 0x0113, 0x4b5: 0x0112, + 0x4b6: 0x0113, 0x4b7: 0x0112, 0x4b8: 0x0113, 0x4b9: 0x0112, + // Block 0x13, offset 0x4c0 + 0x4c0: 0x900a, 0x4c1: 0x908a, 0x4c2: 0x910a, 0x4c3: 0x918a, 0x4c4: 0x923a, 0x4c5: 0x92ea, + 0x4c6: 0x936a, + 0x4d3: 0x93ea, 0x4d4: 0x94ca, 0x4d5: 0x95aa, 0x4d6: 0x968a, 0x4d7: 0x976a, + 0x4dd: 0x0010, + 0x4de: 0x0034, 0x4df: 0x0010, 0x4e0: 0x0010, 0x4e1: 0x0010, 0x4e2: 0x0010, 0x4e3: 0x0010, + 0x4e4: 0x0010, 0x4e5: 0x0010, 0x4e6: 0x0010, 0x4e7: 0x0010, 0x4e8: 0x0010, + 0x4ea: 0x0010, 0x4eb: 0x0010, 0x4ec: 0x0010, 0x4ed: 0x0010, 0x4ee: 0x0010, 0x4ef: 0x0010, + 0x4f0: 0x0010, 0x4f1: 0x0010, 0x4f2: 0x0010, 0x4f3: 0x0010, 0x4f4: 0x0010, 0x4f5: 0x0010, + 0x4f6: 0x0010, 0x4f8: 0x0010, 0x4f9: 0x0010, 0x4fa: 0x0010, 0x4fb: 0x0010, + 0x4fc: 0x0010, 0x4fe: 0x0010, + // Block 0x14, offset 0x500 + 0x500: 0x2213, 0x501: 0x2213, 0x502: 0x2613, 0x503: 0x2613, 0x504: 0x2213, 0x505: 0x2213, + 0x506: 0x2e13, 0x507: 0x2e13, 0x508: 0x2213, 0x509: 0x2213, 0x50a: 0x2613, 0x50b: 0x2613, + 0x50c: 0x2213, 0x50d: 0x2213, 0x50e: 0x3e13, 0x50f: 0x3e13, 0x510: 0x2213, 0x511: 0x2213, + 0x512: 0x2613, 0x513: 0x2613, 0x514: 0x2213, 0x515: 0x2213, 0x516: 0x2e13, 0x517: 0x2e13, + 0x518: 0x2213, 0x519: 0x2213, 0x51a: 0x2613, 0x51b: 0x2613, 0x51c: 0x2213, 0x51d: 0x2213, + 0x51e: 0xb853, 0x51f: 0xb853, 0x520: 0xbb53, 0x521: 0xbb53, 0x522: 0x2212, 0x523: 0x2212, + 0x524: 0x2612, 0x525: 0x2612, 0x526: 0x2212, 0x527: 0x2212, 0x528: 0x2e12, 0x529: 0x2e12, + 0x52a: 0x2212, 0x52b: 0x2212, 0x52c: 0x2612, 0x52d: 0x2612, 0x52e: 0x2212, 0x52f: 0x2212, + 0x530: 0x3e12, 0x531: 0x3e12, 0x532: 0x2212, 0x533: 0x2212, 0x534: 0x2612, 0x535: 0x2612, + 0x536: 0x2212, 0x537: 0x2212, 0x538: 0x2e12, 0x539: 0x2e12, 0x53a: 0x2212, 0x53b: 0x2212, + 0x53c: 0x2612, 0x53d: 0x2612, 0x53e: 0x2212, 0x53f: 0x2212, + // Block 0x15, offset 0x540 + 0x542: 0x0010, + 0x547: 0x0010, 0x549: 0x0010, 0x54b: 0x0010, + 0x54d: 0x0010, 0x54e: 0x0010, 0x54f: 0x0010, 0x551: 0x0010, + 0x552: 0x0010, 0x554: 0x0010, 0x557: 0x0010, + 0x559: 0x0010, 0x55b: 0x0010, 0x55d: 0x0010, + 0x55f: 0x0010, 0x561: 0x0010, 0x562: 0x0010, + 0x564: 0x0010, 0x567: 0x0010, 0x568: 0x0010, 0x569: 0x0010, + 0x56a: 0x0010, 0x56c: 0x0010, 0x56d: 0x0010, 0x56e: 0x0010, 0x56f: 0x0010, + 0x570: 0x0010, 0x571: 0x0010, 0x572: 0x0010, 0x574: 0x0010, 0x575: 0x0010, + 0x576: 0x0010, 0x577: 0x0010, 0x579: 0x0010, 0x57a: 0x0010, 0x57b: 0x0010, + 0x57c: 0x0010, 0x57e: 0x0010, +} + +// caseIndex: 25 blocks, 1600 entries, 3200 bytes +// Block 0 is the zero block. +var caseIndex = [1600]uint16{ + // Block 0x0, offset 0x0 + // Block 0x1, offset 0x40 + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc2: 0x14, 0xc3: 0x15, 0xc4: 0x16, 0xc5: 0x17, 0xc6: 0x01, 0xc7: 0x02, + 0xc8: 0x18, 0xc9: 0x03, 0xca: 0x04, 0xcb: 0x19, 0xcc: 0x1a, 0xcd: 0x05, 0xce: 0x06, 0xcf: 0x07, + 0xd0: 0x1b, 0xd1: 0x1c, 0xd2: 0x1d, 0xd3: 0x1e, 0xd4: 0x1f, 0xd5: 0x20, 0xd6: 0x08, 0xd7: 0x21, + 0xd8: 0x22, 0xd9: 0x23, 0xda: 0x24, 0xdb: 0x25, 0xdc: 0x26, 0xdd: 0x27, 0xde: 0x28, 0xdf: 0x29, + 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, + 0xea: 0x06, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x08, 0xef: 0x09, + 0xf0: 0x14, 0xf3: 0x16, + // Block 0x4, offset 0x100 + 0x120: 0x2a, 0x121: 0x2b, 0x122: 0x2c, 0x123: 0x2d, 0x124: 0x2e, 0x125: 0x2f, 0x126: 0x30, 0x127: 0x31, + 0x128: 0x32, 0x129: 0x33, 0x12a: 0x34, 0x12b: 0x35, 0x12c: 0x36, 0x12d: 0x37, 0x12e: 0x38, 0x12f: 0x39, + 0x130: 0x3a, 0x131: 0x3b, 0x132: 0x3c, 0x133: 0x3d, 0x134: 0x3e, 0x135: 0x3f, 0x136: 0x40, 0x137: 0x41, + 0x138: 0x42, 0x139: 0x43, 0x13a: 0x44, 0x13b: 0x45, 0x13c: 0x46, 0x13d: 0x47, 0x13e: 0x48, 0x13f: 0x49, + // Block 0x5, offset 0x140 + 0x140: 0x4a, 0x141: 0x4b, 0x142: 0x4c, 0x143: 0x09, 0x144: 0x24, 0x145: 0x24, 0x146: 0x24, 0x147: 0x24, + 0x148: 0x24, 0x149: 0x4d, 0x14a: 0x4e, 0x14b: 0x4f, 0x14c: 0x50, 0x14d: 0x51, 0x14e: 0x52, 0x14f: 0x53, + 0x150: 0x54, 0x151: 0x24, 0x152: 0x24, 0x153: 0x24, 0x154: 0x24, 0x155: 0x24, 0x156: 0x24, 0x157: 0x24, + 0x158: 0x24, 0x159: 0x55, 0x15a: 0x56, 0x15b: 0x57, 0x15c: 0x58, 0x15d: 0x59, 0x15e: 0x5a, 0x15f: 0x5b, + 0x160: 0x5c, 0x161: 0x5d, 0x162: 0x5e, 0x163: 0x5f, 0x164: 0x60, 0x165: 0x61, 0x167: 0x62, + 0x168: 0x63, 0x169: 0x64, 0x16a: 0x65, 0x16c: 0x66, 0x16d: 0x67, 0x16e: 0x68, 0x16f: 0x69, + 0x170: 0x6a, 0x171: 0x6b, 0x172: 0x6c, 0x173: 0x6d, 0x174: 0x6e, 0x175: 0x6f, 0x176: 0x70, 0x177: 0x71, + 0x178: 0x72, 0x179: 0x72, 0x17a: 0x73, 0x17b: 0x72, 0x17c: 0x74, 0x17d: 0x0a, 0x17e: 0x0b, 0x17f: 0x0c, + // Block 0x6, offset 0x180 + 0x180: 0x75, 0x181: 0x76, 0x182: 0x77, 0x183: 0x78, 0x184: 0x0d, 0x185: 0x79, 0x186: 0x7a, + 0x192: 0x7b, 0x193: 0x0e, + 0x1b0: 0x7c, 0x1b1: 0x0f, 0x1b2: 0x72, 0x1b3: 0x7d, 0x1b4: 0x7e, 0x1b5: 0x7f, 0x1b6: 0x80, 0x1b7: 0x81, + 0x1b8: 0x82, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x83, 0x1c2: 0x84, 0x1c3: 0x85, 0x1c4: 0x86, 0x1c5: 0x24, 0x1c6: 0x87, + // Block 0x8, offset 0x200 + 0x200: 0x88, 0x201: 0x24, 0x202: 0x24, 0x203: 0x24, 0x204: 0x24, 0x205: 0x24, 0x206: 0x24, 0x207: 0x24, + 0x208: 0x24, 0x209: 0x24, 0x20a: 0x24, 0x20b: 0x24, 0x20c: 0x24, 0x20d: 0x24, 0x20e: 0x24, 0x20f: 0x24, + 0x210: 0x24, 0x211: 0x24, 0x212: 0x89, 0x213: 0x8a, 0x214: 0x24, 0x215: 0x24, 0x216: 0x24, 0x217: 0x24, + 0x218: 0x8b, 0x219: 0x8c, 0x21a: 0x8d, 0x21b: 0x8e, 0x21c: 0x8f, 0x21d: 0x90, 0x21e: 0x10, 0x21f: 0x91, + 0x220: 0x92, 0x221: 0x93, 0x222: 0x24, 0x223: 0x94, 0x224: 0x95, 0x225: 0x96, 0x226: 0x97, 0x227: 0x98, + 0x228: 0x99, 0x229: 0x9a, 0x22a: 0x9b, 0x22b: 0x9c, 0x22c: 0x9d, 0x22d: 0x9e, 0x22e: 0x9f, 0x22f: 0xa0, + 0x230: 0x24, 0x231: 0x24, 0x232: 0x24, 0x233: 0x24, 0x234: 0x24, 0x235: 0x24, 0x236: 0x24, 0x237: 0x24, + 0x238: 0x24, 0x239: 0x24, 0x23a: 0x24, 0x23b: 0x24, 0x23c: 0x24, 0x23d: 0x24, 0x23e: 0x24, 0x23f: 0x24, + // Block 0x9, offset 0x240 + 0x240: 0x24, 0x241: 0x24, 0x242: 0x24, 0x243: 0x24, 0x244: 0x24, 0x245: 0x24, 0x246: 0x24, 0x247: 0x24, + 0x248: 0x24, 0x249: 0x24, 0x24a: 0x24, 0x24b: 0x24, 0x24c: 0x24, 0x24d: 0x24, 0x24e: 0x24, 0x24f: 0x24, + 0x250: 0x24, 0x251: 0x24, 0x252: 0x24, 0x253: 0x24, 0x254: 0x24, 0x255: 0x24, 0x256: 0x24, 0x257: 0x24, + 0x258: 0x24, 0x259: 0x24, 0x25a: 0x24, 0x25b: 0x24, 0x25c: 0x24, 0x25d: 0x24, 0x25e: 0x24, 0x25f: 0x24, + 0x260: 0x24, 0x261: 0x24, 0x262: 0x24, 0x263: 0x24, 0x264: 0x24, 0x265: 0x24, 0x266: 0x24, 0x267: 0x24, + 0x268: 0x24, 0x269: 0x24, 0x26a: 0x24, 0x26b: 0x24, 0x26c: 0x24, 0x26d: 0x24, 0x26e: 0x24, 0x26f: 0x24, + 0x270: 0x24, 0x271: 0x24, 0x272: 0x24, 0x273: 0x24, 0x274: 0x24, 0x275: 0x24, 0x276: 0x24, 0x277: 0x24, + 0x278: 0x24, 0x279: 0x24, 0x27a: 0x24, 0x27b: 0x24, 0x27c: 0x24, 0x27d: 0x24, 0x27e: 0x24, 0x27f: 0x24, + // Block 0xa, offset 0x280 + 0x280: 0x24, 0x281: 0x24, 0x282: 0x24, 0x283: 0x24, 0x284: 0x24, 0x285: 0x24, 0x286: 0x24, 0x287: 0x24, + 0x288: 0x24, 0x289: 0x24, 0x28a: 0x24, 0x28b: 0x24, 0x28c: 0x24, 0x28d: 0x24, 0x28e: 0x24, 0x28f: 0x24, + 0x290: 0x24, 0x291: 0x24, 0x292: 0x24, 0x293: 0x24, 0x294: 0x24, 0x295: 0x24, 0x296: 0x24, 0x297: 0x24, + 0x298: 0x24, 0x299: 0x24, 0x29a: 0x24, 0x29b: 0x24, 0x29c: 0x24, 0x29d: 0x24, 0x29e: 0xa1, 0x29f: 0xa2, + // Block 0xb, offset 0x2c0 + 0x2ec: 0x11, 0x2ed: 0xa3, 0x2ee: 0xa4, 0x2ef: 0xa5, + 0x2f0: 0x24, 0x2f1: 0x24, 0x2f2: 0x24, 0x2f3: 0x24, 0x2f4: 0xa6, 0x2f5: 0xa7, 0x2f6: 0xa8, 0x2f7: 0xa9, + 0x2f8: 0xaa, 0x2f9: 0xab, 0x2fa: 0x24, 0x2fb: 0xac, 0x2fc: 0xad, 0x2fd: 0xae, 0x2fe: 0xaf, 0x2ff: 0xb0, + // Block 0xc, offset 0x300 + 0x300: 0xb1, 0x301: 0xb2, 0x302: 0x24, 0x303: 0xb3, 0x305: 0xb4, 0x307: 0xb5, + 0x30a: 0xb6, 0x30b: 0xb7, 0x30c: 0xb8, 0x30d: 0xb9, 0x30e: 0xba, 0x30f: 0xbb, + 0x310: 0xbc, 0x311: 0xbd, 0x312: 0xbe, 0x313: 0xbf, 0x314: 0xc0, 0x315: 0xc1, + 0x318: 0x24, 0x319: 0x24, 0x31a: 0x24, 0x31b: 0x24, 0x31c: 0xc2, 0x31d: 0xc3, + 0x320: 0xc4, 0x321: 0xc5, 0x322: 0xc6, 0x323: 0xc7, 0x324: 0xc8, 0x326: 0xc9, + 0x328: 0xca, 0x329: 0xcb, 0x32a: 0xcc, 0x32b: 0xcd, 0x32c: 0x5f, 0x32d: 0xce, 0x32e: 0xcf, + 0x330: 0x24, 0x331: 0xd0, 0x332: 0xd1, 0x333: 0xd2, 0x334: 0xd3, + 0x33c: 0xd4, 0x33d: 0xd5, + // Block 0xd, offset 0x340 + 0x340: 0xd6, 0x341: 0xd7, 0x342: 0xd8, 0x343: 0xd9, 0x344: 0xda, 0x345: 0xdb, 0x346: 0xdc, 0x347: 0xdd, + 0x348: 0xde, 0x34a: 0xdf, 0x34b: 0xe0, 0x34c: 0xe1, 0x34d: 0xe2, + 0x350: 0xe3, 0x351: 0xe4, 0x352: 0xe5, 0x353: 0xe6, 0x356: 0xe7, 0x357: 0xe8, + 0x358: 0xe9, 0x359: 0xea, 0x35a: 0xeb, 0x35b: 0xec, 0x35c: 0xed, + 0x360: 0xee, 0x362: 0xef, 0x363: 0xf0, + 0x368: 0xf1, 0x369: 0xf2, 0x36a: 0xf3, 0x36b: 0xf4, + 0x370: 0xf5, 0x371: 0xf6, 0x372: 0xf7, 0x374: 0xf8, 0x375: 0xf9, 0x376: 0xfa, + 0x37b: 0xfb, + // Block 0xe, offset 0x380 + 0x380: 0x24, 0x381: 0x24, 0x382: 0x24, 0x383: 0x24, 0x384: 0x24, 0x385: 0x24, 0x386: 0x24, 0x387: 0x24, + 0x388: 0x24, 0x389: 0x24, 0x38a: 0x24, 0x38b: 0x24, 0x38c: 0x24, 0x38d: 0x24, 0x38e: 0xfc, + 0x390: 0x24, 0x391: 0xfd, 0x392: 0x24, 0x393: 0x24, 0x394: 0x24, 0x395: 0xfe, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x24, 0x3c1: 0x24, 0x3c2: 0x24, 0x3c3: 0x24, 0x3c4: 0x24, 0x3c5: 0x24, 0x3c6: 0x24, 0x3c7: 0x24, + 0x3c8: 0x24, 0x3c9: 0x24, 0x3ca: 0x24, 0x3cb: 0x24, 0x3cc: 0x24, 0x3cd: 0x24, 0x3ce: 0x24, 0x3cf: 0x24, + 0x3d0: 0xfd, + // Block 0x10, offset 0x400 + 0x410: 0x24, 0x411: 0x24, 0x412: 0x24, 0x413: 0x24, 0x414: 0x24, 0x415: 0x24, 0x416: 0x24, 0x417: 0x24, + 0x418: 0x24, 0x419: 0xff, + // Block 0x11, offset 0x440 + 0x460: 0x24, 0x461: 0x24, 0x462: 0x24, 0x463: 0x24, 0x464: 0x24, 0x465: 0x24, 0x466: 0x24, 0x467: 0x24, + 0x468: 0xf4, 0x469: 0x100, 0x46b: 0x101, 0x46c: 0x102, 0x46d: 0x103, 0x46e: 0x104, + 0x479: 0x105, 0x47c: 0x24, 0x47d: 0x106, 0x47e: 0x107, 0x47f: 0x108, + // Block 0x12, offset 0x480 + 0x4b0: 0x24, 0x4b1: 0x109, 0x4b2: 0x10a, + // Block 0x13, offset 0x4c0 + 0x4c5: 0x10b, 0x4c6: 0x10c, + 0x4c9: 0x10d, + 0x4d0: 0x10e, 0x4d1: 0x10f, 0x4d2: 0x110, 0x4d3: 0x111, 0x4d4: 0x112, 0x4d5: 0x113, 0x4d6: 0x114, 0x4d7: 0x115, + 0x4d8: 0x116, 0x4d9: 0x117, 0x4da: 0x118, 0x4db: 0x119, 0x4dc: 0x11a, 0x4dd: 0x11b, 0x4de: 0x11c, 0x4df: 0x11d, + 0x4e8: 0x11e, 0x4e9: 0x11f, 0x4ea: 0x120, + // Block 0x14, offset 0x500 + 0x500: 0x121, + 0x520: 0x24, 0x521: 0x24, 0x522: 0x24, 0x523: 0x122, 0x524: 0x12, 0x525: 0x123, + 0x538: 0x124, 0x539: 0x13, 0x53a: 0x125, + // Block 0x15, offset 0x540 + 0x544: 0x126, 0x545: 0x127, 0x546: 0x128, + 0x54f: 0x129, + // Block 0x16, offset 0x580 + 0x590: 0x0a, 0x591: 0x0b, 0x592: 0x0c, 0x593: 0x0d, 0x594: 0x0e, 0x596: 0x0f, + 0x59b: 0x10, 0x59d: 0x11, 0x59e: 0x12, 0x59f: 0x13, + // Block 0x17, offset 0x5c0 + 0x5c0: 0x12a, 0x5c1: 0x12b, 0x5c4: 0x12b, 0x5c5: 0x12b, 0x5c6: 0x12b, 0x5c7: 0x12c, + // Block 0x18, offset 0x600 + 0x620: 0x15, +} + +// sparseOffsets: 282 entries, 564 bytes +var sparseOffsets = []uint16{0x0, 0x9, 0xf, 0x18, 0x24, 0x2e, 0x35, 0x38, 0x3c, 0x3f, 0x43, 0x4d, 0x4f, 0x57, 0x5e, 0x63, 0x71, 0x72, 0x80, 0x8f, 0x99, 0x9c, 0xa3, 0xab, 0xae, 0xb0, 0xbf, 0xc5, 0xd3, 0xde, 0xeb, 0xf6, 0x102, 0x10c, 0x118, 0x123, 0x12f, 0x13b, 0x143, 0x14c, 0x156, 0x161, 0x16d, 0x174, 0x17f, 0x184, 0x18c, 0x18f, 0x194, 0x198, 0x19c, 0x1a3, 0x1ac, 0x1b4, 0x1b5, 0x1be, 0x1c5, 0x1cd, 0x1d3, 0x1d8, 0x1dc, 0x1df, 0x1e1, 0x1e4, 0x1e9, 0x1ea, 0x1ec, 0x1ee, 0x1f0, 0x1f7, 0x1fc, 0x200, 0x209, 0x20c, 0x20f, 0x215, 0x216, 0x221, 0x222, 0x223, 0x228, 0x235, 0x23d, 0x245, 0x24e, 0x257, 0x260, 0x265, 0x268, 0x273, 0x280, 0x282, 0x289, 0x28b, 0x297, 0x298, 0x2a3, 0x2ab, 0x2b3, 0x2b9, 0x2ba, 0x2c8, 0x2cd, 0x2d0, 0x2d5, 0x2d9, 0x2df, 0x2e4, 0x2e7, 0x2ec, 0x2f1, 0x2f2, 0x2f8, 0x2fa, 0x2fb, 0x2fd, 0x2ff, 0x302, 0x303, 0x305, 0x308, 0x30e, 0x312, 0x314, 0x319, 0x320, 0x324, 0x32d, 0x32e, 0x337, 0x33b, 0x340, 0x348, 0x34e, 0x354, 0x35e, 0x363, 0x36c, 0x372, 0x379, 0x37d, 0x385, 0x387, 0x389, 0x38c, 0x38e, 0x390, 0x391, 0x392, 0x394, 0x396, 0x39c, 0x3a1, 0x3a3, 0x3a9, 0x3ac, 0x3ae, 0x3b4, 0x3b9, 0x3bb, 0x3bc, 0x3bd, 0x3be, 0x3c0, 0x3c2, 0x3c4, 0x3c7, 0x3c9, 0x3cc, 0x3d4, 0x3d7, 0x3db, 0x3e3, 0x3e5, 0x3e6, 0x3e7, 0x3e9, 0x3ef, 0x3f1, 0x3f2, 0x3f4, 0x3f6, 0x3f8, 0x405, 0x406, 0x407, 0x40b, 0x40d, 0x40e, 0x40f, 0x410, 0x411, 0x414, 0x417, 0x41d, 0x421, 0x425, 0x42b, 0x42e, 0x435, 0x439, 0x43d, 0x444, 0x44d, 0x453, 0x459, 0x463, 0x46d, 0x46f, 0x477, 0x47d, 0x483, 0x489, 0x48c, 0x492, 0x495, 0x49d, 0x49e, 0x4a5, 0x4a9, 0x4aa, 0x4ad, 0x4b5, 0x4bb, 0x4c2, 0x4c3, 0x4c9, 0x4cc, 0x4d4, 0x4db, 0x4e5, 0x4ed, 0x4f0, 0x4f1, 0x4f2, 0x4f3, 0x4f4, 0x4f6, 0x4f8, 0x4fa, 0x4fe, 0x4ff, 0x501, 0x503, 0x504, 0x505, 0x507, 0x50c, 0x511, 0x515, 0x516, 0x519, 0x51d, 0x528, 0x52c, 0x534, 0x539, 0x53d, 0x540, 0x544, 0x547, 0x54a, 0x54f, 0x553, 0x557, 0x55b, 0x55f, 0x561, 0x563, 0x566, 0x56b, 0x56d, 0x572, 0x57b, 0x580, 0x581, 0x584, 0x585, 0x586, 0x588, 0x589, 0x58a} + +// sparseValues: 1418 entries, 5672 bytes +var sparseValues = [1418]valueRange{ + // Block 0x0, offset 0x0 + {value: 0x0004, lo: 0xa8, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xaa}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0004, lo: 0xaf, hi: 0xaf}, + {value: 0x0004, lo: 0xb4, hi: 0xb4}, + {value: 0x001a, lo: 0xb5, hi: 0xb5}, + {value: 0x0054, lo: 0xb7, hi: 0xb7}, + {value: 0x0004, lo: 0xb8, hi: 0xb8}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + // Block 0x1, offset 0x9 + {value: 0x2013, lo: 0x80, hi: 0x96}, + {value: 0x2013, lo: 0x98, hi: 0x9e}, + {value: 0x009a, lo: 0x9f, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xb6}, + {value: 0x2012, lo: 0xb8, hi: 0xbe}, + {value: 0x0252, lo: 0xbf, hi: 0xbf}, + // Block 0x2, offset 0xf + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x011b, lo: 0xb0, hi: 0xb0}, + {value: 0x019a, lo: 0xb1, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb7}, + {value: 0x0012, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x0553, lo: 0xbf, hi: 0xbf}, + // Block 0x3, offset 0x18 + {value: 0x0552, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x01da, lo: 0x89, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xb7}, + {value: 0x0253, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x028a, lo: 0xbf, hi: 0xbf}, + // Block 0x4, offset 0x24 + {value: 0x0117, lo: 0x80, hi: 0x9f}, + {value: 0x2f53, lo: 0xa0, hi: 0xa0}, + {value: 0x0012, lo: 0xa1, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xb3}, + {value: 0x0012, lo: 0xb4, hi: 0xb9}, + {value: 0x090b, lo: 0xba, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x2953, lo: 0xbd, hi: 0xbd}, + {value: 0x098b, lo: 0xbe, hi: 0xbe}, + {value: 0x0a0a, lo: 0xbf, hi: 0xbf}, + // Block 0x5, offset 0x2e + {value: 0x0015, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x97}, + {value: 0x0004, lo: 0x98, hi: 0x9d}, + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0015, lo: 0xa0, hi: 0xa4}, + {value: 0x0004, lo: 0xa5, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xbf}, + // Block 0x6, offset 0x35 + {value: 0x0024, lo: 0x80, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbf}, + // Block 0x7, offset 0x38 + {value: 0x6553, lo: 0x80, hi: 0x8f}, + {value: 0x2013, lo: 0x90, hi: 0x9f}, + {value: 0x5f53, lo: 0xa0, hi: 0xaf}, + {value: 0x2012, lo: 0xb0, hi: 0xbf}, + // Block 0x8, offset 0x3c + {value: 0x5f52, lo: 0x80, hi: 0x8f}, + {value: 0x6552, lo: 0x90, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x9, offset 0x3f + {value: 0x0117, lo: 0x80, hi: 0x81}, + {value: 0x0024, lo: 0x83, hi: 0x87}, + {value: 0x0014, lo: 0x88, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xbf}, + // Block 0xa, offset 0x43 + {value: 0x0f13, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x0316, lo: 0x89, hi: 0x8a}, + {value: 0x0716, lo: 0x8b, hi: 0x8c}, + {value: 0x0316, lo: 0x8d, hi: 0x8e}, + {value: 0x0f12, lo: 0x8f, hi: 0x8f}, + {value: 0x0117, lo: 0x90, hi: 0xbf}, + // Block 0xb, offset 0x4d + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x6553, lo: 0xb1, hi: 0xbf}, + // Block 0xc, offset 0x4f + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6853, lo: 0x90, hi: 0x96}, + {value: 0x0014, lo: 0x99, hi: 0x99}, + {value: 0x0010, lo: 0x9b, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0012, lo: 0xa0, hi: 0xa0}, + {value: 0x6552, lo: 0xa1, hi: 0xaf}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0xd, offset 0x57 + {value: 0x0034, lo: 0x81, hi: 0x82}, + {value: 0x0024, lo: 0x84, hi: 0x84}, + {value: 0x0034, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0xaa}, + {value: 0x0010, lo: 0xaf, hi: 0xb3}, + {value: 0x0054, lo: 0xb4, hi: 0xb4}, + // Block 0xe, offset 0x5e + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0024, lo: 0x90, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0014, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xf, offset 0x63 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9c}, + {value: 0x0024, lo: 0x9d, hi: 0x9e}, + {value: 0x0034, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0034, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x10, offset 0x71 + {value: 0x0010, lo: 0x80, hi: 0xbf}, + // Block 0x11, offset 0x72 + {value: 0x0010, lo: 0x80, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0024, lo: 0x9f, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xaa, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x12, offset 0x80 + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0034, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0034, lo: 0xb1, hi: 0xb1}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbd}, + {value: 0x0034, lo: 0xbe, hi: 0xbe}, + {value: 0x0024, lo: 0xbf, hi: 0xbf}, + // Block 0x13, offset 0x8f + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0024, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x88}, + {value: 0x0024, lo: 0x89, hi: 0x8a}, + {value: 0x0010, lo: 0x8d, hi: 0xbf}, + // Block 0x14, offset 0x99 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x15, offset 0x9c + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xb1}, + {value: 0x0034, lo: 0xb2, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0x16, offset 0xa3 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x99}, + {value: 0x0014, lo: 0x9a, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0xa3}, + {value: 0x0014, lo: 0xa4, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xad}, + // Block 0x17, offset 0xab + {value: 0x0010, lo: 0x80, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0xa0, hi: 0xaa}, + // Block 0x18, offset 0xae + {value: 0x0010, lo: 0xa0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbd}, + // Block 0x19, offset 0xb0 + {value: 0x0034, lo: 0x93, hi: 0x93}, + {value: 0x0024, lo: 0x94, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0024, lo: 0xaa, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbf}, + // Block 0x1a, offset 0xbf + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1b, offset 0xc5 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0x1c, offset 0xd3 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb6, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1d, offset 0xde + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xb1}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + // Block 0x1e, offset 0xeb + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x1f, offset 0xf6 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x99, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x20, offset 0x102 + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x21, offset 0x10c + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x85}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xbf}, + // Block 0x22, offset 0x118 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x23, offset 0x123 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x24, offset 0x12f + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0010, lo: 0xa8, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x25, offset 0x13b + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x26, offset 0x143 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb9}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbf}, + // Block 0x27, offset 0x14c + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x88}, + {value: 0x0014, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x28, offset 0x156 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x29, offset 0x161 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb2}, + // Block 0x2a, offset 0x16d + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x2b, offset 0x174 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x94, hi: 0x97}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xba, hi: 0xbf}, + // Block 0x2c, offset 0x17f + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x96}, + {value: 0x0010, lo: 0x9a, hi: 0xb1}, + {value: 0x0010, lo: 0xb3, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x2d, offset 0x184 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x94}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9f}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + // Block 0x2e, offset 0x18c + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xba}, + // Block 0x2f, offset 0x18f + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x30, offset 0x194 + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xb9}, + {value: 0x0014, lo: 0xbb, hi: 0xbc}, + // Block 0x31, offset 0x198 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x32, offset 0x19c + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0034, lo: 0x98, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0034, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x33, offset 0x1a3 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xac}, + {value: 0x0034, lo: 0xb1, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xba, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x34, offset 0x1ac + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0024, lo: 0x82, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x86, hi: 0x87}, + {value: 0x0010, lo: 0x88, hi: 0x8c}, + {value: 0x0014, lo: 0x8d, hi: 0x97}, + {value: 0x0014, lo: 0x99, hi: 0xbc}, + // Block 0x35, offset 0x1b4 + {value: 0x0034, lo: 0x86, hi: 0x86}, + // Block 0x36, offset 0x1b5 + {value: 0x0010, lo: 0xab, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbe}, + // Block 0x37, offset 0x1be + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x96, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x99}, + {value: 0x0014, lo: 0x9e, hi: 0xa0}, + {value: 0x0010, lo: 0xa2, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xad}, + {value: 0x0014, lo: 0xb1, hi: 0xb4}, + // Block 0x38, offset 0x1c5 + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x6c53, lo: 0xa0, hi: 0xbf}, + // Block 0x39, offset 0x1cd + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x9a, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x3a, offset 0x1d3 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x3b, offset 0x1d8 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x82, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3c, offset 0x1dc + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3d, offset 0x1df + {value: 0x0010, lo: 0x80, hi: 0x9a}, + {value: 0x0024, lo: 0x9d, hi: 0x9f}, + // Block 0x3e, offset 0x1e1 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x7453, lo: 0xa0, hi: 0xaf}, + {value: 0x7853, lo: 0xb0, hi: 0xbf}, + // Block 0x3f, offset 0x1e4 + {value: 0x7c53, lo: 0x80, hi: 0x8f}, + {value: 0x8053, lo: 0x90, hi: 0x9f}, + {value: 0x7c53, lo: 0xa0, hi: 0xaf}, + {value: 0x0813, lo: 0xb0, hi: 0xb5}, + {value: 0x0892, lo: 0xb8, hi: 0xbd}, + // Block 0x40, offset 0x1e9 + {value: 0x0010, lo: 0x81, hi: 0xbf}, + // Block 0x41, offset 0x1ea + {value: 0x0010, lo: 0x80, hi: 0xac}, + {value: 0x0010, lo: 0xaf, hi: 0xbf}, + // Block 0x42, offset 0x1ec + {value: 0x0010, lo: 0x81, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x43, offset 0x1ee + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb8}, + // Block 0x44, offset 0x1f0 + {value: 0x0010, lo: 0x80, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0034, lo: 0x94, hi: 0x94}, + {value: 0x0010, lo: 0xa0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + // Block 0x45, offset 0x1f7 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xac}, + {value: 0x0010, lo: 0xae, hi: 0xb0}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + // Block 0x46, offset 0x1fc + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x47, offset 0x200 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x89, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0014, lo: 0x93, hi: 0x93}, + {value: 0x0004, lo: 0x97, hi: 0x97}, + {value: 0x0024, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0x48, offset 0x209 + {value: 0x0014, lo: 0x8b, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x49, offset 0x20c + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb8}, + // Block 0x4a, offset 0x20f + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x4b, offset 0x215 + {value: 0x0010, lo: 0x80, hi: 0xb5}, + // Block 0x4c, offset 0x216 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbb}, + // Block 0x4d, offset 0x221 + {value: 0x0010, lo: 0x86, hi: 0x8f}, + // Block 0x4e, offset 0x222 + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x4f, offset 0x223 + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + // Block 0x50, offset 0x228 + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x9e}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xac}, + {value: 0x0010, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xbc}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x51, offset 0x235 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xa7, hi: 0xa7}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + {value: 0x0034, lo: 0xb5, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbc}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + // Block 0x52, offset 0x23d + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x53, offset 0x245 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0030, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8b}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xab, hi: 0xab}, + {value: 0x0034, lo: 0xac, hi: 0xac}, + {value: 0x0024, lo: 0xad, hi: 0xb3}, + // Block 0x54, offset 0x24e + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0030, lo: 0xaa, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbf}, + // Block 0x55, offset 0x257 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0030, lo: 0xb2, hi: 0xb3}, + // Block 0x56, offset 0x260 + {value: 0x0010, lo: 0x80, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + // Block 0x57, offset 0x265 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8d, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x58, offset 0x268 + {value: 0x316a, lo: 0x80, hi: 0x80}, + {value: 0x31ea, lo: 0x81, hi: 0x81}, + {value: 0x326a, lo: 0x82, hi: 0x82}, + {value: 0x32ea, lo: 0x83, hi: 0x83}, + {value: 0x336a, lo: 0x84, hi: 0x84}, + {value: 0x33ea, lo: 0x85, hi: 0x85}, + {value: 0x346a, lo: 0x86, hi: 0x86}, + {value: 0x34ea, lo: 0x87, hi: 0x87}, + {value: 0x356a, lo: 0x88, hi: 0x88}, + {value: 0x8353, lo: 0x90, hi: 0xba}, + {value: 0x8353, lo: 0xbd, hi: 0xbf}, + // Block 0x59, offset 0x273 + {value: 0x0024, lo: 0x90, hi: 0x92}, + {value: 0x0034, lo: 0x94, hi: 0x99}, + {value: 0x0024, lo: 0x9a, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9f}, + {value: 0x0024, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0034, lo: 0xa2, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xb3}, + {value: 0x0024, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb7}, + {value: 0x0024, lo: 0xb8, hi: 0xb9}, + // Block 0x5a, offset 0x280 + {value: 0x0012, lo: 0x80, hi: 0xab}, + {value: 0x0015, lo: 0xac, hi: 0xbf}, + // Block 0x5b, offset 0x282 + {value: 0x0015, lo: 0x80, hi: 0xaa}, + {value: 0x0012, lo: 0xab, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb8}, + {value: 0x8752, lo: 0xb9, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbc}, + {value: 0x8b52, lo: 0xbd, hi: 0xbd}, + {value: 0x0012, lo: 0xbe, hi: 0xbf}, + // Block 0x5c, offset 0x289 + {value: 0x0012, lo: 0x80, hi: 0x9a}, + {value: 0x0015, lo: 0x9b, hi: 0xbf}, + // Block 0x5d, offset 0x28b + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0024, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb9}, + {value: 0x0024, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbd}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x5e, offset 0x297 + {value: 0x0117, lo: 0x80, hi: 0xbf}, + // Block 0x5f, offset 0x298 + {value: 0x0117, lo: 0x80, hi: 0x95}, + {value: 0x361a, lo: 0x96, hi: 0x96}, + {value: 0x36ca, lo: 0x97, hi: 0x97}, + {value: 0x377a, lo: 0x98, hi: 0x98}, + {value: 0x382a, lo: 0x99, hi: 0x99}, + {value: 0x38da, lo: 0x9a, hi: 0x9a}, + {value: 0x398a, lo: 0x9b, hi: 0x9b}, + {value: 0x0012, lo: 0x9c, hi: 0x9d}, + {value: 0x3a3b, lo: 0x9e, hi: 0x9e}, + {value: 0x0012, lo: 0x9f, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x60, offset 0x2a3 + {value: 0x0812, lo: 0x80, hi: 0x87}, + {value: 0x0813, lo: 0x88, hi: 0x8f}, + {value: 0x0812, lo: 0x90, hi: 0x95}, + {value: 0x0813, lo: 0x98, hi: 0x9d}, + {value: 0x0812, lo: 0xa0, hi: 0xa7}, + {value: 0x0813, lo: 0xa8, hi: 0xaf}, + {value: 0x0812, lo: 0xb0, hi: 0xb7}, + {value: 0x0813, lo: 0xb8, hi: 0xbf}, + // Block 0x61, offset 0x2ab + {value: 0x0004, lo: 0x8b, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8f}, + {value: 0x0054, lo: 0x98, hi: 0x99}, + {value: 0x0054, lo: 0xa4, hi: 0xa4}, + {value: 0x0054, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xaa, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xaf}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x62, offset 0x2b3 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x94, hi: 0x94}, + {value: 0x0014, lo: 0xa0, hi: 0xa4}, + {value: 0x0014, lo: 0xa6, hi: 0xaf}, + {value: 0x0015, lo: 0xb1, hi: 0xb1}, + {value: 0x0015, lo: 0xbf, hi: 0xbf}, + // Block 0x63, offset 0x2b9 + {value: 0x0015, lo: 0x90, hi: 0x9c}, + // Block 0x64, offset 0x2ba + {value: 0x0024, lo: 0x90, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x93}, + {value: 0x0024, lo: 0x94, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0xa0}, + {value: 0x0024, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa4}, + {value: 0x0034, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa7}, + {value: 0x0034, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xa9}, + {value: 0x0034, lo: 0xaa, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + // Block 0x65, offset 0x2c8 + {value: 0x0016, lo: 0x85, hi: 0x86}, + {value: 0x0012, lo: 0x87, hi: 0x89}, + {value: 0xa052, lo: 0x8e, hi: 0x8e}, + {value: 0x1013, lo: 0xa0, hi: 0xaf}, + {value: 0x1012, lo: 0xb0, hi: 0xbf}, + // Block 0x66, offset 0x2cd + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x88}, + // Block 0x67, offset 0x2d0 + {value: 0xa353, lo: 0xb6, hi: 0xb7}, + {value: 0xa653, lo: 0xb8, hi: 0xb9}, + {value: 0xa953, lo: 0xba, hi: 0xbb}, + {value: 0xa653, lo: 0xbc, hi: 0xbd}, + {value: 0xa353, lo: 0xbe, hi: 0xbf}, + // Block 0x68, offset 0x2d5 + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6553, lo: 0x90, hi: 0x9f}, + {value: 0xac53, lo: 0xa0, hi: 0xae}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0x69, offset 0x2d9 + {value: 0x0117, lo: 0x80, hi: 0xa3}, + {value: 0x0012, lo: 0xa4, hi: 0xa4}, + {value: 0x0716, lo: 0xab, hi: 0xac}, + {value: 0x0316, lo: 0xad, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb3}, + // Block 0x6a, offset 0x2df + {value: 0x6c52, lo: 0x80, hi: 0x9f}, + {value: 0x7052, lo: 0xa0, hi: 0xa5}, + {value: 0x7052, lo: 0xa7, hi: 0xa7}, + {value: 0x7052, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x6b, offset 0x2e4 + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x6c, offset 0x2e7 + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0010, lo: 0xb0, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x6d, offset 0x2ec + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9e}, + {value: 0x0024, lo: 0xa0, hi: 0xbf}, + // Block 0x6e, offset 0x2f1 + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + // Block 0x6f, offset 0x2f2 + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0xaa, hi: 0xad}, + {value: 0x0030, lo: 0xae, hi: 0xaf}, + {value: 0x0004, lo: 0xb1, hi: 0xb5}, + {value: 0x0014, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + // Block 0x70, offset 0x2f8 + {value: 0x0034, lo: 0x99, hi: 0x9a}, + {value: 0x0004, lo: 0x9b, hi: 0x9e}, + // Block 0x71, offset 0x2fa + {value: 0x0004, lo: 0xbc, hi: 0xbe}, + // Block 0x72, offset 0x2fb + {value: 0x0010, lo: 0x85, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x73, offset 0x2fd + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0010, lo: 0xa0, hi: 0xba}, + // Block 0x74, offset 0x2ff + {value: 0x0010, lo: 0x80, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0xbf}, + // Block 0x75, offset 0x302 + {value: 0x0010, lo: 0x80, hi: 0x8c}, + // Block 0x76, offset 0x303 + {value: 0x0010, lo: 0x90, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x77, offset 0x305 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0xab}, + // Block 0x78, offset 0x308 + {value: 0x0117, lo: 0x80, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb2}, + {value: 0x0024, lo: 0xb4, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x79, offset 0x30e + {value: 0x0117, lo: 0x80, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9d}, + {value: 0x0024, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x7a, offset 0x312 + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb1}, + // Block 0x7b, offset 0x314 + {value: 0x0004, lo: 0x80, hi: 0x96}, + {value: 0x0014, lo: 0x97, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xaf}, + {value: 0x0012, lo: 0xb0, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xbf}, + // Block 0x7c, offset 0x319 + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x0015, lo: 0xb0, hi: 0xb0}, + {value: 0x0012, lo: 0xb1, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x8753, lo: 0xbd, hi: 0xbd}, + {value: 0x0117, lo: 0xbe, hi: 0xbf}, + // Block 0x7d, offset 0x320 + {value: 0x0010, lo: 0xb7, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbf}, + // Block 0x7e, offset 0x324 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8b}, + {value: 0x0010, lo: 0x8c, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + // Block 0x7f, offset 0x32d + {value: 0x0010, lo: 0x80, hi: 0xb3}, + // Block 0x80, offset 0x32e + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xa0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb7}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x81, offset 0x337 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x82, offset 0x33b + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0x92}, + {value: 0x0030, lo: 0x93, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0x83, offset 0x340 + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb9}, + {value: 0x0010, lo: 0xba, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x84, offset 0x348 + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0004, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x85, offset 0x34e + {value: 0x0010, lo: 0x80, hi: 0xa8}, + {value: 0x0014, lo: 0xa9, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0x86, offset 0x354 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x87, offset 0x35e + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0024, lo: 0xbe, hi: 0xbf}, + // Block 0x88, offset 0x363 + {value: 0x0024, lo: 0x81, hi: 0x81}, + {value: 0x0004, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + // Block 0x89, offset 0x36c + {value: 0x0010, lo: 0x81, hi: 0x86}, + {value: 0x0010, lo: 0x89, hi: 0x8e}, + {value: 0x0010, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x8a, offset 0x372 + {value: 0x0012, lo: 0x80, hi: 0x92}, + {value: 0xaf52, lo: 0x93, hi: 0x93}, + {value: 0x0012, lo: 0x94, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9f}, + {value: 0x0012, lo: 0xa0, hi: 0xa5}, + {value: 0x74d2, lo: 0xb0, hi: 0xbf}, + // Block 0x8b, offset 0x379 + {value: 0x78d2, lo: 0x80, hi: 0x8f}, + {value: 0x7cd2, lo: 0x90, hi: 0x9f}, + {value: 0x80d2, lo: 0xa0, hi: 0xaf}, + {value: 0x7cd2, lo: 0xb0, hi: 0xbf}, + // Block 0x8c, offset 0x37d + {value: 0x0010, lo: 0x80, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x8d, offset 0x385 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x8e, offset 0x387 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x8b, hi: 0xbb}, + // Block 0x8f, offset 0x389 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0xbf}, + // Block 0x90, offset 0x38c + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0004, lo: 0xb2, hi: 0xbf}, + // Block 0x91, offset 0x38e + {value: 0x0004, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x93, hi: 0xbf}, + // Block 0x92, offset 0x390 + {value: 0x0010, lo: 0x80, hi: 0xbd}, + // Block 0x93, offset 0x391 + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0x94, offset 0x392 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0xbf}, + // Block 0x95, offset 0x394 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0xb0, hi: 0xbb}, + // Block 0x96, offset 0x396 + {value: 0x0014, lo: 0x80, hi: 0x8f}, + {value: 0x0054, lo: 0x93, hi: 0x93}, + {value: 0x0024, lo: 0xa0, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xad}, + {value: 0x0024, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + // Block 0x97, offset 0x39c + {value: 0x0010, lo: 0x8d, hi: 0x8f}, + {value: 0x0054, lo: 0x92, hi: 0x92}, + {value: 0x0054, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0xb0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0x98, offset 0x3a1 + {value: 0x0010, lo: 0x80, hi: 0xbc}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x99, offset 0x3a3 + {value: 0x0054, lo: 0x87, hi: 0x87}, + {value: 0x0054, lo: 0x8e, hi: 0x8e}, + {value: 0x0054, lo: 0x9a, hi: 0x9a}, + {value: 0x5f53, lo: 0xa1, hi: 0xba}, + {value: 0x0004, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9a, offset 0x3a9 + {value: 0x0004, lo: 0x80, hi: 0x80}, + {value: 0x5f52, lo: 0x81, hi: 0x9a}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + // Block 0x9b, offset 0x3ac + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbe}, + // Block 0x9c, offset 0x3ae + {value: 0x0010, lo: 0x82, hi: 0x87}, + {value: 0x0010, lo: 0x8a, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0x97}, + {value: 0x0010, lo: 0x9a, hi: 0x9c}, + {value: 0x0004, lo: 0xa3, hi: 0xa3}, + {value: 0x0014, lo: 0xb9, hi: 0xbb}, + // Block 0x9d, offset 0x3b4 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0010, lo: 0x8d, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xba}, + {value: 0x0010, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9e, offset 0x3b9 + {value: 0x0010, lo: 0x80, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x9d}, + // Block 0x9f, offset 0x3bb + {value: 0x0010, lo: 0x80, hi: 0xba}, + // Block 0xa0, offset 0x3bc + {value: 0x0010, lo: 0x80, hi: 0xb4}, + // Block 0xa1, offset 0x3bd + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0xa2, offset 0x3be + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa3, offset 0x3c0 + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + // Block 0xa4, offset 0x3c2 + {value: 0x0010, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xad, hi: 0xbf}, + // Block 0xa5, offset 0x3c4 + {value: 0x0010, lo: 0x80, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0xb5}, + {value: 0x0024, lo: 0xb6, hi: 0xba}, + // Block 0xa6, offset 0x3c7 + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa7, offset 0x3c9 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x91, hi: 0x95}, + // Block 0xa8, offset 0x3cc + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x97}, + {value: 0xb253, lo: 0x98, hi: 0x9f}, + {value: 0xb553, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbf}, + // Block 0xa9, offset 0x3d4 + {value: 0xb252, lo: 0x80, hi: 0x87}, + {value: 0xb552, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0xaa, offset 0x3d7 + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0xb553, lo: 0xb0, hi: 0xb7}, + {value: 0xb253, lo: 0xb8, hi: 0xbf}, + // Block 0xab, offset 0x3db + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x93}, + {value: 0xb552, lo: 0x98, hi: 0x9f}, + {value: 0xb252, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbb}, + // Block 0xac, offset 0x3e3 + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xad, offset 0x3e5 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + // Block 0xae, offset 0x3e6 + {value: 0x0010, lo: 0x80, hi: 0xb6}, + // Block 0xaf, offset 0x3e7 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xa7}, + // Block 0xb0, offset 0x3e9 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xb5}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xb1, offset 0x3ef + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb6}, + // Block 0xb2, offset 0x3f1 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + // Block 0xb3, offset 0x3f2 + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + // Block 0xb4, offset 0x3f4 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb9}, + // Block 0xb5, offset 0x3f6 + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0xb6, offset 0x3f8 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x8e, hi: 0x8e}, + {value: 0x0024, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x99, hi: 0xb5}, + {value: 0x0024, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xb7, offset 0x405 + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0xb8, offset 0x406 + {value: 0x0010, lo: 0x80, hi: 0x9c}, + // Block 0xb9, offset 0x407 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + // Block 0xba, offset 0x40b + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + // Block 0xbb, offset 0x40d + {value: 0x0010, lo: 0x80, hi: 0x91}, + // Block 0xbc, offset 0x40e + {value: 0x0010, lo: 0x80, hi: 0x88}, + // Block 0xbd, offset 0x40f + {value: 0x5653, lo: 0x80, hi: 0xb2}, + // Block 0xbe, offset 0x410 + {value: 0x5652, lo: 0x80, hi: 0xb2}, + // Block 0xbf, offset 0x411 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xc0, offset 0x414 + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xc1, offset 0x417 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x87}, + {value: 0x0024, lo: 0x88, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x8b}, + {value: 0x0024, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + // Block 0xc2, offset 0x41d + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xc3, offset 0x421 + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xc4, offset 0x425 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb6}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + // Block 0xc5, offset 0x42b + {value: 0x0014, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xc6, offset 0x42e + {value: 0x0024, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0xc7, offset 0x435 + {value: 0x0010, lo: 0x84, hi: 0x86}, + {value: 0x0010, lo: 0x90, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + // Block 0xc8, offset 0x439 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xc9, offset 0x43d + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x89, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + // Block 0xca, offset 0x444 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb4}, + {value: 0x0030, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xb7}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + // Block 0xcb, offset 0x44d + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xcc, offset 0x453 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa2}, + {value: 0x0014, lo: 0xa3, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xcd, offset 0x459 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xce, offset 0x463 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0030, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9d, hi: 0xa3}, + {value: 0x0024, lo: 0xa6, hi: 0xac}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + // Block 0xcf, offset 0x46d + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xd0, offset 0x46f + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0x9e, hi: 0x9e}, + // Block 0xd1, offset 0x477 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xd2, offset 0x47d + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd3, offset 0x483 + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xd4, offset 0x489 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x98, hi: 0x9b}, + {value: 0x0014, lo: 0x9c, hi: 0x9d}, + // Block 0xd5, offset 0x48c + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xd6, offset 0x492 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd7, offset 0x495 + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0014, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb5}, + {value: 0x0030, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + // Block 0xd8, offset 0x49d + {value: 0x0010, lo: 0x80, hi: 0x89}, + // Block 0xd9, offset 0x49e + {value: 0x0014, lo: 0x9d, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xda, offset 0x4a5 + {value: 0x0010, lo: 0x80, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + // Block 0xdb, offset 0x4a9 + {value: 0x5f53, lo: 0xa0, hi: 0xbf}, + // Block 0xdc, offset 0x4aa + {value: 0x5f52, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xdd, offset 0x4ad + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x8a}, + {value: 0x0010, lo: 0x8b, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbb, hi: 0xbe}, + // Block 0xde, offset 0x4b5 + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0014, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x98}, + {value: 0x0014, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0x9c, hi: 0xbf}, + // Block 0xdf, offset 0x4bb + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x86, hi: 0x89}, + {value: 0x0014, lo: 0x8a, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x99}, + {value: 0x0010, lo: 0x9d, hi: 0x9d}, + // Block 0xe0, offset 0x4c2 + {value: 0x0010, lo: 0x80, hi: 0xb8}, + // Block 0xe1, offset 0x4c3 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb6}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xe2, offset 0x4c9 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0xe3, offset 0x4cc + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0014, lo: 0x92, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xa9}, + {value: 0x0014, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0xe4, offset 0x4d4 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb6}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xe5, offset 0x4db + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa5}, + {value: 0x0010, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xbf}, + // Block 0xe6, offset 0x4e5 + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0014, lo: 0x90, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0x96}, + {value: 0x0034, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0xe7, offset 0x4ed + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + // Block 0xe8, offset 0x4f0 + {value: 0x0010, lo: 0x80, hi: 0x99}, + // Block 0xe9, offset 0x4f1 + {value: 0x0010, lo: 0x80, hi: 0xae}, + // Block 0xea, offset 0x4f2 + {value: 0x0010, lo: 0x80, hi: 0x83}, + // Block 0xeb, offset 0x4f3 + {value: 0x0010, lo: 0x80, hi: 0x86}, + // Block 0xec, offset 0x4f4 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0xed, offset 0x4f6 + {value: 0x0010, lo: 0x90, hi: 0xad}, + {value: 0x0034, lo: 0xb0, hi: 0xb4}, + // Block 0xee, offset 0x4f8 + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb6}, + // Block 0xef, offset 0x4fa + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa3, hi: 0xb7}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xf0, offset 0x4fe + {value: 0x0010, lo: 0x80, hi: 0x8f}, + // Block 0xf1, offset 0x4ff + {value: 0x2013, lo: 0x80, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xbf}, + // Block 0xf2, offset 0x501 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0010, lo: 0x90, hi: 0xbe}, + // Block 0xf3, offset 0x503 + {value: 0x0014, lo: 0x8f, hi: 0x9f}, + // Block 0xf4, offset 0x504 + {value: 0x0014, lo: 0xa0, hi: 0xa1}, + // Block 0xf5, offset 0x505 + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbc}, + // Block 0xf6, offset 0x507 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0034, lo: 0x9e, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa3}, + // Block 0xf7, offset 0x50c + {value: 0x0030, lo: 0xa5, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xa9}, + {value: 0x0030, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbf}, + // Block 0xf8, offset 0x511 + {value: 0x0034, lo: 0x80, hi: 0x82}, + {value: 0x0024, lo: 0x85, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8b}, + {value: 0x0024, lo: 0xaa, hi: 0xad}, + // Block 0xf9, offset 0x515 + {value: 0x0024, lo: 0x82, hi: 0x84}, + // Block 0xfa, offset 0x516 + {value: 0x0013, lo: 0x80, hi: 0x99}, + {value: 0x0012, lo: 0x9a, hi: 0xb3}, + {value: 0x0013, lo: 0xb4, hi: 0xbf}, + // Block 0xfb, offset 0x519 + {value: 0x0013, lo: 0x80, hi: 0x8d}, + {value: 0x0012, lo: 0x8e, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0xa7}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0xfc, offset 0x51d + {value: 0x0013, lo: 0x80, hi: 0x81}, + {value: 0x0012, lo: 0x82, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0x9c}, + {value: 0x0013, lo: 0x9e, hi: 0x9f}, + {value: 0x0013, lo: 0xa2, hi: 0xa2}, + {value: 0x0013, lo: 0xa5, hi: 0xa6}, + {value: 0x0013, lo: 0xa9, hi: 0xac}, + {value: 0x0013, lo: 0xae, hi: 0xb5}, + {value: 0x0012, lo: 0xb6, hi: 0xb9}, + {value: 0x0012, lo: 0xbb, hi: 0xbb}, + {value: 0x0012, lo: 0xbd, hi: 0xbf}, + // Block 0xfd, offset 0x528 + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0012, lo: 0x85, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0xfe, offset 0x52c + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0013, lo: 0x84, hi: 0x85}, + {value: 0x0013, lo: 0x87, hi: 0x8a}, + {value: 0x0013, lo: 0x8d, hi: 0x94}, + {value: 0x0013, lo: 0x96, hi: 0x9c}, + {value: 0x0012, lo: 0x9e, hi: 0xb7}, + {value: 0x0013, lo: 0xb8, hi: 0xb9}, + {value: 0x0013, lo: 0xbb, hi: 0xbe}, + // Block 0xff, offset 0x534 + {value: 0x0013, lo: 0x80, hi: 0x84}, + {value: 0x0013, lo: 0x86, hi: 0x86}, + {value: 0x0013, lo: 0x8a, hi: 0x90}, + {value: 0x0012, lo: 0x92, hi: 0xab}, + {value: 0x0013, lo: 0xac, hi: 0xbf}, + // Block 0x100, offset 0x539 + {value: 0x0013, lo: 0x80, hi: 0x85}, + {value: 0x0012, lo: 0x86, hi: 0x9f}, + {value: 0x0013, lo: 0xa0, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbf}, + // Block 0x101, offset 0x53d + {value: 0x0012, lo: 0x80, hi: 0x93}, + {value: 0x0013, lo: 0x94, hi: 0xad}, + {value: 0x0012, lo: 0xae, hi: 0xbf}, + // Block 0x102, offset 0x540 + {value: 0x0012, lo: 0x80, hi: 0x87}, + {value: 0x0013, lo: 0x88, hi: 0xa1}, + {value: 0x0012, lo: 0xa2, hi: 0xbb}, + {value: 0x0013, lo: 0xbc, hi: 0xbf}, + // Block 0x103, offset 0x544 + {value: 0x0013, lo: 0x80, hi: 0x95}, + {value: 0x0012, lo: 0x96, hi: 0xaf}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x104, offset 0x547 + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0012, lo: 0x8a, hi: 0xa5}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0x105, offset 0x54a + {value: 0x0013, lo: 0x80, hi: 0x80}, + {value: 0x0012, lo: 0x82, hi: 0x9a}, + {value: 0x0012, lo: 0x9c, hi: 0xa1}, + {value: 0x0013, lo: 0xa2, hi: 0xba}, + {value: 0x0012, lo: 0xbc, hi: 0xbf}, + // Block 0x106, offset 0x54f + {value: 0x0012, lo: 0x80, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0xb4}, + {value: 0x0012, lo: 0xb6, hi: 0xbf}, + // Block 0x107, offset 0x553 + {value: 0x0012, lo: 0x80, hi: 0x8e}, + {value: 0x0012, lo: 0x90, hi: 0x95}, + {value: 0x0013, lo: 0x96, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x108, offset 0x557 + {value: 0x0012, lo: 0x80, hi: 0x88}, + {value: 0x0012, lo: 0x8a, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0x109, offset 0x55b + {value: 0x0012, lo: 0x80, hi: 0x82}, + {value: 0x0012, lo: 0x84, hi: 0x89}, + {value: 0x0017, lo: 0x8a, hi: 0x8b}, + {value: 0x0010, lo: 0x8e, hi: 0xbf}, + // Block 0x10a, offset 0x55f + {value: 0x0014, lo: 0x80, hi: 0xb6}, + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x10b, offset 0x561 + {value: 0x0014, lo: 0x80, hi: 0xac}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x10c, offset 0x563 + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x9b, hi: 0x9f}, + {value: 0x0014, lo: 0xa1, hi: 0xaf}, + // Block 0x10d, offset 0x566 + {value: 0x0024, lo: 0x80, hi: 0x86}, + {value: 0x0024, lo: 0x88, hi: 0x98}, + {value: 0x0024, lo: 0x9b, hi: 0xa1}, + {value: 0x0024, lo: 0xa3, hi: 0xa4}, + {value: 0x0024, lo: 0xa6, hi: 0xaa}, + // Block 0x10e, offset 0x56b + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0034, lo: 0x90, hi: 0x96}, + // Block 0x10f, offset 0x56d + {value: 0xb852, lo: 0x80, hi: 0x81}, + {value: 0xbb52, lo: 0x82, hi: 0x83}, + {value: 0x0024, lo: 0x84, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x110, offset 0x572 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x9f}, + {value: 0x0010, lo: 0xa1, hi: 0xa2}, + {value: 0x0010, lo: 0xa4, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb7}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + // Block 0x111, offset 0x57b + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x9b}, + {value: 0x0010, lo: 0xa1, hi: 0xa3}, + {value: 0x0010, lo: 0xa5, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xbb}, + // Block 0x112, offset 0x580 + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x113, offset 0x581 + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x114, offset 0x584 + {value: 0x0013, lo: 0x80, hi: 0x89}, + // Block 0x115, offset 0x585 + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x116, offset 0x586 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0014, lo: 0xa0, hi: 0xbf}, + // Block 0x117, offset 0x588 + {value: 0x0014, lo: 0x80, hi: 0xbf}, + // Block 0x118, offset 0x589 + {value: 0x0014, lo: 0x80, hi: 0xaf}, +} + +// Total table size 14906 bytes (14KiB); checksum: 362795C7 diff --git a/vendor/golang.org/x/text/cases/tables12.0.0.go b/vendor/golang.org/x/text/cases/tables12.0.0.go new file mode 100644 index 0000000000..84d841b149 --- /dev/null +++ b/vendor/golang.org/x/text/cases/tables12.0.0.go @@ -0,0 +1,2359 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +//go:build go1.14 && !go1.16 + +package cases + +// UnicodeVersion is the Unicode version from which the tables in this package are derived. +const UnicodeVersion = "12.0.0" + +var xorData string = "" + // Size: 192 bytes + "\x00\x06\x07\x00\x01?\x00\x0f\x03\x00\x0f\x12\x00\x0f\x1f\x00\x0f\x1d" + + "\x00\x01\x13\x00\x0f\x16\x00\x0f\x0b\x00\x0f3\x00\x0f7\x00\x01#\x00\x0f?" + + "\x00\x0e'\x00\x0f/\x00\x0e>\x00\x0f*\x00\x0c&\x00\x0c*\x00\x0c;\x00\x0c9" + + "\x00\x0c%\x00\x01\x08\x00\x03\x0d\x00\x03\x09\x00\x02\x06\x00\x02\x02" + + "\x00\x02\x0c\x00\x01\x00\x00\x01\x03\x00\x01\x01\x00\x01 \x00\x01\x0c" + + "\x00\x01\x10\x00\x03\x10\x00\x036 \x00\x037 \x00\x0b#\x10\x00\x0b 0\x00" + + "\x0b!\x10\x00\x0b!0\x001\x00\x00\x0b(\x04\x00\x03\x04\x1e\x00\x0b)\x08" + + "\x00\x03\x0a\x00\x02:\x00\x02>\x00\x02,\x00\x02\x00\x00\x02\x10\x00\x01<" + + "\x00\x01&\x00\x01*\x00\x01.\x00\x010\x003 \x00\x01\x18\x00\x01(\x00\x01" + + "\x1e\x00\x01\x22" + +var exceptions string = "" + // Size: 2450 bytes + "\x00\x12\x12μΜΜ\x12\x12ssSSSs\x13\x18i̇i̇\x10\x09II\x13\x1bʼnʼNʼN\x11" + + "\x09sSS\x12\x12dždžDž\x12\x12dždžDŽ\x10\x12DŽDž\x12\x12ljljLj\x12\x12ljljLJ\x10\x12LJLj" + + "\x12\x12njnjNj\x12\x12njnjNJ\x10\x12NJNj\x13\x1bǰJ̌J̌\x12\x12dzdzDz\x12\x12dzdzDZ\x10" + + "\x12DZDz\x13\x18ⱥⱥ\x13\x18ⱦⱦ\x10\x1bⱾⱾ\x10\x1bⱿⱿ\x10\x1bⱯⱯ\x10\x1bⱭⱭ\x10" + + "\x1bⱰⱰ\x10\x1bꞫꞫ\x10\x1bꞬꞬ\x10\x1bꞍꞍ\x10\x1bꞪꞪ\x10\x1bꞮꞮ\x10\x1bⱢⱢ\x10" + + "\x1bꞭꞭ\x10\x1bⱮⱮ\x10\x1bⱤⱤ\x10\x1bꟅꟅ\x10\x1bꞱꞱ\x10\x1bꞲꞲ\x10\x1bꞰꞰ2\x12ι" + + "ΙΙ\x166ΐΪ́Ϊ́\x166ΰΫ́Ϋ́\x12\x12σΣΣ\x12\x12βΒΒ\x12\x12θΘΘ\x12\x12" + + "φΦΦ\x12\x12πΠΠ\x12\x12κΚΚ\x12\x12ρΡΡ\x12\x12εΕΕ\x14$եւԵՒԵւ\x10\x1bᲐა" + + "\x10\x1bᲑბ\x10\x1bᲒგ\x10\x1bᲓდ\x10\x1bᲔე\x10\x1bᲕვ\x10\x1bᲖზ\x10\x1bᲗთ" + + "\x10\x1bᲘი\x10\x1bᲙკ\x10\x1bᲚლ\x10\x1bᲛმ\x10\x1bᲜნ\x10\x1bᲝო\x10\x1bᲞპ" + + "\x10\x1bᲟჟ\x10\x1bᲠრ\x10\x1bᲡს\x10\x1bᲢტ\x10\x1bᲣუ\x10\x1bᲤფ\x10\x1bᲥქ" + + "\x10\x1bᲦღ\x10\x1bᲧყ\x10\x1bᲨშ\x10\x1bᲩჩ\x10\x1bᲪც\x10\x1bᲫძ\x10\x1bᲬწ" + + "\x10\x1bᲭჭ\x10\x1bᲮხ\x10\x1bᲯჯ\x10\x1bᲰჰ\x10\x1bᲱჱ\x10\x1bᲲჲ\x10\x1bᲳჳ" + + "\x10\x1bᲴჴ\x10\x1bᲵჵ\x10\x1bᲶჶ\x10\x1bᲷჷ\x10\x1bᲸჸ\x10\x1bᲹჹ\x10\x1bᲺჺ" + + "\x10\x1bᲽჽ\x10\x1bᲾჾ\x10\x1bᲿჿ\x12\x12вВВ\x12\x12дДД\x12\x12оОО\x12\x12с" + + "СС\x12\x12тТТ\x12\x12тТТ\x12\x12ъЪЪ\x12\x12ѣѢѢ\x13\x1bꙋꙊꙊ\x13\x1bẖH̱H̱" + + "\x13\x1bẗT̈T̈\x13\x1bẘW̊W̊\x13\x1bẙY̊Y̊\x13\x1baʾAʾAʾ\x13\x1bṡṠṠ\x12" + + "\x10ssß\x14$ὐΥ̓Υ̓\x166ὒΥ̓̀Υ̓̀\x166ὔΥ̓́Υ̓́\x166ὖΥ̓͂Υ̓͂\x15+ἀιἈΙᾈ" + + "\x15+ἁιἉΙᾉ\x15+ἂιἊΙᾊ\x15+ἃιἋΙᾋ\x15+ἄιἌΙᾌ\x15+ἅιἍΙᾍ\x15+ἆιἎΙᾎ\x15+ἇιἏΙᾏ" + + "\x15\x1dἀιᾀἈΙ\x15\x1dἁιᾁἉΙ\x15\x1dἂιᾂἊΙ\x15\x1dἃιᾃἋΙ\x15\x1dἄιᾄἌΙ\x15" + + "\x1dἅιᾅἍΙ\x15\x1dἆιᾆἎΙ\x15\x1dἇιᾇἏΙ\x15+ἠιἨΙᾘ\x15+ἡιἩΙᾙ\x15+ἢιἪΙᾚ\x15+ἣι" + + "ἫΙᾛ\x15+ἤιἬΙᾜ\x15+ἥιἭΙᾝ\x15+ἦιἮΙᾞ\x15+ἧιἯΙᾟ\x15\x1dἠιᾐἨΙ\x15\x1dἡιᾑἩΙ" + + "\x15\x1dἢιᾒἪΙ\x15\x1dἣιᾓἫΙ\x15\x1dἤιᾔἬΙ\x15\x1dἥιᾕἭΙ\x15\x1dἦιᾖἮΙ\x15" + + "\x1dἧιᾗἯΙ\x15+ὠιὨΙᾨ\x15+ὡιὩΙᾩ\x15+ὢιὪΙᾪ\x15+ὣιὫΙᾫ\x15+ὤιὬΙᾬ\x15+ὥιὭΙᾭ" + + "\x15+ὦιὮΙᾮ\x15+ὧιὯΙᾯ\x15\x1dὠιᾠὨΙ\x15\x1dὡιᾡὩΙ\x15\x1dὢιᾢὪΙ\x15\x1dὣιᾣὫΙ" + + "\x15\x1dὤιᾤὬΙ\x15\x1dὥιᾥὭΙ\x15\x1dὦιᾦὮΙ\x15\x1dὧιᾧὯΙ\x15-ὰιᾺΙᾺͅ\x14#αιΑΙ" + + "ᾼ\x14$άιΆΙΆͅ\x14$ᾶΑ͂Α͂\x166ᾶιΑ͂Ιᾼ͂\x14\x1cαιᾳΑΙ\x12\x12ιΙΙ\x15-ὴιῊΙ" + + "Ὴͅ\x14#ηιΗΙῌ\x14$ήιΉΙΉͅ\x14$ῆΗ͂Η͂\x166ῆιΗ͂Ιῌ͂\x14\x1cηιῃΗΙ\x166ῒΙ" + + "̈̀Ϊ̀\x166ΐΪ́Ϊ́\x14$ῖΙ͂Ι͂\x166ῗΪ͂Ϊ͂\x166ῢΫ̀Ϋ̀\x166ΰΫ́Ϋ" + + "́\x14$ῤΡ̓Ρ̓\x14$ῦΥ͂Υ͂\x166ῧΫ͂Ϋ͂\x15-ὼιῺΙῺͅ\x14#ωιΩΙῼ\x14$ώιΏΙΏͅ" + + "\x14$ῶΩ͂Ω͂\x166ῶιΩ͂Ιῼ͂\x14\x1cωιῳΩΙ\x12\x10ωω\x11\x08kk\x12\x10åå\x12" + + "\x10ɫɫ\x12\x10ɽɽ\x10\x12ȺȺ\x10\x12ȾȾ\x12\x10ɑɑ\x12\x10ɱɱ\x12\x10ɐɐ\x12" + + "\x10ɒɒ\x12\x10ȿȿ\x12\x10ɀɀ\x12\x10ɥɥ\x12\x10ɦɦ\x12\x10ɜɜ\x12\x10ɡɡ\x12" + + "\x10ɬɬ\x12\x10ɪɪ\x12\x10ʞʞ\x12\x10ʇʇ\x12\x10ʝʝ\x12\x10ʂʂ\x12\x12ffFFFf" + + "\x12\x12fiFIFi\x12\x12flFLFl\x13\x1bffiFFIFfi\x13\x1bfflFFLFfl\x12\x12st" + + "STSt\x12\x12stSTSt\x14$մնՄՆՄն\x14$մեՄԵՄե\x14$միՄԻՄի\x14$վնՎՆՎն\x14$մխՄԽՄ" + + "խ" + +// lookup returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookup(s []byte) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupUnsafe(s []byte) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// lookupString returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookupString(s string) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupStringUnsafe(s string) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// caseTrie. Total size: 12396 bytes (12.11 KiB). Checksum: c0656238384c3da1. +type caseTrie struct{} + +func newCaseTrie(i int) *caseTrie { + return &caseTrie{} +} + +// lookupValue determines the type of block n and looks up the value for b. +func (t *caseTrie) lookupValue(n uint32, b byte) uint16 { + switch { + case n < 20: + return uint16(caseValues[n<<6+uint32(b)]) + default: + n -= 20 + return uint16(sparse.lookup(n, b)) + } +} + +// caseValues: 22 blocks, 1408 entries, 2816 bytes +// The third block is the zero block. +var caseValues = [1408]uint16{ + // Block 0x0, offset 0x0 + 0x27: 0x0054, + 0x2e: 0x0054, + 0x30: 0x0010, 0x31: 0x0010, 0x32: 0x0010, 0x33: 0x0010, 0x34: 0x0010, 0x35: 0x0010, + 0x36: 0x0010, 0x37: 0x0010, 0x38: 0x0010, 0x39: 0x0010, 0x3a: 0x0054, + // Block 0x1, offset 0x40 + 0x41: 0x2013, 0x42: 0x2013, 0x43: 0x2013, 0x44: 0x2013, 0x45: 0x2013, + 0x46: 0x2013, 0x47: 0x2013, 0x48: 0x2013, 0x49: 0x2013, 0x4a: 0x2013, 0x4b: 0x2013, + 0x4c: 0x2013, 0x4d: 0x2013, 0x4e: 0x2013, 0x4f: 0x2013, 0x50: 0x2013, 0x51: 0x2013, + 0x52: 0x2013, 0x53: 0x2013, 0x54: 0x2013, 0x55: 0x2013, 0x56: 0x2013, 0x57: 0x2013, + 0x58: 0x2013, 0x59: 0x2013, 0x5a: 0x2013, + 0x5e: 0x0004, 0x5f: 0x0010, 0x60: 0x0004, 0x61: 0x2012, 0x62: 0x2012, 0x63: 0x2012, + 0x64: 0x2012, 0x65: 0x2012, 0x66: 0x2012, 0x67: 0x2012, 0x68: 0x2012, 0x69: 0x2012, + 0x6a: 0x2012, 0x6b: 0x2012, 0x6c: 0x2012, 0x6d: 0x2012, 0x6e: 0x2012, 0x6f: 0x2012, + 0x70: 0x2012, 0x71: 0x2012, 0x72: 0x2012, 0x73: 0x2012, 0x74: 0x2012, 0x75: 0x2012, + 0x76: 0x2012, 0x77: 0x2012, 0x78: 0x2012, 0x79: 0x2012, 0x7a: 0x2012, + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc0: 0x0852, 0xc1: 0x0b53, 0xc2: 0x0113, 0xc3: 0x0112, 0xc4: 0x0113, 0xc5: 0x0112, + 0xc6: 0x0b53, 0xc7: 0x0f13, 0xc8: 0x0f12, 0xc9: 0x0e53, 0xca: 0x1153, 0xcb: 0x0713, + 0xcc: 0x0712, 0xcd: 0x0012, 0xce: 0x1453, 0xcf: 0x1753, 0xd0: 0x1a53, 0xd1: 0x0313, + 0xd2: 0x0312, 0xd3: 0x1d53, 0xd4: 0x2053, 0xd5: 0x2352, 0xd6: 0x2653, 0xd7: 0x2653, + 0xd8: 0x0113, 0xd9: 0x0112, 0xda: 0x2952, 0xdb: 0x0012, 0xdc: 0x1d53, 0xdd: 0x2c53, + 0xde: 0x2f52, 0xdf: 0x3253, 0xe0: 0x0113, 0xe1: 0x0112, 0xe2: 0x0113, 0xe3: 0x0112, + 0xe4: 0x0113, 0xe5: 0x0112, 0xe6: 0x3553, 0xe7: 0x0f13, 0xe8: 0x0f12, 0xe9: 0x3853, + 0xea: 0x0012, 0xeb: 0x0012, 0xec: 0x0113, 0xed: 0x0112, 0xee: 0x3553, 0xef: 0x1f13, + 0xf0: 0x1f12, 0xf1: 0x3b53, 0xf2: 0x3e53, 0xf3: 0x0713, 0xf4: 0x0712, 0xf5: 0x0313, + 0xf6: 0x0312, 0xf7: 0x4153, 0xf8: 0x0113, 0xf9: 0x0112, 0xfa: 0x0012, 0xfb: 0x0010, + 0xfc: 0x0113, 0xfd: 0x0112, 0xfe: 0x0012, 0xff: 0x4452, + // Block 0x4, offset 0x100 + 0x100: 0x0010, 0x101: 0x0010, 0x102: 0x0010, 0x103: 0x0010, 0x104: 0x02db, 0x105: 0x0359, + 0x106: 0x03da, 0x107: 0x043b, 0x108: 0x04b9, 0x109: 0x053a, 0x10a: 0x059b, 0x10b: 0x0619, + 0x10c: 0x069a, 0x10d: 0x0313, 0x10e: 0x0312, 0x10f: 0x1f13, 0x110: 0x1f12, 0x111: 0x0313, + 0x112: 0x0312, 0x113: 0x0713, 0x114: 0x0712, 0x115: 0x0313, 0x116: 0x0312, 0x117: 0x0f13, + 0x118: 0x0f12, 0x119: 0x0313, 0x11a: 0x0312, 0x11b: 0x0713, 0x11c: 0x0712, 0x11d: 0x1452, + 0x11e: 0x0113, 0x11f: 0x0112, 0x120: 0x0113, 0x121: 0x0112, 0x122: 0x0113, 0x123: 0x0112, + 0x124: 0x0113, 0x125: 0x0112, 0x126: 0x0113, 0x127: 0x0112, 0x128: 0x0113, 0x129: 0x0112, + 0x12a: 0x0113, 0x12b: 0x0112, 0x12c: 0x0113, 0x12d: 0x0112, 0x12e: 0x0113, 0x12f: 0x0112, + 0x130: 0x06fa, 0x131: 0x07ab, 0x132: 0x0829, 0x133: 0x08aa, 0x134: 0x0113, 0x135: 0x0112, + 0x136: 0x2353, 0x137: 0x4453, 0x138: 0x0113, 0x139: 0x0112, 0x13a: 0x0113, 0x13b: 0x0112, + 0x13c: 0x0113, 0x13d: 0x0112, 0x13e: 0x0113, 0x13f: 0x0112, + // Block 0x5, offset 0x140 + 0x140: 0x0a8a, 0x141: 0x0313, 0x142: 0x0312, 0x143: 0x0853, 0x144: 0x4753, 0x145: 0x4a53, + 0x146: 0x0113, 0x147: 0x0112, 0x148: 0x0113, 0x149: 0x0112, 0x14a: 0x0113, 0x14b: 0x0112, + 0x14c: 0x0113, 0x14d: 0x0112, 0x14e: 0x0113, 0x14f: 0x0112, 0x150: 0x0b0a, 0x151: 0x0b8a, + 0x152: 0x0c0a, 0x153: 0x0b52, 0x154: 0x0b52, 0x155: 0x0012, 0x156: 0x0e52, 0x157: 0x1152, + 0x158: 0x0012, 0x159: 0x1752, 0x15a: 0x0012, 0x15b: 0x1a52, 0x15c: 0x0c8a, 0x15d: 0x0012, + 0x15e: 0x0012, 0x15f: 0x0012, 0x160: 0x1d52, 0x161: 0x0d0a, 0x162: 0x0012, 0x163: 0x2052, + 0x164: 0x0012, 0x165: 0x0d8a, 0x166: 0x0e0a, 0x167: 0x0012, 0x168: 0x2652, 0x169: 0x2652, + 0x16a: 0x0e8a, 0x16b: 0x0f0a, 0x16c: 0x0f8a, 0x16d: 0x0012, 0x16e: 0x0012, 0x16f: 0x1d52, + 0x170: 0x0012, 0x171: 0x100a, 0x172: 0x2c52, 0x173: 0x0012, 0x174: 0x0012, 0x175: 0x3252, + 0x176: 0x0012, 0x177: 0x0012, 0x178: 0x0012, 0x179: 0x0012, 0x17a: 0x0012, 0x17b: 0x0012, + 0x17c: 0x0012, 0x17d: 0x108a, 0x17e: 0x0012, 0x17f: 0x0012, + // Block 0x6, offset 0x180 + 0x180: 0x3552, 0x181: 0x0012, 0x182: 0x110a, 0x183: 0x3852, 0x184: 0x0012, 0x185: 0x0012, + 0x186: 0x0012, 0x187: 0x118a, 0x188: 0x3552, 0x189: 0x4752, 0x18a: 0x3b52, 0x18b: 0x3e52, + 0x18c: 0x4a52, 0x18d: 0x0012, 0x18e: 0x0012, 0x18f: 0x0012, 0x190: 0x0012, 0x191: 0x0012, + 0x192: 0x4152, 0x193: 0x0012, 0x194: 0x0010, 0x195: 0x0012, 0x196: 0x0012, 0x197: 0x0012, + 0x198: 0x0012, 0x199: 0x0012, 0x19a: 0x0012, 0x19b: 0x0012, 0x19c: 0x0012, 0x19d: 0x120a, + 0x19e: 0x128a, 0x19f: 0x0012, 0x1a0: 0x0012, 0x1a1: 0x0012, 0x1a2: 0x0012, 0x1a3: 0x0012, + 0x1a4: 0x0012, 0x1a5: 0x0012, 0x1a6: 0x0012, 0x1a7: 0x0012, 0x1a8: 0x0012, 0x1a9: 0x0012, + 0x1aa: 0x0012, 0x1ab: 0x0012, 0x1ac: 0x0012, 0x1ad: 0x0012, 0x1ae: 0x0012, 0x1af: 0x0012, + 0x1b0: 0x0015, 0x1b1: 0x0015, 0x1b2: 0x0015, 0x1b3: 0x0015, 0x1b4: 0x0015, 0x1b5: 0x0015, + 0x1b6: 0x0015, 0x1b7: 0x0015, 0x1b8: 0x0015, 0x1b9: 0x0014, 0x1ba: 0x0014, 0x1bb: 0x0014, + 0x1bc: 0x0014, 0x1bd: 0x0014, 0x1be: 0x0014, 0x1bf: 0x0014, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x0024, 0x1c1: 0x0024, 0x1c2: 0x0024, 0x1c3: 0x0024, 0x1c4: 0x0024, 0x1c5: 0x130d, + 0x1c6: 0x0024, 0x1c7: 0x0034, 0x1c8: 0x0034, 0x1c9: 0x0034, 0x1ca: 0x0024, 0x1cb: 0x0024, + 0x1cc: 0x0024, 0x1cd: 0x0034, 0x1ce: 0x0034, 0x1cf: 0x0014, 0x1d0: 0x0024, 0x1d1: 0x0024, + 0x1d2: 0x0024, 0x1d3: 0x0034, 0x1d4: 0x0034, 0x1d5: 0x0034, 0x1d6: 0x0034, 0x1d7: 0x0024, + 0x1d8: 0x0034, 0x1d9: 0x0034, 0x1da: 0x0034, 0x1db: 0x0024, 0x1dc: 0x0034, 0x1dd: 0x0034, + 0x1de: 0x0034, 0x1df: 0x0034, 0x1e0: 0x0034, 0x1e1: 0x0034, 0x1e2: 0x0034, 0x1e3: 0x0024, + 0x1e4: 0x0024, 0x1e5: 0x0024, 0x1e6: 0x0024, 0x1e7: 0x0024, 0x1e8: 0x0024, 0x1e9: 0x0024, + 0x1ea: 0x0024, 0x1eb: 0x0024, 0x1ec: 0x0024, 0x1ed: 0x0024, 0x1ee: 0x0024, 0x1ef: 0x0024, + 0x1f0: 0x0113, 0x1f1: 0x0112, 0x1f2: 0x0113, 0x1f3: 0x0112, 0x1f4: 0x0014, 0x1f5: 0x0004, + 0x1f6: 0x0113, 0x1f7: 0x0112, 0x1fa: 0x0015, 0x1fb: 0x4d52, + 0x1fc: 0x5052, 0x1fd: 0x5052, 0x1ff: 0x5353, + // Block 0x8, offset 0x200 + 0x204: 0x0004, 0x205: 0x0004, + 0x206: 0x2a13, 0x207: 0x0054, 0x208: 0x2513, 0x209: 0x2713, 0x20a: 0x2513, + 0x20c: 0x5653, 0x20e: 0x5953, 0x20f: 0x5c53, 0x210: 0x138a, 0x211: 0x2013, + 0x212: 0x2013, 0x213: 0x2013, 0x214: 0x2013, 0x215: 0x2013, 0x216: 0x2013, 0x217: 0x2013, + 0x218: 0x2013, 0x219: 0x2013, 0x21a: 0x2013, 0x21b: 0x2013, 0x21c: 0x2013, 0x21d: 0x2013, + 0x21e: 0x2013, 0x21f: 0x2013, 0x220: 0x5f53, 0x221: 0x5f53, 0x223: 0x5f53, + 0x224: 0x5f53, 0x225: 0x5f53, 0x226: 0x5f53, 0x227: 0x5f53, 0x228: 0x5f53, 0x229: 0x5f53, + 0x22a: 0x5f53, 0x22b: 0x5f53, 0x22c: 0x2a12, 0x22d: 0x2512, 0x22e: 0x2712, 0x22f: 0x2512, + 0x230: 0x14ca, 0x231: 0x2012, 0x232: 0x2012, 0x233: 0x2012, 0x234: 0x2012, 0x235: 0x2012, + 0x236: 0x2012, 0x237: 0x2012, 0x238: 0x2012, 0x239: 0x2012, 0x23a: 0x2012, 0x23b: 0x2012, + 0x23c: 0x2012, 0x23d: 0x2012, 0x23e: 0x2012, 0x23f: 0x2012, + // Block 0x9, offset 0x240 + 0x240: 0x5f52, 0x241: 0x5f52, 0x242: 0x160a, 0x243: 0x5f52, 0x244: 0x5f52, 0x245: 0x5f52, + 0x246: 0x5f52, 0x247: 0x5f52, 0x248: 0x5f52, 0x249: 0x5f52, 0x24a: 0x5f52, 0x24b: 0x5f52, + 0x24c: 0x5652, 0x24d: 0x5952, 0x24e: 0x5c52, 0x24f: 0x1813, 0x250: 0x168a, 0x251: 0x170a, + 0x252: 0x0013, 0x253: 0x0013, 0x254: 0x0013, 0x255: 0x178a, 0x256: 0x180a, 0x257: 0x1812, + 0x258: 0x0113, 0x259: 0x0112, 0x25a: 0x0113, 0x25b: 0x0112, 0x25c: 0x0113, 0x25d: 0x0112, + 0x25e: 0x0113, 0x25f: 0x0112, 0x260: 0x0113, 0x261: 0x0112, 0x262: 0x0113, 0x263: 0x0112, + 0x264: 0x0113, 0x265: 0x0112, 0x266: 0x0113, 0x267: 0x0112, 0x268: 0x0113, 0x269: 0x0112, + 0x26a: 0x0113, 0x26b: 0x0112, 0x26c: 0x0113, 0x26d: 0x0112, 0x26e: 0x0113, 0x26f: 0x0112, + 0x270: 0x188a, 0x271: 0x190a, 0x272: 0x0b12, 0x273: 0x5352, 0x274: 0x6253, 0x275: 0x198a, + 0x277: 0x0f13, 0x278: 0x0f12, 0x279: 0x0b13, 0x27a: 0x0113, 0x27b: 0x0112, + 0x27c: 0x0012, 0x27d: 0x4d53, 0x27e: 0x5053, 0x27f: 0x5053, + // Block 0xa, offset 0x280 + 0x280: 0x6852, 0x281: 0x6852, 0x282: 0x6852, 0x283: 0x6852, 0x284: 0x6852, 0x285: 0x6852, + 0x286: 0x6852, 0x287: 0x1a0a, 0x288: 0x0012, + 0x291: 0x0034, + 0x292: 0x0024, 0x293: 0x0024, 0x294: 0x0024, 0x295: 0x0024, 0x296: 0x0034, 0x297: 0x0024, + 0x298: 0x0024, 0x299: 0x0024, 0x29a: 0x0034, 0x29b: 0x0034, 0x29c: 0x0024, 0x29d: 0x0024, + 0x29e: 0x0024, 0x29f: 0x0024, 0x2a0: 0x0024, 0x2a1: 0x0024, 0x2a2: 0x0034, 0x2a3: 0x0034, + 0x2a4: 0x0034, 0x2a5: 0x0034, 0x2a6: 0x0034, 0x2a7: 0x0034, 0x2a8: 0x0024, 0x2a9: 0x0024, + 0x2aa: 0x0034, 0x2ab: 0x0024, 0x2ac: 0x0024, 0x2ad: 0x0034, 0x2ae: 0x0034, 0x2af: 0x0024, + 0x2b0: 0x0034, 0x2b1: 0x0034, 0x2b2: 0x0034, 0x2b3: 0x0034, 0x2b4: 0x0034, 0x2b5: 0x0034, + 0x2b6: 0x0034, 0x2b7: 0x0034, 0x2b8: 0x0034, 0x2b9: 0x0034, 0x2ba: 0x0034, 0x2bb: 0x0034, + 0x2bc: 0x0034, 0x2bd: 0x0034, 0x2bf: 0x0034, + // Block 0xb, offset 0x2c0 + 0x2c0: 0x7053, 0x2c1: 0x7053, 0x2c2: 0x7053, 0x2c3: 0x7053, 0x2c4: 0x7053, 0x2c5: 0x7053, + 0x2c7: 0x7053, + 0x2cd: 0x7053, 0x2d0: 0x1aea, 0x2d1: 0x1b6a, + 0x2d2: 0x1bea, 0x2d3: 0x1c6a, 0x2d4: 0x1cea, 0x2d5: 0x1d6a, 0x2d6: 0x1dea, 0x2d7: 0x1e6a, + 0x2d8: 0x1eea, 0x2d9: 0x1f6a, 0x2da: 0x1fea, 0x2db: 0x206a, 0x2dc: 0x20ea, 0x2dd: 0x216a, + 0x2de: 0x21ea, 0x2df: 0x226a, 0x2e0: 0x22ea, 0x2e1: 0x236a, 0x2e2: 0x23ea, 0x2e3: 0x246a, + 0x2e4: 0x24ea, 0x2e5: 0x256a, 0x2e6: 0x25ea, 0x2e7: 0x266a, 0x2e8: 0x26ea, 0x2e9: 0x276a, + 0x2ea: 0x27ea, 0x2eb: 0x286a, 0x2ec: 0x28ea, 0x2ed: 0x296a, 0x2ee: 0x29ea, 0x2ef: 0x2a6a, + 0x2f0: 0x2aea, 0x2f1: 0x2b6a, 0x2f2: 0x2bea, 0x2f3: 0x2c6a, 0x2f4: 0x2cea, 0x2f5: 0x2d6a, + 0x2f6: 0x2dea, 0x2f7: 0x2e6a, 0x2f8: 0x2eea, 0x2f9: 0x2f6a, 0x2fa: 0x2fea, + 0x2fc: 0x0014, 0x2fd: 0x306a, 0x2fe: 0x30ea, 0x2ff: 0x316a, + // Block 0xc, offset 0x300 + 0x300: 0x0812, 0x301: 0x0812, 0x302: 0x0812, 0x303: 0x0812, 0x304: 0x0812, 0x305: 0x0812, + 0x308: 0x0813, 0x309: 0x0813, 0x30a: 0x0813, 0x30b: 0x0813, + 0x30c: 0x0813, 0x30d: 0x0813, 0x310: 0x3b1a, 0x311: 0x0812, + 0x312: 0x3bfa, 0x313: 0x0812, 0x314: 0x3d3a, 0x315: 0x0812, 0x316: 0x3e7a, 0x317: 0x0812, + 0x319: 0x0813, 0x31b: 0x0813, 0x31d: 0x0813, + 0x31f: 0x0813, 0x320: 0x0812, 0x321: 0x0812, 0x322: 0x0812, 0x323: 0x0812, + 0x324: 0x0812, 0x325: 0x0812, 0x326: 0x0812, 0x327: 0x0812, 0x328: 0x0813, 0x329: 0x0813, + 0x32a: 0x0813, 0x32b: 0x0813, 0x32c: 0x0813, 0x32d: 0x0813, 0x32e: 0x0813, 0x32f: 0x0813, + 0x330: 0x9252, 0x331: 0x9252, 0x332: 0x9552, 0x333: 0x9552, 0x334: 0x9852, 0x335: 0x9852, + 0x336: 0x9b52, 0x337: 0x9b52, 0x338: 0x9e52, 0x339: 0x9e52, 0x33a: 0xa152, 0x33b: 0xa152, + 0x33c: 0x4d52, 0x33d: 0x4d52, + // Block 0xd, offset 0x340 + 0x340: 0x3fba, 0x341: 0x40aa, 0x342: 0x419a, 0x343: 0x428a, 0x344: 0x437a, 0x345: 0x446a, + 0x346: 0x455a, 0x347: 0x464a, 0x348: 0x4739, 0x349: 0x4829, 0x34a: 0x4919, 0x34b: 0x4a09, + 0x34c: 0x4af9, 0x34d: 0x4be9, 0x34e: 0x4cd9, 0x34f: 0x4dc9, 0x350: 0x4eba, 0x351: 0x4faa, + 0x352: 0x509a, 0x353: 0x518a, 0x354: 0x527a, 0x355: 0x536a, 0x356: 0x545a, 0x357: 0x554a, + 0x358: 0x5639, 0x359: 0x5729, 0x35a: 0x5819, 0x35b: 0x5909, 0x35c: 0x59f9, 0x35d: 0x5ae9, + 0x35e: 0x5bd9, 0x35f: 0x5cc9, 0x360: 0x5dba, 0x361: 0x5eaa, 0x362: 0x5f9a, 0x363: 0x608a, + 0x364: 0x617a, 0x365: 0x626a, 0x366: 0x635a, 0x367: 0x644a, 0x368: 0x6539, 0x369: 0x6629, + 0x36a: 0x6719, 0x36b: 0x6809, 0x36c: 0x68f9, 0x36d: 0x69e9, 0x36e: 0x6ad9, 0x36f: 0x6bc9, + 0x370: 0x0812, 0x371: 0x0812, 0x372: 0x6cba, 0x373: 0x6dca, 0x374: 0x6e9a, + 0x376: 0x6f7a, 0x377: 0x705a, 0x378: 0x0813, 0x379: 0x0813, 0x37a: 0x9253, 0x37b: 0x9253, + 0x37c: 0x7199, 0x37d: 0x0004, 0x37e: 0x726a, 0x37f: 0x0004, + // Block 0xe, offset 0x380 + 0x380: 0x0004, 0x381: 0x0004, 0x382: 0x72ea, 0x383: 0x73fa, 0x384: 0x74ca, + 0x386: 0x75aa, 0x387: 0x768a, 0x388: 0x9553, 0x389: 0x9553, 0x38a: 0x9853, 0x38b: 0x9853, + 0x38c: 0x77c9, 0x38d: 0x0004, 0x38e: 0x0004, 0x38f: 0x0004, 0x390: 0x0812, 0x391: 0x0812, + 0x392: 0x789a, 0x393: 0x79da, 0x396: 0x7b1a, 0x397: 0x7bfa, + 0x398: 0x0813, 0x399: 0x0813, 0x39a: 0x9b53, 0x39b: 0x9b53, 0x39d: 0x0004, + 0x39e: 0x0004, 0x39f: 0x0004, 0x3a0: 0x0812, 0x3a1: 0x0812, 0x3a2: 0x7d3a, 0x3a3: 0x7e7a, + 0x3a4: 0x7fba, 0x3a5: 0x0912, 0x3a6: 0x809a, 0x3a7: 0x817a, 0x3a8: 0x0813, 0x3a9: 0x0813, + 0x3aa: 0xa153, 0x3ab: 0xa153, 0x3ac: 0x0913, 0x3ad: 0x0004, 0x3ae: 0x0004, 0x3af: 0x0004, + 0x3b2: 0x82ba, 0x3b3: 0x83ca, 0x3b4: 0x849a, + 0x3b6: 0x857a, 0x3b7: 0x865a, 0x3b8: 0x9e53, 0x3b9: 0x9e53, 0x3ba: 0x4d53, 0x3bb: 0x4d53, + 0x3bc: 0x8799, 0x3bd: 0x0004, 0x3be: 0x0004, + // Block 0xf, offset 0x3c0 + 0x3c2: 0x0013, + 0x3c7: 0x0013, 0x3ca: 0x0012, 0x3cb: 0x0013, + 0x3cc: 0x0013, 0x3cd: 0x0013, 0x3ce: 0x0012, 0x3cf: 0x0012, 0x3d0: 0x0013, 0x3d1: 0x0013, + 0x3d2: 0x0013, 0x3d3: 0x0012, 0x3d5: 0x0013, + 0x3d9: 0x0013, 0x3da: 0x0013, 0x3db: 0x0013, 0x3dc: 0x0013, 0x3dd: 0x0013, + 0x3e4: 0x0013, 0x3e6: 0x886b, 0x3e8: 0x0013, + 0x3ea: 0x88cb, 0x3eb: 0x890b, 0x3ec: 0x0013, 0x3ed: 0x0013, 0x3ef: 0x0012, + 0x3f0: 0x0013, 0x3f1: 0x0013, 0x3f2: 0xa453, 0x3f3: 0x0013, 0x3f4: 0x0012, 0x3f5: 0x0010, + 0x3f6: 0x0010, 0x3f7: 0x0010, 0x3f8: 0x0010, 0x3f9: 0x0012, + 0x3fc: 0x0012, 0x3fd: 0x0012, 0x3fe: 0x0013, 0x3ff: 0x0013, + // Block 0x10, offset 0x400 + 0x400: 0x1a13, 0x401: 0x1a13, 0x402: 0x1e13, 0x403: 0x1e13, 0x404: 0x1a13, 0x405: 0x1a13, + 0x406: 0x2613, 0x407: 0x2613, 0x408: 0x2a13, 0x409: 0x2a13, 0x40a: 0x2e13, 0x40b: 0x2e13, + 0x40c: 0x2a13, 0x40d: 0x2a13, 0x40e: 0x2613, 0x40f: 0x2613, 0x410: 0xa752, 0x411: 0xa752, + 0x412: 0xaa52, 0x413: 0xaa52, 0x414: 0xad52, 0x415: 0xad52, 0x416: 0xaa52, 0x417: 0xaa52, + 0x418: 0xa752, 0x419: 0xa752, 0x41a: 0x1a12, 0x41b: 0x1a12, 0x41c: 0x1e12, 0x41d: 0x1e12, + 0x41e: 0x1a12, 0x41f: 0x1a12, 0x420: 0x2612, 0x421: 0x2612, 0x422: 0x2a12, 0x423: 0x2a12, + 0x424: 0x2e12, 0x425: 0x2e12, 0x426: 0x2a12, 0x427: 0x2a12, 0x428: 0x2612, 0x429: 0x2612, + // Block 0x11, offset 0x440 + 0x440: 0x6552, 0x441: 0x6552, 0x442: 0x6552, 0x443: 0x6552, 0x444: 0x6552, 0x445: 0x6552, + 0x446: 0x6552, 0x447: 0x6552, 0x448: 0x6552, 0x449: 0x6552, 0x44a: 0x6552, 0x44b: 0x6552, + 0x44c: 0x6552, 0x44d: 0x6552, 0x44e: 0x6552, 0x44f: 0x6552, 0x450: 0xb052, 0x451: 0xb052, + 0x452: 0xb052, 0x453: 0xb052, 0x454: 0xb052, 0x455: 0xb052, 0x456: 0xb052, 0x457: 0xb052, + 0x458: 0xb052, 0x459: 0xb052, 0x45a: 0xb052, 0x45b: 0xb052, 0x45c: 0xb052, 0x45d: 0xb052, + 0x45e: 0xb052, 0x460: 0x0113, 0x461: 0x0112, 0x462: 0x896b, 0x463: 0x8b53, + 0x464: 0x89cb, 0x465: 0x8a2a, 0x466: 0x8a8a, 0x467: 0x0f13, 0x468: 0x0f12, 0x469: 0x0313, + 0x46a: 0x0312, 0x46b: 0x0713, 0x46c: 0x0712, 0x46d: 0x8aeb, 0x46e: 0x8b4b, 0x46f: 0x8bab, + 0x470: 0x8c0b, 0x471: 0x0012, 0x472: 0x0113, 0x473: 0x0112, 0x474: 0x0012, 0x475: 0x0313, + 0x476: 0x0312, 0x477: 0x0012, 0x478: 0x0012, 0x479: 0x0012, 0x47a: 0x0012, 0x47b: 0x0012, + 0x47c: 0x0015, 0x47d: 0x0015, 0x47e: 0x8c6b, 0x47f: 0x8ccb, + // Block 0x12, offset 0x480 + 0x480: 0x0113, 0x481: 0x0112, 0x482: 0x0113, 0x483: 0x0112, 0x484: 0x0113, 0x485: 0x0112, + 0x486: 0x0113, 0x487: 0x0112, 0x488: 0x0014, 0x489: 0x0014, 0x48a: 0x0014, 0x48b: 0x0713, + 0x48c: 0x0712, 0x48d: 0x8d2b, 0x48e: 0x0012, 0x48f: 0x0010, 0x490: 0x0113, 0x491: 0x0112, + 0x492: 0x0113, 0x493: 0x0112, 0x494: 0x6552, 0x495: 0x0012, 0x496: 0x0113, 0x497: 0x0112, + 0x498: 0x0113, 0x499: 0x0112, 0x49a: 0x0113, 0x49b: 0x0112, 0x49c: 0x0113, 0x49d: 0x0112, + 0x49e: 0x0113, 0x49f: 0x0112, 0x4a0: 0x0113, 0x4a1: 0x0112, 0x4a2: 0x0113, 0x4a3: 0x0112, + 0x4a4: 0x0113, 0x4a5: 0x0112, 0x4a6: 0x0113, 0x4a7: 0x0112, 0x4a8: 0x0113, 0x4a9: 0x0112, + 0x4aa: 0x8d8b, 0x4ab: 0x8deb, 0x4ac: 0x8e4b, 0x4ad: 0x8eab, 0x4ae: 0x8f0b, 0x4af: 0x0012, + 0x4b0: 0x8f6b, 0x4b1: 0x8fcb, 0x4b2: 0x902b, 0x4b3: 0xb353, 0x4b4: 0x0113, 0x4b5: 0x0112, + 0x4b6: 0x0113, 0x4b7: 0x0112, 0x4b8: 0x0113, 0x4b9: 0x0112, 0x4ba: 0x0113, 0x4bb: 0x0112, + 0x4bc: 0x0113, 0x4bd: 0x0112, 0x4be: 0x0113, 0x4bf: 0x0112, + // Block 0x13, offset 0x4c0 + 0x4c0: 0x90ea, 0x4c1: 0x916a, 0x4c2: 0x91ea, 0x4c3: 0x926a, 0x4c4: 0x931a, 0x4c5: 0x93ca, + 0x4c6: 0x944a, + 0x4d3: 0x94ca, 0x4d4: 0x95aa, 0x4d5: 0x968a, 0x4d6: 0x976a, 0x4d7: 0x984a, + 0x4dd: 0x0010, + 0x4de: 0x0034, 0x4df: 0x0010, 0x4e0: 0x0010, 0x4e1: 0x0010, 0x4e2: 0x0010, 0x4e3: 0x0010, + 0x4e4: 0x0010, 0x4e5: 0x0010, 0x4e6: 0x0010, 0x4e7: 0x0010, 0x4e8: 0x0010, + 0x4ea: 0x0010, 0x4eb: 0x0010, 0x4ec: 0x0010, 0x4ed: 0x0010, 0x4ee: 0x0010, 0x4ef: 0x0010, + 0x4f0: 0x0010, 0x4f1: 0x0010, 0x4f2: 0x0010, 0x4f3: 0x0010, 0x4f4: 0x0010, 0x4f5: 0x0010, + 0x4f6: 0x0010, 0x4f8: 0x0010, 0x4f9: 0x0010, 0x4fa: 0x0010, 0x4fb: 0x0010, + 0x4fc: 0x0010, 0x4fe: 0x0010, + // Block 0x14, offset 0x500 + 0x500: 0x2213, 0x501: 0x2213, 0x502: 0x2613, 0x503: 0x2613, 0x504: 0x2213, 0x505: 0x2213, + 0x506: 0x2e13, 0x507: 0x2e13, 0x508: 0x2213, 0x509: 0x2213, 0x50a: 0x2613, 0x50b: 0x2613, + 0x50c: 0x2213, 0x50d: 0x2213, 0x50e: 0x3e13, 0x50f: 0x3e13, 0x510: 0x2213, 0x511: 0x2213, + 0x512: 0x2613, 0x513: 0x2613, 0x514: 0x2213, 0x515: 0x2213, 0x516: 0x2e13, 0x517: 0x2e13, + 0x518: 0x2213, 0x519: 0x2213, 0x51a: 0x2613, 0x51b: 0x2613, 0x51c: 0x2213, 0x51d: 0x2213, + 0x51e: 0xbc53, 0x51f: 0xbc53, 0x520: 0xbf53, 0x521: 0xbf53, 0x522: 0x2212, 0x523: 0x2212, + 0x524: 0x2612, 0x525: 0x2612, 0x526: 0x2212, 0x527: 0x2212, 0x528: 0x2e12, 0x529: 0x2e12, + 0x52a: 0x2212, 0x52b: 0x2212, 0x52c: 0x2612, 0x52d: 0x2612, 0x52e: 0x2212, 0x52f: 0x2212, + 0x530: 0x3e12, 0x531: 0x3e12, 0x532: 0x2212, 0x533: 0x2212, 0x534: 0x2612, 0x535: 0x2612, + 0x536: 0x2212, 0x537: 0x2212, 0x538: 0x2e12, 0x539: 0x2e12, 0x53a: 0x2212, 0x53b: 0x2212, + 0x53c: 0x2612, 0x53d: 0x2612, 0x53e: 0x2212, 0x53f: 0x2212, + // Block 0x15, offset 0x540 + 0x542: 0x0010, + 0x547: 0x0010, 0x549: 0x0010, 0x54b: 0x0010, + 0x54d: 0x0010, 0x54e: 0x0010, 0x54f: 0x0010, 0x551: 0x0010, + 0x552: 0x0010, 0x554: 0x0010, 0x557: 0x0010, + 0x559: 0x0010, 0x55b: 0x0010, 0x55d: 0x0010, + 0x55f: 0x0010, 0x561: 0x0010, 0x562: 0x0010, + 0x564: 0x0010, 0x567: 0x0010, 0x568: 0x0010, 0x569: 0x0010, + 0x56a: 0x0010, 0x56c: 0x0010, 0x56d: 0x0010, 0x56e: 0x0010, 0x56f: 0x0010, + 0x570: 0x0010, 0x571: 0x0010, 0x572: 0x0010, 0x574: 0x0010, 0x575: 0x0010, + 0x576: 0x0010, 0x577: 0x0010, 0x579: 0x0010, 0x57a: 0x0010, 0x57b: 0x0010, + 0x57c: 0x0010, 0x57e: 0x0010, +} + +// caseIndex: 25 blocks, 1600 entries, 3200 bytes +// Block 0 is the zero block. +var caseIndex = [1600]uint16{ + // Block 0x0, offset 0x0 + // Block 0x1, offset 0x40 + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc2: 0x14, 0xc3: 0x15, 0xc4: 0x16, 0xc5: 0x17, 0xc6: 0x01, 0xc7: 0x02, + 0xc8: 0x18, 0xc9: 0x03, 0xca: 0x04, 0xcb: 0x19, 0xcc: 0x1a, 0xcd: 0x05, 0xce: 0x06, 0xcf: 0x07, + 0xd0: 0x1b, 0xd1: 0x1c, 0xd2: 0x1d, 0xd3: 0x1e, 0xd4: 0x1f, 0xd5: 0x20, 0xd6: 0x08, 0xd7: 0x21, + 0xd8: 0x22, 0xd9: 0x23, 0xda: 0x24, 0xdb: 0x25, 0xdc: 0x26, 0xdd: 0x27, 0xde: 0x28, 0xdf: 0x29, + 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, + 0xea: 0x06, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x08, 0xef: 0x09, + 0xf0: 0x14, 0xf3: 0x16, + // Block 0x4, offset 0x100 + 0x120: 0x2a, 0x121: 0x2b, 0x122: 0x2c, 0x123: 0x2d, 0x124: 0x2e, 0x125: 0x2f, 0x126: 0x30, 0x127: 0x31, + 0x128: 0x32, 0x129: 0x33, 0x12a: 0x34, 0x12b: 0x35, 0x12c: 0x36, 0x12d: 0x37, 0x12e: 0x38, 0x12f: 0x39, + 0x130: 0x3a, 0x131: 0x3b, 0x132: 0x3c, 0x133: 0x3d, 0x134: 0x3e, 0x135: 0x3f, 0x136: 0x40, 0x137: 0x41, + 0x138: 0x42, 0x139: 0x43, 0x13a: 0x44, 0x13b: 0x45, 0x13c: 0x46, 0x13d: 0x47, 0x13e: 0x48, 0x13f: 0x49, + // Block 0x5, offset 0x140 + 0x140: 0x4a, 0x141: 0x4b, 0x142: 0x4c, 0x143: 0x09, 0x144: 0x24, 0x145: 0x24, 0x146: 0x24, 0x147: 0x24, + 0x148: 0x24, 0x149: 0x4d, 0x14a: 0x4e, 0x14b: 0x4f, 0x14c: 0x50, 0x14d: 0x51, 0x14e: 0x52, 0x14f: 0x53, + 0x150: 0x54, 0x151: 0x24, 0x152: 0x24, 0x153: 0x24, 0x154: 0x24, 0x155: 0x24, 0x156: 0x24, 0x157: 0x24, + 0x158: 0x24, 0x159: 0x55, 0x15a: 0x56, 0x15b: 0x57, 0x15c: 0x58, 0x15d: 0x59, 0x15e: 0x5a, 0x15f: 0x5b, + 0x160: 0x5c, 0x161: 0x5d, 0x162: 0x5e, 0x163: 0x5f, 0x164: 0x60, 0x165: 0x61, 0x167: 0x62, + 0x168: 0x63, 0x169: 0x64, 0x16a: 0x65, 0x16c: 0x66, 0x16d: 0x67, 0x16e: 0x68, 0x16f: 0x69, + 0x170: 0x6a, 0x171: 0x6b, 0x172: 0x6c, 0x173: 0x6d, 0x174: 0x6e, 0x175: 0x6f, 0x176: 0x70, 0x177: 0x71, + 0x178: 0x72, 0x179: 0x72, 0x17a: 0x73, 0x17b: 0x72, 0x17c: 0x74, 0x17d: 0x0a, 0x17e: 0x0b, 0x17f: 0x0c, + // Block 0x6, offset 0x180 + 0x180: 0x75, 0x181: 0x76, 0x182: 0x77, 0x183: 0x78, 0x184: 0x0d, 0x185: 0x79, 0x186: 0x7a, + 0x192: 0x7b, 0x193: 0x0e, + 0x1b0: 0x7c, 0x1b1: 0x0f, 0x1b2: 0x72, 0x1b3: 0x7d, 0x1b4: 0x7e, 0x1b5: 0x7f, 0x1b6: 0x80, 0x1b7: 0x81, + 0x1b8: 0x82, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x83, 0x1c2: 0x84, 0x1c3: 0x85, 0x1c4: 0x86, 0x1c5: 0x24, 0x1c6: 0x87, + // Block 0x8, offset 0x200 + 0x200: 0x88, 0x201: 0x24, 0x202: 0x24, 0x203: 0x24, 0x204: 0x24, 0x205: 0x24, 0x206: 0x24, 0x207: 0x24, + 0x208: 0x24, 0x209: 0x24, 0x20a: 0x24, 0x20b: 0x24, 0x20c: 0x24, 0x20d: 0x24, 0x20e: 0x24, 0x20f: 0x24, + 0x210: 0x24, 0x211: 0x24, 0x212: 0x89, 0x213: 0x8a, 0x214: 0x24, 0x215: 0x24, 0x216: 0x24, 0x217: 0x24, + 0x218: 0x8b, 0x219: 0x8c, 0x21a: 0x8d, 0x21b: 0x8e, 0x21c: 0x8f, 0x21d: 0x90, 0x21e: 0x10, 0x21f: 0x91, + 0x220: 0x92, 0x221: 0x93, 0x222: 0x24, 0x223: 0x94, 0x224: 0x95, 0x225: 0x96, 0x226: 0x97, 0x227: 0x98, + 0x228: 0x99, 0x229: 0x9a, 0x22a: 0x9b, 0x22b: 0x9c, 0x22c: 0x9d, 0x22d: 0x9e, 0x22e: 0x9f, 0x22f: 0xa0, + 0x230: 0x24, 0x231: 0x24, 0x232: 0x24, 0x233: 0x24, 0x234: 0x24, 0x235: 0x24, 0x236: 0x24, 0x237: 0x24, + 0x238: 0x24, 0x239: 0x24, 0x23a: 0x24, 0x23b: 0x24, 0x23c: 0x24, 0x23d: 0x24, 0x23e: 0x24, 0x23f: 0x24, + // Block 0x9, offset 0x240 + 0x240: 0x24, 0x241: 0x24, 0x242: 0x24, 0x243: 0x24, 0x244: 0x24, 0x245: 0x24, 0x246: 0x24, 0x247: 0x24, + 0x248: 0x24, 0x249: 0x24, 0x24a: 0x24, 0x24b: 0x24, 0x24c: 0x24, 0x24d: 0x24, 0x24e: 0x24, 0x24f: 0x24, + 0x250: 0x24, 0x251: 0x24, 0x252: 0x24, 0x253: 0x24, 0x254: 0x24, 0x255: 0x24, 0x256: 0x24, 0x257: 0x24, + 0x258: 0x24, 0x259: 0x24, 0x25a: 0x24, 0x25b: 0x24, 0x25c: 0x24, 0x25d: 0x24, 0x25e: 0x24, 0x25f: 0x24, + 0x260: 0x24, 0x261: 0x24, 0x262: 0x24, 0x263: 0x24, 0x264: 0x24, 0x265: 0x24, 0x266: 0x24, 0x267: 0x24, + 0x268: 0x24, 0x269: 0x24, 0x26a: 0x24, 0x26b: 0x24, 0x26c: 0x24, 0x26d: 0x24, 0x26e: 0x24, 0x26f: 0x24, + 0x270: 0x24, 0x271: 0x24, 0x272: 0x24, 0x273: 0x24, 0x274: 0x24, 0x275: 0x24, 0x276: 0x24, 0x277: 0x24, + 0x278: 0x24, 0x279: 0x24, 0x27a: 0x24, 0x27b: 0x24, 0x27c: 0x24, 0x27d: 0x24, 0x27e: 0x24, 0x27f: 0x24, + // Block 0xa, offset 0x280 + 0x280: 0x24, 0x281: 0x24, 0x282: 0x24, 0x283: 0x24, 0x284: 0x24, 0x285: 0x24, 0x286: 0x24, 0x287: 0x24, + 0x288: 0x24, 0x289: 0x24, 0x28a: 0x24, 0x28b: 0x24, 0x28c: 0x24, 0x28d: 0x24, 0x28e: 0x24, 0x28f: 0x24, + 0x290: 0x24, 0x291: 0x24, 0x292: 0x24, 0x293: 0x24, 0x294: 0x24, 0x295: 0x24, 0x296: 0x24, 0x297: 0x24, + 0x298: 0x24, 0x299: 0x24, 0x29a: 0x24, 0x29b: 0x24, 0x29c: 0x24, 0x29d: 0x24, 0x29e: 0xa1, 0x29f: 0xa2, + // Block 0xb, offset 0x2c0 + 0x2ec: 0x11, 0x2ed: 0xa3, 0x2ee: 0xa4, 0x2ef: 0xa5, + 0x2f0: 0x24, 0x2f1: 0x24, 0x2f2: 0x24, 0x2f3: 0x24, 0x2f4: 0xa6, 0x2f5: 0xa7, 0x2f6: 0xa8, 0x2f7: 0xa9, + 0x2f8: 0xaa, 0x2f9: 0xab, 0x2fa: 0x24, 0x2fb: 0xac, 0x2fc: 0xad, 0x2fd: 0xae, 0x2fe: 0xaf, 0x2ff: 0xb0, + // Block 0xc, offset 0x300 + 0x300: 0xb1, 0x301: 0xb2, 0x302: 0x24, 0x303: 0xb3, 0x305: 0xb4, 0x307: 0xb5, + 0x30a: 0xb6, 0x30b: 0xb7, 0x30c: 0xb8, 0x30d: 0xb9, 0x30e: 0xba, 0x30f: 0xbb, + 0x310: 0xbc, 0x311: 0xbd, 0x312: 0xbe, 0x313: 0xbf, 0x314: 0xc0, 0x315: 0xc1, + 0x318: 0x24, 0x319: 0x24, 0x31a: 0x24, 0x31b: 0x24, 0x31c: 0xc2, 0x31d: 0xc3, + 0x320: 0xc4, 0x321: 0xc5, 0x322: 0xc6, 0x323: 0xc7, 0x324: 0xc8, 0x326: 0xc9, + 0x328: 0xca, 0x329: 0xcb, 0x32a: 0xcc, 0x32b: 0xcd, 0x32c: 0x5f, 0x32d: 0xce, 0x32e: 0xcf, + 0x330: 0x24, 0x331: 0xd0, 0x332: 0xd1, 0x333: 0xd2, 0x334: 0xd3, + 0x33c: 0xd4, 0x33d: 0xd5, 0x33f: 0xd6, + // Block 0xd, offset 0x340 + 0x340: 0xd7, 0x341: 0xd8, 0x342: 0xd9, 0x343: 0xda, 0x344: 0xdb, 0x345: 0xdc, 0x346: 0xdd, 0x347: 0xde, + 0x348: 0xdf, 0x34a: 0xe0, 0x34b: 0xe1, 0x34c: 0xe2, 0x34d: 0xe3, + 0x350: 0xe4, 0x351: 0xe5, 0x352: 0xe6, 0x353: 0xe7, 0x356: 0xe8, 0x357: 0xe9, + 0x358: 0xea, 0x359: 0xeb, 0x35a: 0xec, 0x35b: 0xed, 0x35c: 0xee, + 0x360: 0xef, 0x362: 0xf0, 0x363: 0xf1, 0x366: 0xf2, 0x367: 0xf3, + 0x368: 0xf4, 0x369: 0xf5, 0x36a: 0xf6, 0x36b: 0xf7, + 0x370: 0xf8, 0x371: 0xf9, 0x372: 0xfa, 0x374: 0xfb, 0x375: 0xfc, 0x376: 0xfd, + 0x37b: 0xfe, + // Block 0xe, offset 0x380 + 0x380: 0x24, 0x381: 0x24, 0x382: 0x24, 0x383: 0x24, 0x384: 0x24, 0x385: 0x24, 0x386: 0x24, 0x387: 0x24, + 0x388: 0x24, 0x389: 0x24, 0x38a: 0x24, 0x38b: 0x24, 0x38c: 0x24, 0x38d: 0x24, 0x38e: 0xff, + 0x390: 0x24, 0x391: 0x100, 0x392: 0x24, 0x393: 0x24, 0x394: 0x24, 0x395: 0x101, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x24, 0x3c1: 0x24, 0x3c2: 0x24, 0x3c3: 0x24, 0x3c4: 0x24, 0x3c5: 0x24, 0x3c6: 0x24, 0x3c7: 0x24, + 0x3c8: 0x24, 0x3c9: 0x24, 0x3ca: 0x24, 0x3cb: 0x24, 0x3cc: 0x24, 0x3cd: 0x24, 0x3ce: 0x24, 0x3cf: 0x24, + 0x3d0: 0x102, + // Block 0x10, offset 0x400 + 0x410: 0x24, 0x411: 0x24, 0x412: 0x24, 0x413: 0x24, 0x414: 0x24, 0x415: 0x24, 0x416: 0x24, 0x417: 0x24, + 0x418: 0x24, 0x419: 0x103, + // Block 0x11, offset 0x440 + 0x460: 0x24, 0x461: 0x24, 0x462: 0x24, 0x463: 0x24, 0x464: 0x24, 0x465: 0x24, 0x466: 0x24, 0x467: 0x24, + 0x468: 0xf7, 0x469: 0x104, 0x46b: 0x105, 0x46c: 0x106, 0x46d: 0x107, 0x46e: 0x108, + 0x479: 0x109, 0x47c: 0x24, 0x47d: 0x10a, 0x47e: 0x10b, 0x47f: 0x10c, + // Block 0x12, offset 0x480 + 0x4b0: 0x24, 0x4b1: 0x10d, 0x4b2: 0x10e, + // Block 0x13, offset 0x4c0 + 0x4c5: 0x10f, 0x4c6: 0x110, + 0x4c9: 0x111, + 0x4d0: 0x112, 0x4d1: 0x113, 0x4d2: 0x114, 0x4d3: 0x115, 0x4d4: 0x116, 0x4d5: 0x117, 0x4d6: 0x118, 0x4d7: 0x119, + 0x4d8: 0x11a, 0x4d9: 0x11b, 0x4da: 0x11c, 0x4db: 0x11d, 0x4dc: 0x11e, 0x4dd: 0x11f, 0x4de: 0x120, 0x4df: 0x121, + 0x4e8: 0x122, 0x4e9: 0x123, 0x4ea: 0x124, + // Block 0x14, offset 0x500 + 0x500: 0x125, 0x504: 0x126, 0x505: 0x127, + 0x50b: 0x128, + 0x520: 0x24, 0x521: 0x24, 0x522: 0x24, 0x523: 0x129, 0x524: 0x12, 0x525: 0x12a, + 0x538: 0x12b, 0x539: 0x13, 0x53a: 0x12c, + // Block 0x15, offset 0x540 + 0x544: 0x12d, 0x545: 0x12e, 0x546: 0x12f, + 0x54f: 0x130, + // Block 0x16, offset 0x580 + 0x590: 0x0a, 0x591: 0x0b, 0x592: 0x0c, 0x593: 0x0d, 0x594: 0x0e, 0x596: 0x0f, + 0x59b: 0x10, 0x59d: 0x11, 0x59e: 0x12, 0x59f: 0x13, + // Block 0x17, offset 0x5c0 + 0x5c0: 0x131, 0x5c1: 0x132, 0x5c4: 0x132, 0x5c5: 0x132, 0x5c6: 0x132, 0x5c7: 0x133, + // Block 0x18, offset 0x600 + 0x620: 0x15, +} + +// sparseOffsets: 289 entries, 578 bytes +var sparseOffsets = []uint16{0x0, 0x9, 0xf, 0x18, 0x24, 0x2e, 0x35, 0x38, 0x3c, 0x3f, 0x43, 0x4d, 0x4f, 0x57, 0x5e, 0x63, 0x71, 0x72, 0x80, 0x8f, 0x99, 0x9c, 0xa3, 0xab, 0xae, 0xb0, 0xbf, 0xc5, 0xd3, 0xde, 0xeb, 0xf6, 0x102, 0x10c, 0x118, 0x123, 0x12f, 0x13b, 0x143, 0x14c, 0x156, 0x161, 0x16d, 0x174, 0x17f, 0x184, 0x18c, 0x18f, 0x194, 0x198, 0x19c, 0x1a3, 0x1ac, 0x1b4, 0x1b5, 0x1be, 0x1c5, 0x1cd, 0x1d3, 0x1d8, 0x1dc, 0x1df, 0x1e1, 0x1e4, 0x1e9, 0x1ea, 0x1ec, 0x1ee, 0x1f0, 0x1f7, 0x1fc, 0x200, 0x209, 0x20c, 0x20f, 0x215, 0x216, 0x221, 0x222, 0x223, 0x228, 0x235, 0x23d, 0x245, 0x24e, 0x257, 0x260, 0x265, 0x268, 0x273, 0x281, 0x283, 0x28a, 0x28e, 0x29a, 0x29b, 0x2a6, 0x2ae, 0x2b6, 0x2bc, 0x2bd, 0x2cb, 0x2d0, 0x2d3, 0x2d8, 0x2dc, 0x2e2, 0x2e7, 0x2ea, 0x2ef, 0x2f4, 0x2f5, 0x2fb, 0x2fd, 0x2fe, 0x300, 0x302, 0x305, 0x306, 0x308, 0x30b, 0x311, 0x315, 0x317, 0x31c, 0x323, 0x32b, 0x334, 0x335, 0x33e, 0x342, 0x347, 0x34f, 0x355, 0x35b, 0x365, 0x36a, 0x373, 0x379, 0x380, 0x384, 0x38c, 0x38e, 0x390, 0x393, 0x395, 0x397, 0x398, 0x399, 0x39b, 0x39d, 0x3a3, 0x3a8, 0x3aa, 0x3b1, 0x3b4, 0x3b6, 0x3bc, 0x3c1, 0x3c3, 0x3c4, 0x3c5, 0x3c6, 0x3c8, 0x3ca, 0x3cc, 0x3cf, 0x3d1, 0x3d4, 0x3dc, 0x3df, 0x3e3, 0x3eb, 0x3ed, 0x3ee, 0x3ef, 0x3f1, 0x3f7, 0x3f9, 0x3fa, 0x3fc, 0x3fe, 0x400, 0x40d, 0x40e, 0x40f, 0x413, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41c, 0x41f, 0x425, 0x426, 0x42a, 0x42e, 0x434, 0x437, 0x43e, 0x442, 0x446, 0x44d, 0x456, 0x45c, 0x462, 0x46c, 0x476, 0x478, 0x481, 0x487, 0x48d, 0x493, 0x496, 0x49c, 0x49f, 0x4a8, 0x4a9, 0x4b0, 0x4b4, 0x4b5, 0x4b8, 0x4ba, 0x4c1, 0x4c9, 0x4cf, 0x4d5, 0x4d6, 0x4dc, 0x4df, 0x4e7, 0x4ee, 0x4f8, 0x500, 0x503, 0x504, 0x505, 0x506, 0x508, 0x509, 0x50b, 0x50d, 0x50f, 0x513, 0x514, 0x516, 0x519, 0x51b, 0x51d, 0x51f, 0x524, 0x529, 0x52d, 0x52e, 0x531, 0x535, 0x540, 0x544, 0x54c, 0x551, 0x555, 0x558, 0x55c, 0x55f, 0x562, 0x567, 0x56b, 0x56f, 0x573, 0x577, 0x579, 0x57b, 0x57e, 0x583, 0x586, 0x588, 0x58b, 0x58d, 0x593, 0x59c, 0x5a1, 0x5a2, 0x5a5, 0x5a6, 0x5a7, 0x5a9, 0x5aa, 0x5ab} + +// sparseValues: 1451 entries, 5804 bytes +var sparseValues = [1451]valueRange{ + // Block 0x0, offset 0x0 + {value: 0x0004, lo: 0xa8, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xaa}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0004, lo: 0xaf, hi: 0xaf}, + {value: 0x0004, lo: 0xb4, hi: 0xb4}, + {value: 0x001a, lo: 0xb5, hi: 0xb5}, + {value: 0x0054, lo: 0xb7, hi: 0xb7}, + {value: 0x0004, lo: 0xb8, hi: 0xb8}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + // Block 0x1, offset 0x9 + {value: 0x2013, lo: 0x80, hi: 0x96}, + {value: 0x2013, lo: 0x98, hi: 0x9e}, + {value: 0x009a, lo: 0x9f, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xb6}, + {value: 0x2012, lo: 0xb8, hi: 0xbe}, + {value: 0x0252, lo: 0xbf, hi: 0xbf}, + // Block 0x2, offset 0xf + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x011b, lo: 0xb0, hi: 0xb0}, + {value: 0x019a, lo: 0xb1, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb7}, + {value: 0x0012, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x0553, lo: 0xbf, hi: 0xbf}, + // Block 0x3, offset 0x18 + {value: 0x0552, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x01da, lo: 0x89, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xb7}, + {value: 0x0253, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x028a, lo: 0xbf, hi: 0xbf}, + // Block 0x4, offset 0x24 + {value: 0x0117, lo: 0x80, hi: 0x9f}, + {value: 0x2f53, lo: 0xa0, hi: 0xa0}, + {value: 0x0012, lo: 0xa1, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xb3}, + {value: 0x0012, lo: 0xb4, hi: 0xb9}, + {value: 0x090b, lo: 0xba, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x2953, lo: 0xbd, hi: 0xbd}, + {value: 0x098b, lo: 0xbe, hi: 0xbe}, + {value: 0x0a0a, lo: 0xbf, hi: 0xbf}, + // Block 0x5, offset 0x2e + {value: 0x0015, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x97}, + {value: 0x0004, lo: 0x98, hi: 0x9d}, + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0015, lo: 0xa0, hi: 0xa4}, + {value: 0x0004, lo: 0xa5, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xbf}, + // Block 0x6, offset 0x35 + {value: 0x0024, lo: 0x80, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbf}, + // Block 0x7, offset 0x38 + {value: 0x6553, lo: 0x80, hi: 0x8f}, + {value: 0x2013, lo: 0x90, hi: 0x9f}, + {value: 0x5f53, lo: 0xa0, hi: 0xaf}, + {value: 0x2012, lo: 0xb0, hi: 0xbf}, + // Block 0x8, offset 0x3c + {value: 0x5f52, lo: 0x80, hi: 0x8f}, + {value: 0x6552, lo: 0x90, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x9, offset 0x3f + {value: 0x0117, lo: 0x80, hi: 0x81}, + {value: 0x0024, lo: 0x83, hi: 0x87}, + {value: 0x0014, lo: 0x88, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xbf}, + // Block 0xa, offset 0x43 + {value: 0x0f13, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x0316, lo: 0x89, hi: 0x8a}, + {value: 0x0716, lo: 0x8b, hi: 0x8c}, + {value: 0x0316, lo: 0x8d, hi: 0x8e}, + {value: 0x0f12, lo: 0x8f, hi: 0x8f}, + {value: 0x0117, lo: 0x90, hi: 0xbf}, + // Block 0xb, offset 0x4d + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x6553, lo: 0xb1, hi: 0xbf}, + // Block 0xc, offset 0x4f + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6853, lo: 0x90, hi: 0x96}, + {value: 0x0014, lo: 0x99, hi: 0x99}, + {value: 0x0010, lo: 0x9b, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0012, lo: 0xa0, hi: 0xa0}, + {value: 0x6552, lo: 0xa1, hi: 0xaf}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0xd, offset 0x57 + {value: 0x0034, lo: 0x81, hi: 0x82}, + {value: 0x0024, lo: 0x84, hi: 0x84}, + {value: 0x0034, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0xaa}, + {value: 0x0010, lo: 0xaf, hi: 0xb3}, + {value: 0x0054, lo: 0xb4, hi: 0xb4}, + // Block 0xe, offset 0x5e + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0024, lo: 0x90, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0014, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xf, offset 0x63 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9c}, + {value: 0x0024, lo: 0x9d, hi: 0x9e}, + {value: 0x0034, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0034, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x10, offset 0x71 + {value: 0x0010, lo: 0x80, hi: 0xbf}, + // Block 0x11, offset 0x72 + {value: 0x0010, lo: 0x80, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0024, lo: 0x9f, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xaa, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x12, offset 0x80 + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0034, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0034, lo: 0xb1, hi: 0xb1}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbd}, + {value: 0x0034, lo: 0xbe, hi: 0xbe}, + {value: 0x0024, lo: 0xbf, hi: 0xbf}, + // Block 0x13, offset 0x8f + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0024, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x88}, + {value: 0x0024, lo: 0x89, hi: 0x8a}, + {value: 0x0010, lo: 0x8d, hi: 0xbf}, + // Block 0x14, offset 0x99 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x15, offset 0x9c + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xb1}, + {value: 0x0034, lo: 0xb2, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0x16, offset 0xa3 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x99}, + {value: 0x0014, lo: 0x9a, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0xa3}, + {value: 0x0014, lo: 0xa4, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xad}, + // Block 0x17, offset 0xab + {value: 0x0010, lo: 0x80, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0xa0, hi: 0xaa}, + // Block 0x18, offset 0xae + {value: 0x0010, lo: 0xa0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbd}, + // Block 0x19, offset 0xb0 + {value: 0x0034, lo: 0x93, hi: 0x93}, + {value: 0x0024, lo: 0x94, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0024, lo: 0xaa, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbf}, + // Block 0x1a, offset 0xbf + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1b, offset 0xc5 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0x1c, offset 0xd3 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb6, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1d, offset 0xde + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xb1}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + // Block 0x1e, offset 0xeb + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x1f, offset 0xf6 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x99, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x20, offset 0x102 + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x21, offset 0x10c + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x85}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xbf}, + // Block 0x22, offset 0x118 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x23, offset 0x123 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x24, offset 0x12f + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0010, lo: 0xa8, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x25, offset 0x13b + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x26, offset 0x143 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb9}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbf}, + // Block 0x27, offset 0x14c + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x88}, + {value: 0x0014, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x28, offset 0x156 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x29, offset 0x161 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb2}, + // Block 0x2a, offset 0x16d + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x2b, offset 0x174 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x94, hi: 0x97}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xba, hi: 0xbf}, + // Block 0x2c, offset 0x17f + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x96}, + {value: 0x0010, lo: 0x9a, hi: 0xb1}, + {value: 0x0010, lo: 0xb3, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x2d, offset 0x184 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x94}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9f}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + // Block 0x2e, offset 0x18c + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xba}, + // Block 0x2f, offset 0x18f + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x30, offset 0x194 + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xba}, + {value: 0x0014, lo: 0xbb, hi: 0xbc}, + // Block 0x31, offset 0x198 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x32, offset 0x19c + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0034, lo: 0x98, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0034, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x33, offset 0x1a3 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xac}, + {value: 0x0034, lo: 0xb1, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xba, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x34, offset 0x1ac + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0024, lo: 0x82, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x86, hi: 0x87}, + {value: 0x0010, lo: 0x88, hi: 0x8c}, + {value: 0x0014, lo: 0x8d, hi: 0x97}, + {value: 0x0014, lo: 0x99, hi: 0xbc}, + // Block 0x35, offset 0x1b4 + {value: 0x0034, lo: 0x86, hi: 0x86}, + // Block 0x36, offset 0x1b5 + {value: 0x0010, lo: 0xab, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbe}, + // Block 0x37, offset 0x1be + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x96, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x99}, + {value: 0x0014, lo: 0x9e, hi: 0xa0}, + {value: 0x0010, lo: 0xa2, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xad}, + {value: 0x0014, lo: 0xb1, hi: 0xb4}, + // Block 0x38, offset 0x1c5 + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x6c53, lo: 0xa0, hi: 0xbf}, + // Block 0x39, offset 0x1cd + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x9a, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x3a, offset 0x1d3 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x3b, offset 0x1d8 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x82, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3c, offset 0x1dc + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3d, offset 0x1df + {value: 0x0010, lo: 0x80, hi: 0x9a}, + {value: 0x0024, lo: 0x9d, hi: 0x9f}, + // Block 0x3e, offset 0x1e1 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x7453, lo: 0xa0, hi: 0xaf}, + {value: 0x7853, lo: 0xb0, hi: 0xbf}, + // Block 0x3f, offset 0x1e4 + {value: 0x7c53, lo: 0x80, hi: 0x8f}, + {value: 0x8053, lo: 0x90, hi: 0x9f}, + {value: 0x7c53, lo: 0xa0, hi: 0xaf}, + {value: 0x0813, lo: 0xb0, hi: 0xb5}, + {value: 0x0892, lo: 0xb8, hi: 0xbd}, + // Block 0x40, offset 0x1e9 + {value: 0x0010, lo: 0x81, hi: 0xbf}, + // Block 0x41, offset 0x1ea + {value: 0x0010, lo: 0x80, hi: 0xac}, + {value: 0x0010, lo: 0xaf, hi: 0xbf}, + // Block 0x42, offset 0x1ec + {value: 0x0010, lo: 0x81, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x43, offset 0x1ee + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb8}, + // Block 0x44, offset 0x1f0 + {value: 0x0010, lo: 0x80, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0034, lo: 0x94, hi: 0x94}, + {value: 0x0010, lo: 0xa0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + // Block 0x45, offset 0x1f7 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xac}, + {value: 0x0010, lo: 0xae, hi: 0xb0}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + // Block 0x46, offset 0x1fc + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x47, offset 0x200 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x89, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0014, lo: 0x93, hi: 0x93}, + {value: 0x0004, lo: 0x97, hi: 0x97}, + {value: 0x0024, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0x48, offset 0x209 + {value: 0x0014, lo: 0x8b, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x49, offset 0x20c + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb8}, + // Block 0x4a, offset 0x20f + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x4b, offset 0x215 + {value: 0x0010, lo: 0x80, hi: 0xb5}, + // Block 0x4c, offset 0x216 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbb}, + // Block 0x4d, offset 0x221 + {value: 0x0010, lo: 0x86, hi: 0x8f}, + // Block 0x4e, offset 0x222 + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x4f, offset 0x223 + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + // Block 0x50, offset 0x228 + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x9e}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xac}, + {value: 0x0010, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xbc}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x51, offset 0x235 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xa7, hi: 0xa7}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + {value: 0x0034, lo: 0xb5, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbc}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + // Block 0x52, offset 0x23d + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x53, offset 0x245 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0030, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8b}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xab, hi: 0xab}, + {value: 0x0034, lo: 0xac, hi: 0xac}, + {value: 0x0024, lo: 0xad, hi: 0xb3}, + // Block 0x54, offset 0x24e + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0030, lo: 0xaa, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbf}, + // Block 0x55, offset 0x257 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0030, lo: 0xb2, hi: 0xb3}, + // Block 0x56, offset 0x260 + {value: 0x0010, lo: 0x80, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + // Block 0x57, offset 0x265 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8d, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x58, offset 0x268 + {value: 0x31ea, lo: 0x80, hi: 0x80}, + {value: 0x326a, lo: 0x81, hi: 0x81}, + {value: 0x32ea, lo: 0x82, hi: 0x82}, + {value: 0x336a, lo: 0x83, hi: 0x83}, + {value: 0x33ea, lo: 0x84, hi: 0x84}, + {value: 0x346a, lo: 0x85, hi: 0x85}, + {value: 0x34ea, lo: 0x86, hi: 0x86}, + {value: 0x356a, lo: 0x87, hi: 0x87}, + {value: 0x35ea, lo: 0x88, hi: 0x88}, + {value: 0x8353, lo: 0x90, hi: 0xba}, + {value: 0x8353, lo: 0xbd, hi: 0xbf}, + // Block 0x59, offset 0x273 + {value: 0x0024, lo: 0x90, hi: 0x92}, + {value: 0x0034, lo: 0x94, hi: 0x99}, + {value: 0x0024, lo: 0x9a, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9f}, + {value: 0x0024, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0034, lo: 0xa2, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xb3}, + {value: 0x0024, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb7}, + {value: 0x0024, lo: 0xb8, hi: 0xb9}, + {value: 0x0010, lo: 0xba, hi: 0xba}, + // Block 0x5a, offset 0x281 + {value: 0x0012, lo: 0x80, hi: 0xab}, + {value: 0x0015, lo: 0xac, hi: 0xbf}, + // Block 0x5b, offset 0x283 + {value: 0x0015, lo: 0x80, hi: 0xaa}, + {value: 0x0012, lo: 0xab, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb8}, + {value: 0x8752, lo: 0xb9, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbc}, + {value: 0x8b52, lo: 0xbd, hi: 0xbd}, + {value: 0x0012, lo: 0xbe, hi: 0xbf}, + // Block 0x5c, offset 0x28a + {value: 0x0012, lo: 0x80, hi: 0x8d}, + {value: 0x8f52, lo: 0x8e, hi: 0x8e}, + {value: 0x0012, lo: 0x8f, hi: 0x9a}, + {value: 0x0015, lo: 0x9b, hi: 0xbf}, + // Block 0x5d, offset 0x28e + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0024, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb9}, + {value: 0x0024, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbd}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x5e, offset 0x29a + {value: 0x0117, lo: 0x80, hi: 0xbf}, + // Block 0x5f, offset 0x29b + {value: 0x0117, lo: 0x80, hi: 0x95}, + {value: 0x369a, lo: 0x96, hi: 0x96}, + {value: 0x374a, lo: 0x97, hi: 0x97}, + {value: 0x37fa, lo: 0x98, hi: 0x98}, + {value: 0x38aa, lo: 0x99, hi: 0x99}, + {value: 0x395a, lo: 0x9a, hi: 0x9a}, + {value: 0x3a0a, lo: 0x9b, hi: 0x9b}, + {value: 0x0012, lo: 0x9c, hi: 0x9d}, + {value: 0x3abb, lo: 0x9e, hi: 0x9e}, + {value: 0x0012, lo: 0x9f, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x60, offset 0x2a6 + {value: 0x0812, lo: 0x80, hi: 0x87}, + {value: 0x0813, lo: 0x88, hi: 0x8f}, + {value: 0x0812, lo: 0x90, hi: 0x95}, + {value: 0x0813, lo: 0x98, hi: 0x9d}, + {value: 0x0812, lo: 0xa0, hi: 0xa7}, + {value: 0x0813, lo: 0xa8, hi: 0xaf}, + {value: 0x0812, lo: 0xb0, hi: 0xb7}, + {value: 0x0813, lo: 0xb8, hi: 0xbf}, + // Block 0x61, offset 0x2ae + {value: 0x0004, lo: 0x8b, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8f}, + {value: 0x0054, lo: 0x98, hi: 0x99}, + {value: 0x0054, lo: 0xa4, hi: 0xa4}, + {value: 0x0054, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xaa, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xaf}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x62, offset 0x2b6 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x94, hi: 0x94}, + {value: 0x0014, lo: 0xa0, hi: 0xa4}, + {value: 0x0014, lo: 0xa6, hi: 0xaf}, + {value: 0x0015, lo: 0xb1, hi: 0xb1}, + {value: 0x0015, lo: 0xbf, hi: 0xbf}, + // Block 0x63, offset 0x2bc + {value: 0x0015, lo: 0x90, hi: 0x9c}, + // Block 0x64, offset 0x2bd + {value: 0x0024, lo: 0x90, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x93}, + {value: 0x0024, lo: 0x94, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0xa0}, + {value: 0x0024, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa4}, + {value: 0x0034, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa7}, + {value: 0x0034, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xa9}, + {value: 0x0034, lo: 0xaa, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + // Block 0x65, offset 0x2cb + {value: 0x0016, lo: 0x85, hi: 0x86}, + {value: 0x0012, lo: 0x87, hi: 0x89}, + {value: 0xa452, lo: 0x8e, hi: 0x8e}, + {value: 0x1013, lo: 0xa0, hi: 0xaf}, + {value: 0x1012, lo: 0xb0, hi: 0xbf}, + // Block 0x66, offset 0x2d0 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x88}, + // Block 0x67, offset 0x2d3 + {value: 0xa753, lo: 0xb6, hi: 0xb7}, + {value: 0xaa53, lo: 0xb8, hi: 0xb9}, + {value: 0xad53, lo: 0xba, hi: 0xbb}, + {value: 0xaa53, lo: 0xbc, hi: 0xbd}, + {value: 0xa753, lo: 0xbe, hi: 0xbf}, + // Block 0x68, offset 0x2d8 + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6553, lo: 0x90, hi: 0x9f}, + {value: 0xb053, lo: 0xa0, hi: 0xae}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0x69, offset 0x2dc + {value: 0x0117, lo: 0x80, hi: 0xa3}, + {value: 0x0012, lo: 0xa4, hi: 0xa4}, + {value: 0x0716, lo: 0xab, hi: 0xac}, + {value: 0x0316, lo: 0xad, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb3}, + // Block 0x6a, offset 0x2e2 + {value: 0x6c52, lo: 0x80, hi: 0x9f}, + {value: 0x7052, lo: 0xa0, hi: 0xa5}, + {value: 0x7052, lo: 0xa7, hi: 0xa7}, + {value: 0x7052, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x6b, offset 0x2e7 + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x6c, offset 0x2ea + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0010, lo: 0xb0, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x6d, offset 0x2ef + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9e}, + {value: 0x0024, lo: 0xa0, hi: 0xbf}, + // Block 0x6e, offset 0x2f4 + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + // Block 0x6f, offset 0x2f5 + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0xaa, hi: 0xad}, + {value: 0x0030, lo: 0xae, hi: 0xaf}, + {value: 0x0004, lo: 0xb1, hi: 0xb5}, + {value: 0x0014, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + // Block 0x70, offset 0x2fb + {value: 0x0034, lo: 0x99, hi: 0x9a}, + {value: 0x0004, lo: 0x9b, hi: 0x9e}, + // Block 0x71, offset 0x2fd + {value: 0x0004, lo: 0xbc, hi: 0xbe}, + // Block 0x72, offset 0x2fe + {value: 0x0010, lo: 0x85, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x73, offset 0x300 + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0010, lo: 0xa0, hi: 0xba}, + // Block 0x74, offset 0x302 + {value: 0x0010, lo: 0x80, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0xbf}, + // Block 0x75, offset 0x305 + {value: 0x0010, lo: 0x80, hi: 0x8c}, + // Block 0x76, offset 0x306 + {value: 0x0010, lo: 0x90, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x77, offset 0x308 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0xab}, + // Block 0x78, offset 0x30b + {value: 0x0117, lo: 0x80, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb2}, + {value: 0x0024, lo: 0xb4, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x79, offset 0x311 + {value: 0x0117, lo: 0x80, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9d}, + {value: 0x0024, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x7a, offset 0x315 + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb1}, + // Block 0x7b, offset 0x317 + {value: 0x0004, lo: 0x80, hi: 0x96}, + {value: 0x0014, lo: 0x97, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xaf}, + {value: 0x0012, lo: 0xb0, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xbf}, + // Block 0x7c, offset 0x31c + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x0015, lo: 0xb0, hi: 0xb0}, + {value: 0x0012, lo: 0xb1, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x8753, lo: 0xbd, hi: 0xbd}, + {value: 0x0117, lo: 0xbe, hi: 0xbf}, + // Block 0x7d, offset 0x323 + {value: 0x0117, lo: 0x82, hi: 0x83}, + {value: 0x6553, lo: 0x84, hi: 0x84}, + {value: 0x908b, lo: 0x85, hi: 0x85}, + {value: 0x8f53, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0xb7, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbf}, + // Block 0x7e, offset 0x32b + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8b}, + {value: 0x0010, lo: 0x8c, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + // Block 0x7f, offset 0x334 + {value: 0x0010, lo: 0x80, hi: 0xb3}, + // Block 0x80, offset 0x335 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xa0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb7}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x81, offset 0x33e + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x82, offset 0x342 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0x92}, + {value: 0x0030, lo: 0x93, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0x83, offset 0x347 + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb9}, + {value: 0x0010, lo: 0xba, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x84, offset 0x34f + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0004, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x85, offset 0x355 + {value: 0x0010, lo: 0x80, hi: 0xa8}, + {value: 0x0014, lo: 0xa9, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0x86, offset 0x35b + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x87, offset 0x365 + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0024, lo: 0xbe, hi: 0xbf}, + // Block 0x88, offset 0x36a + {value: 0x0024, lo: 0x81, hi: 0x81}, + {value: 0x0004, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + // Block 0x89, offset 0x373 + {value: 0x0010, lo: 0x81, hi: 0x86}, + {value: 0x0010, lo: 0x89, hi: 0x8e}, + {value: 0x0010, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x8a, offset 0x379 + {value: 0x0012, lo: 0x80, hi: 0x92}, + {value: 0xb352, lo: 0x93, hi: 0x93}, + {value: 0x0012, lo: 0x94, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9f}, + {value: 0x0012, lo: 0xa0, hi: 0xa7}, + {value: 0x74d2, lo: 0xb0, hi: 0xbf}, + // Block 0x8b, offset 0x380 + {value: 0x78d2, lo: 0x80, hi: 0x8f}, + {value: 0x7cd2, lo: 0x90, hi: 0x9f}, + {value: 0x80d2, lo: 0xa0, hi: 0xaf}, + {value: 0x7cd2, lo: 0xb0, hi: 0xbf}, + // Block 0x8c, offset 0x384 + {value: 0x0010, lo: 0x80, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x8d, offset 0x38c + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x8e, offset 0x38e + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x8b, hi: 0xbb}, + // Block 0x8f, offset 0x390 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0xbf}, + // Block 0x90, offset 0x393 + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0004, lo: 0xb2, hi: 0xbf}, + // Block 0x91, offset 0x395 + {value: 0x0004, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x93, hi: 0xbf}, + // Block 0x92, offset 0x397 + {value: 0x0010, lo: 0x80, hi: 0xbd}, + // Block 0x93, offset 0x398 + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0x94, offset 0x399 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0xbf}, + // Block 0x95, offset 0x39b + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0xb0, hi: 0xbb}, + // Block 0x96, offset 0x39d + {value: 0x0014, lo: 0x80, hi: 0x8f}, + {value: 0x0054, lo: 0x93, hi: 0x93}, + {value: 0x0024, lo: 0xa0, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xad}, + {value: 0x0024, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + // Block 0x97, offset 0x3a3 + {value: 0x0010, lo: 0x8d, hi: 0x8f}, + {value: 0x0054, lo: 0x92, hi: 0x92}, + {value: 0x0054, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0xb0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0x98, offset 0x3a8 + {value: 0x0010, lo: 0x80, hi: 0xbc}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x99, offset 0x3aa + {value: 0x0054, lo: 0x87, hi: 0x87}, + {value: 0x0054, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0054, lo: 0x9a, hi: 0x9a}, + {value: 0x5f53, lo: 0xa1, hi: 0xba}, + {value: 0x0004, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9a, offset 0x3b1 + {value: 0x0004, lo: 0x80, hi: 0x80}, + {value: 0x5f52, lo: 0x81, hi: 0x9a}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + // Block 0x9b, offset 0x3b4 + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbe}, + // Block 0x9c, offset 0x3b6 + {value: 0x0010, lo: 0x82, hi: 0x87}, + {value: 0x0010, lo: 0x8a, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0x97}, + {value: 0x0010, lo: 0x9a, hi: 0x9c}, + {value: 0x0004, lo: 0xa3, hi: 0xa3}, + {value: 0x0014, lo: 0xb9, hi: 0xbb}, + // Block 0x9d, offset 0x3bc + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0010, lo: 0x8d, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xba}, + {value: 0x0010, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9e, offset 0x3c1 + {value: 0x0010, lo: 0x80, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x9d}, + // Block 0x9f, offset 0x3c3 + {value: 0x0010, lo: 0x80, hi: 0xba}, + // Block 0xa0, offset 0x3c4 + {value: 0x0010, lo: 0x80, hi: 0xb4}, + // Block 0xa1, offset 0x3c5 + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0xa2, offset 0x3c6 + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa3, offset 0x3c8 + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + // Block 0xa4, offset 0x3ca + {value: 0x0010, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xad, hi: 0xbf}, + // Block 0xa5, offset 0x3cc + {value: 0x0010, lo: 0x80, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0xb5}, + {value: 0x0024, lo: 0xb6, hi: 0xba}, + // Block 0xa6, offset 0x3cf + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa7, offset 0x3d1 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x91, hi: 0x95}, + // Block 0xa8, offset 0x3d4 + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x97}, + {value: 0xb653, lo: 0x98, hi: 0x9f}, + {value: 0xb953, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbf}, + // Block 0xa9, offset 0x3dc + {value: 0xb652, lo: 0x80, hi: 0x87}, + {value: 0xb952, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0xaa, offset 0x3df + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0xb953, lo: 0xb0, hi: 0xb7}, + {value: 0xb653, lo: 0xb8, hi: 0xbf}, + // Block 0xab, offset 0x3e3 + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x93}, + {value: 0xb952, lo: 0x98, hi: 0x9f}, + {value: 0xb652, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbb}, + // Block 0xac, offset 0x3eb + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xad, offset 0x3ed + {value: 0x0010, lo: 0x80, hi: 0xa3}, + // Block 0xae, offset 0x3ee + {value: 0x0010, lo: 0x80, hi: 0xb6}, + // Block 0xaf, offset 0x3ef + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xa7}, + // Block 0xb0, offset 0x3f1 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xb5}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xb1, offset 0x3f7 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb6}, + // Block 0xb2, offset 0x3f9 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + // Block 0xb3, offset 0x3fa + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + // Block 0xb4, offset 0x3fc + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb9}, + // Block 0xb5, offset 0x3fe + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0xb6, offset 0x400 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x8e, hi: 0x8e}, + {value: 0x0024, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x99, hi: 0xb5}, + {value: 0x0024, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xb7, offset 0x40d + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0xb8, offset 0x40e + {value: 0x0010, lo: 0x80, hi: 0x9c}, + // Block 0xb9, offset 0x40f + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + // Block 0xba, offset 0x413 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + // Block 0xbb, offset 0x415 + {value: 0x0010, lo: 0x80, hi: 0x91}, + // Block 0xbc, offset 0x416 + {value: 0x0010, lo: 0x80, hi: 0x88}, + // Block 0xbd, offset 0x417 + {value: 0x5653, lo: 0x80, hi: 0xb2}, + // Block 0xbe, offset 0x418 + {value: 0x5652, lo: 0x80, hi: 0xb2}, + // Block 0xbf, offset 0x419 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xc0, offset 0x41c + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xc1, offset 0x41f + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x87}, + {value: 0x0024, lo: 0x88, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x8b}, + {value: 0x0024, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + // Block 0xc2, offset 0x425 + {value: 0x0010, lo: 0xa0, hi: 0xb6}, + // Block 0xc3, offset 0x426 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xc4, offset 0x42a + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xc5, offset 0x42e + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb6}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + // Block 0xc6, offset 0x434 + {value: 0x0014, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xc7, offset 0x437 + {value: 0x0024, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0xc8, offset 0x43e + {value: 0x0010, lo: 0x84, hi: 0x86}, + {value: 0x0010, lo: 0x90, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + // Block 0xc9, offset 0x442 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xca, offset 0x446 + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x89, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + // Block 0xcb, offset 0x44d + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb4}, + {value: 0x0030, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xb7}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + // Block 0xcc, offset 0x456 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xcd, offset 0x45c + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa2}, + {value: 0x0014, lo: 0xa3, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xce, offset 0x462 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xcf, offset 0x46c + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0030, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9d, hi: 0xa3}, + {value: 0x0024, lo: 0xa6, hi: 0xac}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + // Block 0xd0, offset 0x476 + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xd1, offset 0x478 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0x9f, hi: 0x9f}, + // Block 0xd2, offset 0x481 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xd3, offset 0x487 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd4, offset 0x48d + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xd5, offset 0x493 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x98, hi: 0x9b}, + {value: 0x0014, lo: 0x9c, hi: 0x9d}, + // Block 0xd6, offset 0x496 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xd7, offset 0x49c + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd8, offset 0x49f + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0014, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb5}, + {value: 0x0030, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + // Block 0xd9, offset 0x4a8 + {value: 0x0010, lo: 0x80, hi: 0x89}, + // Block 0xda, offset 0x4a9 + {value: 0x0014, lo: 0x9d, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xdb, offset 0x4b0 + {value: 0x0010, lo: 0x80, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + // Block 0xdc, offset 0x4b4 + {value: 0x5f53, lo: 0xa0, hi: 0xbf}, + // Block 0xdd, offset 0x4b5 + {value: 0x5f52, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xde, offset 0x4b8 + {value: 0x0010, lo: 0xa0, hi: 0xa7}, + {value: 0x0010, lo: 0xaa, hi: 0xbf}, + // Block 0xdf, offset 0x4ba + {value: 0x0010, lo: 0x80, hi: 0x93}, + {value: 0x0014, lo: 0x94, hi: 0x97}, + {value: 0x0014, lo: 0x9a, hi: 0x9b}, + {value: 0x0010, lo: 0x9c, hi: 0x9f}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + // Block 0xe0, offset 0x4c1 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x8a}, + {value: 0x0010, lo: 0x8b, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbb, hi: 0xbe}, + // Block 0xe1, offset 0x4c9 + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0014, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x98}, + {value: 0x0014, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0x9c, hi: 0xbf}, + // Block 0xe2, offset 0x4cf + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0014, lo: 0x8a, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x99}, + {value: 0x0010, lo: 0x9d, hi: 0x9d}, + // Block 0xe3, offset 0x4d5 + {value: 0x0010, lo: 0x80, hi: 0xb8}, + // Block 0xe4, offset 0x4d6 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb6}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xe5, offset 0x4dc + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0xe6, offset 0x4df + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0014, lo: 0x92, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xa9}, + {value: 0x0014, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0xe7, offset 0x4e7 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb6}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xe8, offset 0x4ee + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa5}, + {value: 0x0010, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xbf}, + // Block 0xe9, offset 0x4f8 + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0014, lo: 0x90, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0x96}, + {value: 0x0034, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0xea, offset 0x500 + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + // Block 0xeb, offset 0x503 + {value: 0x0010, lo: 0x80, hi: 0x99}, + // Block 0xec, offset 0x504 + {value: 0x0010, lo: 0x80, hi: 0xae}, + // Block 0xed, offset 0x505 + {value: 0x0010, lo: 0x80, hi: 0x83}, + // Block 0xee, offset 0x506 + {value: 0x0010, lo: 0x80, hi: 0xae}, + {value: 0x0014, lo: 0xb0, hi: 0xb8}, + // Block 0xef, offset 0x508 + {value: 0x0010, lo: 0x80, hi: 0x86}, + // Block 0xf0, offset 0x509 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0xf1, offset 0x50b + {value: 0x0010, lo: 0x90, hi: 0xad}, + {value: 0x0034, lo: 0xb0, hi: 0xb4}, + // Block 0xf2, offset 0x50d + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb6}, + // Block 0xf3, offset 0x50f + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa3, hi: 0xb7}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xf4, offset 0x513 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + // Block 0xf5, offset 0x514 + {value: 0x2013, lo: 0x80, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xbf}, + // Block 0xf6, offset 0x516 + {value: 0x0010, lo: 0x80, hi: 0x8a}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0xf7, offset 0x519 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0014, lo: 0x8f, hi: 0x9f}, + // Block 0xf8, offset 0x51b + {value: 0x0014, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa3, hi: 0xa3}, + // Block 0xf9, offset 0x51d + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbc}, + // Block 0xfa, offset 0x51f + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0034, lo: 0x9e, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa3}, + // Block 0xfb, offset 0x524 + {value: 0x0030, lo: 0xa5, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xa9}, + {value: 0x0030, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbf}, + // Block 0xfc, offset 0x529 + {value: 0x0034, lo: 0x80, hi: 0x82}, + {value: 0x0024, lo: 0x85, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8b}, + {value: 0x0024, lo: 0xaa, hi: 0xad}, + // Block 0xfd, offset 0x52d + {value: 0x0024, lo: 0x82, hi: 0x84}, + // Block 0xfe, offset 0x52e + {value: 0x0013, lo: 0x80, hi: 0x99}, + {value: 0x0012, lo: 0x9a, hi: 0xb3}, + {value: 0x0013, lo: 0xb4, hi: 0xbf}, + // Block 0xff, offset 0x531 + {value: 0x0013, lo: 0x80, hi: 0x8d}, + {value: 0x0012, lo: 0x8e, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0xa7}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0x100, offset 0x535 + {value: 0x0013, lo: 0x80, hi: 0x81}, + {value: 0x0012, lo: 0x82, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0x9c}, + {value: 0x0013, lo: 0x9e, hi: 0x9f}, + {value: 0x0013, lo: 0xa2, hi: 0xa2}, + {value: 0x0013, lo: 0xa5, hi: 0xa6}, + {value: 0x0013, lo: 0xa9, hi: 0xac}, + {value: 0x0013, lo: 0xae, hi: 0xb5}, + {value: 0x0012, lo: 0xb6, hi: 0xb9}, + {value: 0x0012, lo: 0xbb, hi: 0xbb}, + {value: 0x0012, lo: 0xbd, hi: 0xbf}, + // Block 0x101, offset 0x540 + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0012, lo: 0x85, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0x102, offset 0x544 + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0013, lo: 0x84, hi: 0x85}, + {value: 0x0013, lo: 0x87, hi: 0x8a}, + {value: 0x0013, lo: 0x8d, hi: 0x94}, + {value: 0x0013, lo: 0x96, hi: 0x9c}, + {value: 0x0012, lo: 0x9e, hi: 0xb7}, + {value: 0x0013, lo: 0xb8, hi: 0xb9}, + {value: 0x0013, lo: 0xbb, hi: 0xbe}, + // Block 0x103, offset 0x54c + {value: 0x0013, lo: 0x80, hi: 0x84}, + {value: 0x0013, lo: 0x86, hi: 0x86}, + {value: 0x0013, lo: 0x8a, hi: 0x90}, + {value: 0x0012, lo: 0x92, hi: 0xab}, + {value: 0x0013, lo: 0xac, hi: 0xbf}, + // Block 0x104, offset 0x551 + {value: 0x0013, lo: 0x80, hi: 0x85}, + {value: 0x0012, lo: 0x86, hi: 0x9f}, + {value: 0x0013, lo: 0xa0, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbf}, + // Block 0x105, offset 0x555 + {value: 0x0012, lo: 0x80, hi: 0x93}, + {value: 0x0013, lo: 0x94, hi: 0xad}, + {value: 0x0012, lo: 0xae, hi: 0xbf}, + // Block 0x106, offset 0x558 + {value: 0x0012, lo: 0x80, hi: 0x87}, + {value: 0x0013, lo: 0x88, hi: 0xa1}, + {value: 0x0012, lo: 0xa2, hi: 0xbb}, + {value: 0x0013, lo: 0xbc, hi: 0xbf}, + // Block 0x107, offset 0x55c + {value: 0x0013, lo: 0x80, hi: 0x95}, + {value: 0x0012, lo: 0x96, hi: 0xaf}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x108, offset 0x55f + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0012, lo: 0x8a, hi: 0xa5}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0x109, offset 0x562 + {value: 0x0013, lo: 0x80, hi: 0x80}, + {value: 0x0012, lo: 0x82, hi: 0x9a}, + {value: 0x0012, lo: 0x9c, hi: 0xa1}, + {value: 0x0013, lo: 0xa2, hi: 0xba}, + {value: 0x0012, lo: 0xbc, hi: 0xbf}, + // Block 0x10a, offset 0x567 + {value: 0x0012, lo: 0x80, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0xb4}, + {value: 0x0012, lo: 0xb6, hi: 0xbf}, + // Block 0x10b, offset 0x56b + {value: 0x0012, lo: 0x80, hi: 0x8e}, + {value: 0x0012, lo: 0x90, hi: 0x95}, + {value: 0x0013, lo: 0x96, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x10c, offset 0x56f + {value: 0x0012, lo: 0x80, hi: 0x88}, + {value: 0x0012, lo: 0x8a, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0x10d, offset 0x573 + {value: 0x0012, lo: 0x80, hi: 0x82}, + {value: 0x0012, lo: 0x84, hi: 0x89}, + {value: 0x0017, lo: 0x8a, hi: 0x8b}, + {value: 0x0010, lo: 0x8e, hi: 0xbf}, + // Block 0x10e, offset 0x577 + {value: 0x0014, lo: 0x80, hi: 0xb6}, + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x10f, offset 0x579 + {value: 0x0014, lo: 0x80, hi: 0xac}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x110, offset 0x57b + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x9b, hi: 0x9f}, + {value: 0x0014, lo: 0xa1, hi: 0xaf}, + // Block 0x111, offset 0x57e + {value: 0x0024, lo: 0x80, hi: 0x86}, + {value: 0x0024, lo: 0x88, hi: 0x98}, + {value: 0x0024, lo: 0x9b, hi: 0xa1}, + {value: 0x0024, lo: 0xa3, hi: 0xa4}, + {value: 0x0024, lo: 0xa6, hi: 0xaa}, + // Block 0x112, offset 0x583 + {value: 0x0010, lo: 0x80, hi: 0xac}, + {value: 0x0024, lo: 0xb0, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xbd}, + // Block 0x113, offset 0x586 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + // Block 0x114, offset 0x588 + {value: 0x0010, lo: 0x80, hi: 0xab}, + {value: 0x0024, lo: 0xac, hi: 0xaf}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x115, offset 0x58b + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0034, lo: 0x90, hi: 0x96}, + // Block 0x116, offset 0x58d + {value: 0xbc52, lo: 0x80, hi: 0x81}, + {value: 0xbf52, lo: 0x82, hi: 0x83}, + {value: 0x0024, lo: 0x84, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8b}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x117, offset 0x593 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x9f}, + {value: 0x0010, lo: 0xa1, hi: 0xa2}, + {value: 0x0010, lo: 0xa4, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb7}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + // Block 0x118, offset 0x59c + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x9b}, + {value: 0x0010, lo: 0xa1, hi: 0xa3}, + {value: 0x0010, lo: 0xa5, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xbb}, + // Block 0x119, offset 0x5a1 + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x11a, offset 0x5a2 + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x11b, offset 0x5a5 + {value: 0x0013, lo: 0x80, hi: 0x89}, + // Block 0x11c, offset 0x5a6 + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x11d, offset 0x5a7 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0014, lo: 0xa0, hi: 0xbf}, + // Block 0x11e, offset 0x5a9 + {value: 0x0014, lo: 0x80, hi: 0xbf}, + // Block 0x11f, offset 0x5aa + {value: 0x0014, lo: 0x80, hi: 0xaf}, +} + +// Total table size 15070 bytes (14KiB); checksum: 1EB13752 diff --git a/vendor/golang.org/x/text/cases/tables13.0.0.go b/vendor/golang.org/x/text/cases/tables13.0.0.go new file mode 100644 index 0000000000..6187e6b462 --- /dev/null +++ b/vendor/golang.org/x/text/cases/tables13.0.0.go @@ -0,0 +1,2399 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +//go:build go1.16 && !go1.21 + +package cases + +// UnicodeVersion is the Unicode version from which the tables in this package are derived. +const UnicodeVersion = "13.0.0" + +var xorData string = "" + // Size: 192 bytes + "\x00\x06\x07\x00\x01?\x00\x0f\x03\x00\x0f\x12\x00\x0f\x1f\x00\x0f\x1d" + + "\x00\x01\x13\x00\x0f\x16\x00\x0f\x0b\x00\x0f3\x00\x0f7\x00\x01#\x00\x0f?" + + "\x00\x0e'\x00\x0f/\x00\x0e>\x00\x0f*\x00\x0c&\x00\x0c*\x00\x0c;\x00\x0c9" + + "\x00\x0c%\x00\x01\x08\x00\x03\x0d\x00\x03\x09\x00\x02\x06\x00\x02\x02" + + "\x00\x02\x0c\x00\x01\x00\x00\x01\x03\x00\x01\x01\x00\x01 \x00\x01\x0c" + + "\x00\x01\x10\x00\x03\x10\x00\x036 \x00\x037 \x00\x0b#\x10\x00\x0b 0\x00" + + "\x0b!\x10\x00\x0b!0\x001\x00\x00\x0b(\x04\x00\x03\x04\x1e\x00\x0b)\x08" + + "\x00\x03\x0a\x00\x02:\x00\x02>\x00\x02,\x00\x02\x00\x00\x02\x10\x00\x01<" + + "\x00\x01&\x00\x01*\x00\x01.\x00\x010\x003 \x00\x01\x18\x00\x01(\x00\x01" + + "\x1e\x00\x01\x22" + +var exceptions string = "" + // Size: 2450 bytes + "\x00\x12\x12μΜΜ\x12\x12ssSSSs\x13\x18i̇i̇\x10\x09II\x13\x1bʼnʼNʼN\x11" + + "\x09sSS\x12\x12dždžDž\x12\x12dždžDŽ\x10\x12DŽDž\x12\x12ljljLj\x12\x12ljljLJ\x10\x12LJLj" + + "\x12\x12njnjNj\x12\x12njnjNJ\x10\x12NJNj\x13\x1bǰJ̌J̌\x12\x12dzdzDz\x12\x12dzdzDZ\x10" + + "\x12DZDz\x13\x18ⱥⱥ\x13\x18ⱦⱦ\x10\x1bⱾⱾ\x10\x1bⱿⱿ\x10\x1bⱯⱯ\x10\x1bⱭⱭ\x10" + + "\x1bⱰⱰ\x10\x1bꞫꞫ\x10\x1bꞬꞬ\x10\x1bꞍꞍ\x10\x1bꞪꞪ\x10\x1bꞮꞮ\x10\x1bⱢⱢ\x10" + + "\x1bꞭꞭ\x10\x1bⱮⱮ\x10\x1bⱤⱤ\x10\x1bꟅꟅ\x10\x1bꞱꞱ\x10\x1bꞲꞲ\x10\x1bꞰꞰ2\x12ι" + + "ΙΙ\x166ΐΪ́Ϊ́\x166ΰΫ́Ϋ́\x12\x12σΣΣ\x12\x12βΒΒ\x12\x12θΘΘ\x12\x12" + + "φΦΦ\x12\x12πΠΠ\x12\x12κΚΚ\x12\x12ρΡΡ\x12\x12εΕΕ\x14$եւԵՒԵւ\x10\x1bᲐა" + + "\x10\x1bᲑბ\x10\x1bᲒგ\x10\x1bᲓდ\x10\x1bᲔე\x10\x1bᲕვ\x10\x1bᲖზ\x10\x1bᲗთ" + + "\x10\x1bᲘი\x10\x1bᲙკ\x10\x1bᲚლ\x10\x1bᲛმ\x10\x1bᲜნ\x10\x1bᲝო\x10\x1bᲞპ" + + "\x10\x1bᲟჟ\x10\x1bᲠრ\x10\x1bᲡს\x10\x1bᲢტ\x10\x1bᲣუ\x10\x1bᲤფ\x10\x1bᲥქ" + + "\x10\x1bᲦღ\x10\x1bᲧყ\x10\x1bᲨშ\x10\x1bᲩჩ\x10\x1bᲪც\x10\x1bᲫძ\x10\x1bᲬწ" + + "\x10\x1bᲭჭ\x10\x1bᲮხ\x10\x1bᲯჯ\x10\x1bᲰჰ\x10\x1bᲱჱ\x10\x1bᲲჲ\x10\x1bᲳჳ" + + "\x10\x1bᲴჴ\x10\x1bᲵჵ\x10\x1bᲶჶ\x10\x1bᲷჷ\x10\x1bᲸჸ\x10\x1bᲹჹ\x10\x1bᲺჺ" + + "\x10\x1bᲽჽ\x10\x1bᲾჾ\x10\x1bᲿჿ\x12\x12вВВ\x12\x12дДД\x12\x12оОО\x12\x12с" + + "СС\x12\x12тТТ\x12\x12тТТ\x12\x12ъЪЪ\x12\x12ѣѢѢ\x13\x1bꙋꙊꙊ\x13\x1bẖH̱H̱" + + "\x13\x1bẗT̈T̈\x13\x1bẘW̊W̊\x13\x1bẙY̊Y̊\x13\x1baʾAʾAʾ\x13\x1bṡṠṠ\x12" + + "\x10ssß\x14$ὐΥ̓Υ̓\x166ὒΥ̓̀Υ̓̀\x166ὔΥ̓́Υ̓́\x166ὖΥ̓͂Υ̓͂\x15+ἀιἈΙᾈ" + + "\x15+ἁιἉΙᾉ\x15+ἂιἊΙᾊ\x15+ἃιἋΙᾋ\x15+ἄιἌΙᾌ\x15+ἅιἍΙᾍ\x15+ἆιἎΙᾎ\x15+ἇιἏΙᾏ" + + "\x15\x1dἀιᾀἈΙ\x15\x1dἁιᾁἉΙ\x15\x1dἂιᾂἊΙ\x15\x1dἃιᾃἋΙ\x15\x1dἄιᾄἌΙ\x15" + + "\x1dἅιᾅἍΙ\x15\x1dἆιᾆἎΙ\x15\x1dἇιᾇἏΙ\x15+ἠιἨΙᾘ\x15+ἡιἩΙᾙ\x15+ἢιἪΙᾚ\x15+ἣι" + + "ἫΙᾛ\x15+ἤιἬΙᾜ\x15+ἥιἭΙᾝ\x15+ἦιἮΙᾞ\x15+ἧιἯΙᾟ\x15\x1dἠιᾐἨΙ\x15\x1dἡιᾑἩΙ" + + "\x15\x1dἢιᾒἪΙ\x15\x1dἣιᾓἫΙ\x15\x1dἤιᾔἬΙ\x15\x1dἥιᾕἭΙ\x15\x1dἦιᾖἮΙ\x15" + + "\x1dἧιᾗἯΙ\x15+ὠιὨΙᾨ\x15+ὡιὩΙᾩ\x15+ὢιὪΙᾪ\x15+ὣιὫΙᾫ\x15+ὤιὬΙᾬ\x15+ὥιὭΙᾭ" + + "\x15+ὦιὮΙᾮ\x15+ὧιὯΙᾯ\x15\x1dὠιᾠὨΙ\x15\x1dὡιᾡὩΙ\x15\x1dὢιᾢὪΙ\x15\x1dὣιᾣὫΙ" + + "\x15\x1dὤιᾤὬΙ\x15\x1dὥιᾥὭΙ\x15\x1dὦιᾦὮΙ\x15\x1dὧιᾧὯΙ\x15-ὰιᾺΙᾺͅ\x14#αιΑΙ" + + "ᾼ\x14$άιΆΙΆͅ\x14$ᾶΑ͂Α͂\x166ᾶιΑ͂Ιᾼ͂\x14\x1cαιᾳΑΙ\x12\x12ιΙΙ\x15-ὴιῊΙ" + + "Ὴͅ\x14#ηιΗΙῌ\x14$ήιΉΙΉͅ\x14$ῆΗ͂Η͂\x166ῆιΗ͂Ιῌ͂\x14\x1cηιῃΗΙ\x166ῒΙ" + + "̈̀Ϊ̀\x166ΐΪ́Ϊ́\x14$ῖΙ͂Ι͂\x166ῗΪ͂Ϊ͂\x166ῢΫ̀Ϋ̀\x166ΰΫ́Ϋ" + + "́\x14$ῤΡ̓Ρ̓\x14$ῦΥ͂Υ͂\x166ῧΫ͂Ϋ͂\x15-ὼιῺΙῺͅ\x14#ωιΩΙῼ\x14$ώιΏΙΏͅ" + + "\x14$ῶΩ͂Ω͂\x166ῶιΩ͂Ιῼ͂\x14\x1cωιῳΩΙ\x12\x10ωω\x11\x08kk\x12\x10åå\x12" + + "\x10ɫɫ\x12\x10ɽɽ\x10\x12ȺȺ\x10\x12ȾȾ\x12\x10ɑɑ\x12\x10ɱɱ\x12\x10ɐɐ\x12" + + "\x10ɒɒ\x12\x10ȿȿ\x12\x10ɀɀ\x12\x10ɥɥ\x12\x10ɦɦ\x12\x10ɜɜ\x12\x10ɡɡ\x12" + + "\x10ɬɬ\x12\x10ɪɪ\x12\x10ʞʞ\x12\x10ʇʇ\x12\x10ʝʝ\x12\x10ʂʂ\x12\x12ffFFFf" + + "\x12\x12fiFIFi\x12\x12flFLFl\x13\x1bffiFFIFfi\x13\x1bfflFFLFfl\x12\x12st" + + "STSt\x12\x12stSTSt\x14$մնՄՆՄն\x14$մեՄԵՄե\x14$միՄԻՄի\x14$վնՎՆՎն\x14$մխՄԽՄ" + + "խ" + +// lookup returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookup(s []byte) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupUnsafe(s []byte) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// lookupString returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookupString(s string) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupStringUnsafe(s string) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// caseTrie. Total size: 12538 bytes (12.24 KiB). Checksum: af4dfa7d60c71d4c. +type caseTrie struct{} + +func newCaseTrie(i int) *caseTrie { + return &caseTrie{} +} + +// lookupValue determines the type of block n and looks up the value for b. +func (t *caseTrie) lookupValue(n uint32, b byte) uint16 { + switch { + case n < 20: + return uint16(caseValues[n<<6+uint32(b)]) + default: + n -= 20 + return uint16(sparse.lookup(n, b)) + } +} + +// caseValues: 22 blocks, 1408 entries, 2816 bytes +// The third block is the zero block. +var caseValues = [1408]uint16{ + // Block 0x0, offset 0x0 + 0x27: 0x0054, + 0x2e: 0x0054, + 0x30: 0x0010, 0x31: 0x0010, 0x32: 0x0010, 0x33: 0x0010, 0x34: 0x0010, 0x35: 0x0010, + 0x36: 0x0010, 0x37: 0x0010, 0x38: 0x0010, 0x39: 0x0010, 0x3a: 0x0054, + // Block 0x1, offset 0x40 + 0x41: 0x2013, 0x42: 0x2013, 0x43: 0x2013, 0x44: 0x2013, 0x45: 0x2013, + 0x46: 0x2013, 0x47: 0x2013, 0x48: 0x2013, 0x49: 0x2013, 0x4a: 0x2013, 0x4b: 0x2013, + 0x4c: 0x2013, 0x4d: 0x2013, 0x4e: 0x2013, 0x4f: 0x2013, 0x50: 0x2013, 0x51: 0x2013, + 0x52: 0x2013, 0x53: 0x2013, 0x54: 0x2013, 0x55: 0x2013, 0x56: 0x2013, 0x57: 0x2013, + 0x58: 0x2013, 0x59: 0x2013, 0x5a: 0x2013, + 0x5e: 0x0004, 0x5f: 0x0010, 0x60: 0x0004, 0x61: 0x2012, 0x62: 0x2012, 0x63: 0x2012, + 0x64: 0x2012, 0x65: 0x2012, 0x66: 0x2012, 0x67: 0x2012, 0x68: 0x2012, 0x69: 0x2012, + 0x6a: 0x2012, 0x6b: 0x2012, 0x6c: 0x2012, 0x6d: 0x2012, 0x6e: 0x2012, 0x6f: 0x2012, + 0x70: 0x2012, 0x71: 0x2012, 0x72: 0x2012, 0x73: 0x2012, 0x74: 0x2012, 0x75: 0x2012, + 0x76: 0x2012, 0x77: 0x2012, 0x78: 0x2012, 0x79: 0x2012, 0x7a: 0x2012, + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc0: 0x0852, 0xc1: 0x0b53, 0xc2: 0x0113, 0xc3: 0x0112, 0xc4: 0x0113, 0xc5: 0x0112, + 0xc6: 0x0b53, 0xc7: 0x0f13, 0xc8: 0x0f12, 0xc9: 0x0e53, 0xca: 0x1153, 0xcb: 0x0713, + 0xcc: 0x0712, 0xcd: 0x0012, 0xce: 0x1453, 0xcf: 0x1753, 0xd0: 0x1a53, 0xd1: 0x0313, + 0xd2: 0x0312, 0xd3: 0x1d53, 0xd4: 0x2053, 0xd5: 0x2352, 0xd6: 0x2653, 0xd7: 0x2653, + 0xd8: 0x0113, 0xd9: 0x0112, 0xda: 0x2952, 0xdb: 0x0012, 0xdc: 0x1d53, 0xdd: 0x2c53, + 0xde: 0x2f52, 0xdf: 0x3253, 0xe0: 0x0113, 0xe1: 0x0112, 0xe2: 0x0113, 0xe3: 0x0112, + 0xe4: 0x0113, 0xe5: 0x0112, 0xe6: 0x3553, 0xe7: 0x0f13, 0xe8: 0x0f12, 0xe9: 0x3853, + 0xea: 0x0012, 0xeb: 0x0012, 0xec: 0x0113, 0xed: 0x0112, 0xee: 0x3553, 0xef: 0x1f13, + 0xf0: 0x1f12, 0xf1: 0x3b53, 0xf2: 0x3e53, 0xf3: 0x0713, 0xf4: 0x0712, 0xf5: 0x0313, + 0xf6: 0x0312, 0xf7: 0x4153, 0xf8: 0x0113, 0xf9: 0x0112, 0xfa: 0x0012, 0xfb: 0x0010, + 0xfc: 0x0113, 0xfd: 0x0112, 0xfe: 0x0012, 0xff: 0x4452, + // Block 0x4, offset 0x100 + 0x100: 0x0010, 0x101: 0x0010, 0x102: 0x0010, 0x103: 0x0010, 0x104: 0x02db, 0x105: 0x0359, + 0x106: 0x03da, 0x107: 0x043b, 0x108: 0x04b9, 0x109: 0x053a, 0x10a: 0x059b, 0x10b: 0x0619, + 0x10c: 0x069a, 0x10d: 0x0313, 0x10e: 0x0312, 0x10f: 0x1f13, 0x110: 0x1f12, 0x111: 0x0313, + 0x112: 0x0312, 0x113: 0x0713, 0x114: 0x0712, 0x115: 0x0313, 0x116: 0x0312, 0x117: 0x0f13, + 0x118: 0x0f12, 0x119: 0x0313, 0x11a: 0x0312, 0x11b: 0x0713, 0x11c: 0x0712, 0x11d: 0x1452, + 0x11e: 0x0113, 0x11f: 0x0112, 0x120: 0x0113, 0x121: 0x0112, 0x122: 0x0113, 0x123: 0x0112, + 0x124: 0x0113, 0x125: 0x0112, 0x126: 0x0113, 0x127: 0x0112, 0x128: 0x0113, 0x129: 0x0112, + 0x12a: 0x0113, 0x12b: 0x0112, 0x12c: 0x0113, 0x12d: 0x0112, 0x12e: 0x0113, 0x12f: 0x0112, + 0x130: 0x06fa, 0x131: 0x07ab, 0x132: 0x0829, 0x133: 0x08aa, 0x134: 0x0113, 0x135: 0x0112, + 0x136: 0x2353, 0x137: 0x4453, 0x138: 0x0113, 0x139: 0x0112, 0x13a: 0x0113, 0x13b: 0x0112, + 0x13c: 0x0113, 0x13d: 0x0112, 0x13e: 0x0113, 0x13f: 0x0112, + // Block 0x5, offset 0x140 + 0x140: 0x0a8a, 0x141: 0x0313, 0x142: 0x0312, 0x143: 0x0853, 0x144: 0x4753, 0x145: 0x4a53, + 0x146: 0x0113, 0x147: 0x0112, 0x148: 0x0113, 0x149: 0x0112, 0x14a: 0x0113, 0x14b: 0x0112, + 0x14c: 0x0113, 0x14d: 0x0112, 0x14e: 0x0113, 0x14f: 0x0112, 0x150: 0x0b0a, 0x151: 0x0b8a, + 0x152: 0x0c0a, 0x153: 0x0b52, 0x154: 0x0b52, 0x155: 0x0012, 0x156: 0x0e52, 0x157: 0x1152, + 0x158: 0x0012, 0x159: 0x1752, 0x15a: 0x0012, 0x15b: 0x1a52, 0x15c: 0x0c8a, 0x15d: 0x0012, + 0x15e: 0x0012, 0x15f: 0x0012, 0x160: 0x1d52, 0x161: 0x0d0a, 0x162: 0x0012, 0x163: 0x2052, + 0x164: 0x0012, 0x165: 0x0d8a, 0x166: 0x0e0a, 0x167: 0x0012, 0x168: 0x2652, 0x169: 0x2652, + 0x16a: 0x0e8a, 0x16b: 0x0f0a, 0x16c: 0x0f8a, 0x16d: 0x0012, 0x16e: 0x0012, 0x16f: 0x1d52, + 0x170: 0x0012, 0x171: 0x100a, 0x172: 0x2c52, 0x173: 0x0012, 0x174: 0x0012, 0x175: 0x3252, + 0x176: 0x0012, 0x177: 0x0012, 0x178: 0x0012, 0x179: 0x0012, 0x17a: 0x0012, 0x17b: 0x0012, + 0x17c: 0x0012, 0x17d: 0x108a, 0x17e: 0x0012, 0x17f: 0x0012, + // Block 0x6, offset 0x180 + 0x180: 0x3552, 0x181: 0x0012, 0x182: 0x110a, 0x183: 0x3852, 0x184: 0x0012, 0x185: 0x0012, + 0x186: 0x0012, 0x187: 0x118a, 0x188: 0x3552, 0x189: 0x4752, 0x18a: 0x3b52, 0x18b: 0x3e52, + 0x18c: 0x4a52, 0x18d: 0x0012, 0x18e: 0x0012, 0x18f: 0x0012, 0x190: 0x0012, 0x191: 0x0012, + 0x192: 0x4152, 0x193: 0x0012, 0x194: 0x0010, 0x195: 0x0012, 0x196: 0x0012, 0x197: 0x0012, + 0x198: 0x0012, 0x199: 0x0012, 0x19a: 0x0012, 0x19b: 0x0012, 0x19c: 0x0012, 0x19d: 0x120a, + 0x19e: 0x128a, 0x19f: 0x0012, 0x1a0: 0x0012, 0x1a1: 0x0012, 0x1a2: 0x0012, 0x1a3: 0x0012, + 0x1a4: 0x0012, 0x1a5: 0x0012, 0x1a6: 0x0012, 0x1a7: 0x0012, 0x1a8: 0x0012, 0x1a9: 0x0012, + 0x1aa: 0x0012, 0x1ab: 0x0012, 0x1ac: 0x0012, 0x1ad: 0x0012, 0x1ae: 0x0012, 0x1af: 0x0012, + 0x1b0: 0x0015, 0x1b1: 0x0015, 0x1b2: 0x0015, 0x1b3: 0x0015, 0x1b4: 0x0015, 0x1b5: 0x0015, + 0x1b6: 0x0015, 0x1b7: 0x0015, 0x1b8: 0x0015, 0x1b9: 0x0014, 0x1ba: 0x0014, 0x1bb: 0x0014, + 0x1bc: 0x0014, 0x1bd: 0x0014, 0x1be: 0x0014, 0x1bf: 0x0014, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x0024, 0x1c1: 0x0024, 0x1c2: 0x0024, 0x1c3: 0x0024, 0x1c4: 0x0024, 0x1c5: 0x130d, + 0x1c6: 0x0024, 0x1c7: 0x0034, 0x1c8: 0x0034, 0x1c9: 0x0034, 0x1ca: 0x0024, 0x1cb: 0x0024, + 0x1cc: 0x0024, 0x1cd: 0x0034, 0x1ce: 0x0034, 0x1cf: 0x0014, 0x1d0: 0x0024, 0x1d1: 0x0024, + 0x1d2: 0x0024, 0x1d3: 0x0034, 0x1d4: 0x0034, 0x1d5: 0x0034, 0x1d6: 0x0034, 0x1d7: 0x0024, + 0x1d8: 0x0034, 0x1d9: 0x0034, 0x1da: 0x0034, 0x1db: 0x0024, 0x1dc: 0x0034, 0x1dd: 0x0034, + 0x1de: 0x0034, 0x1df: 0x0034, 0x1e0: 0x0034, 0x1e1: 0x0034, 0x1e2: 0x0034, 0x1e3: 0x0024, + 0x1e4: 0x0024, 0x1e5: 0x0024, 0x1e6: 0x0024, 0x1e7: 0x0024, 0x1e8: 0x0024, 0x1e9: 0x0024, + 0x1ea: 0x0024, 0x1eb: 0x0024, 0x1ec: 0x0024, 0x1ed: 0x0024, 0x1ee: 0x0024, 0x1ef: 0x0024, + 0x1f0: 0x0113, 0x1f1: 0x0112, 0x1f2: 0x0113, 0x1f3: 0x0112, 0x1f4: 0x0014, 0x1f5: 0x0004, + 0x1f6: 0x0113, 0x1f7: 0x0112, 0x1fa: 0x0015, 0x1fb: 0x4d52, + 0x1fc: 0x5052, 0x1fd: 0x5052, 0x1ff: 0x5353, + // Block 0x8, offset 0x200 + 0x204: 0x0004, 0x205: 0x0004, + 0x206: 0x2a13, 0x207: 0x0054, 0x208: 0x2513, 0x209: 0x2713, 0x20a: 0x2513, + 0x20c: 0x5653, 0x20e: 0x5953, 0x20f: 0x5c53, 0x210: 0x138a, 0x211: 0x2013, + 0x212: 0x2013, 0x213: 0x2013, 0x214: 0x2013, 0x215: 0x2013, 0x216: 0x2013, 0x217: 0x2013, + 0x218: 0x2013, 0x219: 0x2013, 0x21a: 0x2013, 0x21b: 0x2013, 0x21c: 0x2013, 0x21d: 0x2013, + 0x21e: 0x2013, 0x21f: 0x2013, 0x220: 0x5f53, 0x221: 0x5f53, 0x223: 0x5f53, + 0x224: 0x5f53, 0x225: 0x5f53, 0x226: 0x5f53, 0x227: 0x5f53, 0x228: 0x5f53, 0x229: 0x5f53, + 0x22a: 0x5f53, 0x22b: 0x5f53, 0x22c: 0x2a12, 0x22d: 0x2512, 0x22e: 0x2712, 0x22f: 0x2512, + 0x230: 0x14ca, 0x231: 0x2012, 0x232: 0x2012, 0x233: 0x2012, 0x234: 0x2012, 0x235: 0x2012, + 0x236: 0x2012, 0x237: 0x2012, 0x238: 0x2012, 0x239: 0x2012, 0x23a: 0x2012, 0x23b: 0x2012, + 0x23c: 0x2012, 0x23d: 0x2012, 0x23e: 0x2012, 0x23f: 0x2012, + // Block 0x9, offset 0x240 + 0x240: 0x5f52, 0x241: 0x5f52, 0x242: 0x160a, 0x243: 0x5f52, 0x244: 0x5f52, 0x245: 0x5f52, + 0x246: 0x5f52, 0x247: 0x5f52, 0x248: 0x5f52, 0x249: 0x5f52, 0x24a: 0x5f52, 0x24b: 0x5f52, + 0x24c: 0x5652, 0x24d: 0x5952, 0x24e: 0x5c52, 0x24f: 0x1813, 0x250: 0x168a, 0x251: 0x170a, + 0x252: 0x0013, 0x253: 0x0013, 0x254: 0x0013, 0x255: 0x178a, 0x256: 0x180a, 0x257: 0x1812, + 0x258: 0x0113, 0x259: 0x0112, 0x25a: 0x0113, 0x25b: 0x0112, 0x25c: 0x0113, 0x25d: 0x0112, + 0x25e: 0x0113, 0x25f: 0x0112, 0x260: 0x0113, 0x261: 0x0112, 0x262: 0x0113, 0x263: 0x0112, + 0x264: 0x0113, 0x265: 0x0112, 0x266: 0x0113, 0x267: 0x0112, 0x268: 0x0113, 0x269: 0x0112, + 0x26a: 0x0113, 0x26b: 0x0112, 0x26c: 0x0113, 0x26d: 0x0112, 0x26e: 0x0113, 0x26f: 0x0112, + 0x270: 0x188a, 0x271: 0x190a, 0x272: 0x0b12, 0x273: 0x5352, 0x274: 0x6253, 0x275: 0x198a, + 0x277: 0x0f13, 0x278: 0x0f12, 0x279: 0x0b13, 0x27a: 0x0113, 0x27b: 0x0112, + 0x27c: 0x0012, 0x27d: 0x4d53, 0x27e: 0x5053, 0x27f: 0x5053, + // Block 0xa, offset 0x280 + 0x280: 0x6852, 0x281: 0x6852, 0x282: 0x6852, 0x283: 0x6852, 0x284: 0x6852, 0x285: 0x6852, + 0x286: 0x6852, 0x287: 0x1a0a, 0x288: 0x0012, 0x28a: 0x0010, + 0x291: 0x0034, + 0x292: 0x0024, 0x293: 0x0024, 0x294: 0x0024, 0x295: 0x0024, 0x296: 0x0034, 0x297: 0x0024, + 0x298: 0x0024, 0x299: 0x0024, 0x29a: 0x0034, 0x29b: 0x0034, 0x29c: 0x0024, 0x29d: 0x0024, + 0x29e: 0x0024, 0x29f: 0x0024, 0x2a0: 0x0024, 0x2a1: 0x0024, 0x2a2: 0x0034, 0x2a3: 0x0034, + 0x2a4: 0x0034, 0x2a5: 0x0034, 0x2a6: 0x0034, 0x2a7: 0x0034, 0x2a8: 0x0024, 0x2a9: 0x0024, + 0x2aa: 0x0034, 0x2ab: 0x0024, 0x2ac: 0x0024, 0x2ad: 0x0034, 0x2ae: 0x0034, 0x2af: 0x0024, + 0x2b0: 0x0034, 0x2b1: 0x0034, 0x2b2: 0x0034, 0x2b3: 0x0034, 0x2b4: 0x0034, 0x2b5: 0x0034, + 0x2b6: 0x0034, 0x2b7: 0x0034, 0x2b8: 0x0034, 0x2b9: 0x0034, 0x2ba: 0x0034, 0x2bb: 0x0034, + 0x2bc: 0x0034, 0x2bd: 0x0034, 0x2bf: 0x0034, + // Block 0xb, offset 0x2c0 + 0x2c0: 0x7053, 0x2c1: 0x7053, 0x2c2: 0x7053, 0x2c3: 0x7053, 0x2c4: 0x7053, 0x2c5: 0x7053, + 0x2c7: 0x7053, + 0x2cd: 0x7053, 0x2d0: 0x1aea, 0x2d1: 0x1b6a, + 0x2d2: 0x1bea, 0x2d3: 0x1c6a, 0x2d4: 0x1cea, 0x2d5: 0x1d6a, 0x2d6: 0x1dea, 0x2d7: 0x1e6a, + 0x2d8: 0x1eea, 0x2d9: 0x1f6a, 0x2da: 0x1fea, 0x2db: 0x206a, 0x2dc: 0x20ea, 0x2dd: 0x216a, + 0x2de: 0x21ea, 0x2df: 0x226a, 0x2e0: 0x22ea, 0x2e1: 0x236a, 0x2e2: 0x23ea, 0x2e3: 0x246a, + 0x2e4: 0x24ea, 0x2e5: 0x256a, 0x2e6: 0x25ea, 0x2e7: 0x266a, 0x2e8: 0x26ea, 0x2e9: 0x276a, + 0x2ea: 0x27ea, 0x2eb: 0x286a, 0x2ec: 0x28ea, 0x2ed: 0x296a, 0x2ee: 0x29ea, 0x2ef: 0x2a6a, + 0x2f0: 0x2aea, 0x2f1: 0x2b6a, 0x2f2: 0x2bea, 0x2f3: 0x2c6a, 0x2f4: 0x2cea, 0x2f5: 0x2d6a, + 0x2f6: 0x2dea, 0x2f7: 0x2e6a, 0x2f8: 0x2eea, 0x2f9: 0x2f6a, 0x2fa: 0x2fea, + 0x2fc: 0x0014, 0x2fd: 0x306a, 0x2fe: 0x30ea, 0x2ff: 0x316a, + // Block 0xc, offset 0x300 + 0x300: 0x0812, 0x301: 0x0812, 0x302: 0x0812, 0x303: 0x0812, 0x304: 0x0812, 0x305: 0x0812, + 0x308: 0x0813, 0x309: 0x0813, 0x30a: 0x0813, 0x30b: 0x0813, + 0x30c: 0x0813, 0x30d: 0x0813, 0x310: 0x3b1a, 0x311: 0x0812, + 0x312: 0x3bfa, 0x313: 0x0812, 0x314: 0x3d3a, 0x315: 0x0812, 0x316: 0x3e7a, 0x317: 0x0812, + 0x319: 0x0813, 0x31b: 0x0813, 0x31d: 0x0813, + 0x31f: 0x0813, 0x320: 0x0812, 0x321: 0x0812, 0x322: 0x0812, 0x323: 0x0812, + 0x324: 0x0812, 0x325: 0x0812, 0x326: 0x0812, 0x327: 0x0812, 0x328: 0x0813, 0x329: 0x0813, + 0x32a: 0x0813, 0x32b: 0x0813, 0x32c: 0x0813, 0x32d: 0x0813, 0x32e: 0x0813, 0x32f: 0x0813, + 0x330: 0x9252, 0x331: 0x9252, 0x332: 0x9552, 0x333: 0x9552, 0x334: 0x9852, 0x335: 0x9852, + 0x336: 0x9b52, 0x337: 0x9b52, 0x338: 0x9e52, 0x339: 0x9e52, 0x33a: 0xa152, 0x33b: 0xa152, + 0x33c: 0x4d52, 0x33d: 0x4d52, + // Block 0xd, offset 0x340 + 0x340: 0x3fba, 0x341: 0x40aa, 0x342: 0x419a, 0x343: 0x428a, 0x344: 0x437a, 0x345: 0x446a, + 0x346: 0x455a, 0x347: 0x464a, 0x348: 0x4739, 0x349: 0x4829, 0x34a: 0x4919, 0x34b: 0x4a09, + 0x34c: 0x4af9, 0x34d: 0x4be9, 0x34e: 0x4cd9, 0x34f: 0x4dc9, 0x350: 0x4eba, 0x351: 0x4faa, + 0x352: 0x509a, 0x353: 0x518a, 0x354: 0x527a, 0x355: 0x536a, 0x356: 0x545a, 0x357: 0x554a, + 0x358: 0x5639, 0x359: 0x5729, 0x35a: 0x5819, 0x35b: 0x5909, 0x35c: 0x59f9, 0x35d: 0x5ae9, + 0x35e: 0x5bd9, 0x35f: 0x5cc9, 0x360: 0x5dba, 0x361: 0x5eaa, 0x362: 0x5f9a, 0x363: 0x608a, + 0x364: 0x617a, 0x365: 0x626a, 0x366: 0x635a, 0x367: 0x644a, 0x368: 0x6539, 0x369: 0x6629, + 0x36a: 0x6719, 0x36b: 0x6809, 0x36c: 0x68f9, 0x36d: 0x69e9, 0x36e: 0x6ad9, 0x36f: 0x6bc9, + 0x370: 0x0812, 0x371: 0x0812, 0x372: 0x6cba, 0x373: 0x6dca, 0x374: 0x6e9a, + 0x376: 0x6f7a, 0x377: 0x705a, 0x378: 0x0813, 0x379: 0x0813, 0x37a: 0x9253, 0x37b: 0x9253, + 0x37c: 0x7199, 0x37d: 0x0004, 0x37e: 0x726a, 0x37f: 0x0004, + // Block 0xe, offset 0x380 + 0x380: 0x0004, 0x381: 0x0004, 0x382: 0x72ea, 0x383: 0x73fa, 0x384: 0x74ca, + 0x386: 0x75aa, 0x387: 0x768a, 0x388: 0x9553, 0x389: 0x9553, 0x38a: 0x9853, 0x38b: 0x9853, + 0x38c: 0x77c9, 0x38d: 0x0004, 0x38e: 0x0004, 0x38f: 0x0004, 0x390: 0x0812, 0x391: 0x0812, + 0x392: 0x789a, 0x393: 0x79da, 0x396: 0x7b1a, 0x397: 0x7bfa, + 0x398: 0x0813, 0x399: 0x0813, 0x39a: 0x9b53, 0x39b: 0x9b53, 0x39d: 0x0004, + 0x39e: 0x0004, 0x39f: 0x0004, 0x3a0: 0x0812, 0x3a1: 0x0812, 0x3a2: 0x7d3a, 0x3a3: 0x7e7a, + 0x3a4: 0x7fba, 0x3a5: 0x0912, 0x3a6: 0x809a, 0x3a7: 0x817a, 0x3a8: 0x0813, 0x3a9: 0x0813, + 0x3aa: 0xa153, 0x3ab: 0xa153, 0x3ac: 0x0913, 0x3ad: 0x0004, 0x3ae: 0x0004, 0x3af: 0x0004, + 0x3b2: 0x82ba, 0x3b3: 0x83ca, 0x3b4: 0x849a, + 0x3b6: 0x857a, 0x3b7: 0x865a, 0x3b8: 0x9e53, 0x3b9: 0x9e53, 0x3ba: 0x4d53, 0x3bb: 0x4d53, + 0x3bc: 0x8799, 0x3bd: 0x0004, 0x3be: 0x0004, + // Block 0xf, offset 0x3c0 + 0x3c2: 0x0013, + 0x3c7: 0x0013, 0x3ca: 0x0012, 0x3cb: 0x0013, + 0x3cc: 0x0013, 0x3cd: 0x0013, 0x3ce: 0x0012, 0x3cf: 0x0012, 0x3d0: 0x0013, 0x3d1: 0x0013, + 0x3d2: 0x0013, 0x3d3: 0x0012, 0x3d5: 0x0013, + 0x3d9: 0x0013, 0x3da: 0x0013, 0x3db: 0x0013, 0x3dc: 0x0013, 0x3dd: 0x0013, + 0x3e4: 0x0013, 0x3e6: 0x886b, 0x3e8: 0x0013, + 0x3ea: 0x88cb, 0x3eb: 0x890b, 0x3ec: 0x0013, 0x3ed: 0x0013, 0x3ef: 0x0012, + 0x3f0: 0x0013, 0x3f1: 0x0013, 0x3f2: 0xa453, 0x3f3: 0x0013, 0x3f4: 0x0012, 0x3f5: 0x0010, + 0x3f6: 0x0010, 0x3f7: 0x0010, 0x3f8: 0x0010, 0x3f9: 0x0012, + 0x3fc: 0x0012, 0x3fd: 0x0012, 0x3fe: 0x0013, 0x3ff: 0x0013, + // Block 0x10, offset 0x400 + 0x400: 0x1a13, 0x401: 0x1a13, 0x402: 0x1e13, 0x403: 0x1e13, 0x404: 0x1a13, 0x405: 0x1a13, + 0x406: 0x2613, 0x407: 0x2613, 0x408: 0x2a13, 0x409: 0x2a13, 0x40a: 0x2e13, 0x40b: 0x2e13, + 0x40c: 0x2a13, 0x40d: 0x2a13, 0x40e: 0x2613, 0x40f: 0x2613, 0x410: 0xa752, 0x411: 0xa752, + 0x412: 0xaa52, 0x413: 0xaa52, 0x414: 0xad52, 0x415: 0xad52, 0x416: 0xaa52, 0x417: 0xaa52, + 0x418: 0xa752, 0x419: 0xa752, 0x41a: 0x1a12, 0x41b: 0x1a12, 0x41c: 0x1e12, 0x41d: 0x1e12, + 0x41e: 0x1a12, 0x41f: 0x1a12, 0x420: 0x2612, 0x421: 0x2612, 0x422: 0x2a12, 0x423: 0x2a12, + 0x424: 0x2e12, 0x425: 0x2e12, 0x426: 0x2a12, 0x427: 0x2a12, 0x428: 0x2612, 0x429: 0x2612, + // Block 0x11, offset 0x440 + 0x440: 0x6552, 0x441: 0x6552, 0x442: 0x6552, 0x443: 0x6552, 0x444: 0x6552, 0x445: 0x6552, + 0x446: 0x6552, 0x447: 0x6552, 0x448: 0x6552, 0x449: 0x6552, 0x44a: 0x6552, 0x44b: 0x6552, + 0x44c: 0x6552, 0x44d: 0x6552, 0x44e: 0x6552, 0x44f: 0x6552, 0x450: 0xb052, 0x451: 0xb052, + 0x452: 0xb052, 0x453: 0xb052, 0x454: 0xb052, 0x455: 0xb052, 0x456: 0xb052, 0x457: 0xb052, + 0x458: 0xb052, 0x459: 0xb052, 0x45a: 0xb052, 0x45b: 0xb052, 0x45c: 0xb052, 0x45d: 0xb052, + 0x45e: 0xb052, 0x460: 0x0113, 0x461: 0x0112, 0x462: 0x896b, 0x463: 0x8b53, + 0x464: 0x89cb, 0x465: 0x8a2a, 0x466: 0x8a8a, 0x467: 0x0f13, 0x468: 0x0f12, 0x469: 0x0313, + 0x46a: 0x0312, 0x46b: 0x0713, 0x46c: 0x0712, 0x46d: 0x8aeb, 0x46e: 0x8b4b, 0x46f: 0x8bab, + 0x470: 0x8c0b, 0x471: 0x0012, 0x472: 0x0113, 0x473: 0x0112, 0x474: 0x0012, 0x475: 0x0313, + 0x476: 0x0312, 0x477: 0x0012, 0x478: 0x0012, 0x479: 0x0012, 0x47a: 0x0012, 0x47b: 0x0012, + 0x47c: 0x0015, 0x47d: 0x0015, 0x47e: 0x8c6b, 0x47f: 0x8ccb, + // Block 0x12, offset 0x480 + 0x480: 0x0113, 0x481: 0x0112, 0x482: 0x0113, 0x483: 0x0112, 0x484: 0x0113, 0x485: 0x0112, + 0x486: 0x0113, 0x487: 0x0112, 0x488: 0x0014, 0x489: 0x0014, 0x48a: 0x0014, 0x48b: 0x0713, + 0x48c: 0x0712, 0x48d: 0x8d2b, 0x48e: 0x0012, 0x48f: 0x0010, 0x490: 0x0113, 0x491: 0x0112, + 0x492: 0x0113, 0x493: 0x0112, 0x494: 0x6552, 0x495: 0x0012, 0x496: 0x0113, 0x497: 0x0112, + 0x498: 0x0113, 0x499: 0x0112, 0x49a: 0x0113, 0x49b: 0x0112, 0x49c: 0x0113, 0x49d: 0x0112, + 0x49e: 0x0113, 0x49f: 0x0112, 0x4a0: 0x0113, 0x4a1: 0x0112, 0x4a2: 0x0113, 0x4a3: 0x0112, + 0x4a4: 0x0113, 0x4a5: 0x0112, 0x4a6: 0x0113, 0x4a7: 0x0112, 0x4a8: 0x0113, 0x4a9: 0x0112, + 0x4aa: 0x8d8b, 0x4ab: 0x8deb, 0x4ac: 0x8e4b, 0x4ad: 0x8eab, 0x4ae: 0x8f0b, 0x4af: 0x0012, + 0x4b0: 0x8f6b, 0x4b1: 0x8fcb, 0x4b2: 0x902b, 0x4b3: 0xb353, 0x4b4: 0x0113, 0x4b5: 0x0112, + 0x4b6: 0x0113, 0x4b7: 0x0112, 0x4b8: 0x0113, 0x4b9: 0x0112, 0x4ba: 0x0113, 0x4bb: 0x0112, + 0x4bc: 0x0113, 0x4bd: 0x0112, 0x4be: 0x0113, 0x4bf: 0x0112, + // Block 0x13, offset 0x4c0 + 0x4c0: 0x90ea, 0x4c1: 0x916a, 0x4c2: 0x91ea, 0x4c3: 0x926a, 0x4c4: 0x931a, 0x4c5: 0x93ca, + 0x4c6: 0x944a, + 0x4d3: 0x94ca, 0x4d4: 0x95aa, 0x4d5: 0x968a, 0x4d6: 0x976a, 0x4d7: 0x984a, + 0x4dd: 0x0010, + 0x4de: 0x0034, 0x4df: 0x0010, 0x4e0: 0x0010, 0x4e1: 0x0010, 0x4e2: 0x0010, 0x4e3: 0x0010, + 0x4e4: 0x0010, 0x4e5: 0x0010, 0x4e6: 0x0010, 0x4e7: 0x0010, 0x4e8: 0x0010, + 0x4ea: 0x0010, 0x4eb: 0x0010, 0x4ec: 0x0010, 0x4ed: 0x0010, 0x4ee: 0x0010, 0x4ef: 0x0010, + 0x4f0: 0x0010, 0x4f1: 0x0010, 0x4f2: 0x0010, 0x4f3: 0x0010, 0x4f4: 0x0010, 0x4f5: 0x0010, + 0x4f6: 0x0010, 0x4f8: 0x0010, 0x4f9: 0x0010, 0x4fa: 0x0010, 0x4fb: 0x0010, + 0x4fc: 0x0010, 0x4fe: 0x0010, + // Block 0x14, offset 0x500 + 0x500: 0x2213, 0x501: 0x2213, 0x502: 0x2613, 0x503: 0x2613, 0x504: 0x2213, 0x505: 0x2213, + 0x506: 0x2e13, 0x507: 0x2e13, 0x508: 0x2213, 0x509: 0x2213, 0x50a: 0x2613, 0x50b: 0x2613, + 0x50c: 0x2213, 0x50d: 0x2213, 0x50e: 0x3e13, 0x50f: 0x3e13, 0x510: 0x2213, 0x511: 0x2213, + 0x512: 0x2613, 0x513: 0x2613, 0x514: 0x2213, 0x515: 0x2213, 0x516: 0x2e13, 0x517: 0x2e13, + 0x518: 0x2213, 0x519: 0x2213, 0x51a: 0x2613, 0x51b: 0x2613, 0x51c: 0x2213, 0x51d: 0x2213, + 0x51e: 0xbc53, 0x51f: 0xbc53, 0x520: 0xbf53, 0x521: 0xbf53, 0x522: 0x2212, 0x523: 0x2212, + 0x524: 0x2612, 0x525: 0x2612, 0x526: 0x2212, 0x527: 0x2212, 0x528: 0x2e12, 0x529: 0x2e12, + 0x52a: 0x2212, 0x52b: 0x2212, 0x52c: 0x2612, 0x52d: 0x2612, 0x52e: 0x2212, 0x52f: 0x2212, + 0x530: 0x3e12, 0x531: 0x3e12, 0x532: 0x2212, 0x533: 0x2212, 0x534: 0x2612, 0x535: 0x2612, + 0x536: 0x2212, 0x537: 0x2212, 0x538: 0x2e12, 0x539: 0x2e12, 0x53a: 0x2212, 0x53b: 0x2212, + 0x53c: 0x2612, 0x53d: 0x2612, 0x53e: 0x2212, 0x53f: 0x2212, + // Block 0x15, offset 0x540 + 0x542: 0x0010, + 0x547: 0x0010, 0x549: 0x0010, 0x54b: 0x0010, + 0x54d: 0x0010, 0x54e: 0x0010, 0x54f: 0x0010, 0x551: 0x0010, + 0x552: 0x0010, 0x554: 0x0010, 0x557: 0x0010, + 0x559: 0x0010, 0x55b: 0x0010, 0x55d: 0x0010, + 0x55f: 0x0010, 0x561: 0x0010, 0x562: 0x0010, + 0x564: 0x0010, 0x567: 0x0010, 0x568: 0x0010, 0x569: 0x0010, + 0x56a: 0x0010, 0x56c: 0x0010, 0x56d: 0x0010, 0x56e: 0x0010, 0x56f: 0x0010, + 0x570: 0x0010, 0x571: 0x0010, 0x572: 0x0010, 0x574: 0x0010, 0x575: 0x0010, + 0x576: 0x0010, 0x577: 0x0010, 0x579: 0x0010, 0x57a: 0x0010, 0x57b: 0x0010, + 0x57c: 0x0010, 0x57e: 0x0010, +} + +// caseIndex: 25 blocks, 1600 entries, 3200 bytes +// Block 0 is the zero block. +var caseIndex = [1600]uint16{ + // Block 0x0, offset 0x0 + // Block 0x1, offset 0x40 + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc2: 0x14, 0xc3: 0x15, 0xc4: 0x16, 0xc5: 0x17, 0xc6: 0x01, 0xc7: 0x02, + 0xc8: 0x18, 0xc9: 0x03, 0xca: 0x04, 0xcb: 0x19, 0xcc: 0x1a, 0xcd: 0x05, 0xce: 0x06, 0xcf: 0x07, + 0xd0: 0x1b, 0xd1: 0x1c, 0xd2: 0x1d, 0xd3: 0x1e, 0xd4: 0x1f, 0xd5: 0x20, 0xd6: 0x08, 0xd7: 0x21, + 0xd8: 0x22, 0xd9: 0x23, 0xda: 0x24, 0xdb: 0x25, 0xdc: 0x26, 0xdd: 0x27, 0xde: 0x28, 0xdf: 0x29, + 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, + 0xea: 0x06, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x08, 0xef: 0x09, + 0xf0: 0x14, 0xf3: 0x16, + // Block 0x4, offset 0x100 + 0x120: 0x2a, 0x121: 0x2b, 0x122: 0x2c, 0x123: 0x2d, 0x124: 0x2e, 0x125: 0x2f, 0x126: 0x30, 0x127: 0x31, + 0x128: 0x32, 0x129: 0x33, 0x12a: 0x34, 0x12b: 0x35, 0x12c: 0x36, 0x12d: 0x37, 0x12e: 0x38, 0x12f: 0x39, + 0x130: 0x3a, 0x131: 0x3b, 0x132: 0x3c, 0x133: 0x3d, 0x134: 0x3e, 0x135: 0x3f, 0x136: 0x40, 0x137: 0x41, + 0x138: 0x42, 0x139: 0x43, 0x13a: 0x44, 0x13b: 0x45, 0x13c: 0x46, 0x13d: 0x47, 0x13e: 0x48, 0x13f: 0x49, + // Block 0x5, offset 0x140 + 0x140: 0x4a, 0x141: 0x4b, 0x142: 0x4c, 0x143: 0x09, 0x144: 0x24, 0x145: 0x24, 0x146: 0x24, 0x147: 0x24, + 0x148: 0x24, 0x149: 0x4d, 0x14a: 0x4e, 0x14b: 0x4f, 0x14c: 0x50, 0x14d: 0x51, 0x14e: 0x52, 0x14f: 0x53, + 0x150: 0x54, 0x151: 0x24, 0x152: 0x24, 0x153: 0x24, 0x154: 0x24, 0x155: 0x24, 0x156: 0x24, 0x157: 0x24, + 0x158: 0x24, 0x159: 0x55, 0x15a: 0x56, 0x15b: 0x57, 0x15c: 0x58, 0x15d: 0x59, 0x15e: 0x5a, 0x15f: 0x5b, + 0x160: 0x5c, 0x161: 0x5d, 0x162: 0x5e, 0x163: 0x5f, 0x164: 0x60, 0x165: 0x61, 0x167: 0x62, + 0x168: 0x63, 0x169: 0x64, 0x16a: 0x65, 0x16b: 0x66, 0x16c: 0x67, 0x16d: 0x68, 0x16e: 0x69, 0x16f: 0x6a, + 0x170: 0x6b, 0x171: 0x6c, 0x172: 0x6d, 0x173: 0x6e, 0x174: 0x6f, 0x175: 0x70, 0x176: 0x71, 0x177: 0x72, + 0x178: 0x73, 0x179: 0x73, 0x17a: 0x74, 0x17b: 0x73, 0x17c: 0x75, 0x17d: 0x0a, 0x17e: 0x0b, 0x17f: 0x0c, + // Block 0x6, offset 0x180 + 0x180: 0x76, 0x181: 0x77, 0x182: 0x78, 0x183: 0x79, 0x184: 0x0d, 0x185: 0x7a, 0x186: 0x7b, + 0x192: 0x7c, 0x193: 0x0e, + 0x1b0: 0x7d, 0x1b1: 0x0f, 0x1b2: 0x73, 0x1b3: 0x7e, 0x1b4: 0x7f, 0x1b5: 0x80, 0x1b6: 0x81, 0x1b7: 0x82, + 0x1b8: 0x83, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x84, 0x1c2: 0x85, 0x1c3: 0x86, 0x1c4: 0x87, 0x1c5: 0x24, 0x1c6: 0x88, + // Block 0x8, offset 0x200 + 0x200: 0x89, 0x201: 0x24, 0x202: 0x24, 0x203: 0x24, 0x204: 0x24, 0x205: 0x24, 0x206: 0x24, 0x207: 0x24, + 0x208: 0x24, 0x209: 0x24, 0x20a: 0x24, 0x20b: 0x24, 0x20c: 0x24, 0x20d: 0x24, 0x20e: 0x24, 0x20f: 0x24, + 0x210: 0x24, 0x211: 0x24, 0x212: 0x8a, 0x213: 0x8b, 0x214: 0x24, 0x215: 0x24, 0x216: 0x24, 0x217: 0x24, + 0x218: 0x8c, 0x219: 0x8d, 0x21a: 0x8e, 0x21b: 0x8f, 0x21c: 0x90, 0x21d: 0x91, 0x21e: 0x10, 0x21f: 0x92, + 0x220: 0x93, 0x221: 0x94, 0x222: 0x24, 0x223: 0x95, 0x224: 0x96, 0x225: 0x97, 0x226: 0x98, 0x227: 0x99, + 0x228: 0x9a, 0x229: 0x9b, 0x22a: 0x9c, 0x22b: 0x9d, 0x22c: 0x9e, 0x22d: 0x9f, 0x22e: 0xa0, 0x22f: 0xa1, + 0x230: 0x24, 0x231: 0x24, 0x232: 0x24, 0x233: 0x24, 0x234: 0x24, 0x235: 0x24, 0x236: 0x24, 0x237: 0x24, + 0x238: 0x24, 0x239: 0x24, 0x23a: 0x24, 0x23b: 0x24, 0x23c: 0x24, 0x23d: 0x24, 0x23e: 0x24, 0x23f: 0x24, + // Block 0x9, offset 0x240 + 0x240: 0x24, 0x241: 0x24, 0x242: 0x24, 0x243: 0x24, 0x244: 0x24, 0x245: 0x24, 0x246: 0x24, 0x247: 0x24, + 0x248: 0x24, 0x249: 0x24, 0x24a: 0x24, 0x24b: 0x24, 0x24c: 0x24, 0x24d: 0x24, 0x24e: 0x24, 0x24f: 0x24, + 0x250: 0x24, 0x251: 0x24, 0x252: 0x24, 0x253: 0x24, 0x254: 0x24, 0x255: 0x24, 0x256: 0x24, 0x257: 0x24, + 0x258: 0x24, 0x259: 0x24, 0x25a: 0x24, 0x25b: 0x24, 0x25c: 0x24, 0x25d: 0x24, 0x25e: 0x24, 0x25f: 0x24, + 0x260: 0x24, 0x261: 0x24, 0x262: 0x24, 0x263: 0x24, 0x264: 0x24, 0x265: 0x24, 0x266: 0x24, 0x267: 0x24, + 0x268: 0x24, 0x269: 0x24, 0x26a: 0x24, 0x26b: 0x24, 0x26c: 0x24, 0x26d: 0x24, 0x26e: 0x24, 0x26f: 0x24, + 0x270: 0x24, 0x271: 0x24, 0x272: 0x24, 0x273: 0x24, 0x274: 0x24, 0x275: 0x24, 0x276: 0x24, 0x277: 0x24, + 0x278: 0x24, 0x279: 0x24, 0x27a: 0x24, 0x27b: 0x24, 0x27c: 0x24, 0x27d: 0x24, 0x27e: 0x24, 0x27f: 0x24, + // Block 0xa, offset 0x280 + 0x280: 0x24, 0x281: 0x24, 0x282: 0x24, 0x283: 0x24, 0x284: 0x24, 0x285: 0x24, 0x286: 0x24, 0x287: 0x24, + 0x288: 0x24, 0x289: 0x24, 0x28a: 0x24, 0x28b: 0x24, 0x28c: 0x24, 0x28d: 0x24, 0x28e: 0x24, 0x28f: 0x24, + 0x290: 0x24, 0x291: 0x24, 0x292: 0x24, 0x293: 0x24, 0x294: 0x24, 0x295: 0x24, 0x296: 0x24, 0x297: 0x24, + 0x298: 0x24, 0x299: 0x24, 0x29a: 0x24, 0x29b: 0x24, 0x29c: 0x24, 0x29d: 0x24, 0x29e: 0xa2, 0x29f: 0xa3, + // Block 0xb, offset 0x2c0 + 0x2ec: 0x11, 0x2ed: 0xa4, 0x2ee: 0xa5, 0x2ef: 0xa6, + 0x2f0: 0x24, 0x2f1: 0x24, 0x2f2: 0x24, 0x2f3: 0x24, 0x2f4: 0xa7, 0x2f5: 0xa8, 0x2f6: 0xa9, 0x2f7: 0xaa, + 0x2f8: 0xab, 0x2f9: 0xac, 0x2fa: 0x24, 0x2fb: 0xad, 0x2fc: 0xae, 0x2fd: 0xaf, 0x2fe: 0xb0, 0x2ff: 0xb1, + // Block 0xc, offset 0x300 + 0x300: 0xb2, 0x301: 0xb3, 0x302: 0x24, 0x303: 0xb4, 0x305: 0xb5, 0x307: 0xb6, + 0x30a: 0xb7, 0x30b: 0xb8, 0x30c: 0xb9, 0x30d: 0xba, 0x30e: 0xbb, 0x30f: 0xbc, + 0x310: 0xbd, 0x311: 0xbe, 0x312: 0xbf, 0x313: 0xc0, 0x314: 0xc1, 0x315: 0xc2, + 0x318: 0x24, 0x319: 0x24, 0x31a: 0x24, 0x31b: 0x24, 0x31c: 0xc3, 0x31d: 0xc4, + 0x320: 0xc5, 0x321: 0xc6, 0x322: 0xc7, 0x323: 0xc8, 0x324: 0xc9, 0x326: 0xca, + 0x328: 0xcb, 0x329: 0xcc, 0x32a: 0xcd, 0x32b: 0xce, 0x32c: 0x5f, 0x32d: 0xcf, 0x32e: 0xd0, + 0x330: 0x24, 0x331: 0xd1, 0x332: 0xd2, 0x333: 0xd3, 0x334: 0xd4, + 0x33a: 0xd5, 0x33c: 0xd6, 0x33d: 0xd7, 0x33e: 0xd8, 0x33f: 0xd9, + // Block 0xd, offset 0x340 + 0x340: 0xda, 0x341: 0xdb, 0x342: 0xdc, 0x343: 0xdd, 0x344: 0xde, 0x345: 0xdf, 0x346: 0xe0, 0x347: 0xe1, + 0x348: 0xe2, 0x34a: 0xe3, 0x34b: 0xe4, 0x34c: 0xe5, 0x34d: 0xe6, + 0x350: 0xe7, 0x351: 0xe8, 0x352: 0xe9, 0x353: 0xea, 0x356: 0xeb, 0x357: 0xec, + 0x358: 0xed, 0x359: 0xee, 0x35a: 0xef, 0x35b: 0xf0, 0x35c: 0xf1, + 0x360: 0xf2, 0x362: 0xf3, 0x363: 0xf4, 0x364: 0xf5, 0x365: 0xf6, 0x366: 0xf7, 0x367: 0xf8, + 0x368: 0xf9, 0x369: 0xfa, 0x36a: 0xfb, 0x36b: 0xfc, + 0x370: 0xfd, 0x371: 0xfe, 0x372: 0xff, 0x374: 0x100, 0x375: 0x101, 0x376: 0x102, + 0x37b: 0x103, 0x37e: 0x104, + // Block 0xe, offset 0x380 + 0x380: 0x24, 0x381: 0x24, 0x382: 0x24, 0x383: 0x24, 0x384: 0x24, 0x385: 0x24, 0x386: 0x24, 0x387: 0x24, + 0x388: 0x24, 0x389: 0x24, 0x38a: 0x24, 0x38b: 0x24, 0x38c: 0x24, 0x38d: 0x24, 0x38e: 0x105, + 0x390: 0x24, 0x391: 0x106, 0x392: 0x24, 0x393: 0x24, 0x394: 0x24, 0x395: 0x107, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x24, 0x3c1: 0x24, 0x3c2: 0x24, 0x3c3: 0x24, 0x3c4: 0x24, 0x3c5: 0x24, 0x3c6: 0x24, 0x3c7: 0x24, + 0x3c8: 0x24, 0x3c9: 0x24, 0x3ca: 0x24, 0x3cb: 0x24, 0x3cc: 0x24, 0x3cd: 0x24, 0x3ce: 0x24, 0x3cf: 0x24, + 0x3d0: 0x108, + // Block 0x10, offset 0x400 + 0x410: 0x24, 0x411: 0x24, 0x412: 0x24, 0x413: 0x24, 0x414: 0x24, 0x415: 0x24, 0x416: 0x24, 0x417: 0x24, + 0x418: 0x24, 0x419: 0x109, + // Block 0x11, offset 0x440 + 0x460: 0x24, 0x461: 0x24, 0x462: 0x24, 0x463: 0x24, 0x464: 0x24, 0x465: 0x24, 0x466: 0x24, 0x467: 0x24, + 0x468: 0xfc, 0x469: 0x10a, 0x46b: 0x10b, 0x46c: 0x10c, 0x46d: 0x10d, 0x46e: 0x10e, + 0x479: 0x10f, 0x47c: 0x24, 0x47d: 0x110, 0x47e: 0x111, 0x47f: 0x112, + // Block 0x12, offset 0x480 + 0x4b0: 0x24, 0x4b1: 0x113, 0x4b2: 0x114, + // Block 0x13, offset 0x4c0 + 0x4c5: 0x115, 0x4c6: 0x116, + 0x4c9: 0x117, + 0x4d0: 0x118, 0x4d1: 0x119, 0x4d2: 0x11a, 0x4d3: 0x11b, 0x4d4: 0x11c, 0x4d5: 0x11d, 0x4d6: 0x11e, 0x4d7: 0x11f, + 0x4d8: 0x120, 0x4d9: 0x121, 0x4da: 0x122, 0x4db: 0x123, 0x4dc: 0x124, 0x4dd: 0x125, 0x4de: 0x126, 0x4df: 0x127, + 0x4e8: 0x128, 0x4e9: 0x129, 0x4ea: 0x12a, + // Block 0x14, offset 0x500 + 0x500: 0x12b, 0x504: 0x12c, 0x505: 0x12d, + 0x50b: 0x12e, + 0x520: 0x24, 0x521: 0x24, 0x522: 0x24, 0x523: 0x12f, 0x524: 0x12, 0x525: 0x130, + 0x538: 0x131, 0x539: 0x13, 0x53a: 0x132, + // Block 0x15, offset 0x540 + 0x544: 0x133, 0x545: 0x134, 0x546: 0x135, + 0x54f: 0x136, + 0x56f: 0x137, + // Block 0x16, offset 0x580 + 0x590: 0x0a, 0x591: 0x0b, 0x592: 0x0c, 0x593: 0x0d, 0x594: 0x0e, 0x596: 0x0f, + 0x59b: 0x10, 0x59d: 0x11, 0x59e: 0x12, 0x59f: 0x13, + // Block 0x17, offset 0x5c0 + 0x5c0: 0x138, 0x5c1: 0x139, 0x5c4: 0x139, 0x5c5: 0x139, 0x5c6: 0x139, 0x5c7: 0x13a, + // Block 0x18, offset 0x600 + 0x620: 0x15, +} + +// sparseOffsets: 296 entries, 592 bytes +var sparseOffsets = []uint16{0x0, 0x9, 0xf, 0x18, 0x24, 0x2e, 0x34, 0x37, 0x3b, 0x3e, 0x42, 0x4c, 0x4e, 0x57, 0x5e, 0x63, 0x71, 0x72, 0x80, 0x8f, 0x99, 0x9c, 0xa3, 0xab, 0xae, 0xb0, 0xc0, 0xc6, 0xd4, 0xdf, 0xec, 0xf7, 0x103, 0x10d, 0x119, 0x124, 0x130, 0x13c, 0x144, 0x14d, 0x157, 0x162, 0x16e, 0x174, 0x17f, 0x185, 0x18d, 0x190, 0x195, 0x199, 0x19d, 0x1a4, 0x1ad, 0x1b5, 0x1b6, 0x1bf, 0x1c6, 0x1ce, 0x1d4, 0x1d9, 0x1dd, 0x1e0, 0x1e2, 0x1e5, 0x1ea, 0x1eb, 0x1ed, 0x1ef, 0x1f1, 0x1f8, 0x1fd, 0x201, 0x20a, 0x20d, 0x210, 0x216, 0x217, 0x222, 0x223, 0x224, 0x229, 0x236, 0x23f, 0x240, 0x248, 0x251, 0x25a, 0x263, 0x268, 0x26b, 0x276, 0x284, 0x286, 0x28d, 0x291, 0x29d, 0x29e, 0x2a9, 0x2b1, 0x2b9, 0x2bf, 0x2c0, 0x2ce, 0x2d3, 0x2d6, 0x2db, 0x2df, 0x2e5, 0x2ea, 0x2ed, 0x2f2, 0x2f7, 0x2f8, 0x2fe, 0x300, 0x301, 0x303, 0x305, 0x308, 0x309, 0x30b, 0x30e, 0x314, 0x318, 0x31a, 0x31f, 0x326, 0x331, 0x33b, 0x33c, 0x345, 0x349, 0x34e, 0x356, 0x35c, 0x362, 0x36c, 0x371, 0x37a, 0x380, 0x389, 0x38d, 0x395, 0x397, 0x399, 0x39c, 0x39e, 0x3a0, 0x3a1, 0x3a2, 0x3a4, 0x3a6, 0x3ac, 0x3b1, 0x3b3, 0x3ba, 0x3bd, 0x3bf, 0x3c5, 0x3ca, 0x3cc, 0x3cd, 0x3ce, 0x3cf, 0x3d1, 0x3d3, 0x3d5, 0x3d8, 0x3da, 0x3dd, 0x3e5, 0x3e8, 0x3ec, 0x3f4, 0x3f6, 0x3f7, 0x3f8, 0x3fa, 0x400, 0x402, 0x403, 0x405, 0x407, 0x409, 0x416, 0x417, 0x418, 0x41c, 0x41e, 0x41f, 0x420, 0x421, 0x422, 0x425, 0x428, 0x42b, 0x431, 0x432, 0x434, 0x438, 0x43c, 0x442, 0x445, 0x44c, 0x450, 0x454, 0x45d, 0x466, 0x46c, 0x472, 0x47c, 0x486, 0x488, 0x491, 0x497, 0x49d, 0x4a3, 0x4a6, 0x4ac, 0x4af, 0x4b8, 0x4b9, 0x4c0, 0x4c4, 0x4c5, 0x4c8, 0x4d2, 0x4d5, 0x4d7, 0x4de, 0x4e6, 0x4ec, 0x4f2, 0x4f3, 0x4f9, 0x4fc, 0x504, 0x50b, 0x515, 0x51d, 0x520, 0x521, 0x522, 0x523, 0x524, 0x526, 0x527, 0x529, 0x52b, 0x52d, 0x531, 0x532, 0x534, 0x537, 0x539, 0x53c, 0x53e, 0x543, 0x548, 0x54c, 0x54d, 0x550, 0x554, 0x55f, 0x563, 0x56b, 0x570, 0x574, 0x577, 0x57b, 0x57e, 0x581, 0x586, 0x58a, 0x58e, 0x592, 0x596, 0x598, 0x59a, 0x59d, 0x5a2, 0x5a5, 0x5a7, 0x5aa, 0x5ac, 0x5b2, 0x5bb, 0x5c0, 0x5c1, 0x5c4, 0x5c5, 0x5c6, 0x5c7, 0x5c9, 0x5ca, 0x5cb} + +// sparseValues: 1483 entries, 5932 bytes +var sparseValues = [1483]valueRange{ + // Block 0x0, offset 0x0 + {value: 0x0004, lo: 0xa8, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xaa}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0004, lo: 0xaf, hi: 0xaf}, + {value: 0x0004, lo: 0xb4, hi: 0xb4}, + {value: 0x001a, lo: 0xb5, hi: 0xb5}, + {value: 0x0054, lo: 0xb7, hi: 0xb7}, + {value: 0x0004, lo: 0xb8, hi: 0xb8}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + // Block 0x1, offset 0x9 + {value: 0x2013, lo: 0x80, hi: 0x96}, + {value: 0x2013, lo: 0x98, hi: 0x9e}, + {value: 0x009a, lo: 0x9f, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xb6}, + {value: 0x2012, lo: 0xb8, hi: 0xbe}, + {value: 0x0252, lo: 0xbf, hi: 0xbf}, + // Block 0x2, offset 0xf + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x011b, lo: 0xb0, hi: 0xb0}, + {value: 0x019a, lo: 0xb1, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb7}, + {value: 0x0012, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x0553, lo: 0xbf, hi: 0xbf}, + // Block 0x3, offset 0x18 + {value: 0x0552, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x01da, lo: 0x89, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xb7}, + {value: 0x0253, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x028a, lo: 0xbf, hi: 0xbf}, + // Block 0x4, offset 0x24 + {value: 0x0117, lo: 0x80, hi: 0x9f}, + {value: 0x2f53, lo: 0xa0, hi: 0xa0}, + {value: 0x0012, lo: 0xa1, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xb3}, + {value: 0x0012, lo: 0xb4, hi: 0xb9}, + {value: 0x090b, lo: 0xba, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x2953, lo: 0xbd, hi: 0xbd}, + {value: 0x098b, lo: 0xbe, hi: 0xbe}, + {value: 0x0a0a, lo: 0xbf, hi: 0xbf}, + // Block 0x5, offset 0x2e + {value: 0x0015, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x97}, + {value: 0x0004, lo: 0x98, hi: 0x9d}, + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0015, lo: 0xa0, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xbf}, + // Block 0x6, offset 0x34 + {value: 0x0024, lo: 0x80, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbf}, + // Block 0x7, offset 0x37 + {value: 0x6553, lo: 0x80, hi: 0x8f}, + {value: 0x2013, lo: 0x90, hi: 0x9f}, + {value: 0x5f53, lo: 0xa0, hi: 0xaf}, + {value: 0x2012, lo: 0xb0, hi: 0xbf}, + // Block 0x8, offset 0x3b + {value: 0x5f52, lo: 0x80, hi: 0x8f}, + {value: 0x6552, lo: 0x90, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x9, offset 0x3e + {value: 0x0117, lo: 0x80, hi: 0x81}, + {value: 0x0024, lo: 0x83, hi: 0x87}, + {value: 0x0014, lo: 0x88, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xbf}, + // Block 0xa, offset 0x42 + {value: 0x0f13, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x0316, lo: 0x89, hi: 0x8a}, + {value: 0x0716, lo: 0x8b, hi: 0x8c}, + {value: 0x0316, lo: 0x8d, hi: 0x8e}, + {value: 0x0f12, lo: 0x8f, hi: 0x8f}, + {value: 0x0117, lo: 0x90, hi: 0xbf}, + // Block 0xb, offset 0x4c + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x6553, lo: 0xb1, hi: 0xbf}, + // Block 0xc, offset 0x4e + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6853, lo: 0x90, hi: 0x96}, + {value: 0x0014, lo: 0x99, hi: 0x99}, + {value: 0x0010, lo: 0x9a, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0054, lo: 0x9f, hi: 0x9f}, + {value: 0x0012, lo: 0xa0, hi: 0xa0}, + {value: 0x6552, lo: 0xa1, hi: 0xaf}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0xd, offset 0x57 + {value: 0x0034, lo: 0x81, hi: 0x82}, + {value: 0x0024, lo: 0x84, hi: 0x84}, + {value: 0x0034, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0xaa}, + {value: 0x0010, lo: 0xaf, hi: 0xb3}, + {value: 0x0054, lo: 0xb4, hi: 0xb4}, + // Block 0xe, offset 0x5e + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0024, lo: 0x90, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0014, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xf, offset 0x63 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9c}, + {value: 0x0024, lo: 0x9d, hi: 0x9e}, + {value: 0x0034, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0034, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x10, offset 0x71 + {value: 0x0010, lo: 0x80, hi: 0xbf}, + // Block 0x11, offset 0x72 + {value: 0x0010, lo: 0x80, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0024, lo: 0x9f, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xaa, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x12, offset 0x80 + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0034, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0034, lo: 0xb1, hi: 0xb1}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbd}, + {value: 0x0034, lo: 0xbe, hi: 0xbe}, + {value: 0x0024, lo: 0xbf, hi: 0xbf}, + // Block 0x13, offset 0x8f + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0024, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x88}, + {value: 0x0024, lo: 0x89, hi: 0x8a}, + {value: 0x0010, lo: 0x8d, hi: 0xbf}, + // Block 0x14, offset 0x99 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x15, offset 0x9c + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xb1}, + {value: 0x0034, lo: 0xb2, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0x16, offset 0xa3 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x99}, + {value: 0x0014, lo: 0x9a, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0xa3}, + {value: 0x0014, lo: 0xa4, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xad}, + // Block 0x17, offset 0xab + {value: 0x0010, lo: 0x80, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0xa0, hi: 0xaa}, + // Block 0x18, offset 0xae + {value: 0x0010, lo: 0xa0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0x19, offset 0xb0 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0034, lo: 0x93, hi: 0x93}, + {value: 0x0024, lo: 0x94, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0024, lo: 0xaa, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbf}, + // Block 0x1a, offset 0xc0 + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1b, offset 0xc6 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0x1c, offset 0xd4 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb6, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1d, offset 0xdf + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xb1}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + // Block 0x1e, offset 0xec + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x1f, offset 0xf7 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x99, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x20, offset 0x103 + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x21, offset 0x10d + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x85}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xbf}, + // Block 0x22, offset 0x119 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x23, offset 0x124 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x24, offset 0x130 + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0010, lo: 0xa8, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x25, offset 0x13c + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x26, offset 0x144 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb9}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbf}, + // Block 0x27, offset 0x14d + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x88}, + {value: 0x0014, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x28, offset 0x157 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x29, offset 0x162 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb2}, + // Block 0x2a, offset 0x16e + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x2b, offset 0x174 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x94, hi: 0x97}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xba, hi: 0xbf}, + // Block 0x2c, offset 0x17f + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x96}, + {value: 0x0010, lo: 0x9a, hi: 0xb1}, + {value: 0x0010, lo: 0xb3, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x2d, offset 0x185 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x94}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9f}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + // Block 0x2e, offset 0x18d + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xba}, + // Block 0x2f, offset 0x190 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x30, offset 0x195 + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xba}, + {value: 0x0014, lo: 0xbb, hi: 0xbc}, + // Block 0x31, offset 0x199 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x32, offset 0x19d + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0034, lo: 0x98, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0034, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x33, offset 0x1a4 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xac}, + {value: 0x0034, lo: 0xb1, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xba, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x34, offset 0x1ad + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0024, lo: 0x82, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x86, hi: 0x87}, + {value: 0x0010, lo: 0x88, hi: 0x8c}, + {value: 0x0014, lo: 0x8d, hi: 0x97}, + {value: 0x0014, lo: 0x99, hi: 0xbc}, + // Block 0x35, offset 0x1b5 + {value: 0x0034, lo: 0x86, hi: 0x86}, + // Block 0x36, offset 0x1b6 + {value: 0x0010, lo: 0xab, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbe}, + // Block 0x37, offset 0x1bf + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x96, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x99}, + {value: 0x0014, lo: 0x9e, hi: 0xa0}, + {value: 0x0010, lo: 0xa2, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xad}, + {value: 0x0014, lo: 0xb1, hi: 0xb4}, + // Block 0x38, offset 0x1c6 + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x6c53, lo: 0xa0, hi: 0xbf}, + // Block 0x39, offset 0x1ce + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x9a, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x3a, offset 0x1d4 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x3b, offset 0x1d9 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x82, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3c, offset 0x1dd + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3d, offset 0x1e0 + {value: 0x0010, lo: 0x80, hi: 0x9a}, + {value: 0x0024, lo: 0x9d, hi: 0x9f}, + // Block 0x3e, offset 0x1e2 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x7453, lo: 0xa0, hi: 0xaf}, + {value: 0x7853, lo: 0xb0, hi: 0xbf}, + // Block 0x3f, offset 0x1e5 + {value: 0x7c53, lo: 0x80, hi: 0x8f}, + {value: 0x8053, lo: 0x90, hi: 0x9f}, + {value: 0x7c53, lo: 0xa0, hi: 0xaf}, + {value: 0x0813, lo: 0xb0, hi: 0xb5}, + {value: 0x0892, lo: 0xb8, hi: 0xbd}, + // Block 0x40, offset 0x1ea + {value: 0x0010, lo: 0x81, hi: 0xbf}, + // Block 0x41, offset 0x1eb + {value: 0x0010, lo: 0x80, hi: 0xac}, + {value: 0x0010, lo: 0xaf, hi: 0xbf}, + // Block 0x42, offset 0x1ed + {value: 0x0010, lo: 0x81, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x43, offset 0x1ef + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb8}, + // Block 0x44, offset 0x1f1 + {value: 0x0010, lo: 0x80, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0034, lo: 0x94, hi: 0x94}, + {value: 0x0010, lo: 0xa0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + // Block 0x45, offset 0x1f8 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xac}, + {value: 0x0010, lo: 0xae, hi: 0xb0}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + // Block 0x46, offset 0x1fd + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x47, offset 0x201 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x89, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0014, lo: 0x93, hi: 0x93}, + {value: 0x0004, lo: 0x97, hi: 0x97}, + {value: 0x0024, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0x48, offset 0x20a + {value: 0x0014, lo: 0x8b, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x49, offset 0x20d + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb8}, + // Block 0x4a, offset 0x210 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x4b, offset 0x216 + {value: 0x0010, lo: 0x80, hi: 0xb5}, + // Block 0x4c, offset 0x217 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbb}, + // Block 0x4d, offset 0x222 + {value: 0x0010, lo: 0x86, hi: 0x8f}, + // Block 0x4e, offset 0x223 + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x4f, offset 0x224 + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + // Block 0x50, offset 0x229 + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x9e}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xac}, + {value: 0x0010, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xbc}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x51, offset 0x236 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xa7, hi: 0xa7}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + {value: 0x0034, lo: 0xb5, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbc}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x52, offset 0x23f + {value: 0x0034, lo: 0x80, hi: 0x80}, + // Block 0x53, offset 0x240 + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x54, offset 0x248 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0030, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8b}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xab, hi: 0xab}, + {value: 0x0034, lo: 0xac, hi: 0xac}, + {value: 0x0024, lo: 0xad, hi: 0xb3}, + // Block 0x55, offset 0x251 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0030, lo: 0xaa, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbf}, + // Block 0x56, offset 0x25a + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0030, lo: 0xb2, hi: 0xb3}, + // Block 0x57, offset 0x263 + {value: 0x0010, lo: 0x80, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + // Block 0x58, offset 0x268 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8d, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x59, offset 0x26b + {value: 0x31ea, lo: 0x80, hi: 0x80}, + {value: 0x326a, lo: 0x81, hi: 0x81}, + {value: 0x32ea, lo: 0x82, hi: 0x82}, + {value: 0x336a, lo: 0x83, hi: 0x83}, + {value: 0x33ea, lo: 0x84, hi: 0x84}, + {value: 0x346a, lo: 0x85, hi: 0x85}, + {value: 0x34ea, lo: 0x86, hi: 0x86}, + {value: 0x356a, lo: 0x87, hi: 0x87}, + {value: 0x35ea, lo: 0x88, hi: 0x88}, + {value: 0x8353, lo: 0x90, hi: 0xba}, + {value: 0x8353, lo: 0xbd, hi: 0xbf}, + // Block 0x5a, offset 0x276 + {value: 0x0024, lo: 0x90, hi: 0x92}, + {value: 0x0034, lo: 0x94, hi: 0x99}, + {value: 0x0024, lo: 0x9a, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9f}, + {value: 0x0024, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0034, lo: 0xa2, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xb3}, + {value: 0x0024, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb7}, + {value: 0x0024, lo: 0xb8, hi: 0xb9}, + {value: 0x0010, lo: 0xba, hi: 0xba}, + // Block 0x5b, offset 0x284 + {value: 0x0012, lo: 0x80, hi: 0xab}, + {value: 0x0015, lo: 0xac, hi: 0xbf}, + // Block 0x5c, offset 0x286 + {value: 0x0015, lo: 0x80, hi: 0xaa}, + {value: 0x0012, lo: 0xab, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb8}, + {value: 0x8752, lo: 0xb9, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbc}, + {value: 0x8b52, lo: 0xbd, hi: 0xbd}, + {value: 0x0012, lo: 0xbe, hi: 0xbf}, + // Block 0x5d, offset 0x28d + {value: 0x0012, lo: 0x80, hi: 0x8d}, + {value: 0x8f52, lo: 0x8e, hi: 0x8e}, + {value: 0x0012, lo: 0x8f, hi: 0x9a}, + {value: 0x0015, lo: 0x9b, hi: 0xbf}, + // Block 0x5e, offset 0x291 + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0024, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb9}, + {value: 0x0024, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbd}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x5f, offset 0x29d + {value: 0x0117, lo: 0x80, hi: 0xbf}, + // Block 0x60, offset 0x29e + {value: 0x0117, lo: 0x80, hi: 0x95}, + {value: 0x369a, lo: 0x96, hi: 0x96}, + {value: 0x374a, lo: 0x97, hi: 0x97}, + {value: 0x37fa, lo: 0x98, hi: 0x98}, + {value: 0x38aa, lo: 0x99, hi: 0x99}, + {value: 0x395a, lo: 0x9a, hi: 0x9a}, + {value: 0x3a0a, lo: 0x9b, hi: 0x9b}, + {value: 0x0012, lo: 0x9c, hi: 0x9d}, + {value: 0x3abb, lo: 0x9e, hi: 0x9e}, + {value: 0x0012, lo: 0x9f, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x61, offset 0x2a9 + {value: 0x0812, lo: 0x80, hi: 0x87}, + {value: 0x0813, lo: 0x88, hi: 0x8f}, + {value: 0x0812, lo: 0x90, hi: 0x95}, + {value: 0x0813, lo: 0x98, hi: 0x9d}, + {value: 0x0812, lo: 0xa0, hi: 0xa7}, + {value: 0x0813, lo: 0xa8, hi: 0xaf}, + {value: 0x0812, lo: 0xb0, hi: 0xb7}, + {value: 0x0813, lo: 0xb8, hi: 0xbf}, + // Block 0x62, offset 0x2b1 + {value: 0x0004, lo: 0x8b, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8f}, + {value: 0x0054, lo: 0x98, hi: 0x99}, + {value: 0x0054, lo: 0xa4, hi: 0xa4}, + {value: 0x0054, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xaa, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xaf}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x63, offset 0x2b9 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x94, hi: 0x94}, + {value: 0x0014, lo: 0xa0, hi: 0xa4}, + {value: 0x0014, lo: 0xa6, hi: 0xaf}, + {value: 0x0015, lo: 0xb1, hi: 0xb1}, + {value: 0x0015, lo: 0xbf, hi: 0xbf}, + // Block 0x64, offset 0x2bf + {value: 0x0015, lo: 0x90, hi: 0x9c}, + // Block 0x65, offset 0x2c0 + {value: 0x0024, lo: 0x90, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x93}, + {value: 0x0024, lo: 0x94, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0xa0}, + {value: 0x0024, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa4}, + {value: 0x0034, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa7}, + {value: 0x0034, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xa9}, + {value: 0x0034, lo: 0xaa, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + // Block 0x66, offset 0x2ce + {value: 0x0016, lo: 0x85, hi: 0x86}, + {value: 0x0012, lo: 0x87, hi: 0x89}, + {value: 0xa452, lo: 0x8e, hi: 0x8e}, + {value: 0x1013, lo: 0xa0, hi: 0xaf}, + {value: 0x1012, lo: 0xb0, hi: 0xbf}, + // Block 0x67, offset 0x2d3 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x88}, + // Block 0x68, offset 0x2d6 + {value: 0xa753, lo: 0xb6, hi: 0xb7}, + {value: 0xaa53, lo: 0xb8, hi: 0xb9}, + {value: 0xad53, lo: 0xba, hi: 0xbb}, + {value: 0xaa53, lo: 0xbc, hi: 0xbd}, + {value: 0xa753, lo: 0xbe, hi: 0xbf}, + // Block 0x69, offset 0x2db + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6553, lo: 0x90, hi: 0x9f}, + {value: 0xb053, lo: 0xa0, hi: 0xae}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0x6a, offset 0x2df + {value: 0x0117, lo: 0x80, hi: 0xa3}, + {value: 0x0012, lo: 0xa4, hi: 0xa4}, + {value: 0x0716, lo: 0xab, hi: 0xac}, + {value: 0x0316, lo: 0xad, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb3}, + // Block 0x6b, offset 0x2e5 + {value: 0x6c52, lo: 0x80, hi: 0x9f}, + {value: 0x7052, lo: 0xa0, hi: 0xa5}, + {value: 0x7052, lo: 0xa7, hi: 0xa7}, + {value: 0x7052, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x6c, offset 0x2ea + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x6d, offset 0x2ed + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0010, lo: 0xb0, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x6e, offset 0x2f2 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9e}, + {value: 0x0024, lo: 0xa0, hi: 0xbf}, + // Block 0x6f, offset 0x2f7 + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + // Block 0x70, offset 0x2f8 + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0xaa, hi: 0xad}, + {value: 0x0030, lo: 0xae, hi: 0xaf}, + {value: 0x0004, lo: 0xb1, hi: 0xb5}, + {value: 0x0014, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + // Block 0x71, offset 0x2fe + {value: 0x0034, lo: 0x99, hi: 0x9a}, + {value: 0x0004, lo: 0x9b, hi: 0x9e}, + // Block 0x72, offset 0x300 + {value: 0x0004, lo: 0xbc, hi: 0xbe}, + // Block 0x73, offset 0x301 + {value: 0x0010, lo: 0x85, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x74, offset 0x303 + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x75, offset 0x305 + {value: 0x0010, lo: 0x80, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0xbf}, + // Block 0x76, offset 0x308 + {value: 0x0010, lo: 0x80, hi: 0x8c}, + // Block 0x77, offset 0x309 + {value: 0x0010, lo: 0x90, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x78, offset 0x30b + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0xab}, + // Block 0x79, offset 0x30e + {value: 0x0117, lo: 0x80, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb2}, + {value: 0x0024, lo: 0xb4, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x7a, offset 0x314 + {value: 0x0117, lo: 0x80, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9d}, + {value: 0x0024, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x7b, offset 0x318 + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb1}, + // Block 0x7c, offset 0x31a + {value: 0x0004, lo: 0x80, hi: 0x87}, + {value: 0x0014, lo: 0x88, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xaf}, + {value: 0x0012, lo: 0xb0, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xbf}, + // Block 0x7d, offset 0x31f + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x0015, lo: 0xb0, hi: 0xb0}, + {value: 0x0012, lo: 0xb1, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x8753, lo: 0xbd, hi: 0xbd}, + {value: 0x0117, lo: 0xbe, hi: 0xbf}, + // Block 0x7e, offset 0x326 + {value: 0x0117, lo: 0x82, hi: 0x83}, + {value: 0x6553, lo: 0x84, hi: 0x84}, + {value: 0x908b, lo: 0x85, hi: 0x85}, + {value: 0x8f53, lo: 0x86, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x0316, lo: 0x89, hi: 0x8a}, + {value: 0x0316, lo: 0xb5, hi: 0xb6}, + {value: 0x0010, lo: 0xb7, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbf}, + // Block 0x7f, offset 0x331 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8b}, + {value: 0x0010, lo: 0x8c, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0034, lo: 0xac, hi: 0xac}, + // Block 0x80, offset 0x33b + {value: 0x0010, lo: 0x80, hi: 0xb3}, + // Block 0x81, offset 0x33c + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xa0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb7}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x82, offset 0x345 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x83, offset 0x349 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0x92}, + {value: 0x0030, lo: 0x93, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0x84, offset 0x34e + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb9}, + {value: 0x0010, lo: 0xba, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x85, offset 0x356 + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0004, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x86, offset 0x35c + {value: 0x0010, lo: 0x80, hi: 0xa8}, + {value: 0x0014, lo: 0xa9, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0x87, offset 0x362 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x88, offset 0x36c + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0024, lo: 0xbe, hi: 0xbf}, + // Block 0x89, offset 0x371 + {value: 0x0024, lo: 0x81, hi: 0x81}, + {value: 0x0004, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + // Block 0x8a, offset 0x37a + {value: 0x0010, lo: 0x81, hi: 0x86}, + {value: 0x0010, lo: 0x89, hi: 0x8e}, + {value: 0x0010, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x8b, offset 0x380 + {value: 0x0012, lo: 0x80, hi: 0x92}, + {value: 0xb352, lo: 0x93, hi: 0x93}, + {value: 0x0012, lo: 0x94, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9f}, + {value: 0x0012, lo: 0xa0, hi: 0xa8}, + {value: 0x0014, lo: 0xa9, hi: 0xa9}, + {value: 0x0004, lo: 0xaa, hi: 0xab}, + {value: 0x74d2, lo: 0xb0, hi: 0xbf}, + // Block 0x8c, offset 0x389 + {value: 0x78d2, lo: 0x80, hi: 0x8f}, + {value: 0x7cd2, lo: 0x90, hi: 0x9f}, + {value: 0x80d2, lo: 0xa0, hi: 0xaf}, + {value: 0x7cd2, lo: 0xb0, hi: 0xbf}, + // Block 0x8d, offset 0x38d + {value: 0x0010, lo: 0x80, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x8e, offset 0x395 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x8f, offset 0x397 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x8b, hi: 0xbb}, + // Block 0x90, offset 0x399 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0xbf}, + // Block 0x91, offset 0x39c + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0004, lo: 0xb2, hi: 0xbf}, + // Block 0x92, offset 0x39e + {value: 0x0004, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x93, hi: 0xbf}, + // Block 0x93, offset 0x3a0 + {value: 0x0010, lo: 0x80, hi: 0xbd}, + // Block 0x94, offset 0x3a1 + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0x95, offset 0x3a2 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0xbf}, + // Block 0x96, offset 0x3a4 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0xb0, hi: 0xbb}, + // Block 0x97, offset 0x3a6 + {value: 0x0014, lo: 0x80, hi: 0x8f}, + {value: 0x0054, lo: 0x93, hi: 0x93}, + {value: 0x0024, lo: 0xa0, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xad}, + {value: 0x0024, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + // Block 0x98, offset 0x3ac + {value: 0x0010, lo: 0x8d, hi: 0x8f}, + {value: 0x0054, lo: 0x92, hi: 0x92}, + {value: 0x0054, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0xb0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0x99, offset 0x3b1 + {value: 0x0010, lo: 0x80, hi: 0xbc}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x9a, offset 0x3b3 + {value: 0x0054, lo: 0x87, hi: 0x87}, + {value: 0x0054, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0054, lo: 0x9a, hi: 0x9a}, + {value: 0x5f53, lo: 0xa1, hi: 0xba}, + {value: 0x0004, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9b, offset 0x3ba + {value: 0x0004, lo: 0x80, hi: 0x80}, + {value: 0x5f52, lo: 0x81, hi: 0x9a}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + // Block 0x9c, offset 0x3bd + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbe}, + // Block 0x9d, offset 0x3bf + {value: 0x0010, lo: 0x82, hi: 0x87}, + {value: 0x0010, lo: 0x8a, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0x97}, + {value: 0x0010, lo: 0x9a, hi: 0x9c}, + {value: 0x0004, lo: 0xa3, hi: 0xa3}, + {value: 0x0014, lo: 0xb9, hi: 0xbb}, + // Block 0x9e, offset 0x3c5 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0010, lo: 0x8d, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xba}, + {value: 0x0010, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9f, offset 0x3ca + {value: 0x0010, lo: 0x80, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x9d}, + // Block 0xa0, offset 0x3cc + {value: 0x0010, lo: 0x80, hi: 0xba}, + // Block 0xa1, offset 0x3cd + {value: 0x0010, lo: 0x80, hi: 0xb4}, + // Block 0xa2, offset 0x3ce + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0xa3, offset 0x3cf + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa4, offset 0x3d1 + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + // Block 0xa5, offset 0x3d3 + {value: 0x0010, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xad, hi: 0xbf}, + // Block 0xa6, offset 0x3d5 + {value: 0x0010, lo: 0x80, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0xb5}, + {value: 0x0024, lo: 0xb6, hi: 0xba}, + // Block 0xa7, offset 0x3d8 + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa8, offset 0x3da + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x91, hi: 0x95}, + // Block 0xa9, offset 0x3dd + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x97}, + {value: 0xb653, lo: 0x98, hi: 0x9f}, + {value: 0xb953, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbf}, + // Block 0xaa, offset 0x3e5 + {value: 0xb652, lo: 0x80, hi: 0x87}, + {value: 0xb952, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0xab, offset 0x3e8 + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0xb953, lo: 0xb0, hi: 0xb7}, + {value: 0xb653, lo: 0xb8, hi: 0xbf}, + // Block 0xac, offset 0x3ec + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x93}, + {value: 0xb952, lo: 0x98, hi: 0x9f}, + {value: 0xb652, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbb}, + // Block 0xad, offset 0x3f4 + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xae, offset 0x3f6 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + // Block 0xaf, offset 0x3f7 + {value: 0x0010, lo: 0x80, hi: 0xb6}, + // Block 0xb0, offset 0x3f8 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xa7}, + // Block 0xb1, offset 0x3fa + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xb5}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xb2, offset 0x400 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb6}, + // Block 0xb3, offset 0x402 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + // Block 0xb4, offset 0x403 + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + // Block 0xb5, offset 0x405 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb9}, + // Block 0xb6, offset 0x407 + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0xb7, offset 0x409 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x8e, hi: 0x8e}, + {value: 0x0024, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x99, hi: 0xb5}, + {value: 0x0024, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xb8, offset 0x416 + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0xb9, offset 0x417 + {value: 0x0010, lo: 0x80, hi: 0x9c}, + // Block 0xba, offset 0x418 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + // Block 0xbb, offset 0x41c + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + // Block 0xbc, offset 0x41e + {value: 0x0010, lo: 0x80, hi: 0x91}, + // Block 0xbd, offset 0x41f + {value: 0x0010, lo: 0x80, hi: 0x88}, + // Block 0xbe, offset 0x420 + {value: 0x5653, lo: 0x80, hi: 0xb2}, + // Block 0xbf, offset 0x421 + {value: 0x5652, lo: 0x80, hi: 0xb2}, + // Block 0xc0, offset 0x422 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xc1, offset 0x425 + {value: 0x0010, lo: 0x80, hi: 0xa9}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0010, lo: 0xb0, hi: 0xb1}, + // Block 0xc2, offset 0x428 + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xc3, offset 0x42b + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x87}, + {value: 0x0024, lo: 0x88, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x8b}, + {value: 0x0024, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + // Block 0xc4, offset 0x431 + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xc5, offset 0x432 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0010, lo: 0xa0, hi: 0xb6}, + // Block 0xc6, offset 0x434 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xc7, offset 0x438 + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xc8, offset 0x43c + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb6}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + // Block 0xc9, offset 0x442 + {value: 0x0014, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xca, offset 0x445 + {value: 0x0024, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0xcb, offset 0x44c + {value: 0x0010, lo: 0x84, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + // Block 0xcc, offset 0x450 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xcd, offset 0x454 + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x89, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + // Block 0xce, offset 0x45d + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb4}, + {value: 0x0030, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xb7}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + // Block 0xcf, offset 0x466 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xd0, offset 0x46c + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa2}, + {value: 0x0014, lo: 0xa3, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xd1, offset 0x472 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xd2, offset 0x47c + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0030, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9d, hi: 0xa3}, + {value: 0x0024, lo: 0xa6, hi: 0xac}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + // Block 0xd3, offset 0x486 + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xd4, offset 0x488 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + // Block 0xd5, offset 0x491 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xd6, offset 0x497 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd7, offset 0x49d + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xd8, offset 0x4a3 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x98, hi: 0x9b}, + {value: 0x0014, lo: 0x9c, hi: 0x9d}, + // Block 0xd9, offset 0x4a6 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xda, offset 0x4ac + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xdb, offset 0x4af + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0014, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb5}, + {value: 0x0030, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + // Block 0xdc, offset 0x4b8 + {value: 0x0010, lo: 0x80, hi: 0x89}, + // Block 0xdd, offset 0x4b9 + {value: 0x0014, lo: 0x9d, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xde, offset 0x4c0 + {value: 0x0010, lo: 0x80, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + // Block 0xdf, offset 0x4c4 + {value: 0x5f53, lo: 0xa0, hi: 0xbf}, + // Block 0xe0, offset 0x4c5 + {value: 0x5f52, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xe1, offset 0x4c8 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x89, hi: 0x89}, + {value: 0x0010, lo: 0x8c, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0xb5}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0014, lo: 0xbb, hi: 0xbc}, + {value: 0x0030, lo: 0xbd, hi: 0xbd}, + {value: 0x0034, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xe2, offset 0x4d2 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0034, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xe3, offset 0x4d5 + {value: 0x0010, lo: 0xa0, hi: 0xa7}, + {value: 0x0010, lo: 0xaa, hi: 0xbf}, + // Block 0xe4, offset 0x4d7 + {value: 0x0010, lo: 0x80, hi: 0x93}, + {value: 0x0014, lo: 0x94, hi: 0x97}, + {value: 0x0014, lo: 0x9a, hi: 0x9b}, + {value: 0x0010, lo: 0x9c, hi: 0x9f}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + // Block 0xe5, offset 0x4de + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x8a}, + {value: 0x0010, lo: 0x8b, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbb, hi: 0xbe}, + // Block 0xe6, offset 0x4e6 + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0014, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x98}, + {value: 0x0014, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0x9c, hi: 0xbf}, + // Block 0xe7, offset 0x4ec + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0014, lo: 0x8a, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x99}, + {value: 0x0010, lo: 0x9d, hi: 0x9d}, + // Block 0xe8, offset 0x4f2 + {value: 0x0010, lo: 0x80, hi: 0xb8}, + // Block 0xe9, offset 0x4f3 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb6}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xea, offset 0x4f9 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0xeb, offset 0x4fc + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0014, lo: 0x92, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xa9}, + {value: 0x0014, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0xec, offset 0x504 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb6}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xed, offset 0x50b + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa5}, + {value: 0x0010, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xbf}, + // Block 0xee, offset 0x515 + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0014, lo: 0x90, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0x96}, + {value: 0x0034, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0xef, offset 0x51d + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + // Block 0xf0, offset 0x520 + {value: 0x0010, lo: 0xb0, hi: 0xb0}, + // Block 0xf1, offset 0x521 + {value: 0x0010, lo: 0x80, hi: 0x99}, + // Block 0xf2, offset 0x522 + {value: 0x0010, lo: 0x80, hi: 0xae}, + // Block 0xf3, offset 0x523 + {value: 0x0010, lo: 0x80, hi: 0x83}, + // Block 0xf4, offset 0x524 + {value: 0x0010, lo: 0x80, hi: 0xae}, + {value: 0x0014, lo: 0xb0, hi: 0xb8}, + // Block 0xf5, offset 0x526 + {value: 0x0010, lo: 0x80, hi: 0x86}, + // Block 0xf6, offset 0x527 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0xf7, offset 0x529 + {value: 0x0010, lo: 0x90, hi: 0xad}, + {value: 0x0034, lo: 0xb0, hi: 0xb4}, + // Block 0xf8, offset 0x52b + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb6}, + // Block 0xf9, offset 0x52d + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa3, hi: 0xb7}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xfa, offset 0x531 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + // Block 0xfb, offset 0x532 + {value: 0x2013, lo: 0x80, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xbf}, + // Block 0xfc, offset 0x534 + {value: 0x0010, lo: 0x80, hi: 0x8a}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0xfd, offset 0x537 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0014, lo: 0x8f, hi: 0x9f}, + // Block 0xfe, offset 0x539 + {value: 0x0014, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa3, hi: 0xa4}, + {value: 0x0030, lo: 0xb0, hi: 0xb1}, + // Block 0xff, offset 0x53c + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbc}, + // Block 0x100, offset 0x53e + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0034, lo: 0x9e, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa3}, + // Block 0x101, offset 0x543 + {value: 0x0030, lo: 0xa5, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xa9}, + {value: 0x0030, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbf}, + // Block 0x102, offset 0x548 + {value: 0x0034, lo: 0x80, hi: 0x82}, + {value: 0x0024, lo: 0x85, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8b}, + {value: 0x0024, lo: 0xaa, hi: 0xad}, + // Block 0x103, offset 0x54c + {value: 0x0024, lo: 0x82, hi: 0x84}, + // Block 0x104, offset 0x54d + {value: 0x0013, lo: 0x80, hi: 0x99}, + {value: 0x0012, lo: 0x9a, hi: 0xb3}, + {value: 0x0013, lo: 0xb4, hi: 0xbf}, + // Block 0x105, offset 0x550 + {value: 0x0013, lo: 0x80, hi: 0x8d}, + {value: 0x0012, lo: 0x8e, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0xa7}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0x106, offset 0x554 + {value: 0x0013, lo: 0x80, hi: 0x81}, + {value: 0x0012, lo: 0x82, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0x9c}, + {value: 0x0013, lo: 0x9e, hi: 0x9f}, + {value: 0x0013, lo: 0xa2, hi: 0xa2}, + {value: 0x0013, lo: 0xa5, hi: 0xa6}, + {value: 0x0013, lo: 0xa9, hi: 0xac}, + {value: 0x0013, lo: 0xae, hi: 0xb5}, + {value: 0x0012, lo: 0xb6, hi: 0xb9}, + {value: 0x0012, lo: 0xbb, hi: 0xbb}, + {value: 0x0012, lo: 0xbd, hi: 0xbf}, + // Block 0x107, offset 0x55f + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0012, lo: 0x85, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0x108, offset 0x563 + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0013, lo: 0x84, hi: 0x85}, + {value: 0x0013, lo: 0x87, hi: 0x8a}, + {value: 0x0013, lo: 0x8d, hi: 0x94}, + {value: 0x0013, lo: 0x96, hi: 0x9c}, + {value: 0x0012, lo: 0x9e, hi: 0xb7}, + {value: 0x0013, lo: 0xb8, hi: 0xb9}, + {value: 0x0013, lo: 0xbb, hi: 0xbe}, + // Block 0x109, offset 0x56b + {value: 0x0013, lo: 0x80, hi: 0x84}, + {value: 0x0013, lo: 0x86, hi: 0x86}, + {value: 0x0013, lo: 0x8a, hi: 0x90}, + {value: 0x0012, lo: 0x92, hi: 0xab}, + {value: 0x0013, lo: 0xac, hi: 0xbf}, + // Block 0x10a, offset 0x570 + {value: 0x0013, lo: 0x80, hi: 0x85}, + {value: 0x0012, lo: 0x86, hi: 0x9f}, + {value: 0x0013, lo: 0xa0, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbf}, + // Block 0x10b, offset 0x574 + {value: 0x0012, lo: 0x80, hi: 0x93}, + {value: 0x0013, lo: 0x94, hi: 0xad}, + {value: 0x0012, lo: 0xae, hi: 0xbf}, + // Block 0x10c, offset 0x577 + {value: 0x0012, lo: 0x80, hi: 0x87}, + {value: 0x0013, lo: 0x88, hi: 0xa1}, + {value: 0x0012, lo: 0xa2, hi: 0xbb}, + {value: 0x0013, lo: 0xbc, hi: 0xbf}, + // Block 0x10d, offset 0x57b + {value: 0x0013, lo: 0x80, hi: 0x95}, + {value: 0x0012, lo: 0x96, hi: 0xaf}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x10e, offset 0x57e + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0012, lo: 0x8a, hi: 0xa5}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0x10f, offset 0x581 + {value: 0x0013, lo: 0x80, hi: 0x80}, + {value: 0x0012, lo: 0x82, hi: 0x9a}, + {value: 0x0012, lo: 0x9c, hi: 0xa1}, + {value: 0x0013, lo: 0xa2, hi: 0xba}, + {value: 0x0012, lo: 0xbc, hi: 0xbf}, + // Block 0x110, offset 0x586 + {value: 0x0012, lo: 0x80, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0xb4}, + {value: 0x0012, lo: 0xb6, hi: 0xbf}, + // Block 0x111, offset 0x58a + {value: 0x0012, lo: 0x80, hi: 0x8e}, + {value: 0x0012, lo: 0x90, hi: 0x95}, + {value: 0x0013, lo: 0x96, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x112, offset 0x58e + {value: 0x0012, lo: 0x80, hi: 0x88}, + {value: 0x0012, lo: 0x8a, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0x113, offset 0x592 + {value: 0x0012, lo: 0x80, hi: 0x82}, + {value: 0x0012, lo: 0x84, hi: 0x89}, + {value: 0x0017, lo: 0x8a, hi: 0x8b}, + {value: 0x0010, lo: 0x8e, hi: 0xbf}, + // Block 0x114, offset 0x596 + {value: 0x0014, lo: 0x80, hi: 0xb6}, + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x115, offset 0x598 + {value: 0x0014, lo: 0x80, hi: 0xac}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x116, offset 0x59a + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x9b, hi: 0x9f}, + {value: 0x0014, lo: 0xa1, hi: 0xaf}, + // Block 0x117, offset 0x59d + {value: 0x0024, lo: 0x80, hi: 0x86}, + {value: 0x0024, lo: 0x88, hi: 0x98}, + {value: 0x0024, lo: 0x9b, hi: 0xa1}, + {value: 0x0024, lo: 0xa3, hi: 0xa4}, + {value: 0x0024, lo: 0xa6, hi: 0xaa}, + // Block 0x118, offset 0x5a2 + {value: 0x0010, lo: 0x80, hi: 0xac}, + {value: 0x0024, lo: 0xb0, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xbd}, + // Block 0x119, offset 0x5a5 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + // Block 0x11a, offset 0x5a7 + {value: 0x0010, lo: 0x80, hi: 0xab}, + {value: 0x0024, lo: 0xac, hi: 0xaf}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x11b, offset 0x5aa + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0034, lo: 0x90, hi: 0x96}, + // Block 0x11c, offset 0x5ac + {value: 0xbc52, lo: 0x80, hi: 0x81}, + {value: 0xbf52, lo: 0x82, hi: 0x83}, + {value: 0x0024, lo: 0x84, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8b}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x11d, offset 0x5b2 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x9f}, + {value: 0x0010, lo: 0xa1, hi: 0xa2}, + {value: 0x0010, lo: 0xa4, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb7}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + // Block 0x11e, offset 0x5bb + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x9b}, + {value: 0x0010, lo: 0xa1, hi: 0xa3}, + {value: 0x0010, lo: 0xa5, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xbb}, + // Block 0x11f, offset 0x5c0 + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x120, offset 0x5c1 + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x121, offset 0x5c4 + {value: 0x0013, lo: 0x80, hi: 0x89}, + // Block 0x122, offset 0x5c5 + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x123, offset 0x5c6 + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x124, offset 0x5c7 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0014, lo: 0xa0, hi: 0xbf}, + // Block 0x125, offset 0x5c9 + {value: 0x0014, lo: 0x80, hi: 0xbf}, + // Block 0x126, offset 0x5ca + {value: 0x0014, lo: 0x80, hi: 0xaf}, +} + +// Total table size 15212 bytes (14KiB); checksum: 1EB13752 diff --git a/vendor/golang.org/x/text/cases/tables15.0.0.go b/vendor/golang.org/x/text/cases/tables15.0.0.go new file mode 100644 index 0000000000..aee0f31085 --- /dev/null +++ b/vendor/golang.org/x/text/cases/tables15.0.0.go @@ -0,0 +1,2527 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +//go:build go1.21 + +package cases + +// UnicodeVersion is the Unicode version from which the tables in this package are derived. +const UnicodeVersion = "15.0.0" + +var xorData string = "" + // Size: 213 bytes + "\x00\x06\x07\x00\x01?\x00\x0f\x03\x00\x0f\x12\x00\x0f\x1f\x00\x0f\x1d" + + "\x00\x01\x13\x00\x0f\x16\x00\x0f\x0b\x00\x0f3\x00\x0f7\x00\x01#\x00\x0f?" + + "\x00\x0e'\x00\x0f/\x00\x0e>\x00\x0f*\x00\x0c&\x00\x0c*\x00\x0c;\x00\x0c9" + + "\x00\x0c%\x00\x01\x08\x00\x03\x0d\x00\x03\x09\x00\x02\x06\x00\x02\x02" + + "\x00\x02\x0c\x00\x01\x00\x00\x01\x03\x00\x01\x01\x00\x01 \x00\x01\x0c" + + "\x00\x01\x10\x00\x03\x10\x00\x036 \x00\x037 \x00\x0b#\x10\x00\x0b 0\x00" + + "\x0b!\x10\x00\x0b!0\x001\x00\x00\x0b(\x04\x00\x03\x04\x1e\x00\x0b)\x08" + + "\x00\x03\x0a\x00\x02:\x00\x02>\x00\x02,\x00\x02\x00\x00\x02\x10\x00\x01<" + + "\x00\x01&\x00\x01*\x00\x01.\x00\x010\x003 \x00\x01\x18\x00\x01(\x00\x03'" + + "\x00\x03)\x00\x03+\x00\x03/\x00\x03\x19\x00\x03\x1b\x00\x03\x1f\x00\x01" + + "\x1e\x00\x01\x22" + +var exceptions string = "" + // Size: 2450 bytes + "\x00\x12\x12μΜΜ\x12\x12ssSSSs\x13\x18i̇i̇\x10\x09II\x13\x1bʼnʼNʼN\x11" + + "\x09sSS\x12\x12dždžDž\x12\x12dždžDŽ\x10\x12DŽDž\x12\x12ljljLj\x12\x12ljljLJ\x10\x12LJLj" + + "\x12\x12njnjNj\x12\x12njnjNJ\x10\x12NJNj\x13\x1bǰJ̌J̌\x12\x12dzdzDz\x12\x12dzdzDZ\x10" + + "\x12DZDz\x13\x18ⱥⱥ\x13\x18ⱦⱦ\x10\x1bⱾⱾ\x10\x1bⱿⱿ\x10\x1bⱯⱯ\x10\x1bⱭⱭ\x10" + + "\x1bⱰⱰ\x10\x1bꞫꞫ\x10\x1bꞬꞬ\x10\x1bꞍꞍ\x10\x1bꞪꞪ\x10\x1bꞮꞮ\x10\x1bⱢⱢ\x10" + + "\x1bꞭꞭ\x10\x1bⱮⱮ\x10\x1bⱤⱤ\x10\x1bꟅꟅ\x10\x1bꞱꞱ\x10\x1bꞲꞲ\x10\x1bꞰꞰ2\x12ι" + + "ΙΙ\x166ΐΪ́Ϊ́\x166ΰΫ́Ϋ́\x12\x12σΣΣ\x12\x12βΒΒ\x12\x12θΘΘ\x12\x12" + + "φΦΦ\x12\x12πΠΠ\x12\x12κΚΚ\x12\x12ρΡΡ\x12\x12εΕΕ\x14$եւԵՒԵւ\x10\x1bᲐა" + + "\x10\x1bᲑბ\x10\x1bᲒგ\x10\x1bᲓდ\x10\x1bᲔე\x10\x1bᲕვ\x10\x1bᲖზ\x10\x1bᲗთ" + + "\x10\x1bᲘი\x10\x1bᲙკ\x10\x1bᲚლ\x10\x1bᲛმ\x10\x1bᲜნ\x10\x1bᲝო\x10\x1bᲞპ" + + "\x10\x1bᲟჟ\x10\x1bᲠრ\x10\x1bᲡს\x10\x1bᲢტ\x10\x1bᲣუ\x10\x1bᲤფ\x10\x1bᲥქ" + + "\x10\x1bᲦღ\x10\x1bᲧყ\x10\x1bᲨშ\x10\x1bᲩჩ\x10\x1bᲪც\x10\x1bᲫძ\x10\x1bᲬწ" + + "\x10\x1bᲭჭ\x10\x1bᲮხ\x10\x1bᲯჯ\x10\x1bᲰჰ\x10\x1bᲱჱ\x10\x1bᲲჲ\x10\x1bᲳჳ" + + "\x10\x1bᲴჴ\x10\x1bᲵჵ\x10\x1bᲶჶ\x10\x1bᲷჷ\x10\x1bᲸჸ\x10\x1bᲹჹ\x10\x1bᲺჺ" + + "\x10\x1bᲽჽ\x10\x1bᲾჾ\x10\x1bᲿჿ\x12\x12вВВ\x12\x12дДД\x12\x12оОО\x12\x12с" + + "СС\x12\x12тТТ\x12\x12тТТ\x12\x12ъЪЪ\x12\x12ѣѢѢ\x13\x1bꙋꙊꙊ\x13\x1bẖH̱H̱" + + "\x13\x1bẗT̈T̈\x13\x1bẘW̊W̊\x13\x1bẙY̊Y̊\x13\x1baʾAʾAʾ\x13\x1bṡṠṠ\x12" + + "\x10ssß\x14$ὐΥ̓Υ̓\x166ὒΥ̓̀Υ̓̀\x166ὔΥ̓́Υ̓́\x166ὖΥ̓͂Υ̓͂\x15+ἀιἈΙᾈ" + + "\x15+ἁιἉΙᾉ\x15+ἂιἊΙᾊ\x15+ἃιἋΙᾋ\x15+ἄιἌΙᾌ\x15+ἅιἍΙᾍ\x15+ἆιἎΙᾎ\x15+ἇιἏΙᾏ" + + "\x15\x1dἀιᾀἈΙ\x15\x1dἁιᾁἉΙ\x15\x1dἂιᾂἊΙ\x15\x1dἃιᾃἋΙ\x15\x1dἄιᾄἌΙ\x15" + + "\x1dἅιᾅἍΙ\x15\x1dἆιᾆἎΙ\x15\x1dἇιᾇἏΙ\x15+ἠιἨΙᾘ\x15+ἡιἩΙᾙ\x15+ἢιἪΙᾚ\x15+ἣι" + + "ἫΙᾛ\x15+ἤιἬΙᾜ\x15+ἥιἭΙᾝ\x15+ἦιἮΙᾞ\x15+ἧιἯΙᾟ\x15\x1dἠιᾐἨΙ\x15\x1dἡιᾑἩΙ" + + "\x15\x1dἢιᾒἪΙ\x15\x1dἣιᾓἫΙ\x15\x1dἤιᾔἬΙ\x15\x1dἥιᾕἭΙ\x15\x1dἦιᾖἮΙ\x15" + + "\x1dἧιᾗἯΙ\x15+ὠιὨΙᾨ\x15+ὡιὩΙᾩ\x15+ὢιὪΙᾪ\x15+ὣιὫΙᾫ\x15+ὤιὬΙᾬ\x15+ὥιὭΙᾭ" + + "\x15+ὦιὮΙᾮ\x15+ὧιὯΙᾯ\x15\x1dὠιᾠὨΙ\x15\x1dὡιᾡὩΙ\x15\x1dὢιᾢὪΙ\x15\x1dὣιᾣὫΙ" + + "\x15\x1dὤιᾤὬΙ\x15\x1dὥιᾥὭΙ\x15\x1dὦιᾦὮΙ\x15\x1dὧιᾧὯΙ\x15-ὰιᾺΙᾺͅ\x14#αιΑΙ" + + "ᾼ\x14$άιΆΙΆͅ\x14$ᾶΑ͂Α͂\x166ᾶιΑ͂Ιᾼ͂\x14\x1cαιᾳΑΙ\x12\x12ιΙΙ\x15-ὴιῊΙ" + + "Ὴͅ\x14#ηιΗΙῌ\x14$ήιΉΙΉͅ\x14$ῆΗ͂Η͂\x166ῆιΗ͂Ιῌ͂\x14\x1cηιῃΗΙ\x166ῒΙ" + + "̈̀Ϊ̀\x166ΐΪ́Ϊ́\x14$ῖΙ͂Ι͂\x166ῗΪ͂Ϊ͂\x166ῢΫ̀Ϋ̀\x166ΰΫ́Ϋ" + + "́\x14$ῤΡ̓Ρ̓\x14$ῦΥ͂Υ͂\x166ῧΫ͂Ϋ͂\x15-ὼιῺΙῺͅ\x14#ωιΩΙῼ\x14$ώιΏΙΏͅ" + + "\x14$ῶΩ͂Ω͂\x166ῶιΩ͂Ιῼ͂\x14\x1cωιῳΩΙ\x12\x10ωω\x11\x08kk\x12\x10åå\x12" + + "\x10ɫɫ\x12\x10ɽɽ\x10\x12ȺȺ\x10\x12ȾȾ\x12\x10ɑɑ\x12\x10ɱɱ\x12\x10ɐɐ\x12" + + "\x10ɒɒ\x12\x10ȿȿ\x12\x10ɀɀ\x12\x10ɥɥ\x12\x10ɦɦ\x12\x10ɜɜ\x12\x10ɡɡ\x12" + + "\x10ɬɬ\x12\x10ɪɪ\x12\x10ʞʞ\x12\x10ʇʇ\x12\x10ʝʝ\x12\x10ʂʂ\x12\x12ffFFFf" + + "\x12\x12fiFIFi\x12\x12flFLFl\x13\x1bffiFFIFfi\x13\x1bfflFFLFfl\x12\x12st" + + "STSt\x12\x12stSTSt\x14$մնՄՆՄն\x14$մեՄԵՄե\x14$միՄԻՄի\x14$վնՎՆՎն\x14$մխՄԽՄ" + + "խ" + +// lookup returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookup(s []byte) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupUnsafe(s []byte) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// lookupString returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookupString(s string) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupStringUnsafe(s string) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// caseTrie. Total size: 13398 bytes (13.08 KiB). Checksum: 544af6e6b1b70931. +type caseTrie struct{} + +func newCaseTrie(i int) *caseTrie { + return &caseTrie{} +} + +// lookupValue determines the type of block n and looks up the value for b. +func (t *caseTrie) lookupValue(n uint32, b byte) uint16 { + switch { + case n < 22: + return uint16(caseValues[n<<6+uint32(b)]) + default: + n -= 22 + return uint16(sparse.lookup(n, b)) + } +} + +// caseValues: 24 blocks, 1536 entries, 3072 bytes +// The third block is the zero block. +var caseValues = [1536]uint16{ + // Block 0x0, offset 0x0 + 0x27: 0x0054, + 0x2e: 0x0054, + 0x30: 0x0010, 0x31: 0x0010, 0x32: 0x0010, 0x33: 0x0010, 0x34: 0x0010, 0x35: 0x0010, + 0x36: 0x0010, 0x37: 0x0010, 0x38: 0x0010, 0x39: 0x0010, 0x3a: 0x0054, + // Block 0x1, offset 0x40 + 0x41: 0x2013, 0x42: 0x2013, 0x43: 0x2013, 0x44: 0x2013, 0x45: 0x2013, + 0x46: 0x2013, 0x47: 0x2013, 0x48: 0x2013, 0x49: 0x2013, 0x4a: 0x2013, 0x4b: 0x2013, + 0x4c: 0x2013, 0x4d: 0x2013, 0x4e: 0x2013, 0x4f: 0x2013, 0x50: 0x2013, 0x51: 0x2013, + 0x52: 0x2013, 0x53: 0x2013, 0x54: 0x2013, 0x55: 0x2013, 0x56: 0x2013, 0x57: 0x2013, + 0x58: 0x2013, 0x59: 0x2013, 0x5a: 0x2013, + 0x5e: 0x0004, 0x5f: 0x0010, 0x60: 0x0004, 0x61: 0x2012, 0x62: 0x2012, 0x63: 0x2012, + 0x64: 0x2012, 0x65: 0x2012, 0x66: 0x2012, 0x67: 0x2012, 0x68: 0x2012, 0x69: 0x2012, + 0x6a: 0x2012, 0x6b: 0x2012, 0x6c: 0x2012, 0x6d: 0x2012, 0x6e: 0x2012, 0x6f: 0x2012, + 0x70: 0x2012, 0x71: 0x2012, 0x72: 0x2012, 0x73: 0x2012, 0x74: 0x2012, 0x75: 0x2012, + 0x76: 0x2012, 0x77: 0x2012, 0x78: 0x2012, 0x79: 0x2012, 0x7a: 0x2012, + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc0: 0x0852, 0xc1: 0x0b53, 0xc2: 0x0113, 0xc3: 0x0112, 0xc4: 0x0113, 0xc5: 0x0112, + 0xc6: 0x0b53, 0xc7: 0x0f13, 0xc8: 0x0f12, 0xc9: 0x0e53, 0xca: 0x1153, 0xcb: 0x0713, + 0xcc: 0x0712, 0xcd: 0x0012, 0xce: 0x1453, 0xcf: 0x1753, 0xd0: 0x1a53, 0xd1: 0x0313, + 0xd2: 0x0312, 0xd3: 0x1d53, 0xd4: 0x2053, 0xd5: 0x2352, 0xd6: 0x2653, 0xd7: 0x2653, + 0xd8: 0x0113, 0xd9: 0x0112, 0xda: 0x2952, 0xdb: 0x0012, 0xdc: 0x1d53, 0xdd: 0x2c53, + 0xde: 0x2f52, 0xdf: 0x3253, 0xe0: 0x0113, 0xe1: 0x0112, 0xe2: 0x0113, 0xe3: 0x0112, + 0xe4: 0x0113, 0xe5: 0x0112, 0xe6: 0x3553, 0xe7: 0x0f13, 0xe8: 0x0f12, 0xe9: 0x3853, + 0xea: 0x0012, 0xeb: 0x0012, 0xec: 0x0113, 0xed: 0x0112, 0xee: 0x3553, 0xef: 0x1f13, + 0xf0: 0x1f12, 0xf1: 0x3b53, 0xf2: 0x3e53, 0xf3: 0x0713, 0xf4: 0x0712, 0xf5: 0x0313, + 0xf6: 0x0312, 0xf7: 0x4153, 0xf8: 0x0113, 0xf9: 0x0112, 0xfa: 0x0012, 0xfb: 0x0010, + 0xfc: 0x0113, 0xfd: 0x0112, 0xfe: 0x0012, 0xff: 0x4452, + // Block 0x4, offset 0x100 + 0x100: 0x0010, 0x101: 0x0010, 0x102: 0x0010, 0x103: 0x0010, 0x104: 0x02db, 0x105: 0x0359, + 0x106: 0x03da, 0x107: 0x043b, 0x108: 0x04b9, 0x109: 0x053a, 0x10a: 0x059b, 0x10b: 0x0619, + 0x10c: 0x069a, 0x10d: 0x0313, 0x10e: 0x0312, 0x10f: 0x1f13, 0x110: 0x1f12, 0x111: 0x0313, + 0x112: 0x0312, 0x113: 0x0713, 0x114: 0x0712, 0x115: 0x0313, 0x116: 0x0312, 0x117: 0x0f13, + 0x118: 0x0f12, 0x119: 0x0313, 0x11a: 0x0312, 0x11b: 0x0713, 0x11c: 0x0712, 0x11d: 0x1452, + 0x11e: 0x0113, 0x11f: 0x0112, 0x120: 0x0113, 0x121: 0x0112, 0x122: 0x0113, 0x123: 0x0112, + 0x124: 0x0113, 0x125: 0x0112, 0x126: 0x0113, 0x127: 0x0112, 0x128: 0x0113, 0x129: 0x0112, + 0x12a: 0x0113, 0x12b: 0x0112, 0x12c: 0x0113, 0x12d: 0x0112, 0x12e: 0x0113, 0x12f: 0x0112, + 0x130: 0x06fa, 0x131: 0x07ab, 0x132: 0x0829, 0x133: 0x08aa, 0x134: 0x0113, 0x135: 0x0112, + 0x136: 0x2353, 0x137: 0x4453, 0x138: 0x0113, 0x139: 0x0112, 0x13a: 0x0113, 0x13b: 0x0112, + 0x13c: 0x0113, 0x13d: 0x0112, 0x13e: 0x0113, 0x13f: 0x0112, + // Block 0x5, offset 0x140 + 0x140: 0x0a8a, 0x141: 0x0313, 0x142: 0x0312, 0x143: 0x0853, 0x144: 0x4753, 0x145: 0x4a53, + 0x146: 0x0113, 0x147: 0x0112, 0x148: 0x0113, 0x149: 0x0112, 0x14a: 0x0113, 0x14b: 0x0112, + 0x14c: 0x0113, 0x14d: 0x0112, 0x14e: 0x0113, 0x14f: 0x0112, 0x150: 0x0b0a, 0x151: 0x0b8a, + 0x152: 0x0c0a, 0x153: 0x0b52, 0x154: 0x0b52, 0x155: 0x0012, 0x156: 0x0e52, 0x157: 0x1152, + 0x158: 0x0012, 0x159: 0x1752, 0x15a: 0x0012, 0x15b: 0x1a52, 0x15c: 0x0c8a, 0x15d: 0x0012, + 0x15e: 0x0012, 0x15f: 0x0012, 0x160: 0x1d52, 0x161: 0x0d0a, 0x162: 0x0012, 0x163: 0x2052, + 0x164: 0x0012, 0x165: 0x0d8a, 0x166: 0x0e0a, 0x167: 0x0012, 0x168: 0x2652, 0x169: 0x2652, + 0x16a: 0x0e8a, 0x16b: 0x0f0a, 0x16c: 0x0f8a, 0x16d: 0x0012, 0x16e: 0x0012, 0x16f: 0x1d52, + 0x170: 0x0012, 0x171: 0x100a, 0x172: 0x2c52, 0x173: 0x0012, 0x174: 0x0012, 0x175: 0x3252, + 0x176: 0x0012, 0x177: 0x0012, 0x178: 0x0012, 0x179: 0x0012, 0x17a: 0x0012, 0x17b: 0x0012, + 0x17c: 0x0012, 0x17d: 0x108a, 0x17e: 0x0012, 0x17f: 0x0012, + // Block 0x6, offset 0x180 + 0x180: 0x3552, 0x181: 0x0012, 0x182: 0x110a, 0x183: 0x3852, 0x184: 0x0012, 0x185: 0x0012, + 0x186: 0x0012, 0x187: 0x118a, 0x188: 0x3552, 0x189: 0x4752, 0x18a: 0x3b52, 0x18b: 0x3e52, + 0x18c: 0x4a52, 0x18d: 0x0012, 0x18e: 0x0012, 0x18f: 0x0012, 0x190: 0x0012, 0x191: 0x0012, + 0x192: 0x4152, 0x193: 0x0012, 0x194: 0x0010, 0x195: 0x0012, 0x196: 0x0012, 0x197: 0x0012, + 0x198: 0x0012, 0x199: 0x0012, 0x19a: 0x0012, 0x19b: 0x0012, 0x19c: 0x0012, 0x19d: 0x120a, + 0x19e: 0x128a, 0x19f: 0x0012, 0x1a0: 0x0012, 0x1a1: 0x0012, 0x1a2: 0x0012, 0x1a3: 0x0012, + 0x1a4: 0x0012, 0x1a5: 0x0012, 0x1a6: 0x0012, 0x1a7: 0x0012, 0x1a8: 0x0012, 0x1a9: 0x0012, + 0x1aa: 0x0012, 0x1ab: 0x0012, 0x1ac: 0x0012, 0x1ad: 0x0012, 0x1ae: 0x0012, 0x1af: 0x0012, + 0x1b0: 0x0015, 0x1b1: 0x0015, 0x1b2: 0x0015, 0x1b3: 0x0015, 0x1b4: 0x0015, 0x1b5: 0x0015, + 0x1b6: 0x0015, 0x1b7: 0x0015, 0x1b8: 0x0015, 0x1b9: 0x0014, 0x1ba: 0x0014, 0x1bb: 0x0014, + 0x1bc: 0x0014, 0x1bd: 0x0014, 0x1be: 0x0014, 0x1bf: 0x0014, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x0024, 0x1c1: 0x0024, 0x1c2: 0x0024, 0x1c3: 0x0024, 0x1c4: 0x0024, 0x1c5: 0x130d, + 0x1c6: 0x0024, 0x1c7: 0x0034, 0x1c8: 0x0034, 0x1c9: 0x0034, 0x1ca: 0x0024, 0x1cb: 0x0024, + 0x1cc: 0x0024, 0x1cd: 0x0034, 0x1ce: 0x0034, 0x1cf: 0x0014, 0x1d0: 0x0024, 0x1d1: 0x0024, + 0x1d2: 0x0024, 0x1d3: 0x0034, 0x1d4: 0x0034, 0x1d5: 0x0034, 0x1d6: 0x0034, 0x1d7: 0x0024, + 0x1d8: 0x0034, 0x1d9: 0x0034, 0x1da: 0x0034, 0x1db: 0x0024, 0x1dc: 0x0034, 0x1dd: 0x0034, + 0x1de: 0x0034, 0x1df: 0x0034, 0x1e0: 0x0034, 0x1e1: 0x0034, 0x1e2: 0x0034, 0x1e3: 0x0024, + 0x1e4: 0x0024, 0x1e5: 0x0024, 0x1e6: 0x0024, 0x1e7: 0x0024, 0x1e8: 0x0024, 0x1e9: 0x0024, + 0x1ea: 0x0024, 0x1eb: 0x0024, 0x1ec: 0x0024, 0x1ed: 0x0024, 0x1ee: 0x0024, 0x1ef: 0x0024, + 0x1f0: 0x0113, 0x1f1: 0x0112, 0x1f2: 0x0113, 0x1f3: 0x0112, 0x1f4: 0x0014, 0x1f5: 0x0004, + 0x1f6: 0x0113, 0x1f7: 0x0112, 0x1fa: 0x0015, 0x1fb: 0x4d52, + 0x1fc: 0x5052, 0x1fd: 0x5052, 0x1ff: 0x5353, + // Block 0x8, offset 0x200 + 0x204: 0x0004, 0x205: 0x0004, + 0x206: 0x2a13, 0x207: 0x0054, 0x208: 0x2513, 0x209: 0x2713, 0x20a: 0x2513, + 0x20c: 0x5653, 0x20e: 0x5953, 0x20f: 0x5c53, 0x210: 0x138a, 0x211: 0x2013, + 0x212: 0x2013, 0x213: 0x2013, 0x214: 0x2013, 0x215: 0x2013, 0x216: 0x2013, 0x217: 0x2013, + 0x218: 0x2013, 0x219: 0x2013, 0x21a: 0x2013, 0x21b: 0x2013, 0x21c: 0x2013, 0x21d: 0x2013, + 0x21e: 0x2013, 0x21f: 0x2013, 0x220: 0x5f53, 0x221: 0x5f53, 0x223: 0x5f53, + 0x224: 0x5f53, 0x225: 0x5f53, 0x226: 0x5f53, 0x227: 0x5f53, 0x228: 0x5f53, 0x229: 0x5f53, + 0x22a: 0x5f53, 0x22b: 0x5f53, 0x22c: 0x2a12, 0x22d: 0x2512, 0x22e: 0x2712, 0x22f: 0x2512, + 0x230: 0x14ca, 0x231: 0x2012, 0x232: 0x2012, 0x233: 0x2012, 0x234: 0x2012, 0x235: 0x2012, + 0x236: 0x2012, 0x237: 0x2012, 0x238: 0x2012, 0x239: 0x2012, 0x23a: 0x2012, 0x23b: 0x2012, + 0x23c: 0x2012, 0x23d: 0x2012, 0x23e: 0x2012, 0x23f: 0x2012, + // Block 0x9, offset 0x240 + 0x240: 0x5f52, 0x241: 0x5f52, 0x242: 0x160a, 0x243: 0x5f52, 0x244: 0x5f52, 0x245: 0x5f52, + 0x246: 0x5f52, 0x247: 0x5f52, 0x248: 0x5f52, 0x249: 0x5f52, 0x24a: 0x5f52, 0x24b: 0x5f52, + 0x24c: 0x5652, 0x24d: 0x5952, 0x24e: 0x5c52, 0x24f: 0x1813, 0x250: 0x168a, 0x251: 0x170a, + 0x252: 0x0013, 0x253: 0x0013, 0x254: 0x0013, 0x255: 0x178a, 0x256: 0x180a, 0x257: 0x1812, + 0x258: 0x0113, 0x259: 0x0112, 0x25a: 0x0113, 0x25b: 0x0112, 0x25c: 0x0113, 0x25d: 0x0112, + 0x25e: 0x0113, 0x25f: 0x0112, 0x260: 0x0113, 0x261: 0x0112, 0x262: 0x0113, 0x263: 0x0112, + 0x264: 0x0113, 0x265: 0x0112, 0x266: 0x0113, 0x267: 0x0112, 0x268: 0x0113, 0x269: 0x0112, + 0x26a: 0x0113, 0x26b: 0x0112, 0x26c: 0x0113, 0x26d: 0x0112, 0x26e: 0x0113, 0x26f: 0x0112, + 0x270: 0x188a, 0x271: 0x190a, 0x272: 0x0b12, 0x273: 0x5352, 0x274: 0x6253, 0x275: 0x198a, + 0x277: 0x0f13, 0x278: 0x0f12, 0x279: 0x0b13, 0x27a: 0x0113, 0x27b: 0x0112, + 0x27c: 0x0012, 0x27d: 0x4d53, 0x27e: 0x5053, 0x27f: 0x5053, + // Block 0xa, offset 0x280 + 0x280: 0x6852, 0x281: 0x6852, 0x282: 0x6852, 0x283: 0x6852, 0x284: 0x6852, 0x285: 0x6852, + 0x286: 0x6852, 0x287: 0x1a0a, 0x288: 0x0012, 0x28a: 0x0010, + 0x291: 0x0034, + 0x292: 0x0024, 0x293: 0x0024, 0x294: 0x0024, 0x295: 0x0024, 0x296: 0x0034, 0x297: 0x0024, + 0x298: 0x0024, 0x299: 0x0024, 0x29a: 0x0034, 0x29b: 0x0034, 0x29c: 0x0024, 0x29d: 0x0024, + 0x29e: 0x0024, 0x29f: 0x0024, 0x2a0: 0x0024, 0x2a1: 0x0024, 0x2a2: 0x0034, 0x2a3: 0x0034, + 0x2a4: 0x0034, 0x2a5: 0x0034, 0x2a6: 0x0034, 0x2a7: 0x0034, 0x2a8: 0x0024, 0x2a9: 0x0024, + 0x2aa: 0x0034, 0x2ab: 0x0024, 0x2ac: 0x0024, 0x2ad: 0x0034, 0x2ae: 0x0034, 0x2af: 0x0024, + 0x2b0: 0x0034, 0x2b1: 0x0034, 0x2b2: 0x0034, 0x2b3: 0x0034, 0x2b4: 0x0034, 0x2b5: 0x0034, + 0x2b6: 0x0034, 0x2b7: 0x0034, 0x2b8: 0x0034, 0x2b9: 0x0034, 0x2ba: 0x0034, 0x2bb: 0x0034, + 0x2bc: 0x0034, 0x2bd: 0x0034, 0x2bf: 0x0034, + // Block 0xb, offset 0x2c0 + 0x2c0: 0x0010, 0x2c1: 0x0010, 0x2c2: 0x0010, 0x2c3: 0x0010, 0x2c4: 0x0010, 0x2c5: 0x0010, + 0x2c6: 0x0010, 0x2c7: 0x0010, 0x2c8: 0x0010, 0x2c9: 0x0014, 0x2ca: 0x0024, 0x2cb: 0x0024, + 0x2cc: 0x0024, 0x2cd: 0x0024, 0x2ce: 0x0024, 0x2cf: 0x0034, 0x2d0: 0x0034, 0x2d1: 0x0034, + 0x2d2: 0x0034, 0x2d3: 0x0034, 0x2d4: 0x0024, 0x2d5: 0x0024, 0x2d6: 0x0024, 0x2d7: 0x0024, + 0x2d8: 0x0024, 0x2d9: 0x0024, 0x2da: 0x0024, 0x2db: 0x0024, 0x2dc: 0x0024, 0x2dd: 0x0024, + 0x2de: 0x0024, 0x2df: 0x0024, 0x2e0: 0x0024, 0x2e1: 0x0024, 0x2e2: 0x0014, 0x2e3: 0x0034, + 0x2e4: 0x0024, 0x2e5: 0x0024, 0x2e6: 0x0034, 0x2e7: 0x0024, 0x2e8: 0x0024, 0x2e9: 0x0034, + 0x2ea: 0x0024, 0x2eb: 0x0024, 0x2ec: 0x0024, 0x2ed: 0x0034, 0x2ee: 0x0034, 0x2ef: 0x0034, + 0x2f0: 0x0034, 0x2f1: 0x0034, 0x2f2: 0x0034, 0x2f3: 0x0024, 0x2f4: 0x0024, 0x2f5: 0x0024, + 0x2f6: 0x0034, 0x2f7: 0x0024, 0x2f8: 0x0024, 0x2f9: 0x0034, 0x2fa: 0x0034, 0x2fb: 0x0024, + 0x2fc: 0x0024, 0x2fd: 0x0024, 0x2fe: 0x0024, 0x2ff: 0x0024, + // Block 0xc, offset 0x300 + 0x300: 0x7053, 0x301: 0x7053, 0x302: 0x7053, 0x303: 0x7053, 0x304: 0x7053, 0x305: 0x7053, + 0x307: 0x7053, + 0x30d: 0x7053, 0x310: 0x1aea, 0x311: 0x1b6a, + 0x312: 0x1bea, 0x313: 0x1c6a, 0x314: 0x1cea, 0x315: 0x1d6a, 0x316: 0x1dea, 0x317: 0x1e6a, + 0x318: 0x1eea, 0x319: 0x1f6a, 0x31a: 0x1fea, 0x31b: 0x206a, 0x31c: 0x20ea, 0x31d: 0x216a, + 0x31e: 0x21ea, 0x31f: 0x226a, 0x320: 0x22ea, 0x321: 0x236a, 0x322: 0x23ea, 0x323: 0x246a, + 0x324: 0x24ea, 0x325: 0x256a, 0x326: 0x25ea, 0x327: 0x266a, 0x328: 0x26ea, 0x329: 0x276a, + 0x32a: 0x27ea, 0x32b: 0x286a, 0x32c: 0x28ea, 0x32d: 0x296a, 0x32e: 0x29ea, 0x32f: 0x2a6a, + 0x330: 0x2aea, 0x331: 0x2b6a, 0x332: 0x2bea, 0x333: 0x2c6a, 0x334: 0x2cea, 0x335: 0x2d6a, + 0x336: 0x2dea, 0x337: 0x2e6a, 0x338: 0x2eea, 0x339: 0x2f6a, 0x33a: 0x2fea, + 0x33c: 0x0015, 0x33d: 0x306a, 0x33e: 0x30ea, 0x33f: 0x316a, + // Block 0xd, offset 0x340 + 0x340: 0x0812, 0x341: 0x0812, 0x342: 0x0812, 0x343: 0x0812, 0x344: 0x0812, 0x345: 0x0812, + 0x348: 0x0813, 0x349: 0x0813, 0x34a: 0x0813, 0x34b: 0x0813, + 0x34c: 0x0813, 0x34d: 0x0813, 0x350: 0x3b1a, 0x351: 0x0812, + 0x352: 0x3bfa, 0x353: 0x0812, 0x354: 0x3d3a, 0x355: 0x0812, 0x356: 0x3e7a, 0x357: 0x0812, + 0x359: 0x0813, 0x35b: 0x0813, 0x35d: 0x0813, + 0x35f: 0x0813, 0x360: 0x0812, 0x361: 0x0812, 0x362: 0x0812, 0x363: 0x0812, + 0x364: 0x0812, 0x365: 0x0812, 0x366: 0x0812, 0x367: 0x0812, 0x368: 0x0813, 0x369: 0x0813, + 0x36a: 0x0813, 0x36b: 0x0813, 0x36c: 0x0813, 0x36d: 0x0813, 0x36e: 0x0813, 0x36f: 0x0813, + 0x370: 0x9252, 0x371: 0x9252, 0x372: 0x9552, 0x373: 0x9552, 0x374: 0x9852, 0x375: 0x9852, + 0x376: 0x9b52, 0x377: 0x9b52, 0x378: 0x9e52, 0x379: 0x9e52, 0x37a: 0xa152, 0x37b: 0xa152, + 0x37c: 0x4d52, 0x37d: 0x4d52, + // Block 0xe, offset 0x380 + 0x380: 0x3fba, 0x381: 0x40aa, 0x382: 0x419a, 0x383: 0x428a, 0x384: 0x437a, 0x385: 0x446a, + 0x386: 0x455a, 0x387: 0x464a, 0x388: 0x4739, 0x389: 0x4829, 0x38a: 0x4919, 0x38b: 0x4a09, + 0x38c: 0x4af9, 0x38d: 0x4be9, 0x38e: 0x4cd9, 0x38f: 0x4dc9, 0x390: 0x4eba, 0x391: 0x4faa, + 0x392: 0x509a, 0x393: 0x518a, 0x394: 0x527a, 0x395: 0x536a, 0x396: 0x545a, 0x397: 0x554a, + 0x398: 0x5639, 0x399: 0x5729, 0x39a: 0x5819, 0x39b: 0x5909, 0x39c: 0x59f9, 0x39d: 0x5ae9, + 0x39e: 0x5bd9, 0x39f: 0x5cc9, 0x3a0: 0x5dba, 0x3a1: 0x5eaa, 0x3a2: 0x5f9a, 0x3a3: 0x608a, + 0x3a4: 0x617a, 0x3a5: 0x626a, 0x3a6: 0x635a, 0x3a7: 0x644a, 0x3a8: 0x6539, 0x3a9: 0x6629, + 0x3aa: 0x6719, 0x3ab: 0x6809, 0x3ac: 0x68f9, 0x3ad: 0x69e9, 0x3ae: 0x6ad9, 0x3af: 0x6bc9, + 0x3b0: 0x0812, 0x3b1: 0x0812, 0x3b2: 0x6cba, 0x3b3: 0x6dca, 0x3b4: 0x6e9a, + 0x3b6: 0x6f7a, 0x3b7: 0x705a, 0x3b8: 0x0813, 0x3b9: 0x0813, 0x3ba: 0x9253, 0x3bb: 0x9253, + 0x3bc: 0x7199, 0x3bd: 0x0004, 0x3be: 0x726a, 0x3bf: 0x0004, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x0004, 0x3c1: 0x0004, 0x3c2: 0x72ea, 0x3c3: 0x73fa, 0x3c4: 0x74ca, + 0x3c6: 0x75aa, 0x3c7: 0x768a, 0x3c8: 0x9553, 0x3c9: 0x9553, 0x3ca: 0x9853, 0x3cb: 0x9853, + 0x3cc: 0x77c9, 0x3cd: 0x0004, 0x3ce: 0x0004, 0x3cf: 0x0004, 0x3d0: 0x0812, 0x3d1: 0x0812, + 0x3d2: 0x789a, 0x3d3: 0x79da, 0x3d6: 0x7b1a, 0x3d7: 0x7bfa, + 0x3d8: 0x0813, 0x3d9: 0x0813, 0x3da: 0x9b53, 0x3db: 0x9b53, 0x3dd: 0x0004, + 0x3de: 0x0004, 0x3df: 0x0004, 0x3e0: 0x0812, 0x3e1: 0x0812, 0x3e2: 0x7d3a, 0x3e3: 0x7e7a, + 0x3e4: 0x7fba, 0x3e5: 0x0912, 0x3e6: 0x809a, 0x3e7: 0x817a, 0x3e8: 0x0813, 0x3e9: 0x0813, + 0x3ea: 0xa153, 0x3eb: 0xa153, 0x3ec: 0x0913, 0x3ed: 0x0004, 0x3ee: 0x0004, 0x3ef: 0x0004, + 0x3f2: 0x82ba, 0x3f3: 0x83ca, 0x3f4: 0x849a, + 0x3f6: 0x857a, 0x3f7: 0x865a, 0x3f8: 0x9e53, 0x3f9: 0x9e53, 0x3fa: 0x4d53, 0x3fb: 0x4d53, + 0x3fc: 0x8799, 0x3fd: 0x0004, 0x3fe: 0x0004, + // Block 0x10, offset 0x400 + 0x402: 0x0013, + 0x407: 0x0013, 0x40a: 0x0012, 0x40b: 0x0013, + 0x40c: 0x0013, 0x40d: 0x0013, 0x40e: 0x0012, 0x40f: 0x0012, 0x410: 0x0013, 0x411: 0x0013, + 0x412: 0x0013, 0x413: 0x0012, 0x415: 0x0013, + 0x419: 0x0013, 0x41a: 0x0013, 0x41b: 0x0013, 0x41c: 0x0013, 0x41d: 0x0013, + 0x424: 0x0013, 0x426: 0x886b, 0x428: 0x0013, + 0x42a: 0x88cb, 0x42b: 0x890b, 0x42c: 0x0013, 0x42d: 0x0013, 0x42f: 0x0012, + 0x430: 0x0013, 0x431: 0x0013, 0x432: 0xa453, 0x433: 0x0013, 0x434: 0x0012, 0x435: 0x0010, + 0x436: 0x0010, 0x437: 0x0010, 0x438: 0x0010, 0x439: 0x0012, + 0x43c: 0x0012, 0x43d: 0x0012, 0x43e: 0x0013, 0x43f: 0x0013, + // Block 0x11, offset 0x440 + 0x440: 0x1a13, 0x441: 0x1a13, 0x442: 0x1e13, 0x443: 0x1e13, 0x444: 0x1a13, 0x445: 0x1a13, + 0x446: 0x2613, 0x447: 0x2613, 0x448: 0x2a13, 0x449: 0x2a13, 0x44a: 0x2e13, 0x44b: 0x2e13, + 0x44c: 0x2a13, 0x44d: 0x2a13, 0x44e: 0x2613, 0x44f: 0x2613, 0x450: 0xa752, 0x451: 0xa752, + 0x452: 0xaa52, 0x453: 0xaa52, 0x454: 0xad52, 0x455: 0xad52, 0x456: 0xaa52, 0x457: 0xaa52, + 0x458: 0xa752, 0x459: 0xa752, 0x45a: 0x1a12, 0x45b: 0x1a12, 0x45c: 0x1e12, 0x45d: 0x1e12, + 0x45e: 0x1a12, 0x45f: 0x1a12, 0x460: 0x2612, 0x461: 0x2612, 0x462: 0x2a12, 0x463: 0x2a12, + 0x464: 0x2e12, 0x465: 0x2e12, 0x466: 0x2a12, 0x467: 0x2a12, 0x468: 0x2612, 0x469: 0x2612, + // Block 0x12, offset 0x480 + 0x480: 0x6552, 0x481: 0x6552, 0x482: 0x6552, 0x483: 0x6552, 0x484: 0x6552, 0x485: 0x6552, + 0x486: 0x6552, 0x487: 0x6552, 0x488: 0x6552, 0x489: 0x6552, 0x48a: 0x6552, 0x48b: 0x6552, + 0x48c: 0x6552, 0x48d: 0x6552, 0x48e: 0x6552, 0x48f: 0x6552, 0x490: 0xb052, 0x491: 0xb052, + 0x492: 0xb052, 0x493: 0xb052, 0x494: 0xb052, 0x495: 0xb052, 0x496: 0xb052, 0x497: 0xb052, + 0x498: 0xb052, 0x499: 0xb052, 0x49a: 0xb052, 0x49b: 0xb052, 0x49c: 0xb052, 0x49d: 0xb052, + 0x49e: 0xb052, 0x49f: 0xb052, 0x4a0: 0x0113, 0x4a1: 0x0112, 0x4a2: 0x896b, 0x4a3: 0x8b53, + 0x4a4: 0x89cb, 0x4a5: 0x8a2a, 0x4a6: 0x8a8a, 0x4a7: 0x0f13, 0x4a8: 0x0f12, 0x4a9: 0x0313, + 0x4aa: 0x0312, 0x4ab: 0x0713, 0x4ac: 0x0712, 0x4ad: 0x8aeb, 0x4ae: 0x8b4b, 0x4af: 0x8bab, + 0x4b0: 0x8c0b, 0x4b1: 0x0012, 0x4b2: 0x0113, 0x4b3: 0x0112, 0x4b4: 0x0012, 0x4b5: 0x0313, + 0x4b6: 0x0312, 0x4b7: 0x0012, 0x4b8: 0x0012, 0x4b9: 0x0012, 0x4ba: 0x0012, 0x4bb: 0x0012, + 0x4bc: 0x0015, 0x4bd: 0x0015, 0x4be: 0x8c6b, 0x4bf: 0x8ccb, + // Block 0x13, offset 0x4c0 + 0x4c0: 0x0113, 0x4c1: 0x0112, 0x4c2: 0x0113, 0x4c3: 0x0112, 0x4c4: 0x0113, 0x4c5: 0x0112, + 0x4c6: 0x0113, 0x4c7: 0x0112, 0x4c8: 0x0014, 0x4c9: 0x0014, 0x4ca: 0x0014, 0x4cb: 0x0713, + 0x4cc: 0x0712, 0x4cd: 0x8d2b, 0x4ce: 0x0012, 0x4cf: 0x0010, 0x4d0: 0x0113, 0x4d1: 0x0112, + 0x4d2: 0x0113, 0x4d3: 0x0112, 0x4d4: 0x6552, 0x4d5: 0x0012, 0x4d6: 0x0113, 0x4d7: 0x0112, + 0x4d8: 0x0113, 0x4d9: 0x0112, 0x4da: 0x0113, 0x4db: 0x0112, 0x4dc: 0x0113, 0x4dd: 0x0112, + 0x4de: 0x0113, 0x4df: 0x0112, 0x4e0: 0x0113, 0x4e1: 0x0112, 0x4e2: 0x0113, 0x4e3: 0x0112, + 0x4e4: 0x0113, 0x4e5: 0x0112, 0x4e6: 0x0113, 0x4e7: 0x0112, 0x4e8: 0x0113, 0x4e9: 0x0112, + 0x4ea: 0x8d8b, 0x4eb: 0x8deb, 0x4ec: 0x8e4b, 0x4ed: 0x8eab, 0x4ee: 0x8f0b, 0x4ef: 0x0012, + 0x4f0: 0x8f6b, 0x4f1: 0x8fcb, 0x4f2: 0x902b, 0x4f3: 0xb353, 0x4f4: 0x0113, 0x4f5: 0x0112, + 0x4f6: 0x0113, 0x4f7: 0x0112, 0x4f8: 0x0113, 0x4f9: 0x0112, 0x4fa: 0x0113, 0x4fb: 0x0112, + 0x4fc: 0x0113, 0x4fd: 0x0112, 0x4fe: 0x0113, 0x4ff: 0x0112, + // Block 0x14, offset 0x500 + 0x500: 0x90ea, 0x501: 0x916a, 0x502: 0x91ea, 0x503: 0x926a, 0x504: 0x931a, 0x505: 0x93ca, + 0x506: 0x944a, + 0x513: 0x94ca, 0x514: 0x95aa, 0x515: 0x968a, 0x516: 0x976a, 0x517: 0x984a, + 0x51d: 0x0010, + 0x51e: 0x0034, 0x51f: 0x0010, 0x520: 0x0010, 0x521: 0x0010, 0x522: 0x0010, 0x523: 0x0010, + 0x524: 0x0010, 0x525: 0x0010, 0x526: 0x0010, 0x527: 0x0010, 0x528: 0x0010, + 0x52a: 0x0010, 0x52b: 0x0010, 0x52c: 0x0010, 0x52d: 0x0010, 0x52e: 0x0010, 0x52f: 0x0010, + 0x530: 0x0010, 0x531: 0x0010, 0x532: 0x0010, 0x533: 0x0010, 0x534: 0x0010, 0x535: 0x0010, + 0x536: 0x0010, 0x538: 0x0010, 0x539: 0x0010, 0x53a: 0x0010, 0x53b: 0x0010, + 0x53c: 0x0010, 0x53e: 0x0010, + // Block 0x15, offset 0x540 + 0x540: 0x2713, 0x541: 0x2913, 0x542: 0x2b13, 0x543: 0x2913, 0x544: 0x2f13, 0x545: 0x2913, + 0x546: 0x2b13, 0x547: 0x2913, 0x548: 0x2713, 0x549: 0x3913, 0x54a: 0x3b13, + 0x54c: 0x3f13, 0x54d: 0x3913, 0x54e: 0x3b13, 0x54f: 0x3913, 0x550: 0x2713, 0x551: 0x2913, + 0x552: 0x2b13, 0x554: 0x2f13, 0x555: 0x2913, 0x557: 0xbc52, + 0x558: 0xbf52, 0x559: 0xc252, 0x55a: 0xbf52, 0x55b: 0xc552, 0x55c: 0xbf52, 0x55d: 0xc252, + 0x55e: 0xbf52, 0x55f: 0xbc52, 0x560: 0xc852, 0x561: 0xcb52, 0x563: 0xce52, + 0x564: 0xc852, 0x565: 0xcb52, 0x566: 0xc852, 0x567: 0x2712, 0x568: 0x2912, 0x569: 0x2b12, + 0x56a: 0x2912, 0x56b: 0x2f12, 0x56c: 0x2912, 0x56d: 0x2b12, 0x56e: 0x2912, 0x56f: 0x2712, + 0x570: 0x3912, 0x571: 0x3b12, 0x573: 0x3f12, 0x574: 0x3912, 0x575: 0x3b12, + 0x576: 0x3912, 0x577: 0x2712, 0x578: 0x2912, 0x579: 0x2b12, 0x57b: 0x2f12, + 0x57c: 0x2912, + // Block 0x16, offset 0x580 + 0x580: 0x2213, 0x581: 0x2213, 0x582: 0x2613, 0x583: 0x2613, 0x584: 0x2213, 0x585: 0x2213, + 0x586: 0x2e13, 0x587: 0x2e13, 0x588: 0x2213, 0x589: 0x2213, 0x58a: 0x2613, 0x58b: 0x2613, + 0x58c: 0x2213, 0x58d: 0x2213, 0x58e: 0x3e13, 0x58f: 0x3e13, 0x590: 0x2213, 0x591: 0x2213, + 0x592: 0x2613, 0x593: 0x2613, 0x594: 0x2213, 0x595: 0x2213, 0x596: 0x2e13, 0x597: 0x2e13, + 0x598: 0x2213, 0x599: 0x2213, 0x59a: 0x2613, 0x59b: 0x2613, 0x59c: 0x2213, 0x59d: 0x2213, + 0x59e: 0xd153, 0x59f: 0xd153, 0x5a0: 0xd453, 0x5a1: 0xd453, 0x5a2: 0x2212, 0x5a3: 0x2212, + 0x5a4: 0x2612, 0x5a5: 0x2612, 0x5a6: 0x2212, 0x5a7: 0x2212, 0x5a8: 0x2e12, 0x5a9: 0x2e12, + 0x5aa: 0x2212, 0x5ab: 0x2212, 0x5ac: 0x2612, 0x5ad: 0x2612, 0x5ae: 0x2212, 0x5af: 0x2212, + 0x5b0: 0x3e12, 0x5b1: 0x3e12, 0x5b2: 0x2212, 0x5b3: 0x2212, 0x5b4: 0x2612, 0x5b5: 0x2612, + 0x5b6: 0x2212, 0x5b7: 0x2212, 0x5b8: 0x2e12, 0x5b9: 0x2e12, 0x5ba: 0x2212, 0x5bb: 0x2212, + 0x5bc: 0x2612, 0x5bd: 0x2612, 0x5be: 0x2212, 0x5bf: 0x2212, + // Block 0x17, offset 0x5c0 + 0x5c2: 0x0010, + 0x5c7: 0x0010, 0x5c9: 0x0010, 0x5cb: 0x0010, + 0x5cd: 0x0010, 0x5ce: 0x0010, 0x5cf: 0x0010, 0x5d1: 0x0010, + 0x5d2: 0x0010, 0x5d4: 0x0010, 0x5d7: 0x0010, + 0x5d9: 0x0010, 0x5db: 0x0010, 0x5dd: 0x0010, + 0x5df: 0x0010, 0x5e1: 0x0010, 0x5e2: 0x0010, + 0x5e4: 0x0010, 0x5e7: 0x0010, 0x5e8: 0x0010, 0x5e9: 0x0010, + 0x5ea: 0x0010, 0x5ec: 0x0010, 0x5ed: 0x0010, 0x5ee: 0x0010, 0x5ef: 0x0010, + 0x5f0: 0x0010, 0x5f1: 0x0010, 0x5f2: 0x0010, 0x5f4: 0x0010, 0x5f5: 0x0010, + 0x5f6: 0x0010, 0x5f7: 0x0010, 0x5f9: 0x0010, 0x5fa: 0x0010, 0x5fb: 0x0010, + 0x5fc: 0x0010, 0x5fe: 0x0010, +} + +// caseIndex: 27 blocks, 1728 entries, 3456 bytes +// Block 0 is the zero block. +var caseIndex = [1728]uint16{ + // Block 0x0, offset 0x0 + // Block 0x1, offset 0x40 + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc2: 0x16, 0xc3: 0x17, 0xc4: 0x18, 0xc5: 0x19, 0xc6: 0x01, 0xc7: 0x02, + 0xc8: 0x1a, 0xc9: 0x03, 0xca: 0x04, 0xcb: 0x1b, 0xcc: 0x1c, 0xcd: 0x05, 0xce: 0x06, 0xcf: 0x07, + 0xd0: 0x1d, 0xd1: 0x1e, 0xd2: 0x1f, 0xd3: 0x20, 0xd4: 0x21, 0xd5: 0x22, 0xd6: 0x08, 0xd7: 0x23, + 0xd8: 0x24, 0xd9: 0x25, 0xda: 0x26, 0xdb: 0x27, 0xdc: 0x28, 0xdd: 0x29, 0xde: 0x2a, 0xdf: 0x2b, + 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, + 0xea: 0x06, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x08, 0xef: 0x09, + 0xf0: 0x16, 0xf3: 0x18, + // Block 0x4, offset 0x100 + 0x120: 0x2c, 0x121: 0x2d, 0x122: 0x2e, 0x123: 0x09, 0x124: 0x2f, 0x125: 0x30, 0x126: 0x31, 0x127: 0x32, + 0x128: 0x33, 0x129: 0x34, 0x12a: 0x35, 0x12b: 0x36, 0x12c: 0x37, 0x12d: 0x38, 0x12e: 0x39, 0x12f: 0x3a, + 0x130: 0x3b, 0x131: 0x3c, 0x132: 0x3d, 0x133: 0x3e, 0x134: 0x3f, 0x135: 0x40, 0x136: 0x41, 0x137: 0x42, + 0x138: 0x43, 0x139: 0x44, 0x13a: 0x45, 0x13b: 0x46, 0x13c: 0x47, 0x13d: 0x48, 0x13e: 0x49, 0x13f: 0x4a, + // Block 0x5, offset 0x140 + 0x140: 0x4b, 0x141: 0x4c, 0x142: 0x4d, 0x143: 0x0a, 0x144: 0x26, 0x145: 0x26, 0x146: 0x26, 0x147: 0x26, + 0x148: 0x26, 0x149: 0x4e, 0x14a: 0x4f, 0x14b: 0x50, 0x14c: 0x51, 0x14d: 0x52, 0x14e: 0x53, 0x14f: 0x54, + 0x150: 0x55, 0x151: 0x26, 0x152: 0x26, 0x153: 0x26, 0x154: 0x26, 0x155: 0x26, 0x156: 0x26, 0x157: 0x26, + 0x158: 0x26, 0x159: 0x56, 0x15a: 0x57, 0x15b: 0x58, 0x15c: 0x59, 0x15d: 0x5a, 0x15e: 0x5b, 0x15f: 0x5c, + 0x160: 0x5d, 0x161: 0x5e, 0x162: 0x5f, 0x163: 0x60, 0x164: 0x61, 0x165: 0x62, 0x167: 0x63, + 0x168: 0x64, 0x169: 0x65, 0x16a: 0x66, 0x16b: 0x67, 0x16c: 0x68, 0x16d: 0x69, 0x16e: 0x6a, 0x16f: 0x6b, + 0x170: 0x6c, 0x171: 0x6d, 0x172: 0x6e, 0x173: 0x6f, 0x174: 0x70, 0x175: 0x71, 0x176: 0x72, 0x177: 0x73, + 0x178: 0x74, 0x179: 0x74, 0x17a: 0x75, 0x17b: 0x74, 0x17c: 0x76, 0x17d: 0x0b, 0x17e: 0x0c, 0x17f: 0x0d, + // Block 0x6, offset 0x180 + 0x180: 0x77, 0x181: 0x78, 0x182: 0x79, 0x183: 0x7a, 0x184: 0x0e, 0x185: 0x7b, 0x186: 0x7c, + 0x192: 0x7d, 0x193: 0x0f, + 0x1b0: 0x7e, 0x1b1: 0x10, 0x1b2: 0x74, 0x1b3: 0x7f, 0x1b4: 0x80, 0x1b5: 0x81, 0x1b6: 0x82, 0x1b7: 0x83, + 0x1b8: 0x84, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x85, 0x1c2: 0x86, 0x1c3: 0x87, 0x1c4: 0x88, 0x1c5: 0x26, 0x1c6: 0x89, + // Block 0x8, offset 0x200 + 0x200: 0x8a, 0x201: 0x26, 0x202: 0x26, 0x203: 0x26, 0x204: 0x26, 0x205: 0x26, 0x206: 0x26, 0x207: 0x26, + 0x208: 0x26, 0x209: 0x26, 0x20a: 0x26, 0x20b: 0x26, 0x20c: 0x26, 0x20d: 0x26, 0x20e: 0x26, 0x20f: 0x26, + 0x210: 0x26, 0x211: 0x26, 0x212: 0x8b, 0x213: 0x8c, 0x214: 0x26, 0x215: 0x26, 0x216: 0x26, 0x217: 0x26, + 0x218: 0x8d, 0x219: 0x8e, 0x21a: 0x8f, 0x21b: 0x90, 0x21c: 0x91, 0x21d: 0x92, 0x21e: 0x11, 0x21f: 0x93, + 0x220: 0x94, 0x221: 0x95, 0x222: 0x26, 0x223: 0x96, 0x224: 0x97, 0x225: 0x98, 0x226: 0x99, 0x227: 0x9a, + 0x228: 0x9b, 0x229: 0x9c, 0x22a: 0x9d, 0x22b: 0x9e, 0x22c: 0x9f, 0x22d: 0xa0, 0x22e: 0xa1, 0x22f: 0xa2, + 0x230: 0x26, 0x231: 0x26, 0x232: 0x26, 0x233: 0x26, 0x234: 0x26, 0x235: 0x26, 0x236: 0x26, 0x237: 0x26, + 0x238: 0x26, 0x239: 0x26, 0x23a: 0x26, 0x23b: 0x26, 0x23c: 0x26, 0x23d: 0x26, 0x23e: 0x26, 0x23f: 0x26, + // Block 0x9, offset 0x240 + 0x240: 0x26, 0x241: 0x26, 0x242: 0x26, 0x243: 0x26, 0x244: 0x26, 0x245: 0x26, 0x246: 0x26, 0x247: 0x26, + 0x248: 0x26, 0x249: 0x26, 0x24a: 0x26, 0x24b: 0x26, 0x24c: 0x26, 0x24d: 0x26, 0x24e: 0x26, 0x24f: 0x26, + 0x250: 0x26, 0x251: 0x26, 0x252: 0x26, 0x253: 0x26, 0x254: 0x26, 0x255: 0x26, 0x256: 0x26, 0x257: 0x26, + 0x258: 0x26, 0x259: 0x26, 0x25a: 0x26, 0x25b: 0x26, 0x25c: 0x26, 0x25d: 0x26, 0x25e: 0x26, 0x25f: 0x26, + 0x260: 0x26, 0x261: 0x26, 0x262: 0x26, 0x263: 0x26, 0x264: 0x26, 0x265: 0x26, 0x266: 0x26, 0x267: 0x26, + 0x268: 0x26, 0x269: 0x26, 0x26a: 0x26, 0x26b: 0x26, 0x26c: 0x26, 0x26d: 0x26, 0x26e: 0x26, 0x26f: 0x26, + 0x270: 0x26, 0x271: 0x26, 0x272: 0x26, 0x273: 0x26, 0x274: 0x26, 0x275: 0x26, 0x276: 0x26, 0x277: 0x26, + 0x278: 0x26, 0x279: 0x26, 0x27a: 0x26, 0x27b: 0x26, 0x27c: 0x26, 0x27d: 0x26, 0x27e: 0x26, 0x27f: 0x26, + // Block 0xa, offset 0x280 + 0x280: 0x26, 0x281: 0x26, 0x282: 0x26, 0x283: 0x26, 0x284: 0x26, 0x285: 0x26, 0x286: 0x26, 0x287: 0x26, + 0x288: 0x26, 0x289: 0x26, 0x28a: 0x26, 0x28b: 0x26, 0x28c: 0x26, 0x28d: 0x26, 0x28e: 0x26, 0x28f: 0x26, + 0x290: 0x26, 0x291: 0x26, 0x292: 0x26, 0x293: 0x26, 0x294: 0x26, 0x295: 0x26, 0x296: 0x26, 0x297: 0x26, + 0x298: 0x26, 0x299: 0x26, 0x29a: 0x26, 0x29b: 0x26, 0x29c: 0x26, 0x29d: 0x26, 0x29e: 0xa3, 0x29f: 0xa4, + // Block 0xb, offset 0x2c0 + 0x2ec: 0x12, 0x2ed: 0xa5, 0x2ee: 0xa6, 0x2ef: 0xa7, + 0x2f0: 0x26, 0x2f1: 0x26, 0x2f2: 0x26, 0x2f3: 0x26, 0x2f4: 0xa8, 0x2f5: 0xa9, 0x2f6: 0xaa, 0x2f7: 0xab, + 0x2f8: 0xac, 0x2f9: 0xad, 0x2fa: 0x26, 0x2fb: 0xae, 0x2fc: 0xaf, 0x2fd: 0xb0, 0x2fe: 0xb1, 0x2ff: 0xb2, + // Block 0xc, offset 0x300 + 0x300: 0xb3, 0x301: 0xb4, 0x302: 0x26, 0x303: 0xb5, 0x305: 0xb6, 0x307: 0xb7, + 0x30a: 0xb8, 0x30b: 0xb9, 0x30c: 0xba, 0x30d: 0xbb, 0x30e: 0xbc, 0x30f: 0xbd, + 0x310: 0xbe, 0x311: 0xbf, 0x312: 0xc0, 0x313: 0xc1, 0x314: 0xc2, 0x315: 0xc3, 0x316: 0x13, + 0x318: 0x26, 0x319: 0x26, 0x31a: 0x26, 0x31b: 0x26, 0x31c: 0xc4, 0x31d: 0xc5, 0x31e: 0xc6, + 0x320: 0xc7, 0x321: 0xc8, 0x322: 0xc9, 0x323: 0xca, 0x324: 0xcb, 0x326: 0xcc, + 0x328: 0xcd, 0x329: 0xce, 0x32a: 0xcf, 0x32b: 0xd0, 0x32c: 0x60, 0x32d: 0xd1, 0x32e: 0xd2, + 0x330: 0x26, 0x331: 0xd3, 0x332: 0xd4, 0x333: 0xd5, 0x334: 0xd6, + 0x33a: 0xd7, 0x33b: 0xd8, 0x33c: 0xd9, 0x33d: 0xda, 0x33e: 0xdb, 0x33f: 0xdc, + // Block 0xd, offset 0x340 + 0x340: 0xdd, 0x341: 0xde, 0x342: 0xdf, 0x343: 0xe0, 0x344: 0xe1, 0x345: 0xe2, 0x346: 0xe3, 0x347: 0xe4, + 0x348: 0xe5, 0x349: 0xe6, 0x34a: 0xe7, 0x34b: 0xe8, 0x34c: 0xe9, 0x34d: 0xea, + 0x350: 0xeb, 0x351: 0xec, 0x352: 0xed, 0x353: 0xee, 0x356: 0xef, 0x357: 0xf0, + 0x358: 0xf1, 0x359: 0xf2, 0x35a: 0xf3, 0x35b: 0xf4, 0x35c: 0xf5, + 0x360: 0xf6, 0x362: 0xf7, 0x363: 0xf8, 0x364: 0xf9, 0x365: 0xfa, 0x366: 0xfb, 0x367: 0xfc, + 0x368: 0xfd, 0x369: 0xfe, 0x36a: 0xff, 0x36b: 0x100, + 0x370: 0x101, 0x371: 0x102, 0x372: 0x103, 0x374: 0x104, 0x375: 0x105, 0x376: 0x106, + 0x37b: 0x107, 0x37c: 0x108, 0x37d: 0x109, 0x37e: 0x10a, + // Block 0xe, offset 0x380 + 0x380: 0x26, 0x381: 0x26, 0x382: 0x26, 0x383: 0x26, 0x384: 0x26, 0x385: 0x26, 0x386: 0x26, 0x387: 0x26, + 0x388: 0x26, 0x389: 0x26, 0x38a: 0x26, 0x38b: 0x26, 0x38c: 0x26, 0x38d: 0x26, 0x38e: 0x10b, + 0x390: 0x26, 0x391: 0x10c, 0x392: 0x26, 0x393: 0x26, 0x394: 0x26, 0x395: 0x10d, + 0x3be: 0xa9, 0x3bf: 0x10e, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x26, 0x3c1: 0x26, 0x3c2: 0x26, 0x3c3: 0x26, 0x3c4: 0x26, 0x3c5: 0x26, 0x3c6: 0x26, 0x3c7: 0x26, + 0x3c8: 0x26, 0x3c9: 0x26, 0x3ca: 0x26, 0x3cb: 0x26, 0x3cc: 0x26, 0x3cd: 0x26, 0x3ce: 0x26, 0x3cf: 0x26, + 0x3d0: 0x10f, 0x3d1: 0x110, + // Block 0x10, offset 0x400 + 0x410: 0x26, 0x411: 0x26, 0x412: 0x26, 0x413: 0x26, 0x414: 0x26, 0x415: 0x26, 0x416: 0x26, 0x417: 0x26, + 0x418: 0x26, 0x419: 0x111, + // Block 0x11, offset 0x440 + 0x460: 0x26, 0x461: 0x26, 0x462: 0x26, 0x463: 0x26, 0x464: 0x26, 0x465: 0x26, 0x466: 0x26, 0x467: 0x26, + 0x468: 0x100, 0x469: 0x112, 0x46a: 0x113, 0x46b: 0x114, 0x46c: 0x115, 0x46d: 0x116, 0x46e: 0x117, + 0x479: 0x118, 0x47c: 0x26, 0x47d: 0x119, 0x47e: 0x11a, 0x47f: 0x11b, + // Block 0x12, offset 0x480 + 0x4bf: 0x11c, + // Block 0x13, offset 0x4c0 + 0x4f0: 0x26, 0x4f1: 0x11d, 0x4f2: 0x11e, + // Block 0x14, offset 0x500 + 0x53c: 0x11f, 0x53d: 0x120, + // Block 0x15, offset 0x540 + 0x545: 0x121, 0x546: 0x122, + 0x549: 0x123, + 0x550: 0x124, 0x551: 0x125, 0x552: 0x126, 0x553: 0x127, 0x554: 0x128, 0x555: 0x129, 0x556: 0x12a, 0x557: 0x12b, + 0x558: 0x12c, 0x559: 0x12d, 0x55a: 0x12e, 0x55b: 0x12f, 0x55c: 0x130, 0x55d: 0x131, 0x55e: 0x132, 0x55f: 0x133, + 0x568: 0x134, 0x569: 0x135, 0x56a: 0x136, + 0x57c: 0x137, + // Block 0x16, offset 0x580 + 0x580: 0x138, 0x581: 0x139, 0x582: 0x13a, 0x584: 0x13b, 0x585: 0x13c, + 0x58a: 0x13d, 0x58b: 0x13e, + 0x593: 0x13f, + 0x59f: 0x140, + 0x5a0: 0x26, 0x5a1: 0x26, 0x5a2: 0x26, 0x5a3: 0x141, 0x5a4: 0x14, 0x5a5: 0x142, + 0x5b8: 0x143, 0x5b9: 0x15, 0x5ba: 0x144, + // Block 0x17, offset 0x5c0 + 0x5c4: 0x145, 0x5c5: 0x146, 0x5c6: 0x147, + 0x5cf: 0x148, + 0x5ef: 0x149, + // Block 0x18, offset 0x600 + 0x610: 0x0a, 0x611: 0x0b, 0x612: 0x0c, 0x613: 0x0d, 0x614: 0x0e, 0x616: 0x0f, + 0x61a: 0x10, 0x61b: 0x11, 0x61c: 0x12, 0x61d: 0x13, 0x61e: 0x14, 0x61f: 0x15, + // Block 0x19, offset 0x640 + 0x640: 0x14a, 0x641: 0x14b, 0x644: 0x14b, 0x645: 0x14b, 0x646: 0x14b, 0x647: 0x14c, + // Block 0x1a, offset 0x680 + 0x6a0: 0x17, +} + +// sparseOffsets: 312 entries, 624 bytes +var sparseOffsets = []uint16{0x0, 0x9, 0xf, 0x18, 0x24, 0x2e, 0x34, 0x37, 0x3b, 0x3e, 0x42, 0x4c, 0x4e, 0x57, 0x5e, 0x63, 0x71, 0x72, 0x80, 0x8f, 0x99, 0x9c, 0xa3, 0xab, 0xaf, 0xb7, 0xbd, 0xcb, 0xd6, 0xe3, 0xee, 0xfa, 0x104, 0x110, 0x11b, 0x127, 0x133, 0x13b, 0x145, 0x150, 0x15b, 0x167, 0x16d, 0x178, 0x17e, 0x186, 0x189, 0x18e, 0x192, 0x196, 0x19d, 0x1a6, 0x1ae, 0x1af, 0x1b8, 0x1bf, 0x1c7, 0x1cd, 0x1d2, 0x1d6, 0x1d9, 0x1db, 0x1de, 0x1e3, 0x1e4, 0x1e6, 0x1e8, 0x1ea, 0x1f1, 0x1f6, 0x1fa, 0x203, 0x206, 0x209, 0x20f, 0x210, 0x21b, 0x21c, 0x21d, 0x222, 0x22f, 0x238, 0x23e, 0x246, 0x24f, 0x258, 0x261, 0x266, 0x269, 0x274, 0x282, 0x284, 0x28b, 0x28f, 0x29b, 0x29c, 0x2a7, 0x2af, 0x2b7, 0x2bd, 0x2be, 0x2cc, 0x2d1, 0x2d4, 0x2d9, 0x2dd, 0x2e3, 0x2e8, 0x2eb, 0x2f0, 0x2f5, 0x2f6, 0x2fc, 0x2fe, 0x2ff, 0x301, 0x303, 0x306, 0x307, 0x309, 0x30c, 0x312, 0x316, 0x318, 0x31d, 0x324, 0x334, 0x33e, 0x33f, 0x348, 0x34c, 0x351, 0x359, 0x35f, 0x365, 0x36f, 0x374, 0x37d, 0x383, 0x38c, 0x390, 0x398, 0x39a, 0x39c, 0x39f, 0x3a1, 0x3a3, 0x3a4, 0x3a5, 0x3a7, 0x3a9, 0x3af, 0x3b4, 0x3b6, 0x3bd, 0x3c0, 0x3c2, 0x3c8, 0x3cd, 0x3cf, 0x3d0, 0x3d1, 0x3d2, 0x3d4, 0x3d6, 0x3d8, 0x3db, 0x3dd, 0x3e0, 0x3e8, 0x3eb, 0x3ef, 0x3f7, 0x3f9, 0x409, 0x40a, 0x40c, 0x411, 0x417, 0x419, 0x41a, 0x41c, 0x41e, 0x420, 0x42d, 0x42e, 0x42f, 0x433, 0x435, 0x436, 0x437, 0x438, 0x439, 0x43c, 0x43f, 0x440, 0x443, 0x44a, 0x450, 0x452, 0x456, 0x45e, 0x464, 0x468, 0x46f, 0x473, 0x477, 0x480, 0x48a, 0x48c, 0x492, 0x498, 0x4a2, 0x4ac, 0x4ae, 0x4b7, 0x4bd, 0x4c3, 0x4c9, 0x4cc, 0x4d2, 0x4d5, 0x4de, 0x4df, 0x4e6, 0x4ea, 0x4eb, 0x4ee, 0x4f8, 0x4fb, 0x4fd, 0x504, 0x50c, 0x512, 0x519, 0x51a, 0x520, 0x523, 0x52b, 0x532, 0x53c, 0x544, 0x547, 0x54c, 0x550, 0x551, 0x552, 0x553, 0x554, 0x555, 0x557, 0x55a, 0x55b, 0x55e, 0x55f, 0x562, 0x564, 0x568, 0x569, 0x56b, 0x56e, 0x570, 0x573, 0x576, 0x578, 0x57d, 0x57f, 0x580, 0x585, 0x589, 0x58a, 0x58d, 0x591, 0x59c, 0x5a0, 0x5a8, 0x5ad, 0x5b1, 0x5b4, 0x5b8, 0x5bb, 0x5be, 0x5c3, 0x5c7, 0x5cb, 0x5cf, 0x5d3, 0x5d5, 0x5d7, 0x5da, 0x5de, 0x5e4, 0x5e5, 0x5e6, 0x5e9, 0x5eb, 0x5ed, 0x5f0, 0x5f5, 0x5f9, 0x5fb, 0x601, 0x60a, 0x60f, 0x610, 0x613, 0x614, 0x615, 0x616, 0x618, 0x619, 0x61a} + +// sparseValues: 1562 entries, 6248 bytes +var sparseValues = [1562]valueRange{ + // Block 0x0, offset 0x0 + {value: 0x0004, lo: 0xa8, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xaa}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0004, lo: 0xaf, hi: 0xaf}, + {value: 0x0004, lo: 0xb4, hi: 0xb4}, + {value: 0x001a, lo: 0xb5, hi: 0xb5}, + {value: 0x0054, lo: 0xb7, hi: 0xb7}, + {value: 0x0004, lo: 0xb8, hi: 0xb8}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + // Block 0x1, offset 0x9 + {value: 0x2013, lo: 0x80, hi: 0x96}, + {value: 0x2013, lo: 0x98, hi: 0x9e}, + {value: 0x009a, lo: 0x9f, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xb6}, + {value: 0x2012, lo: 0xb8, hi: 0xbe}, + {value: 0x0252, lo: 0xbf, hi: 0xbf}, + // Block 0x2, offset 0xf + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x011b, lo: 0xb0, hi: 0xb0}, + {value: 0x019a, lo: 0xb1, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb7}, + {value: 0x0012, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x0553, lo: 0xbf, hi: 0xbf}, + // Block 0x3, offset 0x18 + {value: 0x0552, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x01da, lo: 0x89, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xb7}, + {value: 0x0253, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x028a, lo: 0xbf, hi: 0xbf}, + // Block 0x4, offset 0x24 + {value: 0x0117, lo: 0x80, hi: 0x9f}, + {value: 0x2f53, lo: 0xa0, hi: 0xa0}, + {value: 0x0012, lo: 0xa1, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xb3}, + {value: 0x0012, lo: 0xb4, hi: 0xb9}, + {value: 0x090b, lo: 0xba, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x2953, lo: 0xbd, hi: 0xbd}, + {value: 0x098b, lo: 0xbe, hi: 0xbe}, + {value: 0x0a0a, lo: 0xbf, hi: 0xbf}, + // Block 0x5, offset 0x2e + {value: 0x0015, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x97}, + {value: 0x0004, lo: 0x98, hi: 0x9d}, + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0015, lo: 0xa0, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xbf}, + // Block 0x6, offset 0x34 + {value: 0x0024, lo: 0x80, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbf}, + // Block 0x7, offset 0x37 + {value: 0x6553, lo: 0x80, hi: 0x8f}, + {value: 0x2013, lo: 0x90, hi: 0x9f}, + {value: 0x5f53, lo: 0xa0, hi: 0xaf}, + {value: 0x2012, lo: 0xb0, hi: 0xbf}, + // Block 0x8, offset 0x3b + {value: 0x5f52, lo: 0x80, hi: 0x8f}, + {value: 0x6552, lo: 0x90, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x9, offset 0x3e + {value: 0x0117, lo: 0x80, hi: 0x81}, + {value: 0x0024, lo: 0x83, hi: 0x87}, + {value: 0x0014, lo: 0x88, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xbf}, + // Block 0xa, offset 0x42 + {value: 0x0f13, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x0316, lo: 0x89, hi: 0x8a}, + {value: 0x0716, lo: 0x8b, hi: 0x8c}, + {value: 0x0316, lo: 0x8d, hi: 0x8e}, + {value: 0x0f12, lo: 0x8f, hi: 0x8f}, + {value: 0x0117, lo: 0x90, hi: 0xbf}, + // Block 0xb, offset 0x4c + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x6553, lo: 0xb1, hi: 0xbf}, + // Block 0xc, offset 0x4e + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6853, lo: 0x90, hi: 0x96}, + {value: 0x0014, lo: 0x99, hi: 0x99}, + {value: 0x0010, lo: 0x9a, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0054, lo: 0x9f, hi: 0x9f}, + {value: 0x0012, lo: 0xa0, hi: 0xa0}, + {value: 0x6552, lo: 0xa1, hi: 0xaf}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0xd, offset 0x57 + {value: 0x0034, lo: 0x81, hi: 0x82}, + {value: 0x0024, lo: 0x84, hi: 0x84}, + {value: 0x0034, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0xaa}, + {value: 0x0010, lo: 0xaf, hi: 0xb3}, + {value: 0x0054, lo: 0xb4, hi: 0xb4}, + // Block 0xe, offset 0x5e + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0024, lo: 0x90, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0014, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xf, offset 0x63 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9c}, + {value: 0x0024, lo: 0x9d, hi: 0x9e}, + {value: 0x0034, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0034, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x10, offset 0x71 + {value: 0x0010, lo: 0x80, hi: 0xbf}, + // Block 0x11, offset 0x72 + {value: 0x0010, lo: 0x80, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0024, lo: 0x9f, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xaa, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x12, offset 0x80 + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0034, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0034, lo: 0xb1, hi: 0xb1}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbd}, + {value: 0x0034, lo: 0xbe, hi: 0xbe}, + {value: 0x0024, lo: 0xbf, hi: 0xbf}, + // Block 0x13, offset 0x8f + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0024, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x88}, + {value: 0x0024, lo: 0x89, hi: 0x8a}, + {value: 0x0010, lo: 0x8d, hi: 0xbf}, + // Block 0x14, offset 0x99 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x15, offset 0x9c + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xb1}, + {value: 0x0034, lo: 0xb2, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0x16, offset 0xa3 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x99}, + {value: 0x0014, lo: 0x9a, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0xa3}, + {value: 0x0014, lo: 0xa4, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xad}, + // Block 0x17, offset 0xab + {value: 0x0010, lo: 0x80, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0xa0, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x18, offset 0xaf + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0004, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x8e}, + {value: 0x0014, lo: 0x90, hi: 0x91}, + {value: 0x0024, lo: 0x98, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x9b}, + {value: 0x0024, lo: 0x9c, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x19, offset 0xb7 + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1a, offset 0xbd + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0x1b, offset 0xcb + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb6, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1c, offset 0xd6 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xb1}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + // Block 0x1d, offset 0xe3 + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x1e, offset 0xee + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x99, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x1f, offset 0xfa + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x20, offset 0x104 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x85}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xbf}, + // Block 0x21, offset 0x110 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x22, offset 0x11b + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x23, offset 0x127 + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0010, lo: 0xa8, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x24, offset 0x133 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x25, offset 0x13b + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbf}, + // Block 0x26, offset 0x145 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x88}, + {value: 0x0014, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9a}, + {value: 0x0010, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x27, offset 0x150 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x28, offset 0x15b + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x9d, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb3}, + // Block 0x29, offset 0x167 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x2a, offset 0x16d + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x94, hi: 0x97}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xba, hi: 0xbf}, + // Block 0x2b, offset 0x178 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x96}, + {value: 0x0010, lo: 0x9a, hi: 0xb1}, + {value: 0x0010, lo: 0xb3, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x2c, offset 0x17e + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x94}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9f}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + // Block 0x2d, offset 0x186 + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xba}, + // Block 0x2e, offset 0x189 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x2f, offset 0x18e + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xba}, + {value: 0x0014, lo: 0xbb, hi: 0xbc}, + // Block 0x30, offset 0x192 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x31, offset 0x196 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0034, lo: 0x98, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0034, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x32, offset 0x19d + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xac}, + {value: 0x0034, lo: 0xb1, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xba, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x33, offset 0x1a6 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0024, lo: 0x82, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x86, hi: 0x87}, + {value: 0x0010, lo: 0x88, hi: 0x8c}, + {value: 0x0014, lo: 0x8d, hi: 0x97}, + {value: 0x0014, lo: 0x99, hi: 0xbc}, + // Block 0x34, offset 0x1ae + {value: 0x0034, lo: 0x86, hi: 0x86}, + // Block 0x35, offset 0x1af + {value: 0x0010, lo: 0xab, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbe}, + // Block 0x36, offset 0x1b8 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x96, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x99}, + {value: 0x0014, lo: 0x9e, hi: 0xa0}, + {value: 0x0010, lo: 0xa2, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xad}, + {value: 0x0014, lo: 0xb1, hi: 0xb4}, + // Block 0x37, offset 0x1bf + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x6c53, lo: 0xa0, hi: 0xbf}, + // Block 0x38, offset 0x1c7 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x9a, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x39, offset 0x1cd + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x3a, offset 0x1d2 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x82, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3b, offset 0x1d6 + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3c, offset 0x1d9 + {value: 0x0010, lo: 0x80, hi: 0x9a}, + {value: 0x0024, lo: 0x9d, hi: 0x9f}, + // Block 0x3d, offset 0x1db + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x7453, lo: 0xa0, hi: 0xaf}, + {value: 0x7853, lo: 0xb0, hi: 0xbf}, + // Block 0x3e, offset 0x1de + {value: 0x7c53, lo: 0x80, hi: 0x8f}, + {value: 0x8053, lo: 0x90, hi: 0x9f}, + {value: 0x7c53, lo: 0xa0, hi: 0xaf}, + {value: 0x0813, lo: 0xb0, hi: 0xb5}, + {value: 0x0892, lo: 0xb8, hi: 0xbd}, + // Block 0x3f, offset 0x1e3 + {value: 0x0010, lo: 0x81, hi: 0xbf}, + // Block 0x40, offset 0x1e4 + {value: 0x0010, lo: 0x80, hi: 0xac}, + {value: 0x0010, lo: 0xaf, hi: 0xbf}, + // Block 0x41, offset 0x1e6 + {value: 0x0010, lo: 0x81, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x42, offset 0x1e8 + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb8}, + // Block 0x43, offset 0x1ea + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0034, lo: 0x94, hi: 0x94}, + {value: 0x0030, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x9f, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0030, lo: 0xb4, hi: 0xb4}, + // Block 0x44, offset 0x1f1 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xac}, + {value: 0x0010, lo: 0xae, hi: 0xb0}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + // Block 0x45, offset 0x1f6 + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x46, offset 0x1fa + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x89, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0014, lo: 0x93, hi: 0x93}, + {value: 0x0004, lo: 0x97, hi: 0x97}, + {value: 0x0024, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0x47, offset 0x203 + {value: 0x0014, lo: 0x8b, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x48, offset 0x206 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb8}, + // Block 0x49, offset 0x209 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x4a, offset 0x20f + {value: 0x0010, lo: 0x80, hi: 0xb5}, + // Block 0x4b, offset 0x210 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbb}, + // Block 0x4c, offset 0x21b + {value: 0x0010, lo: 0x86, hi: 0x8f}, + // Block 0x4d, offset 0x21c + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x4e, offset 0x21d + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + // Block 0x4f, offset 0x222 + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x9e}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xac}, + {value: 0x0010, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xbc}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x50, offset 0x22f + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xa7, hi: 0xa7}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + {value: 0x0034, lo: 0xb5, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbc}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x51, offset 0x238 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0024, lo: 0x81, hi: 0x82}, + {value: 0x0034, lo: 0x83, hi: 0x84}, + {value: 0x0024, lo: 0x85, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0024, lo: 0x8b, hi: 0x8e}, + // Block 0x52, offset 0x23e + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x53, offset 0x246 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0030, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xab, hi: 0xab}, + {value: 0x0034, lo: 0xac, hi: 0xac}, + {value: 0x0024, lo: 0xad, hi: 0xb3}, + // Block 0x54, offset 0x24f + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0030, lo: 0xaa, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbf}, + // Block 0x55, offset 0x258 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0030, lo: 0xb2, hi: 0xb3}, + // Block 0x56, offset 0x261 + {value: 0x0010, lo: 0x80, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + // Block 0x57, offset 0x266 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8d, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x58, offset 0x269 + {value: 0x31ea, lo: 0x80, hi: 0x80}, + {value: 0x326a, lo: 0x81, hi: 0x81}, + {value: 0x32ea, lo: 0x82, hi: 0x82}, + {value: 0x336a, lo: 0x83, hi: 0x83}, + {value: 0x33ea, lo: 0x84, hi: 0x84}, + {value: 0x346a, lo: 0x85, hi: 0x85}, + {value: 0x34ea, lo: 0x86, hi: 0x86}, + {value: 0x356a, lo: 0x87, hi: 0x87}, + {value: 0x35ea, lo: 0x88, hi: 0x88}, + {value: 0x8353, lo: 0x90, hi: 0xba}, + {value: 0x8353, lo: 0xbd, hi: 0xbf}, + // Block 0x59, offset 0x274 + {value: 0x0024, lo: 0x90, hi: 0x92}, + {value: 0x0034, lo: 0x94, hi: 0x99}, + {value: 0x0024, lo: 0x9a, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9f}, + {value: 0x0024, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0034, lo: 0xa2, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xb3}, + {value: 0x0024, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb7}, + {value: 0x0024, lo: 0xb8, hi: 0xb9}, + {value: 0x0010, lo: 0xba, hi: 0xba}, + // Block 0x5a, offset 0x282 + {value: 0x0012, lo: 0x80, hi: 0xab}, + {value: 0x0015, lo: 0xac, hi: 0xbf}, + // Block 0x5b, offset 0x284 + {value: 0x0015, lo: 0x80, hi: 0xaa}, + {value: 0x0012, lo: 0xab, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb8}, + {value: 0x8752, lo: 0xb9, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbc}, + {value: 0x8b52, lo: 0xbd, hi: 0xbd}, + {value: 0x0012, lo: 0xbe, hi: 0xbf}, + // Block 0x5c, offset 0x28b + {value: 0x0012, lo: 0x80, hi: 0x8d}, + {value: 0x8f52, lo: 0x8e, hi: 0x8e}, + {value: 0x0012, lo: 0x8f, hi: 0x9a}, + {value: 0x0015, lo: 0x9b, hi: 0xbf}, + // Block 0x5d, offset 0x28f + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0024, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbd}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x5e, offset 0x29b + {value: 0x0117, lo: 0x80, hi: 0xbf}, + // Block 0x5f, offset 0x29c + {value: 0x0117, lo: 0x80, hi: 0x95}, + {value: 0x369a, lo: 0x96, hi: 0x96}, + {value: 0x374a, lo: 0x97, hi: 0x97}, + {value: 0x37fa, lo: 0x98, hi: 0x98}, + {value: 0x38aa, lo: 0x99, hi: 0x99}, + {value: 0x395a, lo: 0x9a, hi: 0x9a}, + {value: 0x3a0a, lo: 0x9b, hi: 0x9b}, + {value: 0x0012, lo: 0x9c, hi: 0x9d}, + {value: 0x3abb, lo: 0x9e, hi: 0x9e}, + {value: 0x0012, lo: 0x9f, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x60, offset 0x2a7 + {value: 0x0812, lo: 0x80, hi: 0x87}, + {value: 0x0813, lo: 0x88, hi: 0x8f}, + {value: 0x0812, lo: 0x90, hi: 0x95}, + {value: 0x0813, lo: 0x98, hi: 0x9d}, + {value: 0x0812, lo: 0xa0, hi: 0xa7}, + {value: 0x0813, lo: 0xa8, hi: 0xaf}, + {value: 0x0812, lo: 0xb0, hi: 0xb7}, + {value: 0x0813, lo: 0xb8, hi: 0xbf}, + // Block 0x61, offset 0x2af + {value: 0x0004, lo: 0x8b, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8f}, + {value: 0x0054, lo: 0x98, hi: 0x99}, + {value: 0x0054, lo: 0xa4, hi: 0xa4}, + {value: 0x0054, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xaa, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xaf}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x62, offset 0x2b7 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x94, hi: 0x94}, + {value: 0x0014, lo: 0xa0, hi: 0xa4}, + {value: 0x0014, lo: 0xa6, hi: 0xaf}, + {value: 0x0015, lo: 0xb1, hi: 0xb1}, + {value: 0x0015, lo: 0xbf, hi: 0xbf}, + // Block 0x63, offset 0x2bd + {value: 0x0015, lo: 0x90, hi: 0x9c}, + // Block 0x64, offset 0x2be + {value: 0x0024, lo: 0x90, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x93}, + {value: 0x0024, lo: 0x94, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0xa0}, + {value: 0x0024, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa4}, + {value: 0x0034, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa7}, + {value: 0x0034, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xa9}, + {value: 0x0034, lo: 0xaa, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + // Block 0x65, offset 0x2cc + {value: 0x0016, lo: 0x85, hi: 0x86}, + {value: 0x0012, lo: 0x87, hi: 0x89}, + {value: 0xa452, lo: 0x8e, hi: 0x8e}, + {value: 0x1013, lo: 0xa0, hi: 0xaf}, + {value: 0x1012, lo: 0xb0, hi: 0xbf}, + // Block 0x66, offset 0x2d1 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x88}, + // Block 0x67, offset 0x2d4 + {value: 0xa753, lo: 0xb6, hi: 0xb7}, + {value: 0xaa53, lo: 0xb8, hi: 0xb9}, + {value: 0xad53, lo: 0xba, hi: 0xbb}, + {value: 0xaa53, lo: 0xbc, hi: 0xbd}, + {value: 0xa753, lo: 0xbe, hi: 0xbf}, + // Block 0x68, offset 0x2d9 + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6553, lo: 0x90, hi: 0x9f}, + {value: 0xb053, lo: 0xa0, hi: 0xaf}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0x69, offset 0x2dd + {value: 0x0117, lo: 0x80, hi: 0xa3}, + {value: 0x0012, lo: 0xa4, hi: 0xa4}, + {value: 0x0716, lo: 0xab, hi: 0xac}, + {value: 0x0316, lo: 0xad, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb3}, + // Block 0x6a, offset 0x2e3 + {value: 0x6c52, lo: 0x80, hi: 0x9f}, + {value: 0x7052, lo: 0xa0, hi: 0xa5}, + {value: 0x7052, lo: 0xa7, hi: 0xa7}, + {value: 0x7052, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x6b, offset 0x2e8 + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x6c, offset 0x2eb + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0010, lo: 0xb0, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x6d, offset 0x2f0 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9e}, + {value: 0x0024, lo: 0xa0, hi: 0xbf}, + // Block 0x6e, offset 0x2f5 + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + // Block 0x6f, offset 0x2f6 + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0xaa, hi: 0xad}, + {value: 0x0030, lo: 0xae, hi: 0xaf}, + {value: 0x0004, lo: 0xb1, hi: 0xb5}, + {value: 0x0014, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + // Block 0x70, offset 0x2fc + {value: 0x0034, lo: 0x99, hi: 0x9a}, + {value: 0x0004, lo: 0x9b, hi: 0x9e}, + // Block 0x71, offset 0x2fe + {value: 0x0004, lo: 0xbc, hi: 0xbe}, + // Block 0x72, offset 0x2ff + {value: 0x0010, lo: 0x85, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x73, offset 0x301 + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x74, offset 0x303 + {value: 0x0010, lo: 0x80, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0xbf}, + // Block 0x75, offset 0x306 + {value: 0x0010, lo: 0x80, hi: 0x8c}, + // Block 0x76, offset 0x307 + {value: 0x0010, lo: 0x90, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x77, offset 0x309 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0xab}, + // Block 0x78, offset 0x30c + {value: 0x0117, lo: 0x80, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb2}, + {value: 0x0024, lo: 0xb4, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x79, offset 0x312 + {value: 0x0117, lo: 0x80, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9d}, + {value: 0x0024, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x7a, offset 0x316 + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb1}, + // Block 0x7b, offset 0x318 + {value: 0x0004, lo: 0x80, hi: 0x87}, + {value: 0x0014, lo: 0x88, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xaf}, + {value: 0x0012, lo: 0xb0, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xbf}, + // Block 0x7c, offset 0x31d + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x0015, lo: 0xb0, hi: 0xb0}, + {value: 0x0012, lo: 0xb1, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x8753, lo: 0xbd, hi: 0xbd}, + {value: 0x0117, lo: 0xbe, hi: 0xbf}, + // Block 0x7d, offset 0x324 + {value: 0x0117, lo: 0x80, hi: 0x83}, + {value: 0x6553, lo: 0x84, hi: 0x84}, + {value: 0x908b, lo: 0x85, hi: 0x85}, + {value: 0x8f53, lo: 0x86, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x0316, lo: 0x89, hi: 0x8a}, + {value: 0x0117, lo: 0x90, hi: 0x91}, + {value: 0x0012, lo: 0x93, hi: 0x93}, + {value: 0x0012, lo: 0x95, hi: 0x95}, + {value: 0x0117, lo: 0x96, hi: 0x99}, + {value: 0x0015, lo: 0xb2, hi: 0xb4}, + {value: 0x0316, lo: 0xb5, hi: 0xb6}, + {value: 0x0010, lo: 0xb7, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbf}, + // Block 0x7e, offset 0x334 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8b}, + {value: 0x0010, lo: 0x8c, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0034, lo: 0xac, hi: 0xac}, + // Block 0x7f, offset 0x33e + {value: 0x0010, lo: 0x80, hi: 0xb3}, + // Block 0x80, offset 0x33f + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xa0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb7}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x81, offset 0x348 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x82, offset 0x34c + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0x92}, + {value: 0x0030, lo: 0x93, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0x83, offset 0x351 + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb9}, + {value: 0x0010, lo: 0xba, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x84, offset 0x359 + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0004, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x85, offset 0x35f + {value: 0x0010, lo: 0x80, hi: 0xa8}, + {value: 0x0014, lo: 0xa9, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0x86, offset 0x365 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x87, offset 0x36f + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0024, lo: 0xbe, hi: 0xbf}, + // Block 0x88, offset 0x374 + {value: 0x0024, lo: 0x81, hi: 0x81}, + {value: 0x0004, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + // Block 0x89, offset 0x37d + {value: 0x0010, lo: 0x81, hi: 0x86}, + {value: 0x0010, lo: 0x89, hi: 0x8e}, + {value: 0x0010, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x8a, offset 0x383 + {value: 0x0012, lo: 0x80, hi: 0x92}, + {value: 0xb352, lo: 0x93, hi: 0x93}, + {value: 0x0012, lo: 0x94, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9f}, + {value: 0x0012, lo: 0xa0, hi: 0xa8}, + {value: 0x0015, lo: 0xa9, hi: 0xa9}, + {value: 0x0004, lo: 0xaa, hi: 0xab}, + {value: 0x74d2, lo: 0xb0, hi: 0xbf}, + // Block 0x8b, offset 0x38c + {value: 0x78d2, lo: 0x80, hi: 0x8f}, + {value: 0x7cd2, lo: 0x90, hi: 0x9f}, + {value: 0x80d2, lo: 0xa0, hi: 0xaf}, + {value: 0x7cd2, lo: 0xb0, hi: 0xbf}, + // Block 0x8c, offset 0x390 + {value: 0x0010, lo: 0x80, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x8d, offset 0x398 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x8e, offset 0x39a + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x8b, hi: 0xbb}, + // Block 0x8f, offset 0x39c + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0xbf}, + // Block 0x90, offset 0x39f + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0004, lo: 0xb2, hi: 0xbf}, + // Block 0x91, offset 0x3a1 + {value: 0x0004, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x93, hi: 0xbf}, + // Block 0x92, offset 0x3a3 + {value: 0x0010, lo: 0x80, hi: 0xbd}, + // Block 0x93, offset 0x3a4 + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0x94, offset 0x3a5 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0xbf}, + // Block 0x95, offset 0x3a7 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0xb0, hi: 0xbb}, + // Block 0x96, offset 0x3a9 + {value: 0x0014, lo: 0x80, hi: 0x8f}, + {value: 0x0054, lo: 0x93, hi: 0x93}, + {value: 0x0024, lo: 0xa0, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xad}, + {value: 0x0024, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + // Block 0x97, offset 0x3af + {value: 0x0010, lo: 0x8d, hi: 0x8f}, + {value: 0x0054, lo: 0x92, hi: 0x92}, + {value: 0x0054, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0xb0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0x98, offset 0x3b4 + {value: 0x0010, lo: 0x80, hi: 0xbc}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x99, offset 0x3b6 + {value: 0x0054, lo: 0x87, hi: 0x87}, + {value: 0x0054, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0054, lo: 0x9a, hi: 0x9a}, + {value: 0x5f53, lo: 0xa1, hi: 0xba}, + {value: 0x0004, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9a, offset 0x3bd + {value: 0x0004, lo: 0x80, hi: 0x80}, + {value: 0x5f52, lo: 0x81, hi: 0x9a}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + // Block 0x9b, offset 0x3c0 + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbe}, + // Block 0x9c, offset 0x3c2 + {value: 0x0010, lo: 0x82, hi: 0x87}, + {value: 0x0010, lo: 0x8a, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0x97}, + {value: 0x0010, lo: 0x9a, hi: 0x9c}, + {value: 0x0004, lo: 0xa3, hi: 0xa3}, + {value: 0x0014, lo: 0xb9, hi: 0xbb}, + // Block 0x9d, offset 0x3c8 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0010, lo: 0x8d, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xba}, + {value: 0x0010, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9e, offset 0x3cd + {value: 0x0010, lo: 0x80, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x9d}, + // Block 0x9f, offset 0x3cf + {value: 0x0010, lo: 0x80, hi: 0xba}, + // Block 0xa0, offset 0x3d0 + {value: 0x0010, lo: 0x80, hi: 0xb4}, + // Block 0xa1, offset 0x3d1 + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0xa2, offset 0x3d2 + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa3, offset 0x3d4 + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + // Block 0xa4, offset 0x3d6 + {value: 0x0010, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xad, hi: 0xbf}, + // Block 0xa5, offset 0x3d8 + {value: 0x0010, lo: 0x80, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0xb5}, + {value: 0x0024, lo: 0xb6, hi: 0xba}, + // Block 0xa6, offset 0x3db + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa7, offset 0x3dd + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x91, hi: 0x95}, + // Block 0xa8, offset 0x3e0 + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x97}, + {value: 0xb653, lo: 0x98, hi: 0x9f}, + {value: 0xb953, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbf}, + // Block 0xa9, offset 0x3e8 + {value: 0xb652, lo: 0x80, hi: 0x87}, + {value: 0xb952, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0xaa, offset 0x3eb + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0xb953, lo: 0xb0, hi: 0xb7}, + {value: 0xb653, lo: 0xb8, hi: 0xbf}, + // Block 0xab, offset 0x3ef + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x93}, + {value: 0xb952, lo: 0x98, hi: 0x9f}, + {value: 0xb652, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbb}, + // Block 0xac, offset 0x3f7 + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xad, offset 0x3f9 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0xbc53, lo: 0xb0, hi: 0xb0}, + {value: 0xbf53, lo: 0xb1, hi: 0xb1}, + {value: 0xc253, lo: 0xb2, hi: 0xb2}, + {value: 0xbf53, lo: 0xb3, hi: 0xb3}, + {value: 0xc553, lo: 0xb4, hi: 0xb4}, + {value: 0xbf53, lo: 0xb5, hi: 0xb5}, + {value: 0xc253, lo: 0xb6, hi: 0xb6}, + {value: 0xbf53, lo: 0xb7, hi: 0xb7}, + {value: 0xbc53, lo: 0xb8, hi: 0xb8}, + {value: 0xc853, lo: 0xb9, hi: 0xb9}, + {value: 0xcb53, lo: 0xba, hi: 0xba}, + {value: 0xce53, lo: 0xbc, hi: 0xbc}, + {value: 0xc853, lo: 0xbd, hi: 0xbd}, + {value: 0xcb53, lo: 0xbe, hi: 0xbe}, + {value: 0xc853, lo: 0xbf, hi: 0xbf}, + // Block 0xae, offset 0x409 + {value: 0x0010, lo: 0x80, hi: 0xb6}, + // Block 0xaf, offset 0x40a + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xa7}, + // Block 0xb0, offset 0x40c + {value: 0x0015, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0015, lo: 0x83, hi: 0x85}, + {value: 0x0015, lo: 0x87, hi: 0xb0}, + {value: 0x0015, lo: 0xb2, hi: 0xba}, + // Block 0xb1, offset 0x411 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xb5}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xb2, offset 0x417 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb6}, + // Block 0xb3, offset 0x419 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + // Block 0xb4, offset 0x41a + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + // Block 0xb5, offset 0x41c + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb9}, + // Block 0xb6, offset 0x41e + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0xb7, offset 0x420 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x8e, hi: 0x8e}, + {value: 0x0024, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x99, hi: 0xb5}, + {value: 0x0024, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xb8, offset 0x42d + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0xb9, offset 0x42e + {value: 0x0010, lo: 0x80, hi: 0x9c}, + // Block 0xba, offset 0x42f + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + // Block 0xbb, offset 0x433 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + // Block 0xbc, offset 0x435 + {value: 0x0010, lo: 0x80, hi: 0x91}, + // Block 0xbd, offset 0x436 + {value: 0x0010, lo: 0x80, hi: 0x88}, + // Block 0xbe, offset 0x437 + {value: 0x5653, lo: 0x80, hi: 0xb2}, + // Block 0xbf, offset 0x438 + {value: 0x5652, lo: 0x80, hi: 0xb2}, + // Block 0xc0, offset 0x439 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xc1, offset 0x43c + {value: 0x0010, lo: 0x80, hi: 0xa9}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0010, lo: 0xb0, hi: 0xb1}, + // Block 0xc2, offset 0x43f + {value: 0x0034, lo: 0xbd, hi: 0xbf}, + // Block 0xc3, offset 0x440 + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xc4, offset 0x443 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x87}, + {value: 0x0024, lo: 0x88, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x8b}, + {value: 0x0024, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xc5, offset 0x44a + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0024, lo: 0x82, hi: 0x82}, + {value: 0x0034, lo: 0x83, hi: 0x83}, + {value: 0x0024, lo: 0x84, hi: 0x84}, + {value: 0x0034, lo: 0x85, hi: 0x85}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xc6, offset 0x450 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0010, lo: 0xa0, hi: 0xb6}, + // Block 0xc7, offset 0x452 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xc8, offset 0x456 + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0034, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xc9, offset 0x45e + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb6}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + // Block 0xca, offset 0x464 + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xcb, offset 0x468 + {value: 0x0024, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0xcc, offset 0x46f + {value: 0x0010, lo: 0x84, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + // Block 0xcd, offset 0x473 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xce, offset 0x477 + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x89, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + // Block 0xcf, offset 0x480 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb4}, + {value: 0x0030, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xb7}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xd0, offset 0x48a + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + // Block 0xd1, offset 0x48c + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xd2, offset 0x492 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa2}, + {value: 0x0014, lo: 0xa3, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xd3, offset 0x498 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xd4, offset 0x4a2 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0030, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9d, hi: 0xa3}, + {value: 0x0024, lo: 0xa6, hi: 0xac}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + // Block 0xd5, offset 0x4ac + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xd6, offset 0x4ae + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + // Block 0xd7, offset 0x4b7 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xd8, offset 0x4bd + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd9, offset 0x4c3 + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xda, offset 0x4c9 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x98, hi: 0x9b}, + {value: 0x0014, lo: 0x9c, hi: 0x9d}, + // Block 0xdb, offset 0x4cc + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xdc, offset 0x4d2 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xdd, offset 0x4d5 + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0014, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb5}, + {value: 0x0030, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + // Block 0xde, offset 0x4de + {value: 0x0010, lo: 0x80, hi: 0x89}, + // Block 0xdf, offset 0x4df + {value: 0x0014, lo: 0x9d, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xe0, offset 0x4e6 + {value: 0x0010, lo: 0x80, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + // Block 0xe1, offset 0x4ea + {value: 0x5f53, lo: 0xa0, hi: 0xbf}, + // Block 0xe2, offset 0x4eb + {value: 0x5f52, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xe3, offset 0x4ee + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x89, hi: 0x89}, + {value: 0x0010, lo: 0x8c, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0xb5}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0014, lo: 0xbb, hi: 0xbc}, + {value: 0x0030, lo: 0xbd, hi: 0xbd}, + {value: 0x0034, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xe4, offset 0x4f8 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0034, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xe5, offset 0x4fb + {value: 0x0010, lo: 0xa0, hi: 0xa7}, + {value: 0x0010, lo: 0xaa, hi: 0xbf}, + // Block 0xe6, offset 0x4fd + {value: 0x0010, lo: 0x80, hi: 0x93}, + {value: 0x0014, lo: 0x94, hi: 0x97}, + {value: 0x0014, lo: 0x9a, hi: 0x9b}, + {value: 0x0010, lo: 0x9c, hi: 0x9f}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + // Block 0xe7, offset 0x504 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x8a}, + {value: 0x0010, lo: 0x8b, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbb, hi: 0xbe}, + // Block 0xe8, offset 0x50c + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0014, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x98}, + {value: 0x0014, lo: 0x99, hi: 0x9b}, + {value: 0x0010, lo: 0x9c, hi: 0xbf}, + // Block 0xe9, offset 0x512 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0014, lo: 0x8a, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x99}, + {value: 0x0010, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xea, offset 0x519 + {value: 0x0010, lo: 0x80, hi: 0xb8}, + // Block 0xeb, offset 0x51a + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb6}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xec, offset 0x520 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0xed, offset 0x523 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0014, lo: 0x92, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xa9}, + {value: 0x0014, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0xee, offset 0x52b + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb6}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xef, offset 0x532 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa5}, + {value: 0x0010, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xbf}, + // Block 0xf0, offset 0x53c + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0014, lo: 0x90, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0x96}, + {value: 0x0034, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0xf1, offset 0x544 + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + // Block 0xf2, offset 0x547 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xba}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0xf3, offset 0x54c + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0030, lo: 0x81, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xf4, offset 0x550 + {value: 0x0010, lo: 0xb0, hi: 0xb0}, + // Block 0xf5, offset 0x551 + {value: 0x0010, lo: 0x80, hi: 0x99}, + // Block 0xf6, offset 0x552 + {value: 0x0010, lo: 0x80, hi: 0xae}, + // Block 0xf7, offset 0x553 + {value: 0x0010, lo: 0x80, hi: 0x83}, + // Block 0xf8, offset 0x554 + {value: 0x0010, lo: 0x80, hi: 0xb0}, + // Block 0xf9, offset 0x555 + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xbf}, + // Block 0xfa, offset 0x557 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x95}, + // Block 0xfb, offset 0x55a + {value: 0x0010, lo: 0x80, hi: 0x86}, + // Block 0xfc, offset 0x55b + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xfd, offset 0x55e + {value: 0x0010, lo: 0x80, hi: 0xbe}, + // Block 0xfe, offset 0x55f + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x90, hi: 0xad}, + {value: 0x0034, lo: 0xb0, hi: 0xb4}, + // Block 0xff, offset 0x562 + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb6}, + // Block 0x100, offset 0x564 + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa3, hi: 0xb7}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x101, offset 0x568 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + // Block 0x102, offset 0x569 + {value: 0x2013, lo: 0x80, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xbf}, + // Block 0x103, offset 0x56b + {value: 0x0010, lo: 0x80, hi: 0x8a}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0x104, offset 0x56e + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0014, lo: 0x8f, hi: 0x9f}, + // Block 0x105, offset 0x570 + {value: 0x0014, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa3, hi: 0xa4}, + {value: 0x0030, lo: 0xb0, hi: 0xb1}, + // Block 0x106, offset 0x573 + {value: 0x0004, lo: 0xb0, hi: 0xb3}, + {value: 0x0004, lo: 0xb5, hi: 0xbb}, + {value: 0x0004, lo: 0xbd, hi: 0xbe}, + // Block 0x107, offset 0x576 + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbc}, + // Block 0x108, offset 0x578 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0034, lo: 0x9e, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa3}, + // Block 0x109, offset 0x57d + {value: 0x0014, lo: 0x80, hi: 0xad}, + {value: 0x0014, lo: 0xb0, hi: 0xbf}, + // Block 0x10a, offset 0x57f + {value: 0x0014, lo: 0x80, hi: 0x86}, + // Block 0x10b, offset 0x580 + {value: 0x0030, lo: 0xa5, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xa9}, + {value: 0x0030, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbf}, + // Block 0x10c, offset 0x585 + {value: 0x0034, lo: 0x80, hi: 0x82}, + {value: 0x0024, lo: 0x85, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8b}, + {value: 0x0024, lo: 0xaa, hi: 0xad}, + // Block 0x10d, offset 0x589 + {value: 0x0024, lo: 0x82, hi: 0x84}, + // Block 0x10e, offset 0x58a + {value: 0x0013, lo: 0x80, hi: 0x99}, + {value: 0x0012, lo: 0x9a, hi: 0xb3}, + {value: 0x0013, lo: 0xb4, hi: 0xbf}, + // Block 0x10f, offset 0x58d + {value: 0x0013, lo: 0x80, hi: 0x8d}, + {value: 0x0012, lo: 0x8e, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0xa7}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0x110, offset 0x591 + {value: 0x0013, lo: 0x80, hi: 0x81}, + {value: 0x0012, lo: 0x82, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0x9c}, + {value: 0x0013, lo: 0x9e, hi: 0x9f}, + {value: 0x0013, lo: 0xa2, hi: 0xa2}, + {value: 0x0013, lo: 0xa5, hi: 0xa6}, + {value: 0x0013, lo: 0xa9, hi: 0xac}, + {value: 0x0013, lo: 0xae, hi: 0xb5}, + {value: 0x0012, lo: 0xb6, hi: 0xb9}, + {value: 0x0012, lo: 0xbb, hi: 0xbb}, + {value: 0x0012, lo: 0xbd, hi: 0xbf}, + // Block 0x111, offset 0x59c + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0012, lo: 0x85, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0x112, offset 0x5a0 + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0013, lo: 0x84, hi: 0x85}, + {value: 0x0013, lo: 0x87, hi: 0x8a}, + {value: 0x0013, lo: 0x8d, hi: 0x94}, + {value: 0x0013, lo: 0x96, hi: 0x9c}, + {value: 0x0012, lo: 0x9e, hi: 0xb7}, + {value: 0x0013, lo: 0xb8, hi: 0xb9}, + {value: 0x0013, lo: 0xbb, hi: 0xbe}, + // Block 0x113, offset 0x5a8 + {value: 0x0013, lo: 0x80, hi: 0x84}, + {value: 0x0013, lo: 0x86, hi: 0x86}, + {value: 0x0013, lo: 0x8a, hi: 0x90}, + {value: 0x0012, lo: 0x92, hi: 0xab}, + {value: 0x0013, lo: 0xac, hi: 0xbf}, + // Block 0x114, offset 0x5ad + {value: 0x0013, lo: 0x80, hi: 0x85}, + {value: 0x0012, lo: 0x86, hi: 0x9f}, + {value: 0x0013, lo: 0xa0, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbf}, + // Block 0x115, offset 0x5b1 + {value: 0x0012, lo: 0x80, hi: 0x93}, + {value: 0x0013, lo: 0x94, hi: 0xad}, + {value: 0x0012, lo: 0xae, hi: 0xbf}, + // Block 0x116, offset 0x5b4 + {value: 0x0012, lo: 0x80, hi: 0x87}, + {value: 0x0013, lo: 0x88, hi: 0xa1}, + {value: 0x0012, lo: 0xa2, hi: 0xbb}, + {value: 0x0013, lo: 0xbc, hi: 0xbf}, + // Block 0x117, offset 0x5b8 + {value: 0x0013, lo: 0x80, hi: 0x95}, + {value: 0x0012, lo: 0x96, hi: 0xaf}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x118, offset 0x5bb + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0012, lo: 0x8a, hi: 0xa5}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0x119, offset 0x5be + {value: 0x0013, lo: 0x80, hi: 0x80}, + {value: 0x0012, lo: 0x82, hi: 0x9a}, + {value: 0x0012, lo: 0x9c, hi: 0xa1}, + {value: 0x0013, lo: 0xa2, hi: 0xba}, + {value: 0x0012, lo: 0xbc, hi: 0xbf}, + // Block 0x11a, offset 0x5c3 + {value: 0x0012, lo: 0x80, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0xb4}, + {value: 0x0012, lo: 0xb6, hi: 0xbf}, + // Block 0x11b, offset 0x5c7 + {value: 0x0012, lo: 0x80, hi: 0x8e}, + {value: 0x0012, lo: 0x90, hi: 0x95}, + {value: 0x0013, lo: 0x96, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x11c, offset 0x5cb + {value: 0x0012, lo: 0x80, hi: 0x88}, + {value: 0x0012, lo: 0x8a, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0x11d, offset 0x5cf + {value: 0x0012, lo: 0x80, hi: 0x82}, + {value: 0x0012, lo: 0x84, hi: 0x89}, + {value: 0x0017, lo: 0x8a, hi: 0x8b}, + {value: 0x0010, lo: 0x8e, hi: 0xbf}, + // Block 0x11e, offset 0x5d3 + {value: 0x0014, lo: 0x80, hi: 0xb6}, + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x11f, offset 0x5d5 + {value: 0x0014, lo: 0x80, hi: 0xac}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x120, offset 0x5d7 + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x9b, hi: 0x9f}, + {value: 0x0014, lo: 0xa1, hi: 0xaf}, + // Block 0x121, offset 0x5da + {value: 0x0012, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8a, hi: 0x8a}, + {value: 0x0012, lo: 0x8b, hi: 0x9e}, + {value: 0x0012, lo: 0xa5, hi: 0xaa}, + // Block 0x122, offset 0x5de + {value: 0x0024, lo: 0x80, hi: 0x86}, + {value: 0x0024, lo: 0x88, hi: 0x98}, + {value: 0x0024, lo: 0x9b, hi: 0xa1}, + {value: 0x0024, lo: 0xa3, hi: 0xa4}, + {value: 0x0024, lo: 0xa6, hi: 0xaa}, + {value: 0x0015, lo: 0xb0, hi: 0xbf}, + // Block 0x123, offset 0x5e4 + {value: 0x0015, lo: 0x80, hi: 0xad}, + // Block 0x124, offset 0x5e5 + {value: 0x0024, lo: 0x8f, hi: 0x8f}, + // Block 0x125, offset 0x5e6 + {value: 0x0010, lo: 0x80, hi: 0xac}, + {value: 0x0024, lo: 0xb0, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xbd}, + // Block 0x126, offset 0x5e9 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + // Block 0x127, offset 0x5eb + {value: 0x0010, lo: 0x90, hi: 0xad}, + {value: 0x0024, lo: 0xae, hi: 0xae}, + // Block 0x128, offset 0x5ed + {value: 0x0010, lo: 0x80, hi: 0xab}, + {value: 0x0024, lo: 0xac, hi: 0xaf}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x129, offset 0x5f0 + {value: 0x0010, lo: 0x90, hi: 0xaa}, + {value: 0x0014, lo: 0xab, hi: 0xab}, + {value: 0x0034, lo: 0xac, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xaf}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x12a, offset 0x5f5 + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xab}, + {value: 0x0010, lo: 0xad, hi: 0xae}, + {value: 0x0010, lo: 0xb0, hi: 0xbe}, + // Block 0x12b, offset 0x5f9 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0034, lo: 0x90, hi: 0x96}, + // Block 0x12c, offset 0x5fb + {value: 0xd152, lo: 0x80, hi: 0x81}, + {value: 0xd452, lo: 0x82, hi: 0x83}, + {value: 0x0024, lo: 0x84, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8b}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x12d, offset 0x601 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x9f}, + {value: 0x0010, lo: 0xa1, hi: 0xa2}, + {value: 0x0010, lo: 0xa4, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb7}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + // Block 0x12e, offset 0x60a + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x9b}, + {value: 0x0010, lo: 0xa1, hi: 0xa3}, + {value: 0x0010, lo: 0xa5, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xbb}, + // Block 0x12f, offset 0x60f + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x130, offset 0x610 + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x131, offset 0x613 + {value: 0x0013, lo: 0x80, hi: 0x89}, + // Block 0x132, offset 0x614 + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x133, offset 0x615 + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x134, offset 0x616 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0014, lo: 0xa0, hi: 0xbf}, + // Block 0x135, offset 0x618 + {value: 0x0014, lo: 0x80, hi: 0xbf}, + // Block 0x136, offset 0x619 + {value: 0x0014, lo: 0x80, hi: 0xaf}, +} + +// Total table size 16093 bytes (15KiB); checksum: EE91C452 diff --git a/vendor/golang.org/x/text/cases/tables9.0.0.go b/vendor/golang.org/x/text/cases/tables9.0.0.go new file mode 100644 index 0000000000..3aeb7be6d0 --- /dev/null +++ b/vendor/golang.org/x/text/cases/tables9.0.0.go @@ -0,0 +1,2215 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +//go:build !go1.10 + +package cases + +// UnicodeVersion is the Unicode version from which the tables in this package are derived. +const UnicodeVersion = "9.0.0" + +var xorData string = "" + // Size: 185 bytes + "\x00\x06\x07\x00\x01?\x00\x0f\x03\x00\x0f\x12\x00\x0f\x1f\x00\x0f\x1d" + + "\x00\x01\x13\x00\x0f\x16\x00\x0f\x0b\x00\x0f3\x00\x0f7\x00\x01#\x00\x0f?" + + "\x00\x0e'\x00\x0f/\x00\x0e>\x00\x0f*\x00\x0c&\x00\x0c*\x00\x0c;\x00\x0c9" + + "\x00\x0c%\x00\x01\x08\x00\x03\x0d\x00\x03\x09\x00\x02\x06\x00\x02\x02" + + "\x00\x02\x0c\x00\x01\x00\x00\x01\x03\x00\x01\x01\x00\x01 \x00\x01\x0c" + + "\x00\x01\x10\x00\x03\x10\x00\x036 \x00\x037 \x00\x0b#\x10\x00\x0b 0\x00" + + "\x0b!\x10\x00\x0b!0\x00\x0b(\x04\x00\x03\x04\x1e\x00\x03\x0a\x00\x02:" + + "\x00\x02>\x00\x02,\x00\x02\x00\x00\x02\x10\x00\x01<\x00\x01&\x00\x01*" + + "\x00\x01.\x00\x010\x003 \x00\x01\x18\x00\x01(\x00\x01\x1e\x00\x01\x22" + +var exceptions string = "" + // Size: 2068 bytes + "\x00\x12\x12μΜΜ\x12\x12ssSSSs\x13\x18i̇i̇\x10\x09II\x13\x1bʼnʼNʼN\x11" + + "\x09sSS\x12\x12dždžDž\x12\x12dždžDŽ\x10\x12DŽDž\x12\x12ljljLj\x12\x12ljljLJ\x10\x12LJLj" + + "\x12\x12njnjNj\x12\x12njnjNJ\x10\x12NJNj\x13\x1bǰJ̌J̌\x12\x12dzdzDz\x12\x12dzdzDZ\x10" + + "\x12DZDz\x13\x18ⱥⱥ\x13\x18ⱦⱦ\x10\x1bⱾⱾ\x10\x1bⱿⱿ\x10\x1bⱯⱯ\x10\x1bⱭⱭ\x10" + + "\x1bⱰⱰ\x10\x1bꞫꞫ\x10\x1bꞬꞬ\x10\x1bꞍꞍ\x10\x1bꞪꞪ\x10\x1bꞮꞮ\x10\x1bⱢⱢ\x10" + + "\x1bꞭꞭ\x10\x1bⱮⱮ\x10\x1bⱤⱤ\x10\x1bꞱꞱ\x10\x1bꞲꞲ\x10\x1bꞰꞰ2\x12ιΙΙ\x166ΐ" + + "Ϊ́Ϊ́\x166ΰΫ́Ϋ́\x12\x12σΣΣ\x12\x12βΒΒ\x12\x12θΘΘ\x12\x12φΦΦ\x12" + + "\x12πΠΠ\x12\x12κΚΚ\x12\x12ρΡΡ\x12\x12εΕΕ\x14$եւԵՒԵւ\x12\x12вВВ\x12\x12дД" + + "Д\x12\x12оОО\x12\x12сСС\x12\x12тТТ\x12\x12тТТ\x12\x12ъЪЪ\x12\x12ѣѢѢ\x13" + + "\x1bꙋꙊꙊ\x13\x1bẖH̱H̱\x13\x1bẗT̈T̈\x13\x1bẘW̊W̊\x13\x1bẙY̊Y̊\x13\x1ba" + + "ʾAʾAʾ\x13\x1bṡṠṠ\x12\x10ssß\x14$ὐΥ̓Υ̓\x166ὒΥ̓̀Υ̓̀\x166ὔΥ̓́Υ̓́\x166" + + "ὖΥ̓͂Υ̓͂\x15+ἀιἈΙᾈ\x15+ἁιἉΙᾉ\x15+ἂιἊΙᾊ\x15+ἃιἋΙᾋ\x15+ἄιἌΙᾌ\x15+ἅιἍΙᾍ" + + "\x15+ἆιἎΙᾎ\x15+ἇιἏΙᾏ\x15\x1dἀιᾀἈΙ\x15\x1dἁιᾁἉΙ\x15\x1dἂιᾂἊΙ\x15\x1dἃιᾃἋΙ" + + "\x15\x1dἄιᾄἌΙ\x15\x1dἅιᾅἍΙ\x15\x1dἆιᾆἎΙ\x15\x1dἇιᾇἏΙ\x15+ἠιἨΙᾘ\x15+ἡιἩΙᾙ" + + "\x15+ἢιἪΙᾚ\x15+ἣιἫΙᾛ\x15+ἤιἬΙᾜ\x15+ἥιἭΙᾝ\x15+ἦιἮΙᾞ\x15+ἧιἯΙᾟ\x15\x1dἠιᾐἨ" + + "Ι\x15\x1dἡιᾑἩΙ\x15\x1dἢιᾒἪΙ\x15\x1dἣιᾓἫΙ\x15\x1dἤιᾔἬΙ\x15\x1dἥιᾕἭΙ\x15" + + "\x1dἦιᾖἮΙ\x15\x1dἧιᾗἯΙ\x15+ὠιὨΙᾨ\x15+ὡιὩΙᾩ\x15+ὢιὪΙᾪ\x15+ὣιὫΙᾫ\x15+ὤιὬΙᾬ" + + "\x15+ὥιὭΙᾭ\x15+ὦιὮΙᾮ\x15+ὧιὯΙᾯ\x15\x1dὠιᾠὨΙ\x15\x1dὡιᾡὩΙ\x15\x1dὢιᾢὪΙ" + + "\x15\x1dὣιᾣὫΙ\x15\x1dὤιᾤὬΙ\x15\x1dὥιᾥὭΙ\x15\x1dὦιᾦὮΙ\x15\x1dὧιᾧὯΙ\x15-ὰι" + + "ᾺΙᾺͅ\x14#αιΑΙᾼ\x14$άιΆΙΆͅ\x14$ᾶΑ͂Α͂\x166ᾶιΑ͂Ιᾼ͂\x14\x1cαιᾳΑΙ\x12" + + "\x12ιΙΙ\x15-ὴιῊΙῊͅ\x14#ηιΗΙῌ\x14$ήιΉΙΉͅ\x14$ῆΗ͂Η͂\x166ῆιΗ͂Ιῌ͂\x14\x1c" + + "ηιῃΗΙ\x166ῒΪ̀Ϊ̀\x166ΐΪ́Ϊ́\x14$ῖΙ͂Ι͂\x166ῗΪ͂Ϊ͂\x166ῢΫ̀Ϋ" + + "̀\x166ΰΫ́Ϋ́\x14$ῤΡ̓Ρ̓\x14$ῦΥ͂Υ͂\x166ῧΫ͂Ϋ͂\x15-ὼιῺΙῺͅ\x14#ωιΩΙ" + + "ῼ\x14$ώιΏΙΏͅ\x14$ῶΩ͂Ω͂\x166ῶιΩ͂Ιῼ͂\x14\x1cωιῳΩΙ\x12\x10ωω\x11\x08kk" + + "\x12\x10åå\x12\x10ɫɫ\x12\x10ɽɽ\x10\x12ȺȺ\x10\x12ȾȾ\x12\x10ɑɑ\x12\x10ɱɱ" + + "\x12\x10ɐɐ\x12\x10ɒɒ\x12\x10ȿȿ\x12\x10ɀɀ\x12\x10ɥɥ\x12\x10ɦɦ\x12\x10ɜɜ" + + "\x12\x10ɡɡ\x12\x10ɬɬ\x12\x10ɪɪ\x12\x10ʞʞ\x12\x10ʇʇ\x12\x10ʝʝ\x12\x12ffFF" + + "Ff\x12\x12fiFIFi\x12\x12flFLFl\x13\x1bffiFFIFfi\x13\x1bfflFFLFfl\x12\x12" + + "stSTSt\x12\x12stSTSt\x14$մնՄՆՄն\x14$մեՄԵՄե\x14$միՄԻՄի\x14$վնՎՆՎն\x14$մխՄ" + + "ԽՄխ" + +// lookup returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookup(s []byte) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupUnsafe(s []byte) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// lookupString returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *caseTrie) lookupString(s string) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return caseValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := caseIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = caseIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = caseIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *caseTrie) lookupStringUnsafe(s string) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return caseValues[c0] + } + i := caseIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = caseIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = caseIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// caseTrie. Total size: 11742 bytes (11.47 KiB). Checksum: 795fe57ee5135873. +type caseTrie struct{} + +func newCaseTrie(i int) *caseTrie { + return &caseTrie{} +} + +// lookupValue determines the type of block n and looks up the value for b. +func (t *caseTrie) lookupValue(n uint32, b byte) uint16 { + switch { + case n < 18: + return uint16(caseValues[n<<6+uint32(b)]) + default: + n -= 18 + return uint16(sparse.lookup(n, b)) + } +} + +// caseValues: 20 blocks, 1280 entries, 2560 bytes +// The third block is the zero block. +var caseValues = [1280]uint16{ + // Block 0x0, offset 0x0 + 0x27: 0x0054, + 0x2e: 0x0054, + 0x30: 0x0010, 0x31: 0x0010, 0x32: 0x0010, 0x33: 0x0010, 0x34: 0x0010, 0x35: 0x0010, + 0x36: 0x0010, 0x37: 0x0010, 0x38: 0x0010, 0x39: 0x0010, 0x3a: 0x0054, + // Block 0x1, offset 0x40 + 0x41: 0x2013, 0x42: 0x2013, 0x43: 0x2013, 0x44: 0x2013, 0x45: 0x2013, + 0x46: 0x2013, 0x47: 0x2013, 0x48: 0x2013, 0x49: 0x2013, 0x4a: 0x2013, 0x4b: 0x2013, + 0x4c: 0x2013, 0x4d: 0x2013, 0x4e: 0x2013, 0x4f: 0x2013, 0x50: 0x2013, 0x51: 0x2013, + 0x52: 0x2013, 0x53: 0x2013, 0x54: 0x2013, 0x55: 0x2013, 0x56: 0x2013, 0x57: 0x2013, + 0x58: 0x2013, 0x59: 0x2013, 0x5a: 0x2013, + 0x5e: 0x0004, 0x5f: 0x0010, 0x60: 0x0004, 0x61: 0x2012, 0x62: 0x2012, 0x63: 0x2012, + 0x64: 0x2012, 0x65: 0x2012, 0x66: 0x2012, 0x67: 0x2012, 0x68: 0x2012, 0x69: 0x2012, + 0x6a: 0x2012, 0x6b: 0x2012, 0x6c: 0x2012, 0x6d: 0x2012, 0x6e: 0x2012, 0x6f: 0x2012, + 0x70: 0x2012, 0x71: 0x2012, 0x72: 0x2012, 0x73: 0x2012, 0x74: 0x2012, 0x75: 0x2012, + 0x76: 0x2012, 0x77: 0x2012, 0x78: 0x2012, 0x79: 0x2012, 0x7a: 0x2012, + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc0: 0x0852, 0xc1: 0x0b53, 0xc2: 0x0113, 0xc3: 0x0112, 0xc4: 0x0113, 0xc5: 0x0112, + 0xc6: 0x0b53, 0xc7: 0x0f13, 0xc8: 0x0f12, 0xc9: 0x0e53, 0xca: 0x1153, 0xcb: 0x0713, + 0xcc: 0x0712, 0xcd: 0x0012, 0xce: 0x1453, 0xcf: 0x1753, 0xd0: 0x1a53, 0xd1: 0x0313, + 0xd2: 0x0312, 0xd3: 0x1d53, 0xd4: 0x2053, 0xd5: 0x2352, 0xd6: 0x2653, 0xd7: 0x2653, + 0xd8: 0x0113, 0xd9: 0x0112, 0xda: 0x2952, 0xdb: 0x0012, 0xdc: 0x1d53, 0xdd: 0x2c53, + 0xde: 0x2f52, 0xdf: 0x3253, 0xe0: 0x0113, 0xe1: 0x0112, 0xe2: 0x0113, 0xe3: 0x0112, + 0xe4: 0x0113, 0xe5: 0x0112, 0xe6: 0x3553, 0xe7: 0x0f13, 0xe8: 0x0f12, 0xe9: 0x3853, + 0xea: 0x0012, 0xeb: 0x0012, 0xec: 0x0113, 0xed: 0x0112, 0xee: 0x3553, 0xef: 0x1f13, + 0xf0: 0x1f12, 0xf1: 0x3b53, 0xf2: 0x3e53, 0xf3: 0x0713, 0xf4: 0x0712, 0xf5: 0x0313, + 0xf6: 0x0312, 0xf7: 0x4153, 0xf8: 0x0113, 0xf9: 0x0112, 0xfa: 0x0012, 0xfb: 0x0010, + 0xfc: 0x0113, 0xfd: 0x0112, 0xfe: 0x0012, 0xff: 0x4452, + // Block 0x4, offset 0x100 + 0x100: 0x0010, 0x101: 0x0010, 0x102: 0x0010, 0x103: 0x0010, 0x104: 0x02db, 0x105: 0x0359, + 0x106: 0x03da, 0x107: 0x043b, 0x108: 0x04b9, 0x109: 0x053a, 0x10a: 0x059b, 0x10b: 0x0619, + 0x10c: 0x069a, 0x10d: 0x0313, 0x10e: 0x0312, 0x10f: 0x1f13, 0x110: 0x1f12, 0x111: 0x0313, + 0x112: 0x0312, 0x113: 0x0713, 0x114: 0x0712, 0x115: 0x0313, 0x116: 0x0312, 0x117: 0x0f13, + 0x118: 0x0f12, 0x119: 0x0313, 0x11a: 0x0312, 0x11b: 0x0713, 0x11c: 0x0712, 0x11d: 0x1452, + 0x11e: 0x0113, 0x11f: 0x0112, 0x120: 0x0113, 0x121: 0x0112, 0x122: 0x0113, 0x123: 0x0112, + 0x124: 0x0113, 0x125: 0x0112, 0x126: 0x0113, 0x127: 0x0112, 0x128: 0x0113, 0x129: 0x0112, + 0x12a: 0x0113, 0x12b: 0x0112, 0x12c: 0x0113, 0x12d: 0x0112, 0x12e: 0x0113, 0x12f: 0x0112, + 0x130: 0x06fa, 0x131: 0x07ab, 0x132: 0x0829, 0x133: 0x08aa, 0x134: 0x0113, 0x135: 0x0112, + 0x136: 0x2353, 0x137: 0x4453, 0x138: 0x0113, 0x139: 0x0112, 0x13a: 0x0113, 0x13b: 0x0112, + 0x13c: 0x0113, 0x13d: 0x0112, 0x13e: 0x0113, 0x13f: 0x0112, + // Block 0x5, offset 0x140 + 0x140: 0x0a8a, 0x141: 0x0313, 0x142: 0x0312, 0x143: 0x0853, 0x144: 0x4753, 0x145: 0x4a53, + 0x146: 0x0113, 0x147: 0x0112, 0x148: 0x0113, 0x149: 0x0112, 0x14a: 0x0113, 0x14b: 0x0112, + 0x14c: 0x0113, 0x14d: 0x0112, 0x14e: 0x0113, 0x14f: 0x0112, 0x150: 0x0b0a, 0x151: 0x0b8a, + 0x152: 0x0c0a, 0x153: 0x0b52, 0x154: 0x0b52, 0x155: 0x0012, 0x156: 0x0e52, 0x157: 0x1152, + 0x158: 0x0012, 0x159: 0x1752, 0x15a: 0x0012, 0x15b: 0x1a52, 0x15c: 0x0c8a, 0x15d: 0x0012, + 0x15e: 0x0012, 0x15f: 0x0012, 0x160: 0x1d52, 0x161: 0x0d0a, 0x162: 0x0012, 0x163: 0x2052, + 0x164: 0x0012, 0x165: 0x0d8a, 0x166: 0x0e0a, 0x167: 0x0012, 0x168: 0x2652, 0x169: 0x2652, + 0x16a: 0x0e8a, 0x16b: 0x0f0a, 0x16c: 0x0f8a, 0x16d: 0x0012, 0x16e: 0x0012, 0x16f: 0x1d52, + 0x170: 0x0012, 0x171: 0x100a, 0x172: 0x2c52, 0x173: 0x0012, 0x174: 0x0012, 0x175: 0x3252, + 0x176: 0x0012, 0x177: 0x0012, 0x178: 0x0012, 0x179: 0x0012, 0x17a: 0x0012, 0x17b: 0x0012, + 0x17c: 0x0012, 0x17d: 0x108a, 0x17e: 0x0012, 0x17f: 0x0012, + // Block 0x6, offset 0x180 + 0x180: 0x3552, 0x181: 0x0012, 0x182: 0x0012, 0x183: 0x3852, 0x184: 0x0012, 0x185: 0x0012, + 0x186: 0x0012, 0x187: 0x110a, 0x188: 0x3552, 0x189: 0x4752, 0x18a: 0x3b52, 0x18b: 0x3e52, + 0x18c: 0x4a52, 0x18d: 0x0012, 0x18e: 0x0012, 0x18f: 0x0012, 0x190: 0x0012, 0x191: 0x0012, + 0x192: 0x4152, 0x193: 0x0012, 0x194: 0x0010, 0x195: 0x0012, 0x196: 0x0012, 0x197: 0x0012, + 0x198: 0x0012, 0x199: 0x0012, 0x19a: 0x0012, 0x19b: 0x0012, 0x19c: 0x0012, 0x19d: 0x118a, + 0x19e: 0x120a, 0x19f: 0x0012, 0x1a0: 0x0012, 0x1a1: 0x0012, 0x1a2: 0x0012, 0x1a3: 0x0012, + 0x1a4: 0x0012, 0x1a5: 0x0012, 0x1a6: 0x0012, 0x1a7: 0x0012, 0x1a8: 0x0012, 0x1a9: 0x0012, + 0x1aa: 0x0012, 0x1ab: 0x0012, 0x1ac: 0x0012, 0x1ad: 0x0012, 0x1ae: 0x0012, 0x1af: 0x0012, + 0x1b0: 0x0015, 0x1b1: 0x0015, 0x1b2: 0x0015, 0x1b3: 0x0015, 0x1b4: 0x0015, 0x1b5: 0x0015, + 0x1b6: 0x0015, 0x1b7: 0x0015, 0x1b8: 0x0015, 0x1b9: 0x0014, 0x1ba: 0x0014, 0x1bb: 0x0014, + 0x1bc: 0x0014, 0x1bd: 0x0014, 0x1be: 0x0014, 0x1bf: 0x0014, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x0024, 0x1c1: 0x0024, 0x1c2: 0x0024, 0x1c3: 0x0024, 0x1c4: 0x0024, 0x1c5: 0x128d, + 0x1c6: 0x0024, 0x1c7: 0x0034, 0x1c8: 0x0034, 0x1c9: 0x0034, 0x1ca: 0x0024, 0x1cb: 0x0024, + 0x1cc: 0x0024, 0x1cd: 0x0034, 0x1ce: 0x0034, 0x1cf: 0x0014, 0x1d0: 0x0024, 0x1d1: 0x0024, + 0x1d2: 0x0024, 0x1d3: 0x0034, 0x1d4: 0x0034, 0x1d5: 0x0034, 0x1d6: 0x0034, 0x1d7: 0x0024, + 0x1d8: 0x0034, 0x1d9: 0x0034, 0x1da: 0x0034, 0x1db: 0x0024, 0x1dc: 0x0034, 0x1dd: 0x0034, + 0x1de: 0x0034, 0x1df: 0x0034, 0x1e0: 0x0034, 0x1e1: 0x0034, 0x1e2: 0x0034, 0x1e3: 0x0024, + 0x1e4: 0x0024, 0x1e5: 0x0024, 0x1e6: 0x0024, 0x1e7: 0x0024, 0x1e8: 0x0024, 0x1e9: 0x0024, + 0x1ea: 0x0024, 0x1eb: 0x0024, 0x1ec: 0x0024, 0x1ed: 0x0024, 0x1ee: 0x0024, 0x1ef: 0x0024, + 0x1f0: 0x0113, 0x1f1: 0x0112, 0x1f2: 0x0113, 0x1f3: 0x0112, 0x1f4: 0x0014, 0x1f5: 0x0004, + 0x1f6: 0x0113, 0x1f7: 0x0112, 0x1fa: 0x0015, 0x1fb: 0x4d52, + 0x1fc: 0x5052, 0x1fd: 0x5052, 0x1ff: 0x5353, + // Block 0x8, offset 0x200 + 0x204: 0x0004, 0x205: 0x0004, + 0x206: 0x2a13, 0x207: 0x0054, 0x208: 0x2513, 0x209: 0x2713, 0x20a: 0x2513, + 0x20c: 0x5653, 0x20e: 0x5953, 0x20f: 0x5c53, 0x210: 0x130a, 0x211: 0x2013, + 0x212: 0x2013, 0x213: 0x2013, 0x214: 0x2013, 0x215: 0x2013, 0x216: 0x2013, 0x217: 0x2013, + 0x218: 0x2013, 0x219: 0x2013, 0x21a: 0x2013, 0x21b: 0x2013, 0x21c: 0x2013, 0x21d: 0x2013, + 0x21e: 0x2013, 0x21f: 0x2013, 0x220: 0x5f53, 0x221: 0x5f53, 0x223: 0x5f53, + 0x224: 0x5f53, 0x225: 0x5f53, 0x226: 0x5f53, 0x227: 0x5f53, 0x228: 0x5f53, 0x229: 0x5f53, + 0x22a: 0x5f53, 0x22b: 0x5f53, 0x22c: 0x2a12, 0x22d: 0x2512, 0x22e: 0x2712, 0x22f: 0x2512, + 0x230: 0x144a, 0x231: 0x2012, 0x232: 0x2012, 0x233: 0x2012, 0x234: 0x2012, 0x235: 0x2012, + 0x236: 0x2012, 0x237: 0x2012, 0x238: 0x2012, 0x239: 0x2012, 0x23a: 0x2012, 0x23b: 0x2012, + 0x23c: 0x2012, 0x23d: 0x2012, 0x23e: 0x2012, 0x23f: 0x2012, + // Block 0x9, offset 0x240 + 0x240: 0x5f52, 0x241: 0x5f52, 0x242: 0x158a, 0x243: 0x5f52, 0x244: 0x5f52, 0x245: 0x5f52, + 0x246: 0x5f52, 0x247: 0x5f52, 0x248: 0x5f52, 0x249: 0x5f52, 0x24a: 0x5f52, 0x24b: 0x5f52, + 0x24c: 0x5652, 0x24d: 0x5952, 0x24e: 0x5c52, 0x24f: 0x1813, 0x250: 0x160a, 0x251: 0x168a, + 0x252: 0x0013, 0x253: 0x0013, 0x254: 0x0013, 0x255: 0x170a, 0x256: 0x178a, 0x257: 0x1812, + 0x258: 0x0113, 0x259: 0x0112, 0x25a: 0x0113, 0x25b: 0x0112, 0x25c: 0x0113, 0x25d: 0x0112, + 0x25e: 0x0113, 0x25f: 0x0112, 0x260: 0x0113, 0x261: 0x0112, 0x262: 0x0113, 0x263: 0x0112, + 0x264: 0x0113, 0x265: 0x0112, 0x266: 0x0113, 0x267: 0x0112, 0x268: 0x0113, 0x269: 0x0112, + 0x26a: 0x0113, 0x26b: 0x0112, 0x26c: 0x0113, 0x26d: 0x0112, 0x26e: 0x0113, 0x26f: 0x0112, + 0x270: 0x180a, 0x271: 0x188a, 0x272: 0x0b12, 0x273: 0x5352, 0x274: 0x6253, 0x275: 0x190a, + 0x277: 0x0f13, 0x278: 0x0f12, 0x279: 0x0b13, 0x27a: 0x0113, 0x27b: 0x0112, + 0x27c: 0x0012, 0x27d: 0x4d53, 0x27e: 0x5053, 0x27f: 0x5053, + // Block 0xa, offset 0x280 + 0x280: 0x0812, 0x281: 0x0812, 0x282: 0x0812, 0x283: 0x0812, 0x284: 0x0812, 0x285: 0x0812, + 0x288: 0x0813, 0x289: 0x0813, 0x28a: 0x0813, 0x28b: 0x0813, + 0x28c: 0x0813, 0x28d: 0x0813, 0x290: 0x239a, 0x291: 0x0812, + 0x292: 0x247a, 0x293: 0x0812, 0x294: 0x25ba, 0x295: 0x0812, 0x296: 0x26fa, 0x297: 0x0812, + 0x299: 0x0813, 0x29b: 0x0813, 0x29d: 0x0813, + 0x29f: 0x0813, 0x2a0: 0x0812, 0x2a1: 0x0812, 0x2a2: 0x0812, 0x2a3: 0x0812, + 0x2a4: 0x0812, 0x2a5: 0x0812, 0x2a6: 0x0812, 0x2a7: 0x0812, 0x2a8: 0x0813, 0x2a9: 0x0813, + 0x2aa: 0x0813, 0x2ab: 0x0813, 0x2ac: 0x0813, 0x2ad: 0x0813, 0x2ae: 0x0813, 0x2af: 0x0813, + 0x2b0: 0x8b52, 0x2b1: 0x8b52, 0x2b2: 0x8e52, 0x2b3: 0x8e52, 0x2b4: 0x9152, 0x2b5: 0x9152, + 0x2b6: 0x9452, 0x2b7: 0x9452, 0x2b8: 0x9752, 0x2b9: 0x9752, 0x2ba: 0x9a52, 0x2bb: 0x9a52, + 0x2bc: 0x4d52, 0x2bd: 0x4d52, + // Block 0xb, offset 0x2c0 + 0x2c0: 0x283a, 0x2c1: 0x292a, 0x2c2: 0x2a1a, 0x2c3: 0x2b0a, 0x2c4: 0x2bfa, 0x2c5: 0x2cea, + 0x2c6: 0x2dda, 0x2c7: 0x2eca, 0x2c8: 0x2fb9, 0x2c9: 0x30a9, 0x2ca: 0x3199, 0x2cb: 0x3289, + 0x2cc: 0x3379, 0x2cd: 0x3469, 0x2ce: 0x3559, 0x2cf: 0x3649, 0x2d0: 0x373a, 0x2d1: 0x382a, + 0x2d2: 0x391a, 0x2d3: 0x3a0a, 0x2d4: 0x3afa, 0x2d5: 0x3bea, 0x2d6: 0x3cda, 0x2d7: 0x3dca, + 0x2d8: 0x3eb9, 0x2d9: 0x3fa9, 0x2da: 0x4099, 0x2db: 0x4189, 0x2dc: 0x4279, 0x2dd: 0x4369, + 0x2de: 0x4459, 0x2df: 0x4549, 0x2e0: 0x463a, 0x2e1: 0x472a, 0x2e2: 0x481a, 0x2e3: 0x490a, + 0x2e4: 0x49fa, 0x2e5: 0x4aea, 0x2e6: 0x4bda, 0x2e7: 0x4cca, 0x2e8: 0x4db9, 0x2e9: 0x4ea9, + 0x2ea: 0x4f99, 0x2eb: 0x5089, 0x2ec: 0x5179, 0x2ed: 0x5269, 0x2ee: 0x5359, 0x2ef: 0x5449, + 0x2f0: 0x0812, 0x2f1: 0x0812, 0x2f2: 0x553a, 0x2f3: 0x564a, 0x2f4: 0x571a, + 0x2f6: 0x57fa, 0x2f7: 0x58da, 0x2f8: 0x0813, 0x2f9: 0x0813, 0x2fa: 0x8b53, 0x2fb: 0x8b53, + 0x2fc: 0x5a19, 0x2fd: 0x0004, 0x2fe: 0x5aea, 0x2ff: 0x0004, + // Block 0xc, offset 0x300 + 0x300: 0x0004, 0x301: 0x0004, 0x302: 0x5b6a, 0x303: 0x5c7a, 0x304: 0x5d4a, + 0x306: 0x5e2a, 0x307: 0x5f0a, 0x308: 0x8e53, 0x309: 0x8e53, 0x30a: 0x9153, 0x30b: 0x9153, + 0x30c: 0x6049, 0x30d: 0x0004, 0x30e: 0x0004, 0x30f: 0x0004, 0x310: 0x0812, 0x311: 0x0812, + 0x312: 0x611a, 0x313: 0x625a, 0x316: 0x639a, 0x317: 0x647a, + 0x318: 0x0813, 0x319: 0x0813, 0x31a: 0x9453, 0x31b: 0x9453, 0x31d: 0x0004, + 0x31e: 0x0004, 0x31f: 0x0004, 0x320: 0x0812, 0x321: 0x0812, 0x322: 0x65ba, 0x323: 0x66fa, + 0x324: 0x683a, 0x325: 0x0912, 0x326: 0x691a, 0x327: 0x69fa, 0x328: 0x0813, 0x329: 0x0813, + 0x32a: 0x9a53, 0x32b: 0x9a53, 0x32c: 0x0913, 0x32d: 0x0004, 0x32e: 0x0004, 0x32f: 0x0004, + 0x332: 0x6b3a, 0x333: 0x6c4a, 0x334: 0x6d1a, + 0x336: 0x6dfa, 0x337: 0x6eda, 0x338: 0x9753, 0x339: 0x9753, 0x33a: 0x4d53, 0x33b: 0x4d53, + 0x33c: 0x7019, 0x33d: 0x0004, 0x33e: 0x0004, + // Block 0xd, offset 0x340 + 0x342: 0x0013, + 0x347: 0x0013, 0x34a: 0x0012, 0x34b: 0x0013, + 0x34c: 0x0013, 0x34d: 0x0013, 0x34e: 0x0012, 0x34f: 0x0012, 0x350: 0x0013, 0x351: 0x0013, + 0x352: 0x0013, 0x353: 0x0012, 0x355: 0x0013, + 0x359: 0x0013, 0x35a: 0x0013, 0x35b: 0x0013, 0x35c: 0x0013, 0x35d: 0x0013, + 0x364: 0x0013, 0x366: 0x70eb, 0x368: 0x0013, + 0x36a: 0x714b, 0x36b: 0x718b, 0x36c: 0x0013, 0x36d: 0x0013, 0x36f: 0x0012, + 0x370: 0x0013, 0x371: 0x0013, 0x372: 0x9d53, 0x373: 0x0013, 0x374: 0x0012, 0x375: 0x0010, + 0x376: 0x0010, 0x377: 0x0010, 0x378: 0x0010, 0x379: 0x0012, + 0x37c: 0x0012, 0x37d: 0x0012, 0x37e: 0x0013, 0x37f: 0x0013, + // Block 0xe, offset 0x380 + 0x380: 0x1a13, 0x381: 0x1a13, 0x382: 0x1e13, 0x383: 0x1e13, 0x384: 0x1a13, 0x385: 0x1a13, + 0x386: 0x2613, 0x387: 0x2613, 0x388: 0x2a13, 0x389: 0x2a13, 0x38a: 0x2e13, 0x38b: 0x2e13, + 0x38c: 0x2a13, 0x38d: 0x2a13, 0x38e: 0x2613, 0x38f: 0x2613, 0x390: 0xa052, 0x391: 0xa052, + 0x392: 0xa352, 0x393: 0xa352, 0x394: 0xa652, 0x395: 0xa652, 0x396: 0xa352, 0x397: 0xa352, + 0x398: 0xa052, 0x399: 0xa052, 0x39a: 0x1a12, 0x39b: 0x1a12, 0x39c: 0x1e12, 0x39d: 0x1e12, + 0x39e: 0x1a12, 0x39f: 0x1a12, 0x3a0: 0x2612, 0x3a1: 0x2612, 0x3a2: 0x2a12, 0x3a3: 0x2a12, + 0x3a4: 0x2e12, 0x3a5: 0x2e12, 0x3a6: 0x2a12, 0x3a7: 0x2a12, 0x3a8: 0x2612, 0x3a9: 0x2612, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x6552, 0x3c1: 0x6552, 0x3c2: 0x6552, 0x3c3: 0x6552, 0x3c4: 0x6552, 0x3c5: 0x6552, + 0x3c6: 0x6552, 0x3c7: 0x6552, 0x3c8: 0x6552, 0x3c9: 0x6552, 0x3ca: 0x6552, 0x3cb: 0x6552, + 0x3cc: 0x6552, 0x3cd: 0x6552, 0x3ce: 0x6552, 0x3cf: 0x6552, 0x3d0: 0xa952, 0x3d1: 0xa952, + 0x3d2: 0xa952, 0x3d3: 0xa952, 0x3d4: 0xa952, 0x3d5: 0xa952, 0x3d6: 0xa952, 0x3d7: 0xa952, + 0x3d8: 0xa952, 0x3d9: 0xa952, 0x3da: 0xa952, 0x3db: 0xa952, 0x3dc: 0xa952, 0x3dd: 0xa952, + 0x3de: 0xa952, 0x3e0: 0x0113, 0x3e1: 0x0112, 0x3e2: 0x71eb, 0x3e3: 0x8853, + 0x3e4: 0x724b, 0x3e5: 0x72aa, 0x3e6: 0x730a, 0x3e7: 0x0f13, 0x3e8: 0x0f12, 0x3e9: 0x0313, + 0x3ea: 0x0312, 0x3eb: 0x0713, 0x3ec: 0x0712, 0x3ed: 0x736b, 0x3ee: 0x73cb, 0x3ef: 0x742b, + 0x3f0: 0x748b, 0x3f1: 0x0012, 0x3f2: 0x0113, 0x3f3: 0x0112, 0x3f4: 0x0012, 0x3f5: 0x0313, + 0x3f6: 0x0312, 0x3f7: 0x0012, 0x3f8: 0x0012, 0x3f9: 0x0012, 0x3fa: 0x0012, 0x3fb: 0x0012, + 0x3fc: 0x0015, 0x3fd: 0x0015, 0x3fe: 0x74eb, 0x3ff: 0x754b, + // Block 0x10, offset 0x400 + 0x400: 0x0113, 0x401: 0x0112, 0x402: 0x0113, 0x403: 0x0112, 0x404: 0x0113, 0x405: 0x0112, + 0x406: 0x0113, 0x407: 0x0112, 0x408: 0x0014, 0x409: 0x0004, 0x40a: 0x0004, 0x40b: 0x0713, + 0x40c: 0x0712, 0x40d: 0x75ab, 0x40e: 0x0012, 0x40f: 0x0010, 0x410: 0x0113, 0x411: 0x0112, + 0x412: 0x0113, 0x413: 0x0112, 0x414: 0x0012, 0x415: 0x0012, 0x416: 0x0113, 0x417: 0x0112, + 0x418: 0x0113, 0x419: 0x0112, 0x41a: 0x0113, 0x41b: 0x0112, 0x41c: 0x0113, 0x41d: 0x0112, + 0x41e: 0x0113, 0x41f: 0x0112, 0x420: 0x0113, 0x421: 0x0112, 0x422: 0x0113, 0x423: 0x0112, + 0x424: 0x0113, 0x425: 0x0112, 0x426: 0x0113, 0x427: 0x0112, 0x428: 0x0113, 0x429: 0x0112, + 0x42a: 0x760b, 0x42b: 0x766b, 0x42c: 0x76cb, 0x42d: 0x772b, 0x42e: 0x778b, + 0x430: 0x77eb, 0x431: 0x784b, 0x432: 0x78ab, 0x433: 0xac53, 0x434: 0x0113, 0x435: 0x0112, + 0x436: 0x0113, 0x437: 0x0112, + // Block 0x11, offset 0x440 + 0x440: 0x790a, 0x441: 0x798a, 0x442: 0x7a0a, 0x443: 0x7a8a, 0x444: 0x7b3a, 0x445: 0x7bea, + 0x446: 0x7c6a, + 0x453: 0x7cea, 0x454: 0x7dca, 0x455: 0x7eaa, 0x456: 0x7f8a, 0x457: 0x806a, + 0x45d: 0x0010, + 0x45e: 0x0034, 0x45f: 0x0010, 0x460: 0x0010, 0x461: 0x0010, 0x462: 0x0010, 0x463: 0x0010, + 0x464: 0x0010, 0x465: 0x0010, 0x466: 0x0010, 0x467: 0x0010, 0x468: 0x0010, + 0x46a: 0x0010, 0x46b: 0x0010, 0x46c: 0x0010, 0x46d: 0x0010, 0x46e: 0x0010, 0x46f: 0x0010, + 0x470: 0x0010, 0x471: 0x0010, 0x472: 0x0010, 0x473: 0x0010, 0x474: 0x0010, 0x475: 0x0010, + 0x476: 0x0010, 0x478: 0x0010, 0x479: 0x0010, 0x47a: 0x0010, 0x47b: 0x0010, + 0x47c: 0x0010, 0x47e: 0x0010, + // Block 0x12, offset 0x480 + 0x480: 0x2213, 0x481: 0x2213, 0x482: 0x2613, 0x483: 0x2613, 0x484: 0x2213, 0x485: 0x2213, + 0x486: 0x2e13, 0x487: 0x2e13, 0x488: 0x2213, 0x489: 0x2213, 0x48a: 0x2613, 0x48b: 0x2613, + 0x48c: 0x2213, 0x48d: 0x2213, 0x48e: 0x3e13, 0x48f: 0x3e13, 0x490: 0x2213, 0x491: 0x2213, + 0x492: 0x2613, 0x493: 0x2613, 0x494: 0x2213, 0x495: 0x2213, 0x496: 0x2e13, 0x497: 0x2e13, + 0x498: 0x2213, 0x499: 0x2213, 0x49a: 0x2613, 0x49b: 0x2613, 0x49c: 0x2213, 0x49d: 0x2213, + 0x49e: 0xb553, 0x49f: 0xb553, 0x4a0: 0xb853, 0x4a1: 0xb853, 0x4a2: 0x2212, 0x4a3: 0x2212, + 0x4a4: 0x2612, 0x4a5: 0x2612, 0x4a6: 0x2212, 0x4a7: 0x2212, 0x4a8: 0x2e12, 0x4a9: 0x2e12, + 0x4aa: 0x2212, 0x4ab: 0x2212, 0x4ac: 0x2612, 0x4ad: 0x2612, 0x4ae: 0x2212, 0x4af: 0x2212, + 0x4b0: 0x3e12, 0x4b1: 0x3e12, 0x4b2: 0x2212, 0x4b3: 0x2212, 0x4b4: 0x2612, 0x4b5: 0x2612, + 0x4b6: 0x2212, 0x4b7: 0x2212, 0x4b8: 0x2e12, 0x4b9: 0x2e12, 0x4ba: 0x2212, 0x4bb: 0x2212, + 0x4bc: 0x2612, 0x4bd: 0x2612, 0x4be: 0x2212, 0x4bf: 0x2212, + // Block 0x13, offset 0x4c0 + 0x4c2: 0x0010, + 0x4c7: 0x0010, 0x4c9: 0x0010, 0x4cb: 0x0010, + 0x4cd: 0x0010, 0x4ce: 0x0010, 0x4cf: 0x0010, 0x4d1: 0x0010, + 0x4d2: 0x0010, 0x4d4: 0x0010, 0x4d7: 0x0010, + 0x4d9: 0x0010, 0x4db: 0x0010, 0x4dd: 0x0010, + 0x4df: 0x0010, 0x4e1: 0x0010, 0x4e2: 0x0010, + 0x4e4: 0x0010, 0x4e7: 0x0010, 0x4e8: 0x0010, 0x4e9: 0x0010, + 0x4ea: 0x0010, 0x4ec: 0x0010, 0x4ed: 0x0010, 0x4ee: 0x0010, 0x4ef: 0x0010, + 0x4f0: 0x0010, 0x4f1: 0x0010, 0x4f2: 0x0010, 0x4f4: 0x0010, 0x4f5: 0x0010, + 0x4f6: 0x0010, 0x4f7: 0x0010, 0x4f9: 0x0010, 0x4fa: 0x0010, 0x4fb: 0x0010, + 0x4fc: 0x0010, 0x4fe: 0x0010, +} + +// caseIndex: 25 blocks, 1600 entries, 3200 bytes +// Block 0 is the zero block. +var caseIndex = [1600]uint16{ + // Block 0x0, offset 0x0 + // Block 0x1, offset 0x40 + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc2: 0x12, 0xc3: 0x13, 0xc4: 0x14, 0xc5: 0x15, 0xc6: 0x01, 0xc7: 0x02, + 0xc8: 0x16, 0xc9: 0x03, 0xca: 0x04, 0xcb: 0x17, 0xcc: 0x18, 0xcd: 0x05, 0xce: 0x06, 0xcf: 0x07, + 0xd0: 0x19, 0xd1: 0x1a, 0xd2: 0x1b, 0xd3: 0x1c, 0xd4: 0x1d, 0xd5: 0x1e, 0xd6: 0x1f, 0xd7: 0x20, + 0xd8: 0x21, 0xd9: 0x22, 0xda: 0x23, 0xdb: 0x24, 0xdc: 0x25, 0xdd: 0x26, 0xde: 0x27, 0xdf: 0x28, + 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, + 0xea: 0x06, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x08, 0xef: 0x09, + 0xf0: 0x14, 0xf3: 0x16, + // Block 0x4, offset 0x100 + 0x120: 0x29, 0x121: 0x2a, 0x122: 0x2b, 0x123: 0x2c, 0x124: 0x2d, 0x125: 0x2e, 0x126: 0x2f, 0x127: 0x30, + 0x128: 0x31, 0x129: 0x32, 0x12a: 0x33, 0x12b: 0x34, 0x12c: 0x35, 0x12d: 0x36, 0x12e: 0x37, 0x12f: 0x38, + 0x130: 0x39, 0x131: 0x3a, 0x132: 0x3b, 0x133: 0x3c, 0x134: 0x3d, 0x135: 0x3e, 0x136: 0x3f, 0x137: 0x40, + 0x138: 0x41, 0x139: 0x42, 0x13a: 0x43, 0x13b: 0x44, 0x13c: 0x45, 0x13d: 0x46, 0x13e: 0x47, 0x13f: 0x48, + // Block 0x5, offset 0x140 + 0x140: 0x49, 0x141: 0x4a, 0x142: 0x4b, 0x143: 0x4c, 0x144: 0x23, 0x145: 0x23, 0x146: 0x23, 0x147: 0x23, + 0x148: 0x23, 0x149: 0x4d, 0x14a: 0x4e, 0x14b: 0x4f, 0x14c: 0x50, 0x14d: 0x51, 0x14e: 0x52, 0x14f: 0x53, + 0x150: 0x54, 0x151: 0x23, 0x152: 0x23, 0x153: 0x23, 0x154: 0x23, 0x155: 0x23, 0x156: 0x23, 0x157: 0x23, + 0x158: 0x23, 0x159: 0x55, 0x15a: 0x56, 0x15b: 0x57, 0x15c: 0x58, 0x15d: 0x59, 0x15e: 0x5a, 0x15f: 0x5b, + 0x160: 0x5c, 0x161: 0x5d, 0x162: 0x5e, 0x163: 0x5f, 0x164: 0x60, 0x165: 0x61, 0x167: 0x62, + 0x168: 0x63, 0x169: 0x64, 0x16a: 0x65, 0x16c: 0x66, 0x16d: 0x67, 0x16e: 0x68, 0x16f: 0x69, + 0x170: 0x6a, 0x171: 0x6b, 0x172: 0x6c, 0x173: 0x6d, 0x174: 0x6e, 0x175: 0x6f, 0x176: 0x70, 0x177: 0x71, + 0x178: 0x72, 0x179: 0x72, 0x17a: 0x73, 0x17b: 0x72, 0x17c: 0x74, 0x17d: 0x08, 0x17e: 0x09, 0x17f: 0x0a, + // Block 0x6, offset 0x180 + 0x180: 0x75, 0x181: 0x76, 0x182: 0x77, 0x183: 0x78, 0x184: 0x0b, 0x185: 0x79, 0x186: 0x7a, + 0x192: 0x7b, 0x193: 0x0c, + 0x1b0: 0x7c, 0x1b1: 0x0d, 0x1b2: 0x72, 0x1b3: 0x7d, 0x1b4: 0x7e, 0x1b5: 0x7f, 0x1b6: 0x80, 0x1b7: 0x81, + 0x1b8: 0x82, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x83, 0x1c2: 0x84, 0x1c3: 0x85, 0x1c4: 0x86, 0x1c5: 0x23, 0x1c6: 0x87, + // Block 0x8, offset 0x200 + 0x200: 0x88, 0x201: 0x23, 0x202: 0x23, 0x203: 0x23, 0x204: 0x23, 0x205: 0x23, 0x206: 0x23, 0x207: 0x23, + 0x208: 0x23, 0x209: 0x23, 0x20a: 0x23, 0x20b: 0x23, 0x20c: 0x23, 0x20d: 0x23, 0x20e: 0x23, 0x20f: 0x23, + 0x210: 0x23, 0x211: 0x23, 0x212: 0x89, 0x213: 0x8a, 0x214: 0x23, 0x215: 0x23, 0x216: 0x23, 0x217: 0x23, + 0x218: 0x8b, 0x219: 0x8c, 0x21a: 0x8d, 0x21b: 0x8e, 0x21c: 0x8f, 0x21d: 0x90, 0x21e: 0x0e, 0x21f: 0x91, + 0x220: 0x92, 0x221: 0x93, 0x222: 0x23, 0x223: 0x94, 0x224: 0x95, 0x225: 0x96, 0x226: 0x97, 0x227: 0x98, + 0x228: 0x99, 0x229: 0x9a, 0x22a: 0x9b, 0x22b: 0x9c, 0x22c: 0x9d, 0x22d: 0x9e, 0x22e: 0x9f, 0x22f: 0xa0, + 0x230: 0x23, 0x231: 0x23, 0x232: 0x23, 0x233: 0x23, 0x234: 0x23, 0x235: 0x23, 0x236: 0x23, 0x237: 0x23, + 0x238: 0x23, 0x239: 0x23, 0x23a: 0x23, 0x23b: 0x23, 0x23c: 0x23, 0x23d: 0x23, 0x23e: 0x23, 0x23f: 0x23, + // Block 0x9, offset 0x240 + 0x240: 0x23, 0x241: 0x23, 0x242: 0x23, 0x243: 0x23, 0x244: 0x23, 0x245: 0x23, 0x246: 0x23, 0x247: 0x23, + 0x248: 0x23, 0x249: 0x23, 0x24a: 0x23, 0x24b: 0x23, 0x24c: 0x23, 0x24d: 0x23, 0x24e: 0x23, 0x24f: 0x23, + 0x250: 0x23, 0x251: 0x23, 0x252: 0x23, 0x253: 0x23, 0x254: 0x23, 0x255: 0x23, 0x256: 0x23, 0x257: 0x23, + 0x258: 0x23, 0x259: 0x23, 0x25a: 0x23, 0x25b: 0x23, 0x25c: 0x23, 0x25d: 0x23, 0x25e: 0x23, 0x25f: 0x23, + 0x260: 0x23, 0x261: 0x23, 0x262: 0x23, 0x263: 0x23, 0x264: 0x23, 0x265: 0x23, 0x266: 0x23, 0x267: 0x23, + 0x268: 0x23, 0x269: 0x23, 0x26a: 0x23, 0x26b: 0x23, 0x26c: 0x23, 0x26d: 0x23, 0x26e: 0x23, 0x26f: 0x23, + 0x270: 0x23, 0x271: 0x23, 0x272: 0x23, 0x273: 0x23, 0x274: 0x23, 0x275: 0x23, 0x276: 0x23, 0x277: 0x23, + 0x278: 0x23, 0x279: 0x23, 0x27a: 0x23, 0x27b: 0x23, 0x27c: 0x23, 0x27d: 0x23, 0x27e: 0x23, 0x27f: 0x23, + // Block 0xa, offset 0x280 + 0x280: 0x23, 0x281: 0x23, 0x282: 0x23, 0x283: 0x23, 0x284: 0x23, 0x285: 0x23, 0x286: 0x23, 0x287: 0x23, + 0x288: 0x23, 0x289: 0x23, 0x28a: 0x23, 0x28b: 0x23, 0x28c: 0x23, 0x28d: 0x23, 0x28e: 0x23, 0x28f: 0x23, + 0x290: 0x23, 0x291: 0x23, 0x292: 0x23, 0x293: 0x23, 0x294: 0x23, 0x295: 0x23, 0x296: 0x23, 0x297: 0x23, + 0x298: 0x23, 0x299: 0x23, 0x29a: 0x23, 0x29b: 0x23, 0x29c: 0x23, 0x29d: 0x23, 0x29e: 0xa1, 0x29f: 0xa2, + // Block 0xb, offset 0x2c0 + 0x2ec: 0x0f, 0x2ed: 0xa3, 0x2ee: 0xa4, 0x2ef: 0xa5, + 0x2f0: 0x23, 0x2f1: 0x23, 0x2f2: 0x23, 0x2f3: 0x23, 0x2f4: 0xa6, 0x2f5: 0xa7, 0x2f6: 0xa8, 0x2f7: 0xa9, + 0x2f8: 0xaa, 0x2f9: 0xab, 0x2fa: 0x23, 0x2fb: 0xac, 0x2fc: 0xad, 0x2fd: 0xae, 0x2fe: 0xaf, 0x2ff: 0xb0, + // Block 0xc, offset 0x300 + 0x300: 0xb1, 0x301: 0xb2, 0x302: 0x23, 0x303: 0xb3, 0x305: 0xb4, 0x307: 0xb5, + 0x30a: 0xb6, 0x30b: 0xb7, 0x30c: 0xb8, 0x30d: 0xb9, 0x30e: 0xba, 0x30f: 0xbb, + 0x310: 0xbc, 0x311: 0xbd, 0x312: 0xbe, 0x313: 0xbf, 0x314: 0xc0, 0x315: 0xc1, + 0x318: 0x23, 0x319: 0x23, 0x31a: 0x23, 0x31b: 0x23, 0x31c: 0xc2, 0x31d: 0xc3, + 0x320: 0xc4, 0x321: 0xc5, 0x322: 0xc6, 0x323: 0xc7, 0x324: 0xc8, 0x326: 0xc9, + 0x328: 0xca, 0x329: 0xcb, 0x32a: 0xcc, 0x32b: 0xcd, 0x32c: 0x5f, 0x32d: 0xce, 0x32e: 0xcf, + 0x330: 0x23, 0x331: 0xd0, 0x332: 0xd1, 0x333: 0xd2, + // Block 0xd, offset 0x340 + 0x340: 0xd3, 0x341: 0xd4, 0x342: 0xd5, 0x343: 0xd6, 0x344: 0xd7, 0x345: 0xd8, 0x346: 0xd9, 0x347: 0xda, + 0x348: 0xdb, 0x34a: 0xdc, 0x34b: 0xdd, 0x34c: 0xde, 0x34d: 0xdf, + 0x350: 0xe0, 0x351: 0xe1, 0x352: 0xe2, 0x353: 0xe3, 0x356: 0xe4, 0x357: 0xe5, + 0x358: 0xe6, 0x359: 0xe7, 0x35a: 0xe8, 0x35b: 0xe9, 0x35c: 0xea, + 0x362: 0xeb, 0x363: 0xec, + 0x36b: 0xed, + 0x370: 0xee, 0x371: 0xef, 0x372: 0xf0, + // Block 0xe, offset 0x380 + 0x380: 0x23, 0x381: 0x23, 0x382: 0x23, 0x383: 0x23, 0x384: 0x23, 0x385: 0x23, 0x386: 0x23, 0x387: 0x23, + 0x388: 0x23, 0x389: 0x23, 0x38a: 0x23, 0x38b: 0x23, 0x38c: 0x23, 0x38d: 0x23, 0x38e: 0xf1, + 0x390: 0x23, 0x391: 0xf2, 0x392: 0x23, 0x393: 0x23, 0x394: 0x23, 0x395: 0xf3, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x23, 0x3c1: 0x23, 0x3c2: 0x23, 0x3c3: 0x23, 0x3c4: 0x23, 0x3c5: 0x23, 0x3c6: 0x23, 0x3c7: 0x23, + 0x3c8: 0x23, 0x3c9: 0x23, 0x3ca: 0x23, 0x3cb: 0x23, 0x3cc: 0x23, 0x3cd: 0x23, 0x3ce: 0x23, 0x3cf: 0x23, + 0x3d0: 0xf2, + // Block 0x10, offset 0x400 + 0x410: 0x23, 0x411: 0x23, 0x412: 0x23, 0x413: 0x23, 0x414: 0x23, 0x415: 0x23, 0x416: 0x23, 0x417: 0x23, + 0x418: 0x23, 0x419: 0xf4, + // Block 0x11, offset 0x440 + 0x460: 0x23, 0x461: 0x23, 0x462: 0x23, 0x463: 0x23, 0x464: 0x23, 0x465: 0x23, 0x466: 0x23, 0x467: 0x23, + 0x468: 0xed, 0x469: 0xf5, 0x46b: 0xf6, 0x46c: 0xf7, 0x46d: 0xf8, 0x46e: 0xf9, + 0x47c: 0x23, 0x47d: 0xfa, 0x47e: 0xfb, 0x47f: 0xfc, + // Block 0x12, offset 0x480 + 0x4b0: 0x23, 0x4b1: 0xfd, 0x4b2: 0xfe, + // Block 0x13, offset 0x4c0 + 0x4c5: 0xff, 0x4c6: 0x100, + 0x4c9: 0x101, + 0x4d0: 0x102, 0x4d1: 0x103, 0x4d2: 0x104, 0x4d3: 0x105, 0x4d4: 0x106, 0x4d5: 0x107, 0x4d6: 0x108, 0x4d7: 0x109, + 0x4d8: 0x10a, 0x4d9: 0x10b, 0x4da: 0x10c, 0x4db: 0x10d, 0x4dc: 0x10e, 0x4dd: 0x10f, 0x4de: 0x110, 0x4df: 0x111, + 0x4e8: 0x112, 0x4e9: 0x113, 0x4ea: 0x114, + // Block 0x14, offset 0x500 + 0x500: 0x115, + 0x520: 0x23, 0x521: 0x23, 0x522: 0x23, 0x523: 0x116, 0x524: 0x10, 0x525: 0x117, + 0x538: 0x118, 0x539: 0x11, 0x53a: 0x119, + // Block 0x15, offset 0x540 + 0x544: 0x11a, 0x545: 0x11b, 0x546: 0x11c, + 0x54f: 0x11d, + // Block 0x16, offset 0x580 + 0x590: 0x0a, 0x591: 0x0b, 0x592: 0x0c, 0x593: 0x0d, 0x594: 0x0e, 0x596: 0x0f, + 0x59b: 0x10, 0x59d: 0x11, 0x59e: 0x12, 0x59f: 0x13, + // Block 0x17, offset 0x5c0 + 0x5c0: 0x11e, 0x5c1: 0x11f, 0x5c4: 0x11f, 0x5c5: 0x11f, 0x5c6: 0x11f, 0x5c7: 0x120, + // Block 0x18, offset 0x600 + 0x620: 0x15, +} + +// sparseOffsets: 272 entries, 544 bytes +var sparseOffsets = []uint16{0x0, 0x9, 0xf, 0x18, 0x24, 0x2e, 0x3a, 0x3d, 0x41, 0x44, 0x48, 0x52, 0x54, 0x59, 0x69, 0x70, 0x75, 0x83, 0x84, 0x92, 0xa1, 0xab, 0xae, 0xb4, 0xbc, 0xbe, 0xc0, 0xce, 0xd4, 0xe2, 0xed, 0xf8, 0x103, 0x10f, 0x119, 0x124, 0x12f, 0x13b, 0x147, 0x14f, 0x157, 0x161, 0x16c, 0x178, 0x17e, 0x189, 0x18e, 0x196, 0x199, 0x19e, 0x1a2, 0x1a6, 0x1ad, 0x1b6, 0x1be, 0x1bf, 0x1c8, 0x1cf, 0x1d7, 0x1dd, 0x1e3, 0x1e8, 0x1ec, 0x1ef, 0x1f1, 0x1f4, 0x1f9, 0x1fa, 0x1fc, 0x1fe, 0x200, 0x207, 0x20c, 0x210, 0x219, 0x21c, 0x21f, 0x225, 0x226, 0x231, 0x232, 0x233, 0x238, 0x245, 0x24d, 0x255, 0x25e, 0x267, 0x270, 0x275, 0x278, 0x281, 0x28e, 0x290, 0x297, 0x299, 0x2a4, 0x2a5, 0x2b0, 0x2b8, 0x2c0, 0x2c6, 0x2c7, 0x2d5, 0x2da, 0x2dd, 0x2e2, 0x2e6, 0x2ec, 0x2f1, 0x2f4, 0x2f9, 0x2fe, 0x2ff, 0x305, 0x307, 0x308, 0x30a, 0x30c, 0x30f, 0x310, 0x312, 0x315, 0x31b, 0x31f, 0x321, 0x327, 0x32e, 0x332, 0x33b, 0x33c, 0x344, 0x348, 0x34d, 0x355, 0x35b, 0x361, 0x36b, 0x370, 0x379, 0x37f, 0x386, 0x38a, 0x392, 0x394, 0x396, 0x399, 0x39b, 0x39d, 0x39e, 0x39f, 0x3a1, 0x3a3, 0x3a9, 0x3ae, 0x3b0, 0x3b6, 0x3b9, 0x3bb, 0x3c1, 0x3c6, 0x3c8, 0x3c9, 0x3ca, 0x3cb, 0x3cd, 0x3cf, 0x3d1, 0x3d4, 0x3d6, 0x3d9, 0x3e1, 0x3e4, 0x3e8, 0x3f0, 0x3f2, 0x3f3, 0x3f4, 0x3f6, 0x3fc, 0x3fe, 0x3ff, 0x401, 0x403, 0x405, 0x412, 0x413, 0x414, 0x418, 0x41a, 0x41b, 0x41c, 0x41d, 0x41e, 0x422, 0x426, 0x42c, 0x42e, 0x435, 0x438, 0x43c, 0x442, 0x44b, 0x451, 0x457, 0x461, 0x46b, 0x46d, 0x474, 0x47a, 0x480, 0x486, 0x489, 0x48f, 0x492, 0x49a, 0x49b, 0x4a2, 0x4a3, 0x4a6, 0x4a7, 0x4ad, 0x4b0, 0x4b8, 0x4b9, 0x4ba, 0x4bb, 0x4bc, 0x4be, 0x4c0, 0x4c2, 0x4c6, 0x4c7, 0x4c9, 0x4ca, 0x4cb, 0x4cd, 0x4d2, 0x4d7, 0x4db, 0x4dc, 0x4df, 0x4e3, 0x4ee, 0x4f2, 0x4fa, 0x4ff, 0x503, 0x506, 0x50a, 0x50d, 0x510, 0x515, 0x519, 0x51d, 0x521, 0x525, 0x527, 0x529, 0x52c, 0x531, 0x533, 0x538, 0x541, 0x546, 0x547, 0x54a, 0x54b, 0x54c, 0x54e, 0x54f, 0x550} + +// sparseValues: 1360 entries, 5440 bytes +var sparseValues = [1360]valueRange{ + // Block 0x0, offset 0x0 + {value: 0x0004, lo: 0xa8, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xaa}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0004, lo: 0xaf, hi: 0xaf}, + {value: 0x0004, lo: 0xb4, hi: 0xb4}, + {value: 0x001a, lo: 0xb5, hi: 0xb5}, + {value: 0x0054, lo: 0xb7, hi: 0xb7}, + {value: 0x0004, lo: 0xb8, hi: 0xb8}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + // Block 0x1, offset 0x9 + {value: 0x2013, lo: 0x80, hi: 0x96}, + {value: 0x2013, lo: 0x98, hi: 0x9e}, + {value: 0x009a, lo: 0x9f, hi: 0x9f}, + {value: 0x2012, lo: 0xa0, hi: 0xb6}, + {value: 0x2012, lo: 0xb8, hi: 0xbe}, + {value: 0x0252, lo: 0xbf, hi: 0xbf}, + // Block 0x2, offset 0xf + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x011b, lo: 0xb0, hi: 0xb0}, + {value: 0x019a, lo: 0xb1, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb7}, + {value: 0x0012, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x0553, lo: 0xbf, hi: 0xbf}, + // Block 0x3, offset 0x18 + {value: 0x0552, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x01da, lo: 0x89, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xb7}, + {value: 0x0253, lo: 0xb8, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x0316, lo: 0xbd, hi: 0xbe}, + {value: 0x028a, lo: 0xbf, hi: 0xbf}, + // Block 0x4, offset 0x24 + {value: 0x0117, lo: 0x80, hi: 0x9f}, + {value: 0x2f53, lo: 0xa0, hi: 0xa0}, + {value: 0x0012, lo: 0xa1, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xb3}, + {value: 0x0012, lo: 0xb4, hi: 0xb9}, + {value: 0x090b, lo: 0xba, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x2953, lo: 0xbd, hi: 0xbd}, + {value: 0x098b, lo: 0xbe, hi: 0xbe}, + {value: 0x0a0a, lo: 0xbf, hi: 0xbf}, + // Block 0x5, offset 0x2e + {value: 0x0015, lo: 0x80, hi: 0x81}, + {value: 0x0004, lo: 0x82, hi: 0x85}, + {value: 0x0014, lo: 0x86, hi: 0x91}, + {value: 0x0004, lo: 0x92, hi: 0x96}, + {value: 0x0054, lo: 0x97, hi: 0x97}, + {value: 0x0004, lo: 0x98, hi: 0x9f}, + {value: 0x0015, lo: 0xa0, hi: 0xa4}, + {value: 0x0004, lo: 0xa5, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xac}, + {value: 0x0004, lo: 0xad, hi: 0xad}, + {value: 0x0014, lo: 0xae, hi: 0xae}, + {value: 0x0004, lo: 0xaf, hi: 0xbf}, + // Block 0x6, offset 0x3a + {value: 0x0024, lo: 0x80, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbf}, + // Block 0x7, offset 0x3d + {value: 0x6553, lo: 0x80, hi: 0x8f}, + {value: 0x2013, lo: 0x90, hi: 0x9f}, + {value: 0x5f53, lo: 0xa0, hi: 0xaf}, + {value: 0x2012, lo: 0xb0, hi: 0xbf}, + // Block 0x8, offset 0x41 + {value: 0x5f52, lo: 0x80, hi: 0x8f}, + {value: 0x6552, lo: 0x90, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x9, offset 0x44 + {value: 0x0117, lo: 0x80, hi: 0x81}, + {value: 0x0024, lo: 0x83, hi: 0x87}, + {value: 0x0014, lo: 0x88, hi: 0x89}, + {value: 0x0117, lo: 0x8a, hi: 0xbf}, + // Block 0xa, offset 0x48 + {value: 0x0f13, lo: 0x80, hi: 0x80}, + {value: 0x0316, lo: 0x81, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0316, lo: 0x85, hi: 0x86}, + {value: 0x0f16, lo: 0x87, hi: 0x88}, + {value: 0x0316, lo: 0x89, hi: 0x8a}, + {value: 0x0716, lo: 0x8b, hi: 0x8c}, + {value: 0x0316, lo: 0x8d, hi: 0x8e}, + {value: 0x0f12, lo: 0x8f, hi: 0x8f}, + {value: 0x0117, lo: 0x90, hi: 0xbf}, + // Block 0xb, offset 0x52 + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x6553, lo: 0xb1, hi: 0xbf}, + // Block 0xc, offset 0x54 + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6853, lo: 0x90, hi: 0x96}, + {value: 0x0014, lo: 0x99, hi: 0x99}, + {value: 0x6552, lo: 0xa1, hi: 0xaf}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0xd, offset 0x59 + {value: 0x6852, lo: 0x80, hi: 0x86}, + {value: 0x198a, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x91, hi: 0x91}, + {value: 0x0024, lo: 0x92, hi: 0x95}, + {value: 0x0034, lo: 0x96, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x99}, + {value: 0x0034, lo: 0x9a, hi: 0x9b}, + {value: 0x0024, lo: 0x9c, hi: 0xa1}, + {value: 0x0034, lo: 0xa2, hi: 0xa7}, + {value: 0x0024, lo: 0xa8, hi: 0xa9}, + {value: 0x0034, lo: 0xaa, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xaf}, + {value: 0x0034, lo: 0xb0, hi: 0xbd}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xe, offset 0x69 + {value: 0x0034, lo: 0x81, hi: 0x82}, + {value: 0x0024, lo: 0x84, hi: 0x84}, + {value: 0x0034, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xb3}, + {value: 0x0054, lo: 0xb4, hi: 0xb4}, + // Block 0xf, offset 0x70 + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0024, lo: 0x90, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0014, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x10, offset 0x75 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x8a}, + {value: 0x0034, lo: 0x8b, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9c}, + {value: 0x0024, lo: 0x9d, hi: 0x9e}, + {value: 0x0034, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0034, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x11, offset 0x83 + {value: 0x0010, lo: 0x80, hi: 0xbf}, + // Block 0x12, offset 0x84 + {value: 0x0010, lo: 0x80, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0024, lo: 0x9f, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xaa, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x13, offset 0x92 + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0034, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0034, lo: 0xb1, hi: 0xb1}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbc}, + {value: 0x0024, lo: 0xbd, hi: 0xbd}, + {value: 0x0034, lo: 0xbe, hi: 0xbe}, + {value: 0x0024, lo: 0xbf, hi: 0xbf}, + // Block 0x14, offset 0xa1 + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0024, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x88}, + {value: 0x0024, lo: 0x89, hi: 0x8a}, + {value: 0x0010, lo: 0x8d, hi: 0xbf}, + // Block 0x15, offset 0xab + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x16, offset 0xae + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0024, lo: 0xab, hi: 0xb1}, + {value: 0x0034, lo: 0xb2, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + // Block 0x17, offset 0xb4 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0024, lo: 0x96, hi: 0x99}, + {value: 0x0014, lo: 0x9a, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0xa3}, + {value: 0x0014, lo: 0xa4, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xad}, + // Block 0x18, offset 0xbc + {value: 0x0010, lo: 0x80, hi: 0x98}, + {value: 0x0034, lo: 0x99, hi: 0x9b}, + // Block 0x19, offset 0xbe + {value: 0x0010, lo: 0xa0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbd}, + // Block 0x1a, offset 0xc0 + {value: 0x0024, lo: 0x94, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0034, lo: 0xa3, hi: 0xa3}, + {value: 0x0024, lo: 0xa4, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0024, lo: 0xaa, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xb2}, + {value: 0x0024, lo: 0xb3, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbf}, + // Block 0x1b, offset 0xce + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1c, offset 0xd4 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0024, lo: 0x93, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x98, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0x1d, offset 0xe2 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb6, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x1e, offset 0xed + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xb1}, + // Block 0x1f, offset 0xf8 + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x20, offset 0x103 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x91, hi: 0x91}, + {value: 0x0010, lo: 0x99, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x21, offset 0x10f + {value: 0x0014, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x22, offset 0x119 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x85}, + {value: 0x0014, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x89, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + // Block 0x23, offset 0x124 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x24, offset 0x12f + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9c, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + // Block 0x25, offset 0x13b + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8a}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + {value: 0x0010, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0010, lo: 0xa8, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x26, offset 0x147 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x82}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x27, offset 0x14f + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb9}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbf}, + // Block 0x28, offset 0x157 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x88}, + {value: 0x0014, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0034, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + // Block 0x29, offset 0x161 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x2a, offset 0x16c + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x95, hi: 0x96}, + {value: 0x0010, lo: 0x9e, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb1, hi: 0xb2}, + // Block 0x2b, offset 0x178 + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0xba}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x2c, offset 0x17e + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8e, hi: 0x8e}, + {value: 0x0010, lo: 0x94, hi: 0x97}, + {value: 0x0010, lo: 0x9f, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa3}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xba, hi: 0xbf}, + // Block 0x2d, offset 0x189 + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x96}, + {value: 0x0010, lo: 0x9a, hi: 0xb1}, + {value: 0x0010, lo: 0xb3, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x2e, offset 0x18e + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0010, lo: 0x8f, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x94}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9f}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + // Block 0x2f, offset 0x196 + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xba}, + // Block 0x30, offset 0x199 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x87}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x31, offset 0x19e + {value: 0x0014, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb4, hi: 0xb7}, + {value: 0x0034, lo: 0xb8, hi: 0xb9}, + {value: 0x0014, lo: 0xbb, hi: 0xbc}, + // Block 0x32, offset 0x1a2 + {value: 0x0004, lo: 0x86, hi: 0x86}, + {value: 0x0034, lo: 0x88, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x33, offset 0x1a6 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0034, lo: 0x98, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0034, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x34, offset 0x1ad + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xac}, + {value: 0x0034, lo: 0xb1, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xba, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x35, offset 0x1b6 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0024, lo: 0x82, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0024, lo: 0x86, hi: 0x87}, + {value: 0x0010, lo: 0x88, hi: 0x8c}, + {value: 0x0014, lo: 0x8d, hi: 0x97}, + {value: 0x0014, lo: 0x99, hi: 0xbc}, + // Block 0x36, offset 0x1be + {value: 0x0034, lo: 0x86, hi: 0x86}, + // Block 0x37, offset 0x1bf + {value: 0x0010, lo: 0xab, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + {value: 0x0010, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbe}, + // Block 0x38, offset 0x1c8 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x96, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x99}, + {value: 0x0014, lo: 0x9e, hi: 0xa0}, + {value: 0x0010, lo: 0xa2, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xad}, + {value: 0x0014, lo: 0xb1, hi: 0xb4}, + // Block 0x39, offset 0x1cf + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x6c53, lo: 0xa0, hi: 0xbf}, + // Block 0x3a, offset 0x1d7 + {value: 0x7053, lo: 0x80, hi: 0x85}, + {value: 0x7053, lo: 0x87, hi: 0x87}, + {value: 0x7053, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xba}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x3b, offset 0x1dd + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x9a, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x3c, offset 0x1e3 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x3d, offset 0x1e8 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x82, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3e, offset 0x1ec + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0010, lo: 0x92, hi: 0x95}, + {value: 0x0010, lo: 0x98, hi: 0xbf}, + // Block 0x3f, offset 0x1ef + {value: 0x0010, lo: 0x80, hi: 0x9a}, + {value: 0x0024, lo: 0x9d, hi: 0x9f}, + // Block 0x40, offset 0x1f1 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x7453, lo: 0xa0, hi: 0xaf}, + {value: 0x7853, lo: 0xb0, hi: 0xbf}, + // Block 0x41, offset 0x1f4 + {value: 0x7c53, lo: 0x80, hi: 0x8f}, + {value: 0x8053, lo: 0x90, hi: 0x9f}, + {value: 0x7c53, lo: 0xa0, hi: 0xaf}, + {value: 0x0813, lo: 0xb0, hi: 0xb5}, + {value: 0x0892, lo: 0xb8, hi: 0xbd}, + // Block 0x42, offset 0x1f9 + {value: 0x0010, lo: 0x81, hi: 0xbf}, + // Block 0x43, offset 0x1fa + {value: 0x0010, lo: 0x80, hi: 0xac}, + {value: 0x0010, lo: 0xaf, hi: 0xbf}, + // Block 0x44, offset 0x1fc + {value: 0x0010, lo: 0x81, hi: 0x9a}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x45, offset 0x1fe + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xae, hi: 0xb8}, + // Block 0x46, offset 0x200 + {value: 0x0010, lo: 0x80, hi: 0x8c}, + {value: 0x0010, lo: 0x8e, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0034, lo: 0x94, hi: 0x94}, + {value: 0x0010, lo: 0xa0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + // Block 0x47, offset 0x207 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0014, lo: 0x92, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xac}, + {value: 0x0010, lo: 0xae, hi: 0xb0}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + // Block 0x48, offset 0x20c + {value: 0x0014, lo: 0xb4, hi: 0xb5}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0x49, offset 0x210 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0014, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0014, lo: 0x89, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x92}, + {value: 0x0014, lo: 0x93, hi: 0x93}, + {value: 0x0004, lo: 0x97, hi: 0x97}, + {value: 0x0024, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0x4a, offset 0x219 + {value: 0x0014, lo: 0x8b, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x4b, offset 0x21c + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb7}, + // Block 0x4c, offset 0x21f + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x4d, offset 0x225 + {value: 0x0010, lo: 0x80, hi: 0xb5}, + // Block 0x4e, offset 0x226 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xb9}, + {value: 0x0024, lo: 0xba, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbb}, + // Block 0x4f, offset 0x231 + {value: 0x0010, lo: 0x86, hi: 0x8f}, + // Block 0x50, offset 0x232 + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x51, offset 0x233 + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0024, lo: 0x97, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x98}, + {value: 0x0010, lo: 0x99, hi: 0x9a}, + {value: 0x0014, lo: 0x9b, hi: 0x9b}, + // Block 0x52, offset 0x238 + {value: 0x0010, lo: 0x95, hi: 0x95}, + {value: 0x0014, lo: 0x96, hi: 0x96}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0014, lo: 0x98, hi: 0x9e}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa2}, + {value: 0x0010, lo: 0xa3, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xac}, + {value: 0x0010, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0024, lo: 0xb5, hi: 0xbc}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x53, offset 0x245 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xa7, hi: 0xa7}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + {value: 0x0034, lo: 0xb5, hi: 0xba}, + {value: 0x0024, lo: 0xbb, hi: 0xbc}, + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + // Block 0x54, offset 0x24d + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x55, offset 0x255 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x83}, + {value: 0x0030, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x8b}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xab, hi: 0xab}, + {value: 0x0034, lo: 0xac, hi: 0xac}, + {value: 0x0024, lo: 0xad, hi: 0xb3}, + // Block 0x56, offset 0x25e + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0030, lo: 0xaa, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xbf}, + // Block 0x57, offset 0x267 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa9}, + {value: 0x0010, lo: 0xaa, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0030, lo: 0xb2, hi: 0xb3}, + // Block 0x58, offset 0x270 + {value: 0x0010, lo: 0x80, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + // Block 0x59, offset 0x275 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8d, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x5a, offset 0x278 + {value: 0x1a6a, lo: 0x80, hi: 0x80}, + {value: 0x1aea, lo: 0x81, hi: 0x81}, + {value: 0x1b6a, lo: 0x82, hi: 0x82}, + {value: 0x1bea, lo: 0x83, hi: 0x83}, + {value: 0x1c6a, lo: 0x84, hi: 0x84}, + {value: 0x1cea, lo: 0x85, hi: 0x85}, + {value: 0x1d6a, lo: 0x86, hi: 0x86}, + {value: 0x1dea, lo: 0x87, hi: 0x87}, + {value: 0x1e6a, lo: 0x88, hi: 0x88}, + // Block 0x5b, offset 0x281 + {value: 0x0024, lo: 0x90, hi: 0x92}, + {value: 0x0034, lo: 0x94, hi: 0x99}, + {value: 0x0024, lo: 0x9a, hi: 0x9b}, + {value: 0x0034, lo: 0x9c, hi: 0x9f}, + {value: 0x0024, lo: 0xa0, hi: 0xa0}, + {value: 0x0010, lo: 0xa1, hi: 0xa1}, + {value: 0x0034, lo: 0xa2, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xb3}, + {value: 0x0024, lo: 0xb4, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb6}, + {value: 0x0024, lo: 0xb8, hi: 0xb9}, + // Block 0x5c, offset 0x28e + {value: 0x0012, lo: 0x80, hi: 0xab}, + {value: 0x0015, lo: 0xac, hi: 0xbf}, + // Block 0x5d, offset 0x290 + {value: 0x0015, lo: 0x80, hi: 0xaa}, + {value: 0x0012, lo: 0xab, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb8}, + {value: 0x8452, lo: 0xb9, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbc}, + {value: 0x8852, lo: 0xbd, hi: 0xbd}, + {value: 0x0012, lo: 0xbe, hi: 0xbf}, + // Block 0x5e, offset 0x297 + {value: 0x0012, lo: 0x80, hi: 0x9a}, + {value: 0x0015, lo: 0x9b, hi: 0xbf}, + // Block 0x5f, offset 0x299 + {value: 0x0024, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0024, lo: 0x83, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0024, lo: 0x8b, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x90}, + {value: 0x0024, lo: 0x91, hi: 0xb5}, + {value: 0x0024, lo: 0xbb, hi: 0xbb}, + {value: 0x0034, lo: 0xbc, hi: 0xbd}, + {value: 0x0024, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x60, offset 0x2a4 + {value: 0x0117, lo: 0x80, hi: 0xbf}, + // Block 0x61, offset 0x2a5 + {value: 0x0117, lo: 0x80, hi: 0x95}, + {value: 0x1f1a, lo: 0x96, hi: 0x96}, + {value: 0x1fca, lo: 0x97, hi: 0x97}, + {value: 0x207a, lo: 0x98, hi: 0x98}, + {value: 0x212a, lo: 0x99, hi: 0x99}, + {value: 0x21da, lo: 0x9a, hi: 0x9a}, + {value: 0x228a, lo: 0x9b, hi: 0x9b}, + {value: 0x0012, lo: 0x9c, hi: 0x9d}, + {value: 0x233b, lo: 0x9e, hi: 0x9e}, + {value: 0x0012, lo: 0x9f, hi: 0x9f}, + {value: 0x0117, lo: 0xa0, hi: 0xbf}, + // Block 0x62, offset 0x2b0 + {value: 0x0812, lo: 0x80, hi: 0x87}, + {value: 0x0813, lo: 0x88, hi: 0x8f}, + {value: 0x0812, lo: 0x90, hi: 0x95}, + {value: 0x0813, lo: 0x98, hi: 0x9d}, + {value: 0x0812, lo: 0xa0, hi: 0xa7}, + {value: 0x0813, lo: 0xa8, hi: 0xaf}, + {value: 0x0812, lo: 0xb0, hi: 0xb7}, + {value: 0x0813, lo: 0xb8, hi: 0xbf}, + // Block 0x63, offset 0x2b8 + {value: 0x0004, lo: 0x8b, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8f}, + {value: 0x0054, lo: 0x98, hi: 0x99}, + {value: 0x0054, lo: 0xa4, hi: 0xa4}, + {value: 0x0054, lo: 0xa7, hi: 0xa7}, + {value: 0x0014, lo: 0xaa, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xaf}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x64, offset 0x2c0 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x94, hi: 0x94}, + {value: 0x0014, lo: 0xa0, hi: 0xa4}, + {value: 0x0014, lo: 0xa6, hi: 0xaf}, + {value: 0x0015, lo: 0xb1, hi: 0xb1}, + {value: 0x0015, lo: 0xbf, hi: 0xbf}, + // Block 0x65, offset 0x2c6 + {value: 0x0015, lo: 0x90, hi: 0x9c}, + // Block 0x66, offset 0x2c7 + {value: 0x0024, lo: 0x90, hi: 0x91}, + {value: 0x0034, lo: 0x92, hi: 0x93}, + {value: 0x0024, lo: 0x94, hi: 0x97}, + {value: 0x0034, lo: 0x98, hi: 0x9a}, + {value: 0x0024, lo: 0x9b, hi: 0x9c}, + {value: 0x0014, lo: 0x9d, hi: 0xa0}, + {value: 0x0024, lo: 0xa1, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa4}, + {value: 0x0034, lo: 0xa5, hi: 0xa6}, + {value: 0x0024, lo: 0xa7, hi: 0xa7}, + {value: 0x0034, lo: 0xa8, hi: 0xa8}, + {value: 0x0024, lo: 0xa9, hi: 0xa9}, + {value: 0x0034, lo: 0xaa, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + // Block 0x67, offset 0x2d5 + {value: 0x0016, lo: 0x85, hi: 0x86}, + {value: 0x0012, lo: 0x87, hi: 0x89}, + {value: 0x9d52, lo: 0x8e, hi: 0x8e}, + {value: 0x1013, lo: 0xa0, hi: 0xaf}, + {value: 0x1012, lo: 0xb0, hi: 0xbf}, + // Block 0x68, offset 0x2da + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0716, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x88}, + // Block 0x69, offset 0x2dd + {value: 0xa053, lo: 0xb6, hi: 0xb7}, + {value: 0xa353, lo: 0xb8, hi: 0xb9}, + {value: 0xa653, lo: 0xba, hi: 0xbb}, + {value: 0xa353, lo: 0xbc, hi: 0xbd}, + {value: 0xa053, lo: 0xbe, hi: 0xbf}, + // Block 0x6a, offset 0x2e2 + {value: 0x3013, lo: 0x80, hi: 0x8f}, + {value: 0x6553, lo: 0x90, hi: 0x9f}, + {value: 0xa953, lo: 0xa0, hi: 0xae}, + {value: 0x3012, lo: 0xb0, hi: 0xbf}, + // Block 0x6b, offset 0x2e6 + {value: 0x0117, lo: 0x80, hi: 0xa3}, + {value: 0x0012, lo: 0xa4, hi: 0xa4}, + {value: 0x0716, lo: 0xab, hi: 0xac}, + {value: 0x0316, lo: 0xad, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xb3}, + // Block 0x6c, offset 0x2ec + {value: 0x6c52, lo: 0x80, hi: 0x9f}, + {value: 0x7052, lo: 0xa0, hi: 0xa5}, + {value: 0x7052, lo: 0xa7, hi: 0xa7}, + {value: 0x7052, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x6d, offset 0x2f1 + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0x6e, offset 0x2f4 + {value: 0x0010, lo: 0x80, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0010, lo: 0xb0, hi: 0xb6}, + {value: 0x0010, lo: 0xb8, hi: 0xbe}, + // Block 0x6f, offset 0x2f9 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x8e}, + {value: 0x0010, lo: 0x90, hi: 0x96}, + {value: 0x0010, lo: 0x98, hi: 0x9e}, + {value: 0x0024, lo: 0xa0, hi: 0xbf}, + // Block 0x70, offset 0x2fe + {value: 0x0014, lo: 0xaf, hi: 0xaf}, + // Block 0x71, offset 0x2ff + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0xaa, hi: 0xad}, + {value: 0x0030, lo: 0xae, hi: 0xaf}, + {value: 0x0004, lo: 0xb1, hi: 0xb5}, + {value: 0x0014, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + // Block 0x72, offset 0x305 + {value: 0x0034, lo: 0x99, hi: 0x9a}, + {value: 0x0004, lo: 0x9b, hi: 0x9e}, + // Block 0x73, offset 0x307 + {value: 0x0004, lo: 0xbc, hi: 0xbe}, + // Block 0x74, offset 0x308 + {value: 0x0010, lo: 0x85, hi: 0xad}, + {value: 0x0010, lo: 0xb1, hi: 0xbf}, + // Block 0x75, offset 0x30a + {value: 0x0010, lo: 0x80, hi: 0x8e}, + {value: 0x0010, lo: 0xa0, hi: 0xba}, + // Block 0x76, offset 0x30c + {value: 0x0010, lo: 0x80, hi: 0x94}, + {value: 0x0014, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0x96, hi: 0xbf}, + // Block 0x77, offset 0x30f + {value: 0x0010, lo: 0x80, hi: 0x8c}, + // Block 0x78, offset 0x310 + {value: 0x0010, lo: 0x90, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + // Block 0x79, offset 0x312 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0xab}, + // Block 0x7a, offset 0x315 + {value: 0x0117, lo: 0x80, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xae}, + {value: 0x0024, lo: 0xaf, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb2}, + {value: 0x0024, lo: 0xb4, hi: 0xbd}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x7b, offset 0x31b + {value: 0x0117, lo: 0x80, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9d}, + {value: 0x0024, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0x7c, offset 0x31f + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb1}, + // Block 0x7d, offset 0x321 + {value: 0x0004, lo: 0x80, hi: 0x96}, + {value: 0x0014, lo: 0x97, hi: 0x9f}, + {value: 0x0004, lo: 0xa0, hi: 0xa1}, + {value: 0x0117, lo: 0xa2, hi: 0xaf}, + {value: 0x0012, lo: 0xb0, hi: 0xb1}, + {value: 0x0117, lo: 0xb2, hi: 0xbf}, + // Block 0x7e, offset 0x327 + {value: 0x0117, lo: 0x80, hi: 0xaf}, + {value: 0x0015, lo: 0xb0, hi: 0xb0}, + {value: 0x0012, lo: 0xb1, hi: 0xb8}, + {value: 0x0316, lo: 0xb9, hi: 0xba}, + {value: 0x0716, lo: 0xbb, hi: 0xbc}, + {value: 0x8453, lo: 0xbd, hi: 0xbd}, + {value: 0x0117, lo: 0xbe, hi: 0xbf}, + // Block 0x7f, offset 0x32e + {value: 0x0010, lo: 0xb7, hi: 0xb7}, + {value: 0x0015, lo: 0xb8, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbf}, + // Block 0x80, offset 0x332 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0014, lo: 0x82, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8b}, + {value: 0x0010, lo: 0x8c, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa6}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + // Block 0x81, offset 0x33b + {value: 0x0010, lo: 0x80, hi: 0xb3}, + // Block 0x82, offset 0x33c + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0034, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x85, hi: 0x85}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0024, lo: 0xa0, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb7}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x83, offset 0x344 + {value: 0x0010, lo: 0x80, hi: 0xa5}, + {value: 0x0014, lo: 0xa6, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x84, offset 0x348 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0014, lo: 0x87, hi: 0x91}, + {value: 0x0010, lo: 0x92, hi: 0x92}, + {value: 0x0030, lo: 0x93, hi: 0x93}, + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0x85, offset 0x34d + {value: 0x0014, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xb9}, + {value: 0x0010, lo: 0xba, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0x86, offset 0x355 + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0004, lo: 0xa6, hi: 0xa6}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x87, offset 0x35b + {value: 0x0010, lo: 0x80, hi: 0xa8}, + {value: 0x0014, lo: 0xa9, hi: 0xae}, + {value: 0x0010, lo: 0xaf, hi: 0xb0}, + {value: 0x0014, lo: 0xb1, hi: 0xb2}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0x88, offset 0x361 + {value: 0x0010, lo: 0x80, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x8b}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0010, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbd}, + // Block 0x89, offset 0x36b + {value: 0x0024, lo: 0xb0, hi: 0xb0}, + {value: 0x0024, lo: 0xb2, hi: 0xb3}, + {value: 0x0034, lo: 0xb4, hi: 0xb4}, + {value: 0x0024, lo: 0xb7, hi: 0xb8}, + {value: 0x0024, lo: 0xbe, hi: 0xbf}, + // Block 0x8a, offset 0x370 + {value: 0x0024, lo: 0x81, hi: 0x81}, + {value: 0x0004, lo: 0x9d, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xab}, + {value: 0x0014, lo: 0xac, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb2, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + // Block 0x8b, offset 0x379 + {value: 0x0010, lo: 0x81, hi: 0x86}, + {value: 0x0010, lo: 0x89, hi: 0x8e}, + {value: 0x0010, lo: 0x91, hi: 0x96}, + {value: 0x0010, lo: 0xa0, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0x8c, offset 0x37f + {value: 0x0012, lo: 0x80, hi: 0x92}, + {value: 0xac52, lo: 0x93, hi: 0x93}, + {value: 0x0012, lo: 0x94, hi: 0x9a}, + {value: 0x0004, lo: 0x9b, hi: 0x9b}, + {value: 0x0015, lo: 0x9c, hi: 0x9f}, + {value: 0x0012, lo: 0xa0, hi: 0xa5}, + {value: 0x74d2, lo: 0xb0, hi: 0xbf}, + // Block 0x8d, offset 0x386 + {value: 0x78d2, lo: 0x80, hi: 0x8f}, + {value: 0x7cd2, lo: 0x90, hi: 0x9f}, + {value: 0x80d2, lo: 0xa0, hi: 0xaf}, + {value: 0x7cd2, lo: 0xb0, hi: 0xbf}, + // Block 0x8e, offset 0x38a + {value: 0x0010, lo: 0x80, hi: 0xa4}, + {value: 0x0014, lo: 0xa5, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa7}, + {value: 0x0014, lo: 0xa8, hi: 0xa8}, + {value: 0x0010, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0034, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0x8f, offset 0x392 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0x90, offset 0x394 + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x8b, hi: 0xbb}, + // Block 0x91, offset 0x396 + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x86, hi: 0xbf}, + // Block 0x92, offset 0x399 + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0004, lo: 0xb2, hi: 0xbf}, + // Block 0x93, offset 0x39b + {value: 0x0004, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x93, hi: 0xbf}, + // Block 0x94, offset 0x39d + {value: 0x0010, lo: 0x80, hi: 0xbd}, + // Block 0x95, offset 0x39e + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0x96, offset 0x39f + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0xbf}, + // Block 0x97, offset 0x3a1 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0xb0, hi: 0xbb}, + // Block 0x98, offset 0x3a3 + {value: 0x0014, lo: 0x80, hi: 0x8f}, + {value: 0x0054, lo: 0x93, hi: 0x93}, + {value: 0x0024, lo: 0xa0, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xad}, + {value: 0x0024, lo: 0xae, hi: 0xaf}, + {value: 0x0010, lo: 0xb3, hi: 0xb4}, + // Block 0x99, offset 0x3a9 + {value: 0x0010, lo: 0x8d, hi: 0x8f}, + {value: 0x0054, lo: 0x92, hi: 0x92}, + {value: 0x0054, lo: 0x95, hi: 0x95}, + {value: 0x0010, lo: 0xb0, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0x9a, offset 0x3ae + {value: 0x0010, lo: 0x80, hi: 0xbc}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0x9b, offset 0x3b0 + {value: 0x0054, lo: 0x87, hi: 0x87}, + {value: 0x0054, lo: 0x8e, hi: 0x8e}, + {value: 0x0054, lo: 0x9a, hi: 0x9a}, + {value: 0x5f53, lo: 0xa1, hi: 0xba}, + {value: 0x0004, lo: 0xbe, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0x9c, offset 0x3b6 + {value: 0x0004, lo: 0x80, hi: 0x80}, + {value: 0x5f52, lo: 0x81, hi: 0x9a}, + {value: 0x0004, lo: 0xb0, hi: 0xb0}, + // Block 0x9d, offset 0x3b9 + {value: 0x0014, lo: 0x9e, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xbe}, + // Block 0x9e, offset 0x3bb + {value: 0x0010, lo: 0x82, hi: 0x87}, + {value: 0x0010, lo: 0x8a, hi: 0x8f}, + {value: 0x0010, lo: 0x92, hi: 0x97}, + {value: 0x0010, lo: 0x9a, hi: 0x9c}, + {value: 0x0004, lo: 0xa3, hi: 0xa3}, + {value: 0x0014, lo: 0xb9, hi: 0xbb}, + // Block 0x9f, offset 0x3c1 + {value: 0x0010, lo: 0x80, hi: 0x8b}, + {value: 0x0010, lo: 0x8d, hi: 0xa6}, + {value: 0x0010, lo: 0xa8, hi: 0xba}, + {value: 0x0010, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xa0, offset 0x3c6 + {value: 0x0010, lo: 0x80, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x9d}, + // Block 0xa1, offset 0x3c8 + {value: 0x0010, lo: 0x80, hi: 0xba}, + // Block 0xa2, offset 0x3c9 + {value: 0x0010, lo: 0x80, hi: 0xb4}, + // Block 0xa3, offset 0x3ca + {value: 0x0034, lo: 0xbd, hi: 0xbd}, + // Block 0xa4, offset 0x3cb + {value: 0x0010, lo: 0x80, hi: 0x9c}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa5, offset 0x3cd + {value: 0x0010, lo: 0x80, hi: 0x90}, + {value: 0x0034, lo: 0xa0, hi: 0xa0}, + // Block 0xa6, offset 0x3cf + {value: 0x0010, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xa7, offset 0x3d1 + {value: 0x0010, lo: 0x80, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0xb5}, + {value: 0x0024, lo: 0xb6, hi: 0xba}, + // Block 0xa8, offset 0x3d4 + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xbf}, + // Block 0xa9, offset 0x3d6 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x91, hi: 0x95}, + // Block 0xaa, offset 0x3d9 + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x97}, + {value: 0xaf53, lo: 0x98, hi: 0x9f}, + {value: 0xb253, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbf}, + // Block 0xab, offset 0x3e1 + {value: 0xaf52, lo: 0x80, hi: 0x87}, + {value: 0xb252, lo: 0x88, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0xbf}, + // Block 0xac, offset 0x3e4 + {value: 0x0010, lo: 0x80, hi: 0x9d}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0xb253, lo: 0xb0, hi: 0xb7}, + {value: 0xaf53, lo: 0xb8, hi: 0xbf}, + // Block 0xad, offset 0x3e8 + {value: 0x2813, lo: 0x80, hi: 0x87}, + {value: 0x3813, lo: 0x88, hi: 0x8f}, + {value: 0x2813, lo: 0x90, hi: 0x93}, + {value: 0xb252, lo: 0x98, hi: 0x9f}, + {value: 0xaf52, lo: 0xa0, hi: 0xa7}, + {value: 0x2812, lo: 0xa8, hi: 0xaf}, + {value: 0x3812, lo: 0xb0, hi: 0xb7}, + {value: 0x2812, lo: 0xb8, hi: 0xbb}, + // Block 0xae, offset 0x3f0 + {value: 0x0010, lo: 0x80, hi: 0xa7}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xaf, offset 0x3f2 + {value: 0x0010, lo: 0x80, hi: 0xa3}, + // Block 0xb0, offset 0x3f3 + {value: 0x0010, lo: 0x80, hi: 0xb6}, + // Block 0xb1, offset 0x3f4 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xa7}, + // Block 0xb2, offset 0x3f6 + {value: 0x0010, lo: 0x80, hi: 0x85}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xb5}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0010, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xb3, offset 0x3fc + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb6}, + // Block 0xb4, offset 0x3fe + {value: 0x0010, lo: 0x80, hi: 0x9e}, + // Block 0xb5, offset 0x3ff + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb5}, + // Block 0xb6, offset 0x401 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb9}, + // Block 0xb7, offset 0x403 + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0010, lo: 0xbe, hi: 0xbf}, + // Block 0xb8, offset 0x405 + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x83}, + {value: 0x0014, lo: 0x85, hi: 0x86}, + {value: 0x0014, lo: 0x8c, hi: 0x8c}, + {value: 0x0034, lo: 0x8d, hi: 0x8d}, + {value: 0x0014, lo: 0x8e, hi: 0x8e}, + {value: 0x0024, lo: 0x8f, hi: 0x8f}, + {value: 0x0010, lo: 0x90, hi: 0x93}, + {value: 0x0010, lo: 0x95, hi: 0x97}, + {value: 0x0010, lo: 0x99, hi: 0xb3}, + {value: 0x0024, lo: 0xb8, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xb9, offset 0x412 + {value: 0x0010, lo: 0xa0, hi: 0xbc}, + // Block 0xba, offset 0x413 + {value: 0x0010, lo: 0x80, hi: 0x9c}, + // Block 0xbb, offset 0x414 + {value: 0x0010, lo: 0x80, hi: 0x87}, + {value: 0x0010, lo: 0x89, hi: 0xa4}, + {value: 0x0024, lo: 0xa5, hi: 0xa5}, + {value: 0x0034, lo: 0xa6, hi: 0xa6}, + // Block 0xbc, offset 0x418 + {value: 0x0010, lo: 0x80, hi: 0x95}, + {value: 0x0010, lo: 0xa0, hi: 0xb2}, + // Block 0xbd, offset 0x41a + {value: 0x0010, lo: 0x80, hi: 0x91}, + // Block 0xbe, offset 0x41b + {value: 0x0010, lo: 0x80, hi: 0x88}, + // Block 0xbf, offset 0x41c + {value: 0x5653, lo: 0x80, hi: 0xb2}, + // Block 0xc0, offset 0x41d + {value: 0x5652, lo: 0x80, hi: 0xb2}, + // Block 0xc1, offset 0x41e + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xc2, offset 0x422 + {value: 0x0014, lo: 0x80, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0xa6, hi: 0xaf}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xc3, offset 0x426 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb6}, + {value: 0x0010, lo: 0xb7, hi: 0xb8}, + {value: 0x0034, lo: 0xb9, hi: 0xba}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + // Block 0xc4, offset 0x42c + {value: 0x0010, lo: 0x90, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xc5, offset 0x42e + {value: 0x0024, lo: 0x80, hi: 0x82}, + {value: 0x0010, lo: 0x83, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb4}, + {value: 0x0010, lo: 0xb6, hi: 0xbf}, + // Block 0xc6, offset 0x435 + {value: 0x0010, lo: 0x90, hi: 0xb2}, + {value: 0x0034, lo: 0xb3, hi: 0xb3}, + {value: 0x0010, lo: 0xb6, hi: 0xb6}, + // Block 0xc7, offset 0x438 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0xb5}, + {value: 0x0014, lo: 0xb6, hi: 0xbe}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xc8, offset 0x43c + {value: 0x0030, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0014, lo: 0x8b, hi: 0x8c}, + {value: 0x0010, lo: 0x90, hi: 0x9a}, + {value: 0x0010, lo: 0x9c, hi: 0x9c}, + // Block 0xc9, offset 0x442 + {value: 0x0010, lo: 0x80, hi: 0x91}, + {value: 0x0010, lo: 0x93, hi: 0xae}, + {value: 0x0014, lo: 0xaf, hi: 0xb1}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0014, lo: 0xb4, hi: 0xb4}, + {value: 0x0030, lo: 0xb5, hi: 0xb5}, + {value: 0x0034, lo: 0xb6, hi: 0xb6}, + {value: 0x0014, lo: 0xb7, hi: 0xb7}, + {value: 0x0014, lo: 0xbe, hi: 0xbe}, + // Block 0xca, offset 0x44b + {value: 0x0010, lo: 0x80, hi: 0x86}, + {value: 0x0010, lo: 0x88, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0x8d}, + {value: 0x0010, lo: 0x8f, hi: 0x9d}, + {value: 0x0010, lo: 0x9f, hi: 0xa8}, + {value: 0x0010, lo: 0xb0, hi: 0xbf}, + // Block 0xcb, offset 0x451 + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0014, lo: 0x9f, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa2}, + {value: 0x0014, lo: 0xa3, hi: 0xa8}, + {value: 0x0034, lo: 0xa9, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xcc, offset 0x457 + {value: 0x0014, lo: 0x80, hi: 0x81}, + {value: 0x0010, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x8c}, + {value: 0x0010, lo: 0x8f, hi: 0x90}, + {value: 0x0010, lo: 0x93, hi: 0xa8}, + {value: 0x0010, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb5, hi: 0xb9}, + {value: 0x0034, lo: 0xbc, hi: 0xbc}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xcd, offset 0x461 + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x84}, + {value: 0x0010, lo: 0x87, hi: 0x88}, + {value: 0x0010, lo: 0x8b, hi: 0x8c}, + {value: 0x0030, lo: 0x8d, hi: 0x8d}, + {value: 0x0010, lo: 0x90, hi: 0x90}, + {value: 0x0010, lo: 0x97, hi: 0x97}, + {value: 0x0010, lo: 0x9d, hi: 0xa3}, + {value: 0x0024, lo: 0xa6, hi: 0xac}, + {value: 0x0024, lo: 0xb0, hi: 0xb4}, + // Block 0xce, offset 0x46b + {value: 0x0010, lo: 0x80, hi: 0xb7}, + {value: 0x0014, lo: 0xb8, hi: 0xbf}, + // Block 0xcf, offset 0x46d + {value: 0x0010, lo: 0x80, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x82}, + {value: 0x0014, lo: 0x83, hi: 0x84}, + {value: 0x0010, lo: 0x85, hi: 0x85}, + {value: 0x0034, lo: 0x86, hi: 0x86}, + {value: 0x0010, lo: 0x87, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd0, offset 0x474 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xb8}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0014, lo: 0xba, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbe}, + {value: 0x0014, lo: 0xbf, hi: 0xbf}, + // Block 0xd1, offset 0x47a + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x81, hi: 0x81}, + {value: 0x0034, lo: 0x82, hi: 0x83}, + {value: 0x0010, lo: 0x84, hi: 0x85}, + {value: 0x0010, lo: 0x87, hi: 0x87}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd2, offset 0x480 + {value: 0x0010, lo: 0x80, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb5}, + {value: 0x0010, lo: 0xb8, hi: 0xbb}, + {value: 0x0014, lo: 0xbc, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xd3, offset 0x486 + {value: 0x0034, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x98, hi: 0x9b}, + {value: 0x0014, lo: 0x9c, hi: 0x9d}, + // Block 0xd4, offset 0x489 + {value: 0x0010, lo: 0x80, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0010, lo: 0xbb, hi: 0xbc}, + {value: 0x0014, lo: 0xbd, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xd5, offset 0x48f + {value: 0x0014, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x84, hi: 0x84}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0xd6, offset 0x492 + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0014, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xac, hi: 0xac}, + {value: 0x0014, lo: 0xad, hi: 0xad}, + {value: 0x0010, lo: 0xae, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb5}, + {value: 0x0030, lo: 0xb6, hi: 0xb6}, + {value: 0x0034, lo: 0xb7, hi: 0xb7}, + // Block 0xd7, offset 0x49a + {value: 0x0010, lo: 0x80, hi: 0x89}, + // Block 0xd8, offset 0x49b + {value: 0x0014, lo: 0x9d, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa1}, + {value: 0x0014, lo: 0xa2, hi: 0xa5}, + {value: 0x0010, lo: 0xa6, hi: 0xa6}, + {value: 0x0014, lo: 0xa7, hi: 0xaa}, + {value: 0x0034, lo: 0xab, hi: 0xab}, + {value: 0x0010, lo: 0xb0, hi: 0xb9}, + // Block 0xd9, offset 0x4a2 + {value: 0x5f53, lo: 0xa0, hi: 0xbf}, + // Block 0xda, offset 0x4a3 + {value: 0x5f52, lo: 0x80, hi: 0x9f}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + {value: 0x0010, lo: 0xbf, hi: 0xbf}, + // Block 0xdb, offset 0x4a6 + {value: 0x0010, lo: 0x80, hi: 0xb8}, + // Block 0xdc, offset 0x4a7 + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x8a, hi: 0xaf}, + {value: 0x0014, lo: 0xb0, hi: 0xb6}, + {value: 0x0014, lo: 0xb8, hi: 0xbd}, + {value: 0x0010, lo: 0xbe, hi: 0xbe}, + {value: 0x0034, lo: 0xbf, hi: 0xbf}, + // Block 0xdd, offset 0x4ad + {value: 0x0010, lo: 0x80, hi: 0x80}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xb2, hi: 0xbf}, + // Block 0xde, offset 0x4b0 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + {value: 0x0014, lo: 0x92, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xa9}, + {value: 0x0014, lo: 0xaa, hi: 0xb0}, + {value: 0x0010, lo: 0xb1, hi: 0xb1}, + {value: 0x0014, lo: 0xb2, hi: 0xb3}, + {value: 0x0010, lo: 0xb4, hi: 0xb4}, + {value: 0x0014, lo: 0xb5, hi: 0xb6}, + // Block 0xdf, offset 0x4b8 + {value: 0x0010, lo: 0x80, hi: 0x99}, + // Block 0xe0, offset 0x4b9 + {value: 0x0010, lo: 0x80, hi: 0xae}, + // Block 0xe1, offset 0x4ba + {value: 0x0010, lo: 0x80, hi: 0x83}, + // Block 0xe2, offset 0x4bb + {value: 0x0010, lo: 0x80, hi: 0x86}, + // Block 0xe3, offset 0x4bc + {value: 0x0010, lo: 0x80, hi: 0x9e}, + {value: 0x0010, lo: 0xa0, hi: 0xa9}, + // Block 0xe4, offset 0x4be + {value: 0x0010, lo: 0x90, hi: 0xad}, + {value: 0x0034, lo: 0xb0, hi: 0xb4}, + // Block 0xe5, offset 0x4c0 + {value: 0x0010, lo: 0x80, hi: 0xaf}, + {value: 0x0024, lo: 0xb0, hi: 0xb6}, + // Block 0xe6, offset 0x4c2 + {value: 0x0014, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0010, lo: 0xa3, hi: 0xb7}, + {value: 0x0010, lo: 0xbd, hi: 0xbf}, + // Block 0xe7, offset 0x4c6 + {value: 0x0010, lo: 0x80, hi: 0x8f}, + // Block 0xe8, offset 0x4c7 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0010, lo: 0x90, hi: 0xbe}, + // Block 0xe9, offset 0x4c9 + {value: 0x0014, lo: 0x8f, hi: 0x9f}, + // Block 0xea, offset 0x4ca + {value: 0x0014, lo: 0xa0, hi: 0xa0}, + // Block 0xeb, offset 0x4cb + {value: 0x0010, lo: 0x80, hi: 0xaa}, + {value: 0x0010, lo: 0xb0, hi: 0xbc}, + // Block 0xec, offset 0x4cd + {value: 0x0010, lo: 0x80, hi: 0x88}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + {value: 0x0014, lo: 0x9d, hi: 0x9d}, + {value: 0x0034, lo: 0x9e, hi: 0x9e}, + {value: 0x0014, lo: 0xa0, hi: 0xa3}, + // Block 0xed, offset 0x4d2 + {value: 0x0030, lo: 0xa5, hi: 0xa6}, + {value: 0x0034, lo: 0xa7, hi: 0xa9}, + {value: 0x0030, lo: 0xad, hi: 0xb2}, + {value: 0x0014, lo: 0xb3, hi: 0xba}, + {value: 0x0034, lo: 0xbb, hi: 0xbf}, + // Block 0xee, offset 0x4d7 + {value: 0x0034, lo: 0x80, hi: 0x82}, + {value: 0x0024, lo: 0x85, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8b}, + {value: 0x0024, lo: 0xaa, hi: 0xad}, + // Block 0xef, offset 0x4db + {value: 0x0024, lo: 0x82, hi: 0x84}, + // Block 0xf0, offset 0x4dc + {value: 0x0013, lo: 0x80, hi: 0x99}, + {value: 0x0012, lo: 0x9a, hi: 0xb3}, + {value: 0x0013, lo: 0xb4, hi: 0xbf}, + // Block 0xf1, offset 0x4df + {value: 0x0013, lo: 0x80, hi: 0x8d}, + {value: 0x0012, lo: 0x8e, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0xa7}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0xf2, offset 0x4e3 + {value: 0x0013, lo: 0x80, hi: 0x81}, + {value: 0x0012, lo: 0x82, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0x9c}, + {value: 0x0013, lo: 0x9e, hi: 0x9f}, + {value: 0x0013, lo: 0xa2, hi: 0xa2}, + {value: 0x0013, lo: 0xa5, hi: 0xa6}, + {value: 0x0013, lo: 0xa9, hi: 0xac}, + {value: 0x0013, lo: 0xae, hi: 0xb5}, + {value: 0x0012, lo: 0xb6, hi: 0xb9}, + {value: 0x0012, lo: 0xbb, hi: 0xbb}, + {value: 0x0012, lo: 0xbd, hi: 0xbf}, + // Block 0xf3, offset 0x4ee + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0012, lo: 0x85, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0xf4, offset 0x4f2 + {value: 0x0012, lo: 0x80, hi: 0x83}, + {value: 0x0013, lo: 0x84, hi: 0x85}, + {value: 0x0013, lo: 0x87, hi: 0x8a}, + {value: 0x0013, lo: 0x8d, hi: 0x94}, + {value: 0x0013, lo: 0x96, hi: 0x9c}, + {value: 0x0012, lo: 0x9e, hi: 0xb7}, + {value: 0x0013, lo: 0xb8, hi: 0xb9}, + {value: 0x0013, lo: 0xbb, hi: 0xbe}, + // Block 0xf5, offset 0x4fa + {value: 0x0013, lo: 0x80, hi: 0x84}, + {value: 0x0013, lo: 0x86, hi: 0x86}, + {value: 0x0013, lo: 0x8a, hi: 0x90}, + {value: 0x0012, lo: 0x92, hi: 0xab}, + {value: 0x0013, lo: 0xac, hi: 0xbf}, + // Block 0xf6, offset 0x4ff + {value: 0x0013, lo: 0x80, hi: 0x85}, + {value: 0x0012, lo: 0x86, hi: 0x9f}, + {value: 0x0013, lo: 0xa0, hi: 0xb9}, + {value: 0x0012, lo: 0xba, hi: 0xbf}, + // Block 0xf7, offset 0x503 + {value: 0x0012, lo: 0x80, hi: 0x93}, + {value: 0x0013, lo: 0x94, hi: 0xad}, + {value: 0x0012, lo: 0xae, hi: 0xbf}, + // Block 0xf8, offset 0x506 + {value: 0x0012, lo: 0x80, hi: 0x87}, + {value: 0x0013, lo: 0x88, hi: 0xa1}, + {value: 0x0012, lo: 0xa2, hi: 0xbb}, + {value: 0x0013, lo: 0xbc, hi: 0xbf}, + // Block 0xf9, offset 0x50a + {value: 0x0013, lo: 0x80, hi: 0x95}, + {value: 0x0012, lo: 0x96, hi: 0xaf}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0xfa, offset 0x50d + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0012, lo: 0x8a, hi: 0xa5}, + {value: 0x0013, lo: 0xa8, hi: 0xbf}, + // Block 0xfb, offset 0x510 + {value: 0x0013, lo: 0x80, hi: 0x80}, + {value: 0x0012, lo: 0x82, hi: 0x9a}, + {value: 0x0012, lo: 0x9c, hi: 0xa1}, + {value: 0x0013, lo: 0xa2, hi: 0xba}, + {value: 0x0012, lo: 0xbc, hi: 0xbf}, + // Block 0xfc, offset 0x515 + {value: 0x0012, lo: 0x80, hi: 0x94}, + {value: 0x0012, lo: 0x96, hi: 0x9b}, + {value: 0x0013, lo: 0x9c, hi: 0xb4}, + {value: 0x0012, lo: 0xb6, hi: 0xbf}, + // Block 0xfd, offset 0x519 + {value: 0x0012, lo: 0x80, hi: 0x8e}, + {value: 0x0012, lo: 0x90, hi: 0x95}, + {value: 0x0013, lo: 0x96, hi: 0xae}, + {value: 0x0012, lo: 0xb0, hi: 0xbf}, + // Block 0xfe, offset 0x51d + {value: 0x0012, lo: 0x80, hi: 0x88}, + {value: 0x0012, lo: 0x8a, hi: 0x8f}, + {value: 0x0013, lo: 0x90, hi: 0xa8}, + {value: 0x0012, lo: 0xaa, hi: 0xbf}, + // Block 0xff, offset 0x521 + {value: 0x0012, lo: 0x80, hi: 0x82}, + {value: 0x0012, lo: 0x84, hi: 0x89}, + {value: 0x0017, lo: 0x8a, hi: 0x8b}, + {value: 0x0010, lo: 0x8e, hi: 0xbf}, + // Block 0x100, offset 0x525 + {value: 0x0014, lo: 0x80, hi: 0xb6}, + {value: 0x0014, lo: 0xbb, hi: 0xbf}, + // Block 0x101, offset 0x527 + {value: 0x0014, lo: 0x80, hi: 0xac}, + {value: 0x0014, lo: 0xb5, hi: 0xb5}, + // Block 0x102, offset 0x529 + {value: 0x0014, lo: 0x84, hi: 0x84}, + {value: 0x0014, lo: 0x9b, hi: 0x9f}, + {value: 0x0014, lo: 0xa1, hi: 0xaf}, + // Block 0x103, offset 0x52c + {value: 0x0024, lo: 0x80, hi: 0x86}, + {value: 0x0024, lo: 0x88, hi: 0x98}, + {value: 0x0024, lo: 0x9b, hi: 0xa1}, + {value: 0x0024, lo: 0xa3, hi: 0xa4}, + {value: 0x0024, lo: 0xa6, hi: 0xaa}, + // Block 0x104, offset 0x531 + {value: 0x0010, lo: 0x80, hi: 0x84}, + {value: 0x0034, lo: 0x90, hi: 0x96}, + // Block 0x105, offset 0x533 + {value: 0xb552, lo: 0x80, hi: 0x81}, + {value: 0xb852, lo: 0x82, hi: 0x83}, + {value: 0x0024, lo: 0x84, hi: 0x89}, + {value: 0x0034, lo: 0x8a, hi: 0x8a}, + {value: 0x0010, lo: 0x90, hi: 0x99}, + // Block 0x106, offset 0x538 + {value: 0x0010, lo: 0x80, hi: 0x83}, + {value: 0x0010, lo: 0x85, hi: 0x9f}, + {value: 0x0010, lo: 0xa1, hi: 0xa2}, + {value: 0x0010, lo: 0xa4, hi: 0xa4}, + {value: 0x0010, lo: 0xa7, hi: 0xa7}, + {value: 0x0010, lo: 0xa9, hi: 0xb2}, + {value: 0x0010, lo: 0xb4, hi: 0xb7}, + {value: 0x0010, lo: 0xb9, hi: 0xb9}, + {value: 0x0010, lo: 0xbb, hi: 0xbb}, + // Block 0x107, offset 0x541 + {value: 0x0010, lo: 0x80, hi: 0x89}, + {value: 0x0010, lo: 0x8b, hi: 0x9b}, + {value: 0x0010, lo: 0xa1, hi: 0xa3}, + {value: 0x0010, lo: 0xa5, hi: 0xa9}, + {value: 0x0010, lo: 0xab, hi: 0xbb}, + // Block 0x108, offset 0x546 + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x109, offset 0x547 + {value: 0x0013, lo: 0x80, hi: 0x89}, + {value: 0x0013, lo: 0x90, hi: 0xa9}, + {value: 0x0013, lo: 0xb0, hi: 0xbf}, + // Block 0x10a, offset 0x54a + {value: 0x0013, lo: 0x80, hi: 0x89}, + // Block 0x10b, offset 0x54b + {value: 0x0004, lo: 0xbb, hi: 0xbf}, + // Block 0x10c, offset 0x54c + {value: 0x0014, lo: 0x81, hi: 0x81}, + {value: 0x0014, lo: 0xa0, hi: 0xbf}, + // Block 0x10d, offset 0x54e + {value: 0x0014, lo: 0x80, hi: 0xbf}, + // Block 0x10e, offset 0x54f + {value: 0x0014, lo: 0x80, hi: 0xaf}, +} + +// Total table size 14027 bytes (13KiB); checksum: F17D40E8 diff --git a/vendor/golang.org/x/text/cases/trieval.go b/vendor/golang.org/x/text/cases/trieval.go new file mode 100644 index 0000000000..4e4d13fe5d --- /dev/null +++ b/vendor/golang.org/x/text/cases/trieval.go @@ -0,0 +1,217 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +package cases + +// This file contains definitions for interpreting the trie value of the case +// trie generated by "go run gen*.go". It is shared by both the generator +// program and the resultant package. Sharing is achieved by the generator +// copying gen_trieval.go to trieval.go and changing what's above this comment. + +// info holds case information for a single rune. It is the value returned +// by a trie lookup. Most mapping information can be stored in a single 16-bit +// value. If not, for example when a rune is mapped to multiple runes, the value +// stores some basic case data and an index into an array with additional data. +// +// The per-rune values have the following format: +// +// if (exception) { +// 15..4 unsigned exception index +// } else { +// 15..8 XOR pattern or index to XOR pattern for case mapping +// Only 13..8 are used for XOR patterns. +// 7 inverseFold (fold to upper, not to lower) +// 6 index: interpret the XOR pattern as an index +// or isMid if case mode is cIgnorableUncased. +// 5..4 CCC: zero (normal or break), above or other +// } +// 3 exception: interpret this value as an exception index +// (TODO: is this bit necessary? Probably implied from case mode.) +// 2..0 case mode +// +// For the non-exceptional cases, a rune must be either uncased, lowercase or +// uppercase. If the rune is cased, the XOR pattern maps either a lowercase +// rune to uppercase or an uppercase rune to lowercase (applied to the 10 +// least-significant bits of the rune). +// +// See the definitions below for a more detailed description of the various +// bits. +type info uint16 + +const ( + casedMask = 0x0003 + fullCasedMask = 0x0007 + ignorableMask = 0x0006 + ignorableValue = 0x0004 + + inverseFoldBit = 1 << 7 + isMidBit = 1 << 6 + + exceptionBit = 1 << 3 + exceptionShift = 4 + numExceptionBits = 12 + + xorIndexBit = 1 << 6 + xorShift = 8 + + // There is no mapping if all xor bits and the exception bit are zero. + hasMappingMask = 0xff80 | exceptionBit +) + +// The case mode bits encodes the case type of a rune. This includes uncased, +// title, upper and lower case and case ignorable. (For a definition of these +// terms see Chapter 3 of The Unicode Standard Core Specification.) In some rare +// cases, a rune can be both cased and case-ignorable. This is encoded by +// cIgnorableCased. A rune of this type is always lower case. Some runes are +// cased while not having a mapping. +// +// A common pattern for scripts in the Unicode standard is for upper and lower +// case runes to alternate for increasing rune values (e.g. the accented Latin +// ranges starting from U+0100 and U+1E00 among others and some Cyrillic +// characters). We use this property by defining a cXORCase mode, where the case +// mode (always upper or lower case) is derived from the rune value. As the XOR +// pattern for case mappings is often identical for successive runes, using +// cXORCase can result in large series of identical trie values. This, in turn, +// allows us to better compress the trie blocks. +const ( + cUncased info = iota // 000 + cTitle // 001 + cLower // 010 + cUpper // 011 + cIgnorableUncased // 100 + cIgnorableCased // 101 // lower case if mappings exist + cXORCase // 11x // case is cLower | ((rune&1) ^ x) + + maxCaseMode = cUpper +) + +func (c info) isCased() bool { + return c&casedMask != 0 +} + +func (c info) isCaseIgnorable() bool { + return c&ignorableMask == ignorableValue +} + +func (c info) isNotCasedAndNotCaseIgnorable() bool { + return c&fullCasedMask == 0 +} + +func (c info) isCaseIgnorableAndNotCased() bool { + return c&fullCasedMask == cIgnorableUncased +} + +func (c info) isMid() bool { + return c&(fullCasedMask|isMidBit) == isMidBit|cIgnorableUncased +} + +// The case mapping implementation will need to know about various Canonical +// Combining Class (CCC) values. We encode two of these in the trie value: +// cccZero (0) and cccAbove (230). If the value is cccOther, it means that +// CCC(r) > 0, but not 230. A value of cccBreak means that CCC(r) == 0 and that +// the rune also has the break category Break (see below). +const ( + cccBreak info = iota << 4 + cccZero + cccAbove + cccOther + + cccMask = cccBreak | cccZero | cccAbove | cccOther +) + +const ( + starter = 0 + above = 230 + iotaSubscript = 240 +) + +// The exceptions slice holds data that does not fit in a normal info entry. +// The entry is pointed to by the exception index in an entry. It has the +// following format: +// +// Header: +// +// byte 0: +// 7..6 unused +// 5..4 CCC type (same bits as entry) +// 3 unused +// 2..0 length of fold +// +// byte 1: +// 7..6 unused +// 5..3 length of 1st mapping of case type +// 2..0 length of 2nd mapping of case type +// +// case 1st 2nd +// lower -> upper, title +// upper -> lower, title +// title -> lower, upper +// +// Lengths with the value 0x7 indicate no value and implies no change. +// A length of 0 indicates a mapping to zero-length string. +// +// Body bytes: +// +// case folding bytes +// lowercase mapping bytes +// uppercase mapping bytes +// titlecase mapping bytes +// closure mapping bytes (for NFKC_Casefold). (TODO) +// +// Fallbacks: +// +// missing fold -> lower +// missing title -> upper +// all missing -> original rune +// +// exceptions starts with a dummy byte to enforce that there is no zero index +// value. +const ( + lengthMask = 0x07 + lengthBits = 3 + noChange = 0 +) + +// References to generated trie. + +var trie = newCaseTrie(0) + +var sparse = sparseBlocks{ + values: sparseValues[:], + offsets: sparseOffsets[:], +} + +// Sparse block lookup code. + +// valueRange is an entry in a sparse block. +type valueRange struct { + value uint16 + lo, hi byte +} + +type sparseBlocks struct { + values []valueRange + offsets []uint16 +} + +// lookup returns the value from values block n for byte b using binary search. +func (s *sparseBlocks) lookup(n uint32, b byte) uint16 { + lo := s.offsets[n] + hi := s.offsets[n+1] + for lo < hi { + m := lo + (hi-lo)/2 + r := s.values[m] + if r.lo <= b && b <= r.hi { + return r.value + } + if b < r.lo { + hi = m + } else { + lo = m + 1 + } + } + return 0 +} + +// lastRuneForTesting is the last rune used for testing. Everything after this +// is boring. +const lastRuneForTesting = rune(0x1FFFF) diff --git a/vendor/golang.org/x/text/internal/internal.go b/vendor/golang.org/x/text/internal/internal.go new file mode 100644 index 0000000000..3cddbbdda8 --- /dev/null +++ b/vendor/golang.org/x/text/internal/internal.go @@ -0,0 +1,49 @@ +// Copyright 2015 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 internal contains non-exported functionality that are used by +// packages in the text repository. +package internal // import "golang.org/x/text/internal" + +import ( + "sort" + + "golang.org/x/text/language" +) + +// SortTags sorts tags in place. +func SortTags(tags []language.Tag) { + sort.Sort(sorter(tags)) +} + +type sorter []language.Tag + +func (s sorter) Len() int { + return len(s) +} + +func (s sorter) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s sorter) Less(i, j int) bool { + return s[i].String() < s[j].String() +} + +// UniqueTags sorts and filters duplicate tags in place and returns a slice with +// only unique tags. +func UniqueTags(tags []language.Tag) []language.Tag { + if len(tags) <= 1 { + return tags + } + SortTags(tags) + k := 0 + for i := 1; i < len(tags); i++ { + if tags[k].String() < tags[i].String() { + k++ + tags[k] = tags[i] + } + } + return tags[:k+1] +} diff --git a/vendor/golang.org/x/text/internal/language/common.go b/vendor/golang.org/x/text/internal/language/common.go new file mode 100644 index 0000000000..cdfdb74971 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/common.go @@ -0,0 +1,16 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +package language + +// This file contains code common to the maketables.go and the package code. + +// AliasType is the type of an alias in AliasMap. +type AliasType int8 + +const ( + Deprecated AliasType = iota + Macro + Legacy + + AliasTypeUnknown AliasType = -1 +) diff --git a/vendor/golang.org/x/text/internal/language/compact.go b/vendor/golang.org/x/text/internal/language/compact.go new file mode 100644 index 0000000000..46a0015074 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/compact.go @@ -0,0 +1,29 @@ +// Copyright 2018 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 language + +// CompactCoreInfo is a compact integer with the three core tags encoded. +type CompactCoreInfo uint32 + +// GetCompactCore generates a uint32 value that is guaranteed to be unique for +// different language, region, and script values. +func GetCompactCore(t Tag) (cci CompactCoreInfo, ok bool) { + if t.LangID > langNoIndexOffset { + return 0, false + } + cci |= CompactCoreInfo(t.LangID) << (8 + 12) + cci |= CompactCoreInfo(t.ScriptID) << 12 + cci |= CompactCoreInfo(t.RegionID) + return cci, true +} + +// Tag generates a tag from c. +func (c CompactCoreInfo) Tag() Tag { + return Tag{ + LangID: Language(c >> 20), + RegionID: Region(c & 0x3ff), + ScriptID: Script(c>>12) & 0xff, + } +} diff --git a/vendor/golang.org/x/text/internal/language/compact/compact.go b/vendor/golang.org/x/text/internal/language/compact/compact.go new file mode 100644 index 0000000000..1b36935ef7 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/compact/compact.go @@ -0,0 +1,61 @@ +// Copyright 2018 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 compact defines a compact representation of language tags. +// +// Common language tags (at least all for which locale information is defined +// in CLDR) are assigned a unique index. Each Tag is associated with such an +// ID for selecting language-related resources (such as translations) as well +// as one for selecting regional defaults (currency, number formatting, etc.) +// +// It may want to export this functionality at some point, but at this point +// this is only available for use within x/text. +package compact // import "golang.org/x/text/internal/language/compact" + +import ( + "sort" + "strings" + + "golang.org/x/text/internal/language" +) + +// ID is an integer identifying a single tag. +type ID uint16 + +func getCoreIndex(t language.Tag) (id ID, ok bool) { + cci, ok := language.GetCompactCore(t) + if !ok { + return 0, false + } + i := sort.Search(len(coreTags), func(i int) bool { + return cci <= coreTags[i] + }) + if i == len(coreTags) || coreTags[i] != cci { + return 0, false + } + return ID(i), true +} + +// Parent returns the ID of the parent or the root ID if id is already the root. +func (id ID) Parent() ID { + return parents[id] +} + +// Tag converts id to an internal language Tag. +func (id ID) Tag() language.Tag { + if int(id) >= len(coreTags) { + return specialTags[int(id)-len(coreTags)] + } + return coreTags[id].Tag() +} + +var specialTags []language.Tag + +func init() { + tags := strings.Split(specialTagsStr, " ") + specialTags = make([]language.Tag, len(tags)) + for i, t := range tags { + specialTags[i] = language.MustParse(t) + } +} diff --git a/vendor/golang.org/x/text/internal/language/compact/language.go b/vendor/golang.org/x/text/internal/language/compact/language.go new file mode 100644 index 0000000000..8c1b6666fb --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/compact/language.go @@ -0,0 +1,260 @@ +// 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. + +//go:generate go run gen.go gen_index.go -output tables.go +//go:generate go run gen_parents.go + +package compact + +// TODO: Remove above NOTE after: +// - verifying that tables are dropped correctly (most notably matcher tables). + +import ( + "strings" + + "golang.org/x/text/internal/language" +) + +// Tag represents a BCP 47 language tag. It is used to specify an instance of a +// specific language or locale. All language tag values are guaranteed to be +// well-formed. +type Tag struct { + // NOTE: exported tags will become part of the public API. + language ID + locale ID + full fullTag // always a language.Tag for now. +} + +const _und = 0 + +type fullTag interface { + IsRoot() bool + Parent() language.Tag +} + +// Make a compact Tag from a fully specified internal language Tag. +func Make(t language.Tag) (tag Tag) { + if region := t.TypeForKey("rg"); len(region) == 6 && region[2:] == "zzzz" { + if r, err := language.ParseRegion(region[:2]); err == nil { + tFull := t + t, _ = t.SetTypeForKey("rg", "") + // TODO: should we not consider "va" for the language tag? + var exact1, exact2 bool + tag.language, exact1 = FromTag(t) + t.RegionID = r + tag.locale, exact2 = FromTag(t) + if !exact1 || !exact2 { + tag.full = tFull + } + return tag + } + } + lang, ok := FromTag(t) + tag.language = lang + tag.locale = lang + if !ok { + tag.full = t + } + return tag +} + +// Tag returns an internal language Tag version of this tag. +func (t Tag) Tag() language.Tag { + if t.full != nil { + return t.full.(language.Tag) + } + tag := t.language.Tag() + if t.language != t.locale { + loc := t.locale.Tag() + tag, _ = tag.SetTypeForKey("rg", strings.ToLower(loc.RegionID.String())+"zzzz") + } + return tag +} + +// IsCompact reports whether this tag is fully defined in terms of ID. +func (t *Tag) IsCompact() bool { + return t.full == nil +} + +// MayHaveVariants reports whether a tag may have variants. If it returns false +// it is guaranteed the tag does not have variants. +func (t Tag) MayHaveVariants() bool { + return t.full != nil || int(t.language) >= len(coreTags) +} + +// MayHaveExtensions reports whether a tag may have extensions. If it returns +// false it is guaranteed the tag does not have them. +func (t Tag) MayHaveExtensions() bool { + return t.full != nil || + int(t.language) >= len(coreTags) || + t.language != t.locale +} + +// IsRoot returns true if t is equal to language "und". +func (t Tag) IsRoot() bool { + if t.full != nil { + return t.full.IsRoot() + } + return t.language == _und +} + +// Parent returns the CLDR parent of t. In CLDR, missing fields in data for a +// specific language are substituted with fields from the parent language. +// The parent for a language may change for newer versions of CLDR. +func (t Tag) Parent() Tag { + if t.full != nil { + return Make(t.full.Parent()) + } + if t.language != t.locale { + // Simulate stripping -u-rg-xxxxxx + return Tag{language: t.language, locale: t.language} + } + // TODO: use parent lookup table once cycle from internal package is + // removed. Probably by internalizing the table and declaring this fast + // enough. + // lang := compactID(internal.Parent(uint16(t.language))) + lang, _ := FromTag(t.language.Tag().Parent()) + return Tag{language: lang, locale: lang} +} + +// nextToken returns token t and the rest of the string. +func nextToken(s string) (t, tail string) { + p := strings.Index(s[1:], "-") + if p == -1 { + return s[1:], "" + } + p++ + return s[1:p], s[p:] +} + +// LanguageID returns an index, where 0 <= index < NumCompactTags, for tags +// for which data exists in the text repository.The index will change over time +// and should not be stored in persistent storage. If t does not match a compact +// index, exact will be false and the compact index will be returned for the +// first match after repeatedly taking the Parent of t. +func LanguageID(t Tag) (id ID, exact bool) { + return t.language, t.full == nil +} + +// RegionalID returns the ID for the regional variant of this tag. This index is +// used to indicate region-specific overrides, such as default currency, default +// calendar and week data, default time cycle, and default measurement system +// and unit preferences. +// +// For instance, the tag en-GB-u-rg-uszzzz specifies British English with US +// settings for currency, number formatting, etc. The CompactIndex for this tag +// will be that for en-GB, while the RegionalID will be the one corresponding to +// en-US. +func RegionalID(t Tag) (id ID, exact bool) { + return t.locale, t.full == nil +} + +// LanguageTag returns t stripped of regional variant indicators. +// +// At the moment this means it is stripped of a regional and variant subtag "rg" +// and "va" in the "u" extension. +func (t Tag) LanguageTag() Tag { + if t.full == nil { + return Tag{language: t.language, locale: t.language} + } + tt := t.Tag() + tt.SetTypeForKey("rg", "") + tt.SetTypeForKey("va", "") + return Make(tt) +} + +// RegionalTag returns the regional variant of the tag. +// +// At the moment this means that the region is set from the regional subtag +// "rg" in the "u" extension. +func (t Tag) RegionalTag() Tag { + rt := Tag{language: t.locale, locale: t.locale} + if t.full == nil { + return rt + } + b := language.Builder{} + tag := t.Tag() + // tag, _ = tag.SetTypeForKey("rg", "") + b.SetTag(t.locale.Tag()) + if v := tag.Variants(); v != "" { + for _, v := range strings.Split(v, "-") { + b.AddVariant(v) + } + } + for _, e := range tag.Extensions() { + b.AddExt(e) + } + return t +} + +// FromTag reports closest matching ID for an internal language Tag. +func FromTag(t language.Tag) (id ID, exact bool) { + // TODO: perhaps give more frequent tags a lower index. + // TODO: we could make the indexes stable. This will excluded some + // possibilities for optimization, so don't do this quite yet. + exact = true + + b, s, r := t.Raw() + if t.HasString() { + if t.IsPrivateUse() { + // We have no entries for user-defined tags. + return 0, false + } + hasExtra := false + if t.HasVariants() { + if t.HasExtensions() { + build := language.Builder{} + build.SetTag(language.Tag{LangID: b, ScriptID: s, RegionID: r}) + build.AddVariant(t.Variants()) + exact = false + t = build.Make() + } + hasExtra = true + } else if _, ok := t.Extension('u'); ok { + // TODO: va may mean something else. Consider not considering it. + // Strip all but the 'va' entry. + old := t + variant := t.TypeForKey("va") + t = language.Tag{LangID: b, ScriptID: s, RegionID: r} + if variant != "" { + t, _ = t.SetTypeForKey("va", variant) + hasExtra = true + } + exact = old == t + } else { + exact = false + } + if hasExtra { + // We have some variants. + for i, s := range specialTags { + if s == t { + return ID(i + len(coreTags)), exact + } + } + exact = false + } + } + if x, ok := getCoreIndex(t); ok { + return x, exact + } + exact = false + if r != 0 && s == 0 { + // Deal with cases where an extra script is inserted for the region. + t, _ := t.Maximize() + if x, ok := getCoreIndex(t); ok { + return x, exact + } + } + for t = t.Parent(); t != root; t = t.Parent() { + // No variants specified: just compare core components. + // The key has the form lllssrrr, where l, s, and r are nibbles for + // respectively the langID, scriptID, and regionID. + if x, ok := getCoreIndex(t); ok { + return x, exact + } + } + return 0, exact +} + +var root = language.Tag{} diff --git a/vendor/golang.org/x/text/internal/language/compact/parents.go b/vendor/golang.org/x/text/internal/language/compact/parents.go new file mode 100644 index 0000000000..8d810723c7 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/compact/parents.go @@ -0,0 +1,120 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +package compact + +// parents maps a compact index of a tag to the compact index of the parent of +// this tag. +var parents = []ID{ // 775 elements + // Entry 0 - 3F + 0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0x0004, 0x0000, 0x0006, + 0x0000, 0x0008, 0x0000, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, + 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, + 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, + 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x0000, + 0x0000, 0x0028, 0x0000, 0x002a, 0x0000, 0x002c, 0x0000, 0x0000, + 0x002f, 0x002e, 0x002e, 0x0000, 0x0033, 0x0000, 0x0035, 0x0000, + 0x0037, 0x0000, 0x0039, 0x0000, 0x003b, 0x0000, 0x0000, 0x003e, + // Entry 40 - 7F + 0x0000, 0x0040, 0x0040, 0x0000, 0x0043, 0x0043, 0x0000, 0x0046, + 0x0000, 0x0048, 0x0000, 0x0000, 0x004b, 0x004a, 0x004a, 0x0000, + 0x004f, 0x004f, 0x004f, 0x004f, 0x0000, 0x0054, 0x0054, 0x0000, + 0x0057, 0x0000, 0x0059, 0x0000, 0x005b, 0x0000, 0x005d, 0x005d, + 0x0000, 0x0060, 0x0000, 0x0062, 0x0000, 0x0064, 0x0000, 0x0066, + 0x0066, 0x0000, 0x0069, 0x0000, 0x006b, 0x006b, 0x006b, 0x006b, + 0x006b, 0x006b, 0x006b, 0x0000, 0x0073, 0x0000, 0x0075, 0x0000, + 0x0077, 0x0000, 0x0000, 0x007a, 0x0000, 0x007c, 0x0000, 0x007e, + // Entry 80 - BF + 0x0000, 0x0080, 0x0080, 0x0000, 0x0083, 0x0083, 0x0000, 0x0086, + 0x0087, 0x0087, 0x0087, 0x0086, 0x0088, 0x0087, 0x0087, 0x0087, + 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0088, + 0x0087, 0x0087, 0x0087, 0x0087, 0x0088, 0x0087, 0x0088, 0x0087, + 0x0087, 0x0088, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, + 0x0087, 0x0087, 0x0087, 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, + 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, + 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0086, 0x0087, 0x0086, + // Entry C0 - FF + 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, + 0x0088, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, + 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0088, 0x0087, + 0x0087, 0x0088, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, + 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0086, 0x0086, 0x0087, + 0x0087, 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0000, + 0x00ef, 0x0000, 0x00f1, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2, + 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f1, 0x00f2, 0x00f1, 0x00f1, + // Entry 100 - 13F + 0x00f2, 0x00f2, 0x00f1, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f1, + 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x0000, 0x010e, + 0x0000, 0x0110, 0x0000, 0x0112, 0x0000, 0x0114, 0x0114, 0x0000, + 0x0117, 0x0117, 0x0117, 0x0117, 0x0000, 0x011c, 0x0000, 0x011e, + 0x0000, 0x0120, 0x0120, 0x0000, 0x0123, 0x0123, 0x0123, 0x0123, + 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, + 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, + 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, + // Entry 140 - 17F + 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, + 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, + 0x0123, 0x0123, 0x0000, 0x0152, 0x0000, 0x0154, 0x0000, 0x0156, + 0x0000, 0x0158, 0x0000, 0x015a, 0x0000, 0x015c, 0x015c, 0x015c, + 0x0000, 0x0160, 0x0000, 0x0000, 0x0163, 0x0000, 0x0165, 0x0000, + 0x0167, 0x0167, 0x0167, 0x0000, 0x016b, 0x0000, 0x016d, 0x0000, + 0x016f, 0x0000, 0x0171, 0x0171, 0x0000, 0x0174, 0x0000, 0x0176, + 0x0000, 0x0178, 0x0000, 0x017a, 0x0000, 0x017c, 0x0000, 0x017e, + // Entry 180 - 1BF + 0x0000, 0x0000, 0x0000, 0x0182, 0x0000, 0x0184, 0x0184, 0x0184, + 0x0184, 0x0000, 0x0000, 0x0000, 0x018b, 0x0000, 0x0000, 0x018e, + 0x0000, 0x0000, 0x0191, 0x0000, 0x0000, 0x0000, 0x0195, 0x0000, + 0x0197, 0x0000, 0x0000, 0x019a, 0x0000, 0x0000, 0x019d, 0x0000, + 0x019f, 0x0000, 0x01a1, 0x0000, 0x01a3, 0x0000, 0x01a5, 0x0000, + 0x01a7, 0x0000, 0x01a9, 0x0000, 0x01ab, 0x0000, 0x01ad, 0x0000, + 0x01af, 0x0000, 0x01b1, 0x01b1, 0x0000, 0x01b4, 0x0000, 0x01b6, + 0x0000, 0x01b8, 0x0000, 0x01ba, 0x0000, 0x01bc, 0x0000, 0x0000, + // Entry 1C0 - 1FF + 0x01bf, 0x0000, 0x01c1, 0x0000, 0x01c3, 0x0000, 0x01c5, 0x0000, + 0x01c7, 0x0000, 0x01c9, 0x0000, 0x01cb, 0x01cb, 0x01cb, 0x01cb, + 0x0000, 0x01d0, 0x0000, 0x01d2, 0x01d2, 0x0000, 0x01d5, 0x0000, + 0x01d7, 0x0000, 0x01d9, 0x0000, 0x01db, 0x0000, 0x01dd, 0x0000, + 0x01df, 0x01df, 0x0000, 0x01e2, 0x0000, 0x01e4, 0x0000, 0x01e6, + 0x0000, 0x01e8, 0x0000, 0x01ea, 0x0000, 0x01ec, 0x0000, 0x01ee, + 0x0000, 0x01f0, 0x0000, 0x0000, 0x01f3, 0x0000, 0x01f5, 0x01f5, + 0x01f5, 0x0000, 0x01f9, 0x0000, 0x01fb, 0x0000, 0x01fd, 0x0000, + // Entry 200 - 23F + 0x01ff, 0x0000, 0x0000, 0x0202, 0x0000, 0x0204, 0x0204, 0x0000, + 0x0207, 0x0000, 0x0209, 0x0209, 0x0000, 0x020c, 0x020c, 0x0000, + 0x020f, 0x020f, 0x020f, 0x020f, 0x020f, 0x020f, 0x020f, 0x0000, + 0x0217, 0x0000, 0x0219, 0x0000, 0x021b, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0221, 0x0000, 0x0000, 0x0224, 0x0000, 0x0226, + 0x0226, 0x0000, 0x0229, 0x0000, 0x022b, 0x022b, 0x0000, 0x0000, + 0x022f, 0x022e, 0x022e, 0x0000, 0x0000, 0x0234, 0x0000, 0x0236, + 0x0000, 0x0238, 0x0000, 0x0244, 0x023a, 0x0244, 0x0244, 0x0244, + // Entry 240 - 27F + 0x0244, 0x0244, 0x0244, 0x0244, 0x023a, 0x0244, 0x0244, 0x0000, + 0x0247, 0x0247, 0x0247, 0x0000, 0x024b, 0x0000, 0x024d, 0x0000, + 0x024f, 0x024f, 0x0000, 0x0252, 0x0000, 0x0254, 0x0254, 0x0254, + 0x0254, 0x0254, 0x0254, 0x0000, 0x025b, 0x0000, 0x025d, 0x0000, + 0x025f, 0x0000, 0x0261, 0x0000, 0x0263, 0x0000, 0x0265, 0x0000, + 0x0000, 0x0268, 0x0268, 0x0268, 0x0000, 0x026c, 0x0000, 0x026e, + 0x0000, 0x0270, 0x0000, 0x0000, 0x0000, 0x0274, 0x0273, 0x0273, + 0x0000, 0x0278, 0x0000, 0x027a, 0x0000, 0x027c, 0x0000, 0x0000, + // Entry 280 - 2BF + 0x0000, 0x0000, 0x0281, 0x0000, 0x0000, 0x0284, 0x0000, 0x0286, + 0x0286, 0x0286, 0x0286, 0x0000, 0x028b, 0x028b, 0x028b, 0x0000, + 0x028f, 0x028f, 0x028f, 0x028f, 0x028f, 0x0000, 0x0295, 0x0295, + 0x0295, 0x0295, 0x0000, 0x0000, 0x0000, 0x0000, 0x029d, 0x029d, + 0x029d, 0x0000, 0x02a1, 0x02a1, 0x02a1, 0x02a1, 0x0000, 0x0000, + 0x02a7, 0x02a7, 0x02a7, 0x02a7, 0x0000, 0x02ac, 0x0000, 0x02ae, + 0x02ae, 0x0000, 0x02b1, 0x0000, 0x02b3, 0x0000, 0x02b5, 0x02b5, + 0x0000, 0x0000, 0x02b9, 0x0000, 0x0000, 0x0000, 0x02bd, 0x0000, + // Entry 2C0 - 2FF + 0x02bf, 0x02bf, 0x0000, 0x0000, 0x02c3, 0x0000, 0x02c5, 0x0000, + 0x02c7, 0x0000, 0x02c9, 0x0000, 0x02cb, 0x0000, 0x02cd, 0x02cd, + 0x0000, 0x0000, 0x02d1, 0x0000, 0x02d3, 0x02d0, 0x02d0, 0x0000, + 0x0000, 0x02d8, 0x02d7, 0x02d7, 0x0000, 0x0000, 0x02dd, 0x0000, + 0x02df, 0x0000, 0x02e1, 0x0000, 0x0000, 0x02e4, 0x0000, 0x02e6, + 0x0000, 0x0000, 0x02e9, 0x0000, 0x02eb, 0x0000, 0x02ed, 0x0000, + 0x02ef, 0x02ef, 0x0000, 0x0000, 0x02f3, 0x02f2, 0x02f2, 0x0000, + 0x02f7, 0x0000, 0x02f9, 0x02f9, 0x02f9, 0x02f9, 0x02f9, 0x0000, + // Entry 300 - 33F + 0x02ff, 0x0300, 0x02ff, 0x0000, 0x0303, 0x0051, 0x00e6, +} // Size: 1574 bytes + +// Total table size 1574 bytes (1KiB); checksum: 895AAF0B diff --git a/vendor/golang.org/x/text/internal/language/compact/tables.go b/vendor/golang.org/x/text/internal/language/compact/tables.go new file mode 100644 index 0000000000..a09ed198a5 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/compact/tables.go @@ -0,0 +1,1015 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +package compact + +import "golang.org/x/text/internal/language" + +// CLDRVersion is the CLDR version from which the tables in this package are derived. +const CLDRVersion = "32" + +// NumCompactTags is the number of common tags. The maximum tag is +// NumCompactTags-1. +const NumCompactTags = 775 +const ( + undIndex ID = 0 + afIndex ID = 1 + afNAIndex ID = 2 + afZAIndex ID = 3 + agqIndex ID = 4 + agqCMIndex ID = 5 + akIndex ID = 6 + akGHIndex ID = 7 + amIndex ID = 8 + amETIndex ID = 9 + arIndex ID = 10 + ar001Index ID = 11 + arAEIndex ID = 12 + arBHIndex ID = 13 + arDJIndex ID = 14 + arDZIndex ID = 15 + arEGIndex ID = 16 + arEHIndex ID = 17 + arERIndex ID = 18 + arILIndex ID = 19 + arIQIndex ID = 20 + arJOIndex ID = 21 + arKMIndex ID = 22 + arKWIndex ID = 23 + arLBIndex ID = 24 + arLYIndex ID = 25 + arMAIndex ID = 26 + arMRIndex ID = 27 + arOMIndex ID = 28 + arPSIndex ID = 29 + arQAIndex ID = 30 + arSAIndex ID = 31 + arSDIndex ID = 32 + arSOIndex ID = 33 + arSSIndex ID = 34 + arSYIndex ID = 35 + arTDIndex ID = 36 + arTNIndex ID = 37 + arYEIndex ID = 38 + arsIndex ID = 39 + asIndex ID = 40 + asINIndex ID = 41 + asaIndex ID = 42 + asaTZIndex ID = 43 + astIndex ID = 44 + astESIndex ID = 45 + azIndex ID = 46 + azCyrlIndex ID = 47 + azCyrlAZIndex ID = 48 + azLatnIndex ID = 49 + azLatnAZIndex ID = 50 + basIndex ID = 51 + basCMIndex ID = 52 + beIndex ID = 53 + beBYIndex ID = 54 + bemIndex ID = 55 + bemZMIndex ID = 56 + bezIndex ID = 57 + bezTZIndex ID = 58 + bgIndex ID = 59 + bgBGIndex ID = 60 + bhIndex ID = 61 + bmIndex ID = 62 + bmMLIndex ID = 63 + bnIndex ID = 64 + bnBDIndex ID = 65 + bnINIndex ID = 66 + boIndex ID = 67 + boCNIndex ID = 68 + boINIndex ID = 69 + brIndex ID = 70 + brFRIndex ID = 71 + brxIndex ID = 72 + brxINIndex ID = 73 + bsIndex ID = 74 + bsCyrlIndex ID = 75 + bsCyrlBAIndex ID = 76 + bsLatnIndex ID = 77 + bsLatnBAIndex ID = 78 + caIndex ID = 79 + caADIndex ID = 80 + caESIndex ID = 81 + caFRIndex ID = 82 + caITIndex ID = 83 + ccpIndex ID = 84 + ccpBDIndex ID = 85 + ccpINIndex ID = 86 + ceIndex ID = 87 + ceRUIndex ID = 88 + cggIndex ID = 89 + cggUGIndex ID = 90 + chrIndex ID = 91 + chrUSIndex ID = 92 + ckbIndex ID = 93 + ckbIQIndex ID = 94 + ckbIRIndex ID = 95 + csIndex ID = 96 + csCZIndex ID = 97 + cuIndex ID = 98 + cuRUIndex ID = 99 + cyIndex ID = 100 + cyGBIndex ID = 101 + daIndex ID = 102 + daDKIndex ID = 103 + daGLIndex ID = 104 + davIndex ID = 105 + davKEIndex ID = 106 + deIndex ID = 107 + deATIndex ID = 108 + deBEIndex ID = 109 + deCHIndex ID = 110 + deDEIndex ID = 111 + deITIndex ID = 112 + deLIIndex ID = 113 + deLUIndex ID = 114 + djeIndex ID = 115 + djeNEIndex ID = 116 + dsbIndex ID = 117 + dsbDEIndex ID = 118 + duaIndex ID = 119 + duaCMIndex ID = 120 + dvIndex ID = 121 + dyoIndex ID = 122 + dyoSNIndex ID = 123 + dzIndex ID = 124 + dzBTIndex ID = 125 + ebuIndex ID = 126 + ebuKEIndex ID = 127 + eeIndex ID = 128 + eeGHIndex ID = 129 + eeTGIndex ID = 130 + elIndex ID = 131 + elCYIndex ID = 132 + elGRIndex ID = 133 + enIndex ID = 134 + en001Index ID = 135 + en150Index ID = 136 + enAGIndex ID = 137 + enAIIndex ID = 138 + enASIndex ID = 139 + enATIndex ID = 140 + enAUIndex ID = 141 + enBBIndex ID = 142 + enBEIndex ID = 143 + enBIIndex ID = 144 + enBMIndex ID = 145 + enBSIndex ID = 146 + enBWIndex ID = 147 + enBZIndex ID = 148 + enCAIndex ID = 149 + enCCIndex ID = 150 + enCHIndex ID = 151 + enCKIndex ID = 152 + enCMIndex ID = 153 + enCXIndex ID = 154 + enCYIndex ID = 155 + enDEIndex ID = 156 + enDGIndex ID = 157 + enDKIndex ID = 158 + enDMIndex ID = 159 + enERIndex ID = 160 + enFIIndex ID = 161 + enFJIndex ID = 162 + enFKIndex ID = 163 + enFMIndex ID = 164 + enGBIndex ID = 165 + enGDIndex ID = 166 + enGGIndex ID = 167 + enGHIndex ID = 168 + enGIIndex ID = 169 + enGMIndex ID = 170 + enGUIndex ID = 171 + enGYIndex ID = 172 + enHKIndex ID = 173 + enIEIndex ID = 174 + enILIndex ID = 175 + enIMIndex ID = 176 + enINIndex ID = 177 + enIOIndex ID = 178 + enJEIndex ID = 179 + enJMIndex ID = 180 + enKEIndex ID = 181 + enKIIndex ID = 182 + enKNIndex ID = 183 + enKYIndex ID = 184 + enLCIndex ID = 185 + enLRIndex ID = 186 + enLSIndex ID = 187 + enMGIndex ID = 188 + enMHIndex ID = 189 + enMOIndex ID = 190 + enMPIndex ID = 191 + enMSIndex ID = 192 + enMTIndex ID = 193 + enMUIndex ID = 194 + enMWIndex ID = 195 + enMYIndex ID = 196 + enNAIndex ID = 197 + enNFIndex ID = 198 + enNGIndex ID = 199 + enNLIndex ID = 200 + enNRIndex ID = 201 + enNUIndex ID = 202 + enNZIndex ID = 203 + enPGIndex ID = 204 + enPHIndex ID = 205 + enPKIndex ID = 206 + enPNIndex ID = 207 + enPRIndex ID = 208 + enPWIndex ID = 209 + enRWIndex ID = 210 + enSBIndex ID = 211 + enSCIndex ID = 212 + enSDIndex ID = 213 + enSEIndex ID = 214 + enSGIndex ID = 215 + enSHIndex ID = 216 + enSIIndex ID = 217 + enSLIndex ID = 218 + enSSIndex ID = 219 + enSXIndex ID = 220 + enSZIndex ID = 221 + enTCIndex ID = 222 + enTKIndex ID = 223 + enTOIndex ID = 224 + enTTIndex ID = 225 + enTVIndex ID = 226 + enTZIndex ID = 227 + enUGIndex ID = 228 + enUMIndex ID = 229 + enUSIndex ID = 230 + enVCIndex ID = 231 + enVGIndex ID = 232 + enVIIndex ID = 233 + enVUIndex ID = 234 + enWSIndex ID = 235 + enZAIndex ID = 236 + enZMIndex ID = 237 + enZWIndex ID = 238 + eoIndex ID = 239 + eo001Index ID = 240 + esIndex ID = 241 + es419Index ID = 242 + esARIndex ID = 243 + esBOIndex ID = 244 + esBRIndex ID = 245 + esBZIndex ID = 246 + esCLIndex ID = 247 + esCOIndex ID = 248 + esCRIndex ID = 249 + esCUIndex ID = 250 + esDOIndex ID = 251 + esEAIndex ID = 252 + esECIndex ID = 253 + esESIndex ID = 254 + esGQIndex ID = 255 + esGTIndex ID = 256 + esHNIndex ID = 257 + esICIndex ID = 258 + esMXIndex ID = 259 + esNIIndex ID = 260 + esPAIndex ID = 261 + esPEIndex ID = 262 + esPHIndex ID = 263 + esPRIndex ID = 264 + esPYIndex ID = 265 + esSVIndex ID = 266 + esUSIndex ID = 267 + esUYIndex ID = 268 + esVEIndex ID = 269 + etIndex ID = 270 + etEEIndex ID = 271 + euIndex ID = 272 + euESIndex ID = 273 + ewoIndex ID = 274 + ewoCMIndex ID = 275 + faIndex ID = 276 + faAFIndex ID = 277 + faIRIndex ID = 278 + ffIndex ID = 279 + ffCMIndex ID = 280 + ffGNIndex ID = 281 + ffMRIndex ID = 282 + ffSNIndex ID = 283 + fiIndex ID = 284 + fiFIIndex ID = 285 + filIndex ID = 286 + filPHIndex ID = 287 + foIndex ID = 288 + foDKIndex ID = 289 + foFOIndex ID = 290 + frIndex ID = 291 + frBEIndex ID = 292 + frBFIndex ID = 293 + frBIIndex ID = 294 + frBJIndex ID = 295 + frBLIndex ID = 296 + frCAIndex ID = 297 + frCDIndex ID = 298 + frCFIndex ID = 299 + frCGIndex ID = 300 + frCHIndex ID = 301 + frCIIndex ID = 302 + frCMIndex ID = 303 + frDJIndex ID = 304 + frDZIndex ID = 305 + frFRIndex ID = 306 + frGAIndex ID = 307 + frGFIndex ID = 308 + frGNIndex ID = 309 + frGPIndex ID = 310 + frGQIndex ID = 311 + frHTIndex ID = 312 + frKMIndex ID = 313 + frLUIndex ID = 314 + frMAIndex ID = 315 + frMCIndex ID = 316 + frMFIndex ID = 317 + frMGIndex ID = 318 + frMLIndex ID = 319 + frMQIndex ID = 320 + frMRIndex ID = 321 + frMUIndex ID = 322 + frNCIndex ID = 323 + frNEIndex ID = 324 + frPFIndex ID = 325 + frPMIndex ID = 326 + frREIndex ID = 327 + frRWIndex ID = 328 + frSCIndex ID = 329 + frSNIndex ID = 330 + frSYIndex ID = 331 + frTDIndex ID = 332 + frTGIndex ID = 333 + frTNIndex ID = 334 + frVUIndex ID = 335 + frWFIndex ID = 336 + frYTIndex ID = 337 + furIndex ID = 338 + furITIndex ID = 339 + fyIndex ID = 340 + fyNLIndex ID = 341 + gaIndex ID = 342 + gaIEIndex ID = 343 + gdIndex ID = 344 + gdGBIndex ID = 345 + glIndex ID = 346 + glESIndex ID = 347 + gswIndex ID = 348 + gswCHIndex ID = 349 + gswFRIndex ID = 350 + gswLIIndex ID = 351 + guIndex ID = 352 + guINIndex ID = 353 + guwIndex ID = 354 + guzIndex ID = 355 + guzKEIndex ID = 356 + gvIndex ID = 357 + gvIMIndex ID = 358 + haIndex ID = 359 + haGHIndex ID = 360 + haNEIndex ID = 361 + haNGIndex ID = 362 + hawIndex ID = 363 + hawUSIndex ID = 364 + heIndex ID = 365 + heILIndex ID = 366 + hiIndex ID = 367 + hiINIndex ID = 368 + hrIndex ID = 369 + hrBAIndex ID = 370 + hrHRIndex ID = 371 + hsbIndex ID = 372 + hsbDEIndex ID = 373 + huIndex ID = 374 + huHUIndex ID = 375 + hyIndex ID = 376 + hyAMIndex ID = 377 + idIndex ID = 378 + idIDIndex ID = 379 + igIndex ID = 380 + igNGIndex ID = 381 + iiIndex ID = 382 + iiCNIndex ID = 383 + inIndex ID = 384 + ioIndex ID = 385 + isIndex ID = 386 + isISIndex ID = 387 + itIndex ID = 388 + itCHIndex ID = 389 + itITIndex ID = 390 + itSMIndex ID = 391 + itVAIndex ID = 392 + iuIndex ID = 393 + iwIndex ID = 394 + jaIndex ID = 395 + jaJPIndex ID = 396 + jboIndex ID = 397 + jgoIndex ID = 398 + jgoCMIndex ID = 399 + jiIndex ID = 400 + jmcIndex ID = 401 + jmcTZIndex ID = 402 + jvIndex ID = 403 + jwIndex ID = 404 + kaIndex ID = 405 + kaGEIndex ID = 406 + kabIndex ID = 407 + kabDZIndex ID = 408 + kajIndex ID = 409 + kamIndex ID = 410 + kamKEIndex ID = 411 + kcgIndex ID = 412 + kdeIndex ID = 413 + kdeTZIndex ID = 414 + keaIndex ID = 415 + keaCVIndex ID = 416 + khqIndex ID = 417 + khqMLIndex ID = 418 + kiIndex ID = 419 + kiKEIndex ID = 420 + kkIndex ID = 421 + kkKZIndex ID = 422 + kkjIndex ID = 423 + kkjCMIndex ID = 424 + klIndex ID = 425 + klGLIndex ID = 426 + klnIndex ID = 427 + klnKEIndex ID = 428 + kmIndex ID = 429 + kmKHIndex ID = 430 + knIndex ID = 431 + knINIndex ID = 432 + koIndex ID = 433 + koKPIndex ID = 434 + koKRIndex ID = 435 + kokIndex ID = 436 + kokINIndex ID = 437 + ksIndex ID = 438 + ksINIndex ID = 439 + ksbIndex ID = 440 + ksbTZIndex ID = 441 + ksfIndex ID = 442 + ksfCMIndex ID = 443 + kshIndex ID = 444 + kshDEIndex ID = 445 + kuIndex ID = 446 + kwIndex ID = 447 + kwGBIndex ID = 448 + kyIndex ID = 449 + kyKGIndex ID = 450 + lagIndex ID = 451 + lagTZIndex ID = 452 + lbIndex ID = 453 + lbLUIndex ID = 454 + lgIndex ID = 455 + lgUGIndex ID = 456 + lktIndex ID = 457 + lktUSIndex ID = 458 + lnIndex ID = 459 + lnAOIndex ID = 460 + lnCDIndex ID = 461 + lnCFIndex ID = 462 + lnCGIndex ID = 463 + loIndex ID = 464 + loLAIndex ID = 465 + lrcIndex ID = 466 + lrcIQIndex ID = 467 + lrcIRIndex ID = 468 + ltIndex ID = 469 + ltLTIndex ID = 470 + luIndex ID = 471 + luCDIndex ID = 472 + luoIndex ID = 473 + luoKEIndex ID = 474 + luyIndex ID = 475 + luyKEIndex ID = 476 + lvIndex ID = 477 + lvLVIndex ID = 478 + masIndex ID = 479 + masKEIndex ID = 480 + masTZIndex ID = 481 + merIndex ID = 482 + merKEIndex ID = 483 + mfeIndex ID = 484 + mfeMUIndex ID = 485 + mgIndex ID = 486 + mgMGIndex ID = 487 + mghIndex ID = 488 + mghMZIndex ID = 489 + mgoIndex ID = 490 + mgoCMIndex ID = 491 + mkIndex ID = 492 + mkMKIndex ID = 493 + mlIndex ID = 494 + mlINIndex ID = 495 + mnIndex ID = 496 + mnMNIndex ID = 497 + moIndex ID = 498 + mrIndex ID = 499 + mrINIndex ID = 500 + msIndex ID = 501 + msBNIndex ID = 502 + msMYIndex ID = 503 + msSGIndex ID = 504 + mtIndex ID = 505 + mtMTIndex ID = 506 + muaIndex ID = 507 + muaCMIndex ID = 508 + myIndex ID = 509 + myMMIndex ID = 510 + mznIndex ID = 511 + mznIRIndex ID = 512 + nahIndex ID = 513 + naqIndex ID = 514 + naqNAIndex ID = 515 + nbIndex ID = 516 + nbNOIndex ID = 517 + nbSJIndex ID = 518 + ndIndex ID = 519 + ndZWIndex ID = 520 + ndsIndex ID = 521 + ndsDEIndex ID = 522 + ndsNLIndex ID = 523 + neIndex ID = 524 + neINIndex ID = 525 + neNPIndex ID = 526 + nlIndex ID = 527 + nlAWIndex ID = 528 + nlBEIndex ID = 529 + nlBQIndex ID = 530 + nlCWIndex ID = 531 + nlNLIndex ID = 532 + nlSRIndex ID = 533 + nlSXIndex ID = 534 + nmgIndex ID = 535 + nmgCMIndex ID = 536 + nnIndex ID = 537 + nnNOIndex ID = 538 + nnhIndex ID = 539 + nnhCMIndex ID = 540 + noIndex ID = 541 + nqoIndex ID = 542 + nrIndex ID = 543 + nsoIndex ID = 544 + nusIndex ID = 545 + nusSSIndex ID = 546 + nyIndex ID = 547 + nynIndex ID = 548 + nynUGIndex ID = 549 + omIndex ID = 550 + omETIndex ID = 551 + omKEIndex ID = 552 + orIndex ID = 553 + orINIndex ID = 554 + osIndex ID = 555 + osGEIndex ID = 556 + osRUIndex ID = 557 + paIndex ID = 558 + paArabIndex ID = 559 + paArabPKIndex ID = 560 + paGuruIndex ID = 561 + paGuruINIndex ID = 562 + papIndex ID = 563 + plIndex ID = 564 + plPLIndex ID = 565 + prgIndex ID = 566 + prg001Index ID = 567 + psIndex ID = 568 + psAFIndex ID = 569 + ptIndex ID = 570 + ptAOIndex ID = 571 + ptBRIndex ID = 572 + ptCHIndex ID = 573 + ptCVIndex ID = 574 + ptGQIndex ID = 575 + ptGWIndex ID = 576 + ptLUIndex ID = 577 + ptMOIndex ID = 578 + ptMZIndex ID = 579 + ptPTIndex ID = 580 + ptSTIndex ID = 581 + ptTLIndex ID = 582 + quIndex ID = 583 + quBOIndex ID = 584 + quECIndex ID = 585 + quPEIndex ID = 586 + rmIndex ID = 587 + rmCHIndex ID = 588 + rnIndex ID = 589 + rnBIIndex ID = 590 + roIndex ID = 591 + roMDIndex ID = 592 + roROIndex ID = 593 + rofIndex ID = 594 + rofTZIndex ID = 595 + ruIndex ID = 596 + ruBYIndex ID = 597 + ruKGIndex ID = 598 + ruKZIndex ID = 599 + ruMDIndex ID = 600 + ruRUIndex ID = 601 + ruUAIndex ID = 602 + rwIndex ID = 603 + rwRWIndex ID = 604 + rwkIndex ID = 605 + rwkTZIndex ID = 606 + sahIndex ID = 607 + sahRUIndex ID = 608 + saqIndex ID = 609 + saqKEIndex ID = 610 + sbpIndex ID = 611 + sbpTZIndex ID = 612 + sdIndex ID = 613 + sdPKIndex ID = 614 + sdhIndex ID = 615 + seIndex ID = 616 + seFIIndex ID = 617 + seNOIndex ID = 618 + seSEIndex ID = 619 + sehIndex ID = 620 + sehMZIndex ID = 621 + sesIndex ID = 622 + sesMLIndex ID = 623 + sgIndex ID = 624 + sgCFIndex ID = 625 + shIndex ID = 626 + shiIndex ID = 627 + shiLatnIndex ID = 628 + shiLatnMAIndex ID = 629 + shiTfngIndex ID = 630 + shiTfngMAIndex ID = 631 + siIndex ID = 632 + siLKIndex ID = 633 + skIndex ID = 634 + skSKIndex ID = 635 + slIndex ID = 636 + slSIIndex ID = 637 + smaIndex ID = 638 + smiIndex ID = 639 + smjIndex ID = 640 + smnIndex ID = 641 + smnFIIndex ID = 642 + smsIndex ID = 643 + snIndex ID = 644 + snZWIndex ID = 645 + soIndex ID = 646 + soDJIndex ID = 647 + soETIndex ID = 648 + soKEIndex ID = 649 + soSOIndex ID = 650 + sqIndex ID = 651 + sqALIndex ID = 652 + sqMKIndex ID = 653 + sqXKIndex ID = 654 + srIndex ID = 655 + srCyrlIndex ID = 656 + srCyrlBAIndex ID = 657 + srCyrlMEIndex ID = 658 + srCyrlRSIndex ID = 659 + srCyrlXKIndex ID = 660 + srLatnIndex ID = 661 + srLatnBAIndex ID = 662 + srLatnMEIndex ID = 663 + srLatnRSIndex ID = 664 + srLatnXKIndex ID = 665 + ssIndex ID = 666 + ssyIndex ID = 667 + stIndex ID = 668 + svIndex ID = 669 + svAXIndex ID = 670 + svFIIndex ID = 671 + svSEIndex ID = 672 + swIndex ID = 673 + swCDIndex ID = 674 + swKEIndex ID = 675 + swTZIndex ID = 676 + swUGIndex ID = 677 + syrIndex ID = 678 + taIndex ID = 679 + taINIndex ID = 680 + taLKIndex ID = 681 + taMYIndex ID = 682 + taSGIndex ID = 683 + teIndex ID = 684 + teINIndex ID = 685 + teoIndex ID = 686 + teoKEIndex ID = 687 + teoUGIndex ID = 688 + tgIndex ID = 689 + tgTJIndex ID = 690 + thIndex ID = 691 + thTHIndex ID = 692 + tiIndex ID = 693 + tiERIndex ID = 694 + tiETIndex ID = 695 + tigIndex ID = 696 + tkIndex ID = 697 + tkTMIndex ID = 698 + tlIndex ID = 699 + tnIndex ID = 700 + toIndex ID = 701 + toTOIndex ID = 702 + trIndex ID = 703 + trCYIndex ID = 704 + trTRIndex ID = 705 + tsIndex ID = 706 + ttIndex ID = 707 + ttRUIndex ID = 708 + twqIndex ID = 709 + twqNEIndex ID = 710 + tzmIndex ID = 711 + tzmMAIndex ID = 712 + ugIndex ID = 713 + ugCNIndex ID = 714 + ukIndex ID = 715 + ukUAIndex ID = 716 + urIndex ID = 717 + urINIndex ID = 718 + urPKIndex ID = 719 + uzIndex ID = 720 + uzArabIndex ID = 721 + uzArabAFIndex ID = 722 + uzCyrlIndex ID = 723 + uzCyrlUZIndex ID = 724 + uzLatnIndex ID = 725 + uzLatnUZIndex ID = 726 + vaiIndex ID = 727 + vaiLatnIndex ID = 728 + vaiLatnLRIndex ID = 729 + vaiVaiiIndex ID = 730 + vaiVaiiLRIndex ID = 731 + veIndex ID = 732 + viIndex ID = 733 + viVNIndex ID = 734 + voIndex ID = 735 + vo001Index ID = 736 + vunIndex ID = 737 + vunTZIndex ID = 738 + waIndex ID = 739 + waeIndex ID = 740 + waeCHIndex ID = 741 + woIndex ID = 742 + woSNIndex ID = 743 + xhIndex ID = 744 + xogIndex ID = 745 + xogUGIndex ID = 746 + yavIndex ID = 747 + yavCMIndex ID = 748 + yiIndex ID = 749 + yi001Index ID = 750 + yoIndex ID = 751 + yoBJIndex ID = 752 + yoNGIndex ID = 753 + yueIndex ID = 754 + yueHansIndex ID = 755 + yueHansCNIndex ID = 756 + yueHantIndex ID = 757 + yueHantHKIndex ID = 758 + zghIndex ID = 759 + zghMAIndex ID = 760 + zhIndex ID = 761 + zhHansIndex ID = 762 + zhHansCNIndex ID = 763 + zhHansHKIndex ID = 764 + zhHansMOIndex ID = 765 + zhHansSGIndex ID = 766 + zhHantIndex ID = 767 + zhHantHKIndex ID = 768 + zhHantMOIndex ID = 769 + zhHantTWIndex ID = 770 + zuIndex ID = 771 + zuZAIndex ID = 772 + caESvalenciaIndex ID = 773 + enUSuvaposixIndex ID = 774 +) + +var coreTags = []language.CompactCoreInfo{ // 773 elements + // Entry 0 - 1F + 0x00000000, 0x01600000, 0x016000d3, 0x01600162, + 0x01c00000, 0x01c00052, 0x02100000, 0x02100081, + 0x02700000, 0x02700070, 0x03a00000, 0x03a00001, + 0x03a00023, 0x03a00039, 0x03a00063, 0x03a00068, + 0x03a0006c, 0x03a0006d, 0x03a0006e, 0x03a00098, + 0x03a0009c, 0x03a000a2, 0x03a000a9, 0x03a000ad, + 0x03a000b1, 0x03a000ba, 0x03a000bb, 0x03a000ca, + 0x03a000e2, 0x03a000ee, 0x03a000f4, 0x03a00109, + // Entry 20 - 3F + 0x03a0010c, 0x03a00116, 0x03a00118, 0x03a0011d, + 0x03a00121, 0x03a00129, 0x03a0015f, 0x04000000, + 0x04300000, 0x0430009a, 0x04400000, 0x04400130, + 0x04800000, 0x0480006f, 0x05800000, 0x05820000, + 0x05820032, 0x0585b000, 0x0585b032, 0x05e00000, + 0x05e00052, 0x07100000, 0x07100047, 0x07500000, + 0x07500163, 0x07900000, 0x07900130, 0x07e00000, + 0x07e00038, 0x08200000, 0x0a000000, 0x0a0000c4, + // Entry 40 - 5F + 0x0a500000, 0x0a500035, 0x0a50009a, 0x0a900000, + 0x0a900053, 0x0a90009a, 0x0b200000, 0x0b200079, + 0x0b500000, 0x0b50009a, 0x0b700000, 0x0b720000, + 0x0b720033, 0x0b75b000, 0x0b75b033, 0x0d700000, + 0x0d700022, 0x0d70006f, 0x0d700079, 0x0d70009f, + 0x0db00000, 0x0db00035, 0x0db0009a, 0x0dc00000, + 0x0dc00107, 0x0df00000, 0x0df00132, 0x0e500000, + 0x0e500136, 0x0e900000, 0x0e90009c, 0x0e90009d, + // Entry 60 - 7F + 0x0fa00000, 0x0fa0005f, 0x0fe00000, 0x0fe00107, + 0x10000000, 0x1000007c, 0x10100000, 0x10100064, + 0x10100083, 0x10800000, 0x108000a5, 0x10d00000, + 0x10d0002e, 0x10d00036, 0x10d0004e, 0x10d00061, + 0x10d0009f, 0x10d000b3, 0x10d000b8, 0x11700000, + 0x117000d5, 0x11f00000, 0x11f00061, 0x12400000, + 0x12400052, 0x12800000, 0x12b00000, 0x12b00115, + 0x12d00000, 0x12d00043, 0x12f00000, 0x12f000a5, + // Entry 80 - 9F + 0x13000000, 0x13000081, 0x13000123, 0x13600000, + 0x1360005e, 0x13600088, 0x13900000, 0x13900001, + 0x1390001a, 0x13900025, 0x13900026, 0x1390002d, + 0x1390002e, 0x1390002f, 0x13900034, 0x13900036, + 0x1390003a, 0x1390003d, 0x13900042, 0x13900046, + 0x13900048, 0x13900049, 0x1390004a, 0x1390004e, + 0x13900050, 0x13900052, 0x1390005d, 0x1390005e, + 0x13900061, 0x13900062, 0x13900064, 0x13900065, + // Entry A0 - BF + 0x1390006e, 0x13900073, 0x13900074, 0x13900075, + 0x13900076, 0x1390007c, 0x1390007d, 0x13900080, + 0x13900081, 0x13900082, 0x13900084, 0x1390008b, + 0x1390008d, 0x1390008e, 0x13900097, 0x13900098, + 0x13900099, 0x1390009a, 0x1390009b, 0x139000a0, + 0x139000a1, 0x139000a5, 0x139000a8, 0x139000aa, + 0x139000ae, 0x139000b2, 0x139000b5, 0x139000b6, + 0x139000c0, 0x139000c1, 0x139000c7, 0x139000c8, + // Entry C0 - DF + 0x139000cb, 0x139000cc, 0x139000cd, 0x139000cf, + 0x139000d1, 0x139000d3, 0x139000d6, 0x139000d7, + 0x139000da, 0x139000de, 0x139000e0, 0x139000e1, + 0x139000e7, 0x139000e8, 0x139000e9, 0x139000ec, + 0x139000ed, 0x139000f1, 0x13900108, 0x1390010a, + 0x1390010b, 0x1390010c, 0x1390010d, 0x1390010e, + 0x1390010f, 0x13900110, 0x13900113, 0x13900118, + 0x1390011c, 0x1390011e, 0x13900120, 0x13900126, + // Entry E0 - FF + 0x1390012a, 0x1390012d, 0x1390012e, 0x13900130, + 0x13900132, 0x13900134, 0x13900136, 0x1390013a, + 0x1390013d, 0x1390013e, 0x13900140, 0x13900143, + 0x13900162, 0x13900163, 0x13900165, 0x13c00000, + 0x13c00001, 0x13e00000, 0x13e0001f, 0x13e0002c, + 0x13e0003f, 0x13e00041, 0x13e00048, 0x13e00051, + 0x13e00054, 0x13e00057, 0x13e0005a, 0x13e00066, + 0x13e00069, 0x13e0006a, 0x13e0006f, 0x13e00087, + // Entry 100 - 11F + 0x13e0008a, 0x13e00090, 0x13e00095, 0x13e000d0, + 0x13e000d9, 0x13e000e3, 0x13e000e5, 0x13e000e8, + 0x13e000ed, 0x13e000f2, 0x13e0011b, 0x13e00136, + 0x13e00137, 0x13e0013c, 0x14000000, 0x1400006b, + 0x14500000, 0x1450006f, 0x14600000, 0x14600052, + 0x14800000, 0x14800024, 0x1480009d, 0x14e00000, + 0x14e00052, 0x14e00085, 0x14e000ca, 0x14e00115, + 0x15100000, 0x15100073, 0x15300000, 0x153000e8, + // Entry 120 - 13F + 0x15800000, 0x15800064, 0x15800077, 0x15e00000, + 0x15e00036, 0x15e00037, 0x15e0003a, 0x15e0003b, + 0x15e0003c, 0x15e00049, 0x15e0004b, 0x15e0004c, + 0x15e0004d, 0x15e0004e, 0x15e0004f, 0x15e00052, + 0x15e00063, 0x15e00068, 0x15e00079, 0x15e0007b, + 0x15e0007f, 0x15e00085, 0x15e00086, 0x15e00087, + 0x15e00092, 0x15e000a9, 0x15e000b8, 0x15e000bb, + 0x15e000bc, 0x15e000bf, 0x15e000c0, 0x15e000c4, + // Entry 140 - 15F + 0x15e000c9, 0x15e000ca, 0x15e000cd, 0x15e000d4, + 0x15e000d5, 0x15e000e6, 0x15e000eb, 0x15e00103, + 0x15e00108, 0x15e0010b, 0x15e00115, 0x15e0011d, + 0x15e00121, 0x15e00123, 0x15e00129, 0x15e00140, + 0x15e00141, 0x15e00160, 0x16900000, 0x1690009f, + 0x16d00000, 0x16d000da, 0x16e00000, 0x16e00097, + 0x17e00000, 0x17e0007c, 0x19000000, 0x1900006f, + 0x1a300000, 0x1a30004e, 0x1a300079, 0x1a3000b3, + // Entry 160 - 17F + 0x1a400000, 0x1a40009a, 0x1a900000, 0x1ab00000, + 0x1ab000a5, 0x1ac00000, 0x1ac00099, 0x1b400000, + 0x1b400081, 0x1b4000d5, 0x1b4000d7, 0x1b800000, + 0x1b800136, 0x1bc00000, 0x1bc00098, 0x1be00000, + 0x1be0009a, 0x1d100000, 0x1d100033, 0x1d100091, + 0x1d200000, 0x1d200061, 0x1d500000, 0x1d500093, + 0x1d700000, 0x1d700028, 0x1e100000, 0x1e100096, + 0x1e700000, 0x1e7000d7, 0x1ea00000, 0x1ea00053, + // Entry 180 - 19F + 0x1f300000, 0x1f500000, 0x1f800000, 0x1f80009e, + 0x1f900000, 0x1f90004e, 0x1f90009f, 0x1f900114, + 0x1f900139, 0x1fa00000, 0x1fb00000, 0x20000000, + 0x200000a3, 0x20300000, 0x20700000, 0x20700052, + 0x20800000, 0x20a00000, 0x20a00130, 0x20e00000, + 0x20f00000, 0x21000000, 0x2100007e, 0x21200000, + 0x21200068, 0x21600000, 0x21700000, 0x217000a5, + 0x21f00000, 0x22300000, 0x22300130, 0x22700000, + // Entry 1A0 - 1BF + 0x2270005b, 0x23400000, 0x234000c4, 0x23900000, + 0x239000a5, 0x24200000, 0x242000af, 0x24400000, + 0x24400052, 0x24500000, 0x24500083, 0x24600000, + 0x246000a5, 0x24a00000, 0x24a000a7, 0x25100000, + 0x2510009a, 0x25400000, 0x254000ab, 0x254000ac, + 0x25600000, 0x2560009a, 0x26a00000, 0x26a0009a, + 0x26b00000, 0x26b00130, 0x26d00000, 0x26d00052, + 0x26e00000, 0x26e00061, 0x27400000, 0x28100000, + // Entry 1C0 - 1DF + 0x2810007c, 0x28a00000, 0x28a000a6, 0x29100000, + 0x29100130, 0x29500000, 0x295000b8, 0x2a300000, + 0x2a300132, 0x2af00000, 0x2af00136, 0x2b500000, + 0x2b50002a, 0x2b50004b, 0x2b50004c, 0x2b50004d, + 0x2b800000, 0x2b8000b0, 0x2bf00000, 0x2bf0009c, + 0x2bf0009d, 0x2c000000, 0x2c0000b7, 0x2c200000, + 0x2c20004b, 0x2c400000, 0x2c4000a5, 0x2c500000, + 0x2c5000a5, 0x2c700000, 0x2c7000b9, 0x2d100000, + // Entry 1E0 - 1FF + 0x2d1000a5, 0x2d100130, 0x2e900000, 0x2e9000a5, + 0x2ed00000, 0x2ed000cd, 0x2f100000, 0x2f1000c0, + 0x2f200000, 0x2f2000d2, 0x2f400000, 0x2f400052, + 0x2ff00000, 0x2ff000c3, 0x30400000, 0x3040009a, + 0x30b00000, 0x30b000c6, 0x31000000, 0x31b00000, + 0x31b0009a, 0x31f00000, 0x31f0003e, 0x31f000d1, + 0x31f0010e, 0x32000000, 0x320000cc, 0x32500000, + 0x32500052, 0x33100000, 0x331000c5, 0x33a00000, + // Entry 200 - 21F + 0x33a0009d, 0x34100000, 0x34500000, 0x345000d3, + 0x34700000, 0x347000db, 0x34700111, 0x34e00000, + 0x34e00165, 0x35000000, 0x35000061, 0x350000da, + 0x35100000, 0x3510009a, 0x351000dc, 0x36700000, + 0x36700030, 0x36700036, 0x36700040, 0x3670005c, + 0x367000da, 0x36700117, 0x3670011c, 0x36800000, + 0x36800052, 0x36a00000, 0x36a000db, 0x36c00000, + 0x36c00052, 0x36f00000, 0x37500000, 0x37600000, + // Entry 220 - 23F + 0x37a00000, 0x38000000, 0x38000118, 0x38700000, + 0x38900000, 0x38900132, 0x39000000, 0x39000070, + 0x390000a5, 0x39500000, 0x3950009a, 0x39800000, + 0x3980007e, 0x39800107, 0x39d00000, 0x39d05000, + 0x39d050e9, 0x39d36000, 0x39d3609a, 0x3a100000, + 0x3b300000, 0x3b3000ea, 0x3bd00000, 0x3bd00001, + 0x3be00000, 0x3be00024, 0x3c000000, 0x3c00002a, + 0x3c000041, 0x3c00004e, 0x3c00005b, 0x3c000087, + // Entry 240 - 25F + 0x3c00008c, 0x3c0000b8, 0x3c0000c7, 0x3c0000d2, + 0x3c0000ef, 0x3c000119, 0x3c000127, 0x3c400000, + 0x3c40003f, 0x3c40006a, 0x3c4000e5, 0x3d400000, + 0x3d40004e, 0x3d900000, 0x3d90003a, 0x3dc00000, + 0x3dc000bd, 0x3dc00105, 0x3de00000, 0x3de00130, + 0x3e200000, 0x3e200047, 0x3e2000a6, 0x3e2000af, + 0x3e2000bd, 0x3e200107, 0x3e200131, 0x3e500000, + 0x3e500108, 0x3e600000, 0x3e600130, 0x3eb00000, + // Entry 260 - 27F + 0x3eb00107, 0x3ec00000, 0x3ec000a5, 0x3f300000, + 0x3f300130, 0x3fa00000, 0x3fa000e9, 0x3fc00000, + 0x3fd00000, 0x3fd00073, 0x3fd000db, 0x3fd0010d, + 0x3ff00000, 0x3ff000d2, 0x40100000, 0x401000c4, + 0x40200000, 0x4020004c, 0x40700000, 0x40800000, + 0x4085b000, 0x4085b0bb, 0x408eb000, 0x408eb0bb, + 0x40c00000, 0x40c000b4, 0x41200000, 0x41200112, + 0x41600000, 0x41600110, 0x41c00000, 0x41d00000, + // Entry 280 - 29F + 0x41e00000, 0x41f00000, 0x41f00073, 0x42200000, + 0x42300000, 0x42300165, 0x42900000, 0x42900063, + 0x42900070, 0x429000a5, 0x42900116, 0x43100000, + 0x43100027, 0x431000c3, 0x4310014e, 0x43200000, + 0x43220000, 0x43220033, 0x432200be, 0x43220106, + 0x4322014e, 0x4325b000, 0x4325b033, 0x4325b0be, + 0x4325b106, 0x4325b14e, 0x43700000, 0x43a00000, + 0x43b00000, 0x44400000, 0x44400031, 0x44400073, + // Entry 2A0 - 2BF + 0x4440010d, 0x44500000, 0x4450004b, 0x445000a5, + 0x44500130, 0x44500132, 0x44e00000, 0x45000000, + 0x4500009a, 0x450000b4, 0x450000d1, 0x4500010e, + 0x46100000, 0x4610009a, 0x46400000, 0x464000a5, + 0x46400132, 0x46700000, 0x46700125, 0x46b00000, + 0x46b00124, 0x46f00000, 0x46f0006e, 0x46f00070, + 0x47100000, 0x47600000, 0x47600128, 0x47a00000, + 0x48000000, 0x48200000, 0x4820012a, 0x48a00000, + // Entry 2C0 - 2DF + 0x48a0005e, 0x48a0012c, 0x48e00000, 0x49400000, + 0x49400107, 0x4a400000, 0x4a4000d5, 0x4a900000, + 0x4a9000bb, 0x4ac00000, 0x4ac00053, 0x4ae00000, + 0x4ae00131, 0x4b400000, 0x4b40009a, 0x4b4000e9, + 0x4bc00000, 0x4bc05000, 0x4bc05024, 0x4bc20000, + 0x4bc20138, 0x4bc5b000, 0x4bc5b138, 0x4be00000, + 0x4be5b000, 0x4be5b0b5, 0x4bef4000, 0x4bef40b5, + 0x4c000000, 0x4c300000, 0x4c30013f, 0x4c900000, + // Entry 2E0 - 2FF + 0x4c900001, 0x4cc00000, 0x4cc00130, 0x4ce00000, + 0x4cf00000, 0x4cf0004e, 0x4e500000, 0x4e500115, + 0x4f200000, 0x4fb00000, 0x4fb00132, 0x50900000, + 0x50900052, 0x51200000, 0x51200001, 0x51800000, + 0x5180003b, 0x518000d7, 0x51f00000, 0x51f3b000, + 0x51f3b053, 0x51f3c000, 0x51f3c08e, 0x52800000, + 0x528000bb, 0x52900000, 0x5293b000, 0x5293b053, + 0x5293b08e, 0x5293b0c7, 0x5293b10e, 0x5293c000, + // Entry 300 - 31F + 0x5293c08e, 0x5293c0c7, 0x5293c12f, 0x52f00000, + 0x52f00162, +} // Size: 3116 bytes + +const specialTagsStr string = "ca-ES-valencia en-US-u-va-posix" + +// Total table size 3147 bytes (3KiB); checksum: 5A8FFFA5 diff --git a/vendor/golang.org/x/text/internal/language/compact/tags.go b/vendor/golang.org/x/text/internal/language/compact/tags.go new file mode 100644 index 0000000000..ca135d295a --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/compact/tags.go @@ -0,0 +1,91 @@ +// 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 compact + +var ( + und = Tag{} + + Und Tag = Tag{} + + Afrikaans Tag = Tag{language: afIndex, locale: afIndex} + Amharic Tag = Tag{language: amIndex, locale: amIndex} + Arabic Tag = Tag{language: arIndex, locale: arIndex} + ModernStandardArabic Tag = Tag{language: ar001Index, locale: ar001Index} + Azerbaijani Tag = Tag{language: azIndex, locale: azIndex} + Bulgarian Tag = Tag{language: bgIndex, locale: bgIndex} + Bengali Tag = Tag{language: bnIndex, locale: bnIndex} + Catalan Tag = Tag{language: caIndex, locale: caIndex} + Czech Tag = Tag{language: csIndex, locale: csIndex} + Danish Tag = Tag{language: daIndex, locale: daIndex} + German Tag = Tag{language: deIndex, locale: deIndex} + Greek Tag = Tag{language: elIndex, locale: elIndex} + English Tag = Tag{language: enIndex, locale: enIndex} + AmericanEnglish Tag = Tag{language: enUSIndex, locale: enUSIndex} + BritishEnglish Tag = Tag{language: enGBIndex, locale: enGBIndex} + Spanish Tag = Tag{language: esIndex, locale: esIndex} + EuropeanSpanish Tag = Tag{language: esESIndex, locale: esESIndex} + LatinAmericanSpanish Tag = Tag{language: es419Index, locale: es419Index} + Estonian Tag = Tag{language: etIndex, locale: etIndex} + Persian Tag = Tag{language: faIndex, locale: faIndex} + Finnish Tag = Tag{language: fiIndex, locale: fiIndex} + Filipino Tag = Tag{language: filIndex, locale: filIndex} + French Tag = Tag{language: frIndex, locale: frIndex} + CanadianFrench Tag = Tag{language: frCAIndex, locale: frCAIndex} + Gujarati Tag = Tag{language: guIndex, locale: guIndex} + Hebrew Tag = Tag{language: heIndex, locale: heIndex} + Hindi Tag = Tag{language: hiIndex, locale: hiIndex} + Croatian Tag = Tag{language: hrIndex, locale: hrIndex} + Hungarian Tag = Tag{language: huIndex, locale: huIndex} + Armenian Tag = Tag{language: hyIndex, locale: hyIndex} + Indonesian Tag = Tag{language: idIndex, locale: idIndex} + Icelandic Tag = Tag{language: isIndex, locale: isIndex} + Italian Tag = Tag{language: itIndex, locale: itIndex} + Japanese Tag = Tag{language: jaIndex, locale: jaIndex} + Georgian Tag = Tag{language: kaIndex, locale: kaIndex} + Kazakh Tag = Tag{language: kkIndex, locale: kkIndex} + Khmer Tag = Tag{language: kmIndex, locale: kmIndex} + Kannada Tag = Tag{language: knIndex, locale: knIndex} + Korean Tag = Tag{language: koIndex, locale: koIndex} + Kirghiz Tag = Tag{language: kyIndex, locale: kyIndex} + Lao Tag = Tag{language: loIndex, locale: loIndex} + Lithuanian Tag = Tag{language: ltIndex, locale: ltIndex} + Latvian Tag = Tag{language: lvIndex, locale: lvIndex} + Macedonian Tag = Tag{language: mkIndex, locale: mkIndex} + Malayalam Tag = Tag{language: mlIndex, locale: mlIndex} + Mongolian Tag = Tag{language: mnIndex, locale: mnIndex} + Marathi Tag = Tag{language: mrIndex, locale: mrIndex} + Malay Tag = Tag{language: msIndex, locale: msIndex} + Burmese Tag = Tag{language: myIndex, locale: myIndex} + Nepali Tag = Tag{language: neIndex, locale: neIndex} + Dutch Tag = Tag{language: nlIndex, locale: nlIndex} + Norwegian Tag = Tag{language: noIndex, locale: noIndex} + Punjabi Tag = Tag{language: paIndex, locale: paIndex} + Polish Tag = Tag{language: plIndex, locale: plIndex} + Portuguese Tag = Tag{language: ptIndex, locale: ptIndex} + BrazilianPortuguese Tag = Tag{language: ptBRIndex, locale: ptBRIndex} + EuropeanPortuguese Tag = Tag{language: ptPTIndex, locale: ptPTIndex} + Romanian Tag = Tag{language: roIndex, locale: roIndex} + Russian Tag = Tag{language: ruIndex, locale: ruIndex} + Sinhala Tag = Tag{language: siIndex, locale: siIndex} + Slovak Tag = Tag{language: skIndex, locale: skIndex} + Slovenian Tag = Tag{language: slIndex, locale: slIndex} + Albanian Tag = Tag{language: sqIndex, locale: sqIndex} + Serbian Tag = Tag{language: srIndex, locale: srIndex} + SerbianLatin Tag = Tag{language: srLatnIndex, locale: srLatnIndex} + Swedish Tag = Tag{language: svIndex, locale: svIndex} + Swahili Tag = Tag{language: swIndex, locale: swIndex} + Tamil Tag = Tag{language: taIndex, locale: taIndex} + Telugu Tag = Tag{language: teIndex, locale: teIndex} + Thai Tag = Tag{language: thIndex, locale: thIndex} + Turkish Tag = Tag{language: trIndex, locale: trIndex} + Ukrainian Tag = Tag{language: ukIndex, locale: ukIndex} + Urdu Tag = Tag{language: urIndex, locale: urIndex} + Uzbek Tag = Tag{language: uzIndex, locale: uzIndex} + Vietnamese Tag = Tag{language: viIndex, locale: viIndex} + Chinese Tag = Tag{language: zhIndex, locale: zhIndex} + SimplifiedChinese Tag = Tag{language: zhHansIndex, locale: zhHansIndex} + TraditionalChinese Tag = Tag{language: zhHantIndex, locale: zhHantIndex} + Zulu Tag = Tag{language: zuIndex, locale: zuIndex} +) diff --git a/vendor/golang.org/x/text/internal/language/compose.go b/vendor/golang.org/x/text/internal/language/compose.go new file mode 100644 index 0000000000..4ae78e0fa5 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/compose.go @@ -0,0 +1,167 @@ +// Copyright 2018 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 language + +import ( + "sort" + "strings" +) + +// A Builder allows constructing a Tag from individual components. +// Its main user is Compose in the top-level language package. +type Builder struct { + Tag Tag + + private string // the x extension + variants []string + extensions []string +} + +// Make returns a new Tag from the current settings. +func (b *Builder) Make() Tag { + t := b.Tag + + if len(b.extensions) > 0 || len(b.variants) > 0 { + sort.Sort(sortVariants(b.variants)) + sort.Strings(b.extensions) + + if b.private != "" { + b.extensions = append(b.extensions, b.private) + } + n := maxCoreSize + tokenLen(b.variants...) + tokenLen(b.extensions...) + buf := make([]byte, n) + p := t.genCoreBytes(buf) + t.pVariant = byte(p) + p += appendTokens(buf[p:], b.variants...) + t.pExt = uint16(p) + p += appendTokens(buf[p:], b.extensions...) + t.str = string(buf[:p]) + // We may not always need to remake the string, but when or when not + // to do so is rather tricky. + scan := makeScanner(buf[:p]) + t, _ = parse(&scan, "") + return t + + } else if b.private != "" { + t.str = b.private + t.RemakeString() + } + return t +} + +// SetTag copies all the settings from a given Tag. Any previously set values +// are discarded. +func (b *Builder) SetTag(t Tag) { + b.Tag.LangID = t.LangID + b.Tag.RegionID = t.RegionID + b.Tag.ScriptID = t.ScriptID + // TODO: optimize + b.variants = b.variants[:0] + if variants := t.Variants(); variants != "" { + for _, vr := range strings.Split(variants[1:], "-") { + b.variants = append(b.variants, vr) + } + } + b.extensions, b.private = b.extensions[:0], "" + for _, e := range t.Extensions() { + b.AddExt(e) + } +} + +// AddExt adds extension e to the tag. e must be a valid extension as returned +// by Tag.Extension. If the extension already exists, it will be discarded, +// except for a -u extension, where non-existing key-type pairs will added. +func (b *Builder) AddExt(e string) { + if e[0] == 'x' { + if b.private == "" { + b.private = e + } + return + } + for i, s := range b.extensions { + if s[0] == e[0] { + if e[0] == 'u' { + b.extensions[i] += e[1:] + } + return + } + } + b.extensions = append(b.extensions, e) +} + +// SetExt sets the extension e to the tag. e must be a valid extension as +// returned by Tag.Extension. If the extension already exists, it will be +// overwritten, except for a -u extension, where the individual key-type pairs +// will be set. +func (b *Builder) SetExt(e string) { + if e[0] == 'x' { + b.private = e + return + } + for i, s := range b.extensions { + if s[0] == e[0] { + if e[0] == 'u' { + b.extensions[i] = e + s[1:] + } else { + b.extensions[i] = e + } + return + } + } + b.extensions = append(b.extensions, e) +} + +// AddVariant adds any number of variants. +func (b *Builder) AddVariant(v ...string) { + for _, v := range v { + if v != "" { + b.variants = append(b.variants, v) + } + } +} + +// ClearVariants removes any variants previously added, including those +// copied from a Tag in SetTag. +func (b *Builder) ClearVariants() { + b.variants = b.variants[:0] +} + +// ClearExtensions removes any extensions previously added, including those +// copied from a Tag in SetTag. +func (b *Builder) ClearExtensions() { + b.private = "" + b.extensions = b.extensions[:0] +} + +func tokenLen(token ...string) (n int) { + for _, t := range token { + n += len(t) + 1 + } + return +} + +func appendTokens(b []byte, token ...string) int { + p := 0 + for _, t := range token { + b[p] = '-' + copy(b[p+1:], t) + p += 1 + len(t) + } + return p +} + +type sortVariants []string + +func (s sortVariants) Len() int { + return len(s) +} + +func (s sortVariants) Swap(i, j int) { + s[j], s[i] = s[i], s[j] +} + +func (s sortVariants) Less(i, j int) bool { + return variantIndex[s[i]] < variantIndex[s[j]] +} diff --git a/vendor/golang.org/x/text/internal/language/coverage.go b/vendor/golang.org/x/text/internal/language/coverage.go new file mode 100644 index 0000000000..9b20b88feb --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/coverage.go @@ -0,0 +1,28 @@ +// Copyright 2014 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 language + +// BaseLanguages returns the list of all supported base languages. It generates +// the list by traversing the internal structures. +func BaseLanguages() []Language { + base := make([]Language, 0, NumLanguages) + for i := 0; i < langNoIndexOffset; i++ { + // We included "und" already for the value 0. + if i != nonCanonicalUnd { + base = append(base, Language(i)) + } + } + i := langNoIndexOffset + for _, v := range langNoIndex { + for k := 0; k < 8; k++ { + if v&1 == 1 { + base = append(base, Language(i)) + } + v >>= 1 + i++ + } + } + return base +} diff --git a/vendor/golang.org/x/text/internal/language/language.go b/vendor/golang.org/x/text/internal/language/language.go new file mode 100644 index 0000000000..09d41c7367 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/language.go @@ -0,0 +1,627 @@ +// 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. + +//go:generate go run gen.go gen_common.go -output tables.go + +package language // import "golang.org/x/text/internal/language" + +// TODO: Remove above NOTE after: +// - verifying that tables are dropped correctly (most notably matcher tables). + +import ( + "errors" + "fmt" + "strings" +) + +const ( + // maxCoreSize is the maximum size of a BCP 47 tag without variants and + // extensions. Equals max lang (3) + script (4) + max reg (3) + 2 dashes. + maxCoreSize = 12 + + // max99thPercentileSize is a somewhat arbitrary buffer size that presumably + // is large enough to hold at least 99% of the BCP 47 tags. + max99thPercentileSize = 32 + + // maxSimpleUExtensionSize is the maximum size of a -u extension with one + // key-type pair. Equals len("-u-") + key (2) + dash + max value (8). + maxSimpleUExtensionSize = 14 +) + +// Tag represents a BCP 47 language tag. It is used to specify an instance of a +// specific language or locale. All language tag values are guaranteed to be +// well-formed. The zero value of Tag is Und. +type Tag struct { + // TODO: the following fields have the form TagTypeID. This name is chosen + // to allow refactoring the public package without conflicting with its + // Base, Script, and Region methods. Once the transition is fully completed + // the ID can be stripped from the name. + + LangID Language + RegionID Region + // TODO: we will soon run out of positions for ScriptID. Idea: instead of + // storing lang, region, and ScriptID codes, store only the compact index and + // have a lookup table from this code to its expansion. This greatly speeds + // up table lookup, speed up common variant cases. + // This will also immediately free up 3 extra bytes. Also, the pVariant + // field can now be moved to the lookup table, as the compact index uniquely + // determines the offset of a possible variant. + ScriptID Script + pVariant byte // offset in str, includes preceding '-' + pExt uint16 // offset of first extension, includes preceding '-' + + // str is the string representation of the Tag. It will only be used if the + // tag has variants or extensions. + str string +} + +// Make is a convenience wrapper for Parse that omits the error. +// In case of an error, a sensible default is returned. +func Make(s string) Tag { + t, _ := Parse(s) + return t +} + +// Raw returns the raw base language, script and region, without making an +// attempt to infer their values. +// TODO: consider removing +func (t Tag) Raw() (b Language, s Script, r Region) { + return t.LangID, t.ScriptID, t.RegionID +} + +// equalTags compares language, script and region subtags only. +func (t Tag) equalTags(a Tag) bool { + return t.LangID == a.LangID && t.ScriptID == a.ScriptID && t.RegionID == a.RegionID +} + +// IsRoot returns true if t is equal to language "und". +func (t Tag) IsRoot() bool { + if int(t.pVariant) < len(t.str) { + return false + } + return t.equalTags(Und) +} + +// IsPrivateUse reports whether the Tag consists solely of an IsPrivateUse use +// tag. +func (t Tag) IsPrivateUse() bool { + return t.str != "" && t.pVariant == 0 +} + +// RemakeString is used to update t.str in case lang, script or region changed. +// It is assumed that pExt and pVariant still point to the start of the +// respective parts. +func (t *Tag) RemakeString() { + if t.str == "" { + return + } + extra := t.str[t.pVariant:] + if t.pVariant > 0 { + extra = extra[1:] + } + if t.equalTags(Und) && strings.HasPrefix(extra, "x-") { + t.str = extra + t.pVariant = 0 + t.pExt = 0 + return + } + var buf [max99thPercentileSize]byte // avoid extra memory allocation in most cases. + b := buf[:t.genCoreBytes(buf[:])] + if extra != "" { + diff := len(b) - int(t.pVariant) + b = append(b, '-') + b = append(b, extra...) + t.pVariant = uint8(int(t.pVariant) + diff) + t.pExt = uint16(int(t.pExt) + diff) + } else { + t.pVariant = uint8(len(b)) + t.pExt = uint16(len(b)) + } + t.str = string(b) +} + +// genCoreBytes writes a string for the base languages, script and region tags +// to the given buffer and returns the number of bytes written. It will never +// write more than maxCoreSize bytes. +func (t *Tag) genCoreBytes(buf []byte) int { + n := t.LangID.StringToBuf(buf[:]) + if t.ScriptID != 0 { + n += copy(buf[n:], "-") + n += copy(buf[n:], t.ScriptID.String()) + } + if t.RegionID != 0 { + n += copy(buf[n:], "-") + n += copy(buf[n:], t.RegionID.String()) + } + return n +} + +// String returns the canonical string representation of the language tag. +func (t Tag) String() string { + if t.str != "" { + return t.str + } + if t.ScriptID == 0 && t.RegionID == 0 { + return t.LangID.String() + } + buf := [maxCoreSize]byte{} + return string(buf[:t.genCoreBytes(buf[:])]) +} + +// MarshalText implements encoding.TextMarshaler. +func (t Tag) MarshalText() (text []byte, err error) { + if t.str != "" { + text = append(text, t.str...) + } else if t.ScriptID == 0 && t.RegionID == 0 { + text = append(text, t.LangID.String()...) + } else { + buf := [maxCoreSize]byte{} + text = buf[:t.genCoreBytes(buf[:])] + } + return text, nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (t *Tag) UnmarshalText(text []byte) error { + tag, err := Parse(string(text)) + *t = tag + return err +} + +// Variants returns the part of the tag holding all variants or the empty string +// if there are no variants defined. +func (t Tag) Variants() string { + if t.pVariant == 0 { + return "" + } + return t.str[t.pVariant:t.pExt] +} + +// VariantOrPrivateUseTags returns variants or private use tags. +func (t Tag) VariantOrPrivateUseTags() string { + if t.pExt > 0 { + return t.str[t.pVariant:t.pExt] + } + return t.str[t.pVariant:] +} + +// HasString reports whether this tag defines more than just the raw +// components. +func (t Tag) HasString() bool { + return t.str != "" +} + +// Parent returns the CLDR parent of t. In CLDR, missing fields in data for a +// specific language are substituted with fields from the parent language. +// The parent for a language may change for newer versions of CLDR. +func (t Tag) Parent() Tag { + if t.str != "" { + // Strip the variants and extensions. + b, s, r := t.Raw() + t = Tag{LangID: b, ScriptID: s, RegionID: r} + if t.RegionID == 0 && t.ScriptID != 0 && t.LangID != 0 { + base, _ := addTags(Tag{LangID: t.LangID}) + if base.ScriptID == t.ScriptID { + return Tag{LangID: t.LangID} + } + } + return t + } + if t.LangID != 0 { + if t.RegionID != 0 { + maxScript := t.ScriptID + if maxScript == 0 { + max, _ := addTags(t) + maxScript = max.ScriptID + } + + for i := range parents { + if Language(parents[i].lang) == t.LangID && Script(parents[i].maxScript) == maxScript { + for _, r := range parents[i].fromRegion { + if Region(r) == t.RegionID { + return Tag{ + LangID: t.LangID, + ScriptID: Script(parents[i].script), + RegionID: Region(parents[i].toRegion), + } + } + } + } + } + + // Strip the script if it is the default one. + base, _ := addTags(Tag{LangID: t.LangID}) + if base.ScriptID != maxScript { + return Tag{LangID: t.LangID, ScriptID: maxScript} + } + return Tag{LangID: t.LangID} + } else if t.ScriptID != 0 { + // The parent for an base-script pair with a non-default script is + // "und" instead of the base language. + base, _ := addTags(Tag{LangID: t.LangID}) + if base.ScriptID != t.ScriptID { + return Und + } + return Tag{LangID: t.LangID} + } + } + return Und +} + +// ParseExtension parses s as an extension and returns it on success. +func ParseExtension(s string) (ext string, err error) { + defer func() { + if recover() != nil { + ext = "" + err = ErrSyntax + } + }() + + scan := makeScannerString(s) + var end int + if n := len(scan.token); n != 1 { + return "", ErrSyntax + } + scan.toLower(0, len(scan.b)) + end = parseExtension(&scan) + if end != len(s) { + return "", ErrSyntax + } + return string(scan.b), nil +} + +// HasVariants reports whether t has variants. +func (t Tag) HasVariants() bool { + return uint16(t.pVariant) < t.pExt +} + +// HasExtensions reports whether t has extensions. +func (t Tag) HasExtensions() bool { + return int(t.pExt) < len(t.str) +} + +// Extension returns the extension of type x for tag t. It will return +// false for ok if t does not have the requested extension. The returned +// extension will be invalid in this case. +func (t Tag) Extension(x byte) (ext string, ok bool) { + for i := int(t.pExt); i < len(t.str)-1; { + var ext string + i, ext = getExtension(t.str, i) + if ext[0] == x { + return ext, true + } + } + return "", false +} + +// Extensions returns all extensions of t. +func (t Tag) Extensions() []string { + e := []string{} + for i := int(t.pExt); i < len(t.str)-1; { + var ext string + i, ext = getExtension(t.str, i) + e = append(e, ext) + } + return e +} + +// TypeForKey returns the type associated with the given key, where key and type +// are of the allowed values defined for the Unicode locale extension ('u') in +// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// TypeForKey will traverse the inheritance chain to get the correct value. +// +// If there are multiple types associated with a key, only the first will be +// returned. If there is no type associated with a key, it returns the empty +// string. +func (t Tag) TypeForKey(key string) string { + if _, start, end, _ := t.findTypeForKey(key); end != start { + s := t.str[start:end] + if p := strings.IndexByte(s, '-'); p >= 0 { + s = s[:p] + } + return s + } + return "" +} + +var ( + errPrivateUse = errors.New("cannot set a key on a private use tag") + errInvalidArguments = errors.New("invalid key or type") +) + +// SetTypeForKey returns a new Tag with the key set to type, where key and type +// are of the allowed values defined for the Unicode locale extension ('u') in +// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// An empty value removes an existing pair with the same key. +func (t Tag) SetTypeForKey(key, value string) (Tag, error) { + if t.IsPrivateUse() { + return t, errPrivateUse + } + if len(key) != 2 { + return t, errInvalidArguments + } + + // Remove the setting if value is "". + if value == "" { + start, sep, end, _ := t.findTypeForKey(key) + if start != sep { + // Remove a possible empty extension. + switch { + case t.str[start-2] != '-': // has previous elements. + case end == len(t.str), // end of string + end+2 < len(t.str) && t.str[end+2] == '-': // end of extension + start -= 2 + } + if start == int(t.pVariant) && end == len(t.str) { + t.str = "" + t.pVariant, t.pExt = 0, 0 + } else { + t.str = fmt.Sprintf("%s%s", t.str[:start], t.str[end:]) + } + } + return t, nil + } + + if len(value) < 3 || len(value) > 8 { + return t, errInvalidArguments + } + + var ( + buf [maxCoreSize + maxSimpleUExtensionSize]byte + uStart int // start of the -u extension. + ) + + // Generate the tag string if needed. + if t.str == "" { + uStart = t.genCoreBytes(buf[:]) + buf[uStart] = '-' + uStart++ + } + + // Create new key-type pair and parse it to verify. + b := buf[uStart:] + copy(b, "u-") + copy(b[2:], key) + b[4] = '-' + b = b[:5+copy(b[5:], value)] + scan := makeScanner(b) + if parseExtensions(&scan); scan.err != nil { + return t, scan.err + } + + // Assemble the replacement string. + if t.str == "" { + t.pVariant, t.pExt = byte(uStart-1), uint16(uStart-1) + t.str = string(buf[:uStart+len(b)]) + } else { + s := t.str + start, sep, end, hasExt := t.findTypeForKey(key) + if start == sep { + if hasExt { + b = b[2:] + } + t.str = fmt.Sprintf("%s-%s%s", s[:sep], b, s[end:]) + } else { + t.str = fmt.Sprintf("%s-%s%s", s[:start+3], value, s[end:]) + } + } + return t, nil +} + +// findTypeForKey returns the start and end position for the type corresponding +// to key or the point at which to insert the key-value pair if the type +// wasn't found. The hasExt return value reports whether an -u extension was present. +// Note: the extensions are typically very small and are likely to contain +// only one key-type pair. +func (t Tag) findTypeForKey(key string) (start, sep, end int, hasExt bool) { + p := int(t.pExt) + if len(key) != 2 || p == len(t.str) || p == 0 { + return p, p, p, false + } + s := t.str + + // Find the correct extension. + for p++; s[p] != 'u'; p++ { + if s[p] > 'u' { + p-- + return p, p, p, false + } + if p = nextExtension(s, p); p == len(s) { + return len(s), len(s), len(s), false + } + } + // Proceed to the hyphen following the extension name. + p++ + + // curKey is the key currently being processed. + curKey := "" + + // Iterate over keys until we get the end of a section. + for { + end = p + for p++; p < len(s) && s[p] != '-'; p++ { + } + n := p - end - 1 + if n <= 2 && curKey == key { + if sep < end { + sep++ + } + return start, sep, end, true + } + switch n { + case 0, // invalid string + 1: // next extension + return end, end, end, true + case 2: + // next key + curKey = s[end+1 : p] + if curKey > key { + return end, end, end, true + } + start = end + sep = p + } + } +} + +// ParseBase parses a 2- or 3-letter ISO 639 code. +// It returns a ValueError if s is a well-formed but unknown language identifier +// or another error if another error occurred. +func ParseBase(s string) (l Language, err error) { + defer func() { + if recover() != nil { + l = 0 + err = ErrSyntax + } + }() + + if n := len(s); n < 2 || 3 < n { + return 0, ErrSyntax + } + var buf [3]byte + return getLangID(buf[:copy(buf[:], s)]) +} + +// ParseScript parses a 4-letter ISO 15924 code. +// It returns a ValueError if s is a well-formed but unknown script identifier +// or another error if another error occurred. +func ParseScript(s string) (scr Script, err error) { + defer func() { + if recover() != nil { + scr = 0 + err = ErrSyntax + } + }() + + if len(s) != 4 { + return 0, ErrSyntax + } + var buf [4]byte + return getScriptID(script, buf[:copy(buf[:], s)]) +} + +// EncodeM49 returns the Region for the given UN M.49 code. +// It returns an error if r is not a valid code. +func EncodeM49(r int) (Region, error) { + return getRegionM49(r) +} + +// ParseRegion parses a 2- or 3-letter ISO 3166-1 or a UN M.49 code. +// It returns a ValueError if s is a well-formed but unknown region identifier +// or another error if another error occurred. +func ParseRegion(s string) (r Region, err error) { + defer func() { + if recover() != nil { + r = 0 + err = ErrSyntax + } + }() + + if n := len(s); n < 2 || 3 < n { + return 0, ErrSyntax + } + var buf [3]byte + return getRegionID(buf[:copy(buf[:], s)]) +} + +// IsCountry returns whether this region is a country or autonomous area. This +// includes non-standard definitions from CLDR. +func (r Region) IsCountry() bool { + if r == 0 || r.IsGroup() || r.IsPrivateUse() && r != _XK { + return false + } + return true +} + +// IsGroup returns whether this region defines a collection of regions. This +// includes non-standard definitions from CLDR. +func (r Region) IsGroup() bool { + if r == 0 { + return false + } + return int(regionInclusion[r]) < len(regionContainment) +} + +// Contains returns whether Region c is contained by Region r. It returns true +// if c == r. +func (r Region) Contains(c Region) bool { + if r == c { + return true + } + g := regionInclusion[r] + if g >= nRegionGroups { + return false + } + m := regionContainment[g] + + d := regionInclusion[c] + b := regionInclusionBits[d] + + // A contained country may belong to multiple disjoint groups. Matching any + // of these indicates containment. If the contained region is a group, it + // must strictly be a subset. + if d >= nRegionGroups { + return b&m != 0 + } + return b&^m == 0 +} + +var errNoTLD = errors.New("language: region is not a valid ccTLD") + +// TLD returns the country code top-level domain (ccTLD). UK is returned for GB. +// In all other cases it returns either the region itself or an error. +// +// This method may return an error for a region for which there exists a +// canonical form with a ccTLD. To get that ccTLD canonicalize r first. The +// region will already be canonicalized it was obtained from a Tag that was +// obtained using any of the default methods. +func (r Region) TLD() (Region, error) { + // See http://en.wikipedia.org/wiki/Country_code_top-level_domain for the + // difference between ISO 3166-1 and IANA ccTLD. + if r == _GB { + r = _UK + } + if (r.typ() & ccTLD) == 0 { + return 0, errNoTLD + } + return r, nil +} + +// Canonicalize returns the region or a possible replacement if the region is +// deprecated. It will not return a replacement for deprecated regions that +// are split into multiple regions. +func (r Region) Canonicalize() Region { + if cr := normRegion(r); cr != 0 { + return cr + } + return r +} + +// Variant represents a registered variant of a language as defined by BCP 47. +type Variant struct { + ID uint8 + str string +} + +// ParseVariant parses and returns a Variant. An error is returned if s is not +// a valid variant. +func ParseVariant(s string) (v Variant, err error) { + defer func() { + if recover() != nil { + v = Variant{} + err = ErrSyntax + } + }() + + s = strings.ToLower(s) + if id, ok := variantIndex[s]; ok { + return Variant{id, s}, nil + } + return Variant{}, NewValueError([]byte(s)) +} + +// String returns the string representation of the variant. +func (v Variant) String() string { + return v.str +} diff --git a/vendor/golang.org/x/text/internal/language/lookup.go b/vendor/golang.org/x/text/internal/language/lookup.go new file mode 100644 index 0000000000..231b4fbdeb --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/lookup.go @@ -0,0 +1,412 @@ +// 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 language + +import ( + "bytes" + "fmt" + "sort" + "strconv" + + "golang.org/x/text/internal/tag" +) + +// findIndex tries to find the given tag in idx and returns a standardized error +// if it could not be found. +func findIndex(idx tag.Index, key []byte, form string) (index int, err error) { + if !tag.FixCase(form, key) { + return 0, ErrSyntax + } + i := idx.Index(key) + if i == -1 { + return 0, NewValueError(key) + } + return i, nil +} + +func searchUint(imap []uint16, key uint16) int { + return sort.Search(len(imap), func(i int) bool { + return imap[i] >= key + }) +} + +type Language uint16 + +// getLangID returns the langID of s if s is a canonical subtag +// or langUnknown if s is not a canonical subtag. +func getLangID(s []byte) (Language, error) { + if len(s) == 2 { + return getLangISO2(s) + } + return getLangISO3(s) +} + +// TODO language normalization as well as the AliasMaps could be moved to the +// higher level package, but it is a bit tricky to separate the generation. + +func (id Language) Canonicalize() (Language, AliasType) { + return normLang(id) +} + +// normLang returns the mapped langID of id according to mapping m. +func normLang(id Language) (Language, AliasType) { + k := sort.Search(len(AliasMap), func(i int) bool { + return AliasMap[i].From >= uint16(id) + }) + if k < len(AliasMap) && AliasMap[k].From == uint16(id) { + return Language(AliasMap[k].To), AliasTypes[k] + } + return id, AliasTypeUnknown +} + +// getLangISO2 returns the langID for the given 2-letter ISO language code +// or unknownLang if this does not exist. +func getLangISO2(s []byte) (Language, error) { + if !tag.FixCase("zz", s) { + return 0, ErrSyntax + } + if i := lang.Index(s); i != -1 && lang.Elem(i)[3] != 0 { + return Language(i), nil + } + return 0, NewValueError(s) +} + +const base = 'z' - 'a' + 1 + +func strToInt(s []byte) uint { + v := uint(0) + for i := 0; i < len(s); i++ { + v *= base + v += uint(s[i] - 'a') + } + return v +} + +// converts the given integer to the original ASCII string passed to strToInt. +// len(s) must match the number of characters obtained. +func intToStr(v uint, s []byte) { + for i := len(s) - 1; i >= 0; i-- { + s[i] = byte(v%base) + 'a' + v /= base + } +} + +// getLangISO3 returns the langID for the given 3-letter ISO language code +// or unknownLang if this does not exist. +func getLangISO3(s []byte) (Language, error) { + if tag.FixCase("und", s) { + // first try to match canonical 3-letter entries + for i := lang.Index(s[:2]); i != -1; i = lang.Next(s[:2], i) { + if e := lang.Elem(i); e[3] == 0 && e[2] == s[2] { + // We treat "und" as special and always translate it to "unspecified". + // Note that ZZ and Zzzz are private use and are not treated as + // unspecified by default. + id := Language(i) + if id == nonCanonicalUnd { + return 0, nil + } + return id, nil + } + } + if i := altLangISO3.Index(s); i != -1 { + return Language(altLangIndex[altLangISO3.Elem(i)[3]]), nil + } + n := strToInt(s) + if langNoIndex[n/8]&(1<<(n%8)) != 0 { + return Language(n) + langNoIndexOffset, nil + } + // Check for non-canonical uses of ISO3. + for i := lang.Index(s[:1]); i != -1; i = lang.Next(s[:1], i) { + if e := lang.Elem(i); e[2] == s[1] && e[3] == s[2] { + return Language(i), nil + } + } + return 0, NewValueError(s) + } + return 0, ErrSyntax +} + +// StringToBuf writes the string to b and returns the number of bytes +// written. cap(b) must be >= 3. +func (id Language) StringToBuf(b []byte) int { + if id >= langNoIndexOffset { + intToStr(uint(id)-langNoIndexOffset, b[:3]) + return 3 + } else if id == 0 { + return copy(b, "und") + } + l := lang[id<<2:] + if l[3] == 0 { + return copy(b, l[:3]) + } + return copy(b, l[:2]) +} + +// String returns the BCP 47 representation of the langID. +// Use b as variable name, instead of id, to ensure the variable +// used is consistent with that of Base in which this type is embedded. +func (b Language) String() string { + if b == 0 { + return "und" + } else if b >= langNoIndexOffset { + b -= langNoIndexOffset + buf := [3]byte{} + intToStr(uint(b), buf[:]) + return string(buf[:]) + } + l := lang.Elem(int(b)) + if l[3] == 0 { + return l[:3] + } + return l[:2] +} + +// ISO3 returns the ISO 639-3 language code. +func (b Language) ISO3() string { + if b == 0 || b >= langNoIndexOffset { + return b.String() + } + l := lang.Elem(int(b)) + if l[3] == 0 { + return l[:3] + } else if l[2] == 0 { + return altLangISO3.Elem(int(l[3]))[:3] + } + // This allocation will only happen for 3-letter ISO codes + // that are non-canonical BCP 47 language identifiers. + return l[0:1] + l[2:4] +} + +// IsPrivateUse reports whether this language code is reserved for private use. +func (b Language) IsPrivateUse() bool { + return langPrivateStart <= b && b <= langPrivateEnd +} + +// SuppressScript returns the script marked as SuppressScript in the IANA +// language tag repository, or 0 if there is no such script. +func (b Language) SuppressScript() Script { + if b < langNoIndexOffset { + return Script(suppressScript[b]) + } + return 0 +} + +type Region uint16 + +// getRegionID returns the region id for s if s is a valid 2-letter region code +// or unknownRegion. +func getRegionID(s []byte) (Region, error) { + if len(s) == 3 { + if isAlpha(s[0]) { + return getRegionISO3(s) + } + if i, err := strconv.ParseUint(string(s), 10, 10); err == nil { + return getRegionM49(int(i)) + } + } + return getRegionISO2(s) +} + +// getRegionISO2 returns the regionID for the given 2-letter ISO country code +// or unknownRegion if this does not exist. +func getRegionISO2(s []byte) (Region, error) { + i, err := findIndex(regionISO, s, "ZZ") + if err != nil { + return 0, err + } + return Region(i) + isoRegionOffset, nil +} + +// getRegionISO3 returns the regionID for the given 3-letter ISO country code +// or unknownRegion if this does not exist. +func getRegionISO3(s []byte) (Region, error) { + if tag.FixCase("ZZZ", s) { + for i := regionISO.Index(s[:1]); i != -1; i = regionISO.Next(s[:1], i) { + if e := regionISO.Elem(i); e[2] == s[1] && e[3] == s[2] { + return Region(i) + isoRegionOffset, nil + } + } + for i := 0; i < len(altRegionISO3); i += 3 { + if tag.Compare(altRegionISO3[i:i+3], s) == 0 { + return Region(altRegionIDs[i/3]), nil + } + } + return 0, NewValueError(s) + } + return 0, ErrSyntax +} + +func getRegionM49(n int) (Region, error) { + if 0 < n && n <= 999 { + const ( + searchBits = 7 + regionBits = 9 + regionMask = 1<> searchBits + buf := fromM49[m49Index[idx]:m49Index[idx+1]] + val := uint16(n) << regionBits // we rely on bits shifting out + i := sort.Search(len(buf), func(i int) bool { + return buf[i] >= val + }) + if r := fromM49[int(m49Index[idx])+i]; r&^regionMask == val { + return Region(r & regionMask), nil + } + } + var e ValueError + fmt.Fprint(bytes.NewBuffer([]byte(e.v[:])), n) + return 0, e +} + +// normRegion returns a region if r is deprecated or 0 otherwise. +// TODO: consider supporting BYS (-> BLR), CSK (-> 200 or CZ), PHI (-> PHL) and AFI (-> DJ). +// TODO: consider mapping split up regions to new most populous one (like CLDR). +func normRegion(r Region) Region { + m := regionOldMap + k := sort.Search(len(m), func(i int) bool { + return m[i].From >= uint16(r) + }) + if k < len(m) && m[k].From == uint16(r) { + return Region(m[k].To) + } + return 0 +} + +const ( + iso3166UserAssigned = 1 << iota + ccTLD + bcp47Region +) + +func (r Region) typ() byte { + return regionTypes[r] +} + +// String returns the BCP 47 representation for the region. +// It returns "ZZ" for an unspecified region. +func (r Region) String() string { + if r < isoRegionOffset { + if r == 0 { + return "ZZ" + } + return fmt.Sprintf("%03d", r.M49()) + } + r -= isoRegionOffset + return regionISO.Elem(int(r))[:2] +} + +// ISO3 returns the 3-letter ISO code of r. +// Note that not all regions have a 3-letter ISO code. +// In such cases this method returns "ZZZ". +func (r Region) ISO3() string { + if r < isoRegionOffset { + return "ZZZ" + } + r -= isoRegionOffset + reg := regionISO.Elem(int(r)) + switch reg[2] { + case 0: + return altRegionISO3[reg[3]:][:3] + case ' ': + return "ZZZ" + } + return reg[0:1] + reg[2:4] +} + +// M49 returns the UN M.49 encoding of r, or 0 if this encoding +// is not defined for r. +func (r Region) M49() int { + return int(m49[r]) +} + +// IsPrivateUse reports whether r has the ISO 3166 User-assigned status. This +// may include private-use tags that are assigned by CLDR and used in this +// implementation. So IsPrivateUse and IsCountry can be simultaneously true. +func (r Region) IsPrivateUse() bool { + return r.typ()&iso3166UserAssigned != 0 +} + +type Script uint16 + +// getScriptID returns the script id for string s. It assumes that s +// is of the format [A-Z][a-z]{3}. +func getScriptID(idx tag.Index, s []byte) (Script, error) { + i, err := findIndex(idx, s, "Zzzz") + return Script(i), err +} + +// String returns the script code in title case. +// It returns "Zzzz" for an unspecified script. +func (s Script) String() string { + if s == 0 { + return "Zzzz" + } + return script.Elem(int(s)) +} + +// IsPrivateUse reports whether this script code is reserved for private use. +func (s Script) IsPrivateUse() bool { + return _Qaaa <= s && s <= _Qabx +} + +const ( + maxAltTaglen = len("en-US-POSIX") + maxLen = maxAltTaglen +) + +var ( + // grandfatheredMap holds a mapping from legacy and grandfathered tags to + // their base language or index to more elaborate tag. + grandfatheredMap = map[[maxLen]byte]int16{ + [maxLen]byte{'a', 'r', 't', '-', 'l', 'o', 'j', 'b', 'a', 'n'}: _jbo, // art-lojban + [maxLen]byte{'i', '-', 'a', 'm', 'i'}: _ami, // i-ami + [maxLen]byte{'i', '-', 'b', 'n', 'n'}: _bnn, // i-bnn + [maxLen]byte{'i', '-', 'h', 'a', 'k'}: _hak, // i-hak + [maxLen]byte{'i', '-', 'k', 'l', 'i', 'n', 'g', 'o', 'n'}: _tlh, // i-klingon + [maxLen]byte{'i', '-', 'l', 'u', 'x'}: _lb, // i-lux + [maxLen]byte{'i', '-', 'n', 'a', 'v', 'a', 'j', 'o'}: _nv, // i-navajo + [maxLen]byte{'i', '-', 'p', 'w', 'n'}: _pwn, // i-pwn + [maxLen]byte{'i', '-', 't', 'a', 'o'}: _tao, // i-tao + [maxLen]byte{'i', '-', 't', 'a', 'y'}: _tay, // i-tay + [maxLen]byte{'i', '-', 't', 's', 'u'}: _tsu, // i-tsu + [maxLen]byte{'n', 'o', '-', 'b', 'o', 'k'}: _nb, // no-bok + [maxLen]byte{'n', 'o', '-', 'n', 'y', 'n'}: _nn, // no-nyn + [maxLen]byte{'s', 'g', 'n', '-', 'b', 'e', '-', 'f', 'r'}: _sfb, // sgn-BE-FR + [maxLen]byte{'s', 'g', 'n', '-', 'b', 'e', '-', 'n', 'l'}: _vgt, // sgn-BE-NL + [maxLen]byte{'s', 'g', 'n', '-', 'c', 'h', '-', 'd', 'e'}: _sgg, // sgn-CH-DE + [maxLen]byte{'z', 'h', '-', 'g', 'u', 'o', 'y', 'u'}: _cmn, // zh-guoyu + [maxLen]byte{'z', 'h', '-', 'h', 'a', 'k', 'k', 'a'}: _hak, // zh-hakka + [maxLen]byte{'z', 'h', '-', 'm', 'i', 'n', '-', 'n', 'a', 'n'}: _nan, // zh-min-nan + [maxLen]byte{'z', 'h', '-', 'x', 'i', 'a', 'n', 'g'}: _hsn, // zh-xiang + + // Grandfathered tags with no modern replacement will be converted as + // follows: + [maxLen]byte{'c', 'e', 'l', '-', 'g', 'a', 'u', 'l', 'i', 's', 'h'}: -1, // cel-gaulish + [maxLen]byte{'e', 'n', '-', 'g', 'b', '-', 'o', 'e', 'd'}: -2, // en-GB-oed + [maxLen]byte{'i', '-', 'd', 'e', 'f', 'a', 'u', 'l', 't'}: -3, // i-default + [maxLen]byte{'i', '-', 'e', 'n', 'o', 'c', 'h', 'i', 'a', 'n'}: -4, // i-enochian + [maxLen]byte{'i', '-', 'm', 'i', 'n', 'g', 'o'}: -5, // i-mingo + [maxLen]byte{'z', 'h', '-', 'm', 'i', 'n'}: -6, // zh-min + + // CLDR-specific tag. + [maxLen]byte{'r', 'o', 'o', 't'}: 0, // root + [maxLen]byte{'e', 'n', '-', 'u', 's', '-', 'p', 'o', 's', 'i', 'x'}: -7, // en_US_POSIX" + } + + altTagIndex = [...]uint8{0, 17, 31, 45, 61, 74, 86, 102} + + altTags = "xtg-x-cel-gaulishen-GB-oxendicten-x-i-defaultund-x-i-enochiansee-x-i-mingonan-x-zh-minen-US-u-va-posix" +) + +func grandfathered(s [maxAltTaglen]byte) (t Tag, ok bool) { + if v, ok := grandfatheredMap[s]; ok { + if v < 0 { + return Make(altTags[altTagIndex[-v-1]:altTagIndex[-v]]), true + } + t.LangID = Language(v) + return t, true + } + return t, false +} diff --git a/vendor/golang.org/x/text/internal/language/match.go b/vendor/golang.org/x/text/internal/language/match.go new file mode 100644 index 0000000000..75a2dbca76 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/match.go @@ -0,0 +1,226 @@ +// 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 language + +import "errors" + +type scriptRegionFlags uint8 + +const ( + isList = 1 << iota + scriptInFrom + regionInFrom +) + +func (t *Tag) setUndefinedLang(id Language) { + if t.LangID == 0 { + t.LangID = id + } +} + +func (t *Tag) setUndefinedScript(id Script) { + if t.ScriptID == 0 { + t.ScriptID = id + } +} + +func (t *Tag) setUndefinedRegion(id Region) { + if t.RegionID == 0 || t.RegionID.Contains(id) { + t.RegionID = id + } +} + +// ErrMissingLikelyTagsData indicates no information was available +// to compute likely values of missing tags. +var ErrMissingLikelyTagsData = errors.New("missing likely tags data") + +// addLikelySubtags sets subtags to their most likely value, given the locale. +// In most cases this means setting fields for unknown values, but in some +// cases it may alter a value. It returns an ErrMissingLikelyTagsData error +// if the given locale cannot be expanded. +func (t Tag) addLikelySubtags() (Tag, error) { + id, err := addTags(t) + if err != nil { + return t, err + } else if id.equalTags(t) { + return t, nil + } + id.RemakeString() + return id, nil +} + +// specializeRegion attempts to specialize a group region. +func specializeRegion(t *Tag) bool { + if i := regionInclusion[t.RegionID]; i < nRegionGroups { + x := likelyRegionGroup[i] + if Language(x.lang) == t.LangID && Script(x.script) == t.ScriptID { + t.RegionID = Region(x.region) + } + return true + } + return false +} + +// Maximize returns a new tag with missing tags filled in. +func (t Tag) Maximize() (Tag, error) { + return addTags(t) +} + +func addTags(t Tag) (Tag, error) { + // We leave private use identifiers alone. + if t.IsPrivateUse() { + return t, nil + } + if t.ScriptID != 0 && t.RegionID != 0 { + if t.LangID != 0 { + // already fully specified + specializeRegion(&t) + return t, nil + } + // Search matches for und-script-region. Note that for these cases + // region will never be a group so there is no need to check for this. + list := likelyRegion[t.RegionID : t.RegionID+1] + if x := list[0]; x.flags&isList != 0 { + list = likelyRegionList[x.lang : x.lang+uint16(x.script)] + } + for _, x := range list { + // Deviating from the spec. See match_test.go for details. + if Script(x.script) == t.ScriptID { + t.setUndefinedLang(Language(x.lang)) + return t, nil + } + } + } + if t.LangID != 0 { + // Search matches for lang-script and lang-region, where lang != und. + if t.LangID < langNoIndexOffset { + x := likelyLang[t.LangID] + if x.flags&isList != 0 { + list := likelyLangList[x.region : x.region+uint16(x.script)] + if t.ScriptID != 0 { + for _, x := range list { + if Script(x.script) == t.ScriptID && x.flags&scriptInFrom != 0 { + t.setUndefinedRegion(Region(x.region)) + return t, nil + } + } + } else if t.RegionID != 0 { + count := 0 + goodScript := true + tt := t + for _, x := range list { + // We visit all entries for which the script was not + // defined, including the ones where the region was not + // defined. This allows for proper disambiguation within + // regions. + if x.flags&scriptInFrom == 0 && t.RegionID.Contains(Region(x.region)) { + tt.RegionID = Region(x.region) + tt.setUndefinedScript(Script(x.script)) + goodScript = goodScript && tt.ScriptID == Script(x.script) + count++ + } + } + if count == 1 { + return tt, nil + } + // Even if we fail to find a unique Region, we might have + // an unambiguous script. + if goodScript { + t.ScriptID = tt.ScriptID + } + } + } + } + } else { + // Search matches for und-script. + if t.ScriptID != 0 { + x := likelyScript[t.ScriptID] + if x.region != 0 { + t.setUndefinedRegion(Region(x.region)) + t.setUndefinedLang(Language(x.lang)) + return t, nil + } + } + // Search matches for und-region. If und-script-region exists, it would + // have been found earlier. + if t.RegionID != 0 { + if i := regionInclusion[t.RegionID]; i < nRegionGroups { + x := likelyRegionGroup[i] + if x.region != 0 { + t.setUndefinedLang(Language(x.lang)) + t.setUndefinedScript(Script(x.script)) + t.RegionID = Region(x.region) + } + } else { + x := likelyRegion[t.RegionID] + if x.flags&isList != 0 { + x = likelyRegionList[x.lang] + } + if x.script != 0 && x.flags != scriptInFrom { + t.setUndefinedLang(Language(x.lang)) + t.setUndefinedScript(Script(x.script)) + return t, nil + } + } + } + } + + // Search matches for lang. + if t.LangID < langNoIndexOffset { + x := likelyLang[t.LangID] + if x.flags&isList != 0 { + x = likelyLangList[x.region] + } + if x.region != 0 { + t.setUndefinedScript(Script(x.script)) + t.setUndefinedRegion(Region(x.region)) + } + specializeRegion(&t) + if t.LangID == 0 { + t.LangID = _en // default language + } + return t, nil + } + return t, ErrMissingLikelyTagsData +} + +func (t *Tag) setTagsFrom(id Tag) { + t.LangID = id.LangID + t.ScriptID = id.ScriptID + t.RegionID = id.RegionID +} + +// minimize removes the region or script subtags from t such that +// t.addLikelySubtags() == t.minimize().addLikelySubtags(). +func (t Tag) minimize() (Tag, error) { + t, err := minimizeTags(t) + if err != nil { + return t, err + } + t.RemakeString() + return t, nil +} + +// minimizeTags mimics the behavior of the ICU 51 C implementation. +func minimizeTags(t Tag) (Tag, error) { + if t.equalTags(Und) { + return t, nil + } + max, err := addTags(t) + if err != nil { + return t, err + } + for _, id := range [...]Tag{ + {LangID: t.LangID}, + {LangID: t.LangID, RegionID: t.RegionID}, + {LangID: t.LangID, ScriptID: t.ScriptID}, + } { + if x, err := addTags(id); err == nil && max.equalTags(x) { + t.setTagsFrom(id) + break + } + } + return t, nil +} diff --git a/vendor/golang.org/x/text/internal/language/parse.go b/vendor/golang.org/x/text/internal/language/parse.go new file mode 100644 index 0000000000..aad1e0acf7 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/parse.go @@ -0,0 +1,608 @@ +// 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 language + +import ( + "bytes" + "errors" + "fmt" + "sort" + + "golang.org/x/text/internal/tag" +) + +// isAlpha returns true if the byte is not a digit. +// b must be an ASCII letter or digit. +func isAlpha(b byte) bool { + return b > '9' +} + +// isAlphaNum returns true if the string contains only ASCII letters or digits. +func isAlphaNum(s []byte) bool { + for _, c := range s { + if !('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9') { + return false + } + } + return true +} + +// ErrSyntax is returned by any of the parsing functions when the +// input is not well-formed, according to BCP 47. +// TODO: return the position at which the syntax error occurred? +var ErrSyntax = errors.New("language: tag is not well-formed") + +// ErrDuplicateKey is returned when a tag contains the same key twice with +// different values in the -u section. +var ErrDuplicateKey = errors.New("language: different values for same key in -u extension") + +// ValueError is returned by any of the parsing functions when the +// input is well-formed but the respective subtag is not recognized +// as a valid value. +type ValueError struct { + v [8]byte +} + +// NewValueError creates a new ValueError. +func NewValueError(tag []byte) ValueError { + var e ValueError + copy(e.v[:], tag) + return e +} + +func (e ValueError) tag() []byte { + n := bytes.IndexByte(e.v[:], 0) + if n == -1 { + n = 8 + } + return e.v[:n] +} + +// Error implements the error interface. +func (e ValueError) Error() string { + return fmt.Sprintf("language: subtag %q is well-formed but unknown", e.tag()) +} + +// Subtag returns the subtag for which the error occurred. +func (e ValueError) Subtag() string { + return string(e.tag()) +} + +// scanner is used to scan BCP 47 tokens, which are separated by _ or -. +type scanner struct { + b []byte + bytes [max99thPercentileSize]byte + token []byte + start int // start position of the current token + end int // end position of the current token + next int // next point for scan + err error + done bool +} + +func makeScannerString(s string) scanner { + scan := scanner{} + if len(s) <= len(scan.bytes) { + scan.b = scan.bytes[:copy(scan.bytes[:], s)] + } else { + scan.b = []byte(s) + } + scan.init() + return scan +} + +// makeScanner returns a scanner using b as the input buffer. +// b is not copied and may be modified by the scanner routines. +func makeScanner(b []byte) scanner { + scan := scanner{b: b} + scan.init() + return scan +} + +func (s *scanner) init() { + for i, c := range s.b { + if c == '_' { + s.b[i] = '-' + } + } + s.scan() +} + +// restToLower converts the string between start and end to lower case. +func (s *scanner) toLower(start, end int) { + for i := start; i < end; i++ { + c := s.b[i] + if 'A' <= c && c <= 'Z' { + s.b[i] += 'a' - 'A' + } + } +} + +func (s *scanner) setError(e error) { + if s.err == nil || (e == ErrSyntax && s.err != ErrSyntax) { + s.err = e + } +} + +// resizeRange shrinks or grows the array at position oldStart such that +// a new string of size newSize can fit between oldStart and oldEnd. +// Sets the scan point to after the resized range. +func (s *scanner) resizeRange(oldStart, oldEnd, newSize int) { + s.start = oldStart + if end := oldStart + newSize; end != oldEnd { + diff := end - oldEnd + var b []byte + if n := len(s.b) + diff; n > cap(s.b) { + b = make([]byte, n) + copy(b, s.b[:oldStart]) + } else { + b = s.b[:n] + } + copy(b[end:], s.b[oldEnd:]) + s.b = b + s.next = end + (s.next - s.end) + s.end = end + } +} + +// replace replaces the current token with repl. +func (s *scanner) replace(repl string) { + s.resizeRange(s.start, s.end, len(repl)) + copy(s.b[s.start:], repl) +} + +// gobble removes the current token from the input. +// Caller must call scan after calling gobble. +func (s *scanner) gobble(e error) { + s.setError(e) + if s.start == 0 { + s.b = s.b[:+copy(s.b, s.b[s.next:])] + s.end = 0 + } else { + s.b = s.b[:s.start-1+copy(s.b[s.start-1:], s.b[s.end:])] + s.end = s.start - 1 + } + s.next = s.start +} + +// deleteRange removes the given range from s.b before the current token. +func (s *scanner) deleteRange(start, end int) { + s.b = s.b[:start+copy(s.b[start:], s.b[end:])] + diff := end - start + s.next -= diff + s.start -= diff + s.end -= diff +} + +// scan parses the next token of a BCP 47 string. Tokens that are larger +// than 8 characters or include non-alphanumeric characters result in an error +// and are gobbled and removed from the output. +// It returns the end position of the last token consumed. +func (s *scanner) scan() (end int) { + end = s.end + s.token = nil + for s.start = s.next; s.next < len(s.b); { + i := bytes.IndexByte(s.b[s.next:], '-') + if i == -1 { + s.end = len(s.b) + s.next = len(s.b) + i = s.end - s.start + } else { + s.end = s.next + i + s.next = s.end + 1 + } + token := s.b[s.start:s.end] + if i < 1 || i > 8 || !isAlphaNum(token) { + s.gobble(ErrSyntax) + continue + } + s.token = token + return end + } + if n := len(s.b); n > 0 && s.b[n-1] == '-' { + s.setError(ErrSyntax) + s.b = s.b[:len(s.b)-1] + } + s.done = true + return end +} + +// acceptMinSize parses multiple tokens of the given size or greater. +// It returns the end position of the last token consumed. +func (s *scanner) acceptMinSize(min int) (end int) { + end = s.end + s.scan() + for ; len(s.token) >= min; s.scan() { + end = s.end + } + return end +} + +// Parse parses the given BCP 47 string and returns a valid Tag. If parsing +// failed it returns an error and any part of the tag that could be parsed. +// If parsing succeeded but an unknown value was found, it returns +// ValueError. The Tag returned in this case is just stripped of the unknown +// value. All other values are preserved. It accepts tags in the BCP 47 format +// and extensions to this standard defined in +// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +func Parse(s string) (t Tag, err error) { + // TODO: consider supporting old-style locale key-value pairs. + if s == "" { + return Und, ErrSyntax + } + defer func() { + if recover() != nil { + t = Und + err = ErrSyntax + return + } + }() + if len(s) <= maxAltTaglen { + b := [maxAltTaglen]byte{} + for i, c := range s { + // Generating invalid UTF-8 is okay as it won't match. + if 'A' <= c && c <= 'Z' { + c += 'a' - 'A' + } else if c == '_' { + c = '-' + } + b[i] = byte(c) + } + if t, ok := grandfathered(b); ok { + return t, nil + } + } + scan := makeScannerString(s) + return parse(&scan, s) +} + +func parse(scan *scanner, s string) (t Tag, err error) { + t = Und + var end int + if n := len(scan.token); n <= 1 { + scan.toLower(0, len(scan.b)) + if n == 0 || scan.token[0] != 'x' { + return t, ErrSyntax + } + end = parseExtensions(scan) + } else if n >= 4 { + return Und, ErrSyntax + } else { // the usual case + t, end = parseTag(scan, true) + if n := len(scan.token); n == 1 { + t.pExt = uint16(end) + end = parseExtensions(scan) + } else if end < len(scan.b) { + scan.setError(ErrSyntax) + scan.b = scan.b[:end] + } + } + if int(t.pVariant) < len(scan.b) { + if end < len(s) { + s = s[:end] + } + if len(s) > 0 && tag.Compare(s, scan.b) == 0 { + t.str = s + } else { + t.str = string(scan.b) + } + } else { + t.pVariant, t.pExt = 0, 0 + } + return t, scan.err +} + +// parseTag parses language, script, region and variants. +// It returns a Tag and the end position in the input that was parsed. +// If doNorm is true, then - will be normalized to . +func parseTag(scan *scanner, doNorm bool) (t Tag, end int) { + var e error + // TODO: set an error if an unknown lang, script or region is encountered. + t.LangID, e = getLangID(scan.token) + scan.setError(e) + scan.replace(t.LangID.String()) + langStart := scan.start + end = scan.scan() + for len(scan.token) == 3 && isAlpha(scan.token[0]) { + // From http://tools.ietf.org/html/bcp47, - tags are equivalent + // to a tag of the form . + if doNorm { + lang, e := getLangID(scan.token) + if lang != 0 { + t.LangID = lang + langStr := lang.String() + copy(scan.b[langStart:], langStr) + scan.b[langStart+len(langStr)] = '-' + scan.start = langStart + len(langStr) + 1 + } + scan.gobble(e) + } + end = scan.scan() + } + if len(scan.token) == 4 && isAlpha(scan.token[0]) { + t.ScriptID, e = getScriptID(script, scan.token) + if t.ScriptID == 0 { + scan.gobble(e) + } + end = scan.scan() + } + if n := len(scan.token); n >= 2 && n <= 3 { + t.RegionID, e = getRegionID(scan.token) + if t.RegionID == 0 { + scan.gobble(e) + } else { + scan.replace(t.RegionID.String()) + } + end = scan.scan() + } + scan.toLower(scan.start, len(scan.b)) + t.pVariant = byte(end) + end = parseVariants(scan, end, t) + t.pExt = uint16(end) + return t, end +} + +var separator = []byte{'-'} + +// parseVariants scans tokens as long as each token is a valid variant string. +// Duplicate variants are removed. +func parseVariants(scan *scanner, end int, t Tag) int { + start := scan.start + varIDBuf := [4]uint8{} + variantBuf := [4][]byte{} + varID := varIDBuf[:0] + variant := variantBuf[:0] + last := -1 + needSort := false + for ; len(scan.token) >= 4; scan.scan() { + // TODO: measure the impact of needing this conversion and redesign + // the data structure if there is an issue. + v, ok := variantIndex[string(scan.token)] + if !ok { + // unknown variant + // TODO: allow user-defined variants? + scan.gobble(NewValueError(scan.token)) + continue + } + varID = append(varID, v) + variant = append(variant, scan.token) + if !needSort { + if last < int(v) { + last = int(v) + } else { + needSort = true + // There is no legal combinations of more than 7 variants + // (and this is by no means a useful sequence). + const maxVariants = 8 + if len(varID) > maxVariants { + break + } + } + } + end = scan.end + } + if needSort { + sort.Sort(variantsSort{varID, variant}) + k, l := 0, -1 + for i, v := range varID { + w := int(v) + if l == w { + // Remove duplicates. + continue + } + varID[k] = varID[i] + variant[k] = variant[i] + k++ + l = w + } + if str := bytes.Join(variant[:k], separator); len(str) == 0 { + end = start - 1 + } else { + scan.resizeRange(start, end, len(str)) + copy(scan.b[scan.start:], str) + end = scan.end + } + } + return end +} + +type variantsSort struct { + i []uint8 + v [][]byte +} + +func (s variantsSort) Len() int { + return len(s.i) +} + +func (s variantsSort) Swap(i, j int) { + s.i[i], s.i[j] = s.i[j], s.i[i] + s.v[i], s.v[j] = s.v[j], s.v[i] +} + +func (s variantsSort) Less(i, j int) bool { + return s.i[i] < s.i[j] +} + +type bytesSort struct { + b [][]byte + n int // first n bytes to compare +} + +func (b bytesSort) Len() int { + return len(b.b) +} + +func (b bytesSort) Swap(i, j int) { + b.b[i], b.b[j] = b.b[j], b.b[i] +} + +func (b bytesSort) Less(i, j int) bool { + for k := 0; k < b.n; k++ { + if b.b[i][k] == b.b[j][k] { + continue + } + return b.b[i][k] < b.b[j][k] + } + return false +} + +// parseExtensions parses and normalizes the extensions in the buffer. +// It returns the last position of scan.b that is part of any extension. +// It also trims scan.b to remove excess parts accordingly. +func parseExtensions(scan *scanner) int { + start := scan.start + exts := [][]byte{} + private := []byte{} + end := scan.end + for len(scan.token) == 1 { + extStart := scan.start + ext := scan.token[0] + end = parseExtension(scan) + extension := scan.b[extStart:end] + if len(extension) < 3 || (ext != 'x' && len(extension) < 4) { + scan.setError(ErrSyntax) + end = extStart + continue + } else if start == extStart && (ext == 'x' || scan.start == len(scan.b)) { + scan.b = scan.b[:end] + return end + } else if ext == 'x' { + private = extension + break + } + exts = append(exts, extension) + } + sort.Sort(bytesSort{exts, 1}) + if len(private) > 0 { + exts = append(exts, private) + } + scan.b = scan.b[:start] + if len(exts) > 0 { + scan.b = append(scan.b, bytes.Join(exts, separator)...) + } else if start > 0 { + // Strip trailing '-'. + scan.b = scan.b[:start-1] + } + return end +} + +// parseExtension parses a single extension and returns the position of +// the extension end. +func parseExtension(scan *scanner) int { + start, end := scan.start, scan.end + switch scan.token[0] { + case 'u': // https://www.ietf.org/rfc/rfc6067.txt + attrStart := end + scan.scan() + for last := []byte{}; len(scan.token) > 2; scan.scan() { + if bytes.Compare(scan.token, last) != -1 { + // Attributes are unsorted. Start over from scratch. + p := attrStart + 1 + scan.next = p + attrs := [][]byte{} + for scan.scan(); len(scan.token) > 2; scan.scan() { + attrs = append(attrs, scan.token) + end = scan.end + } + sort.Sort(bytesSort{attrs, 3}) + copy(scan.b[p:], bytes.Join(attrs, separator)) + break + } + last = scan.token + end = scan.end + } + // Scan key-type sequences. A key is of length 2 and may be followed + // by 0 or more "type" subtags from 3 to the maximum of 8 letters. + var last, key []byte + for attrEnd := end; len(scan.token) == 2; last = key { + key = scan.token + end = scan.end + for scan.scan(); end < scan.end && len(scan.token) > 2; scan.scan() { + end = scan.end + } + // TODO: check key value validity + if bytes.Compare(key, last) != 1 || scan.err != nil { + // We have an invalid key or the keys are not sorted. + // Start scanning keys from scratch and reorder. + p := attrEnd + 1 + scan.next = p + keys := [][]byte{} + for scan.scan(); len(scan.token) == 2; { + keyStart := scan.start + end = scan.end + for scan.scan(); end < scan.end && len(scan.token) > 2; scan.scan() { + end = scan.end + } + keys = append(keys, scan.b[keyStart:end]) + } + sort.Stable(bytesSort{keys, 2}) + if n := len(keys); n > 0 { + k := 0 + for i := 1; i < n; i++ { + if !bytes.Equal(keys[k][:2], keys[i][:2]) { + k++ + keys[k] = keys[i] + } else if !bytes.Equal(keys[k], keys[i]) { + scan.setError(ErrDuplicateKey) + } + } + keys = keys[:k+1] + } + reordered := bytes.Join(keys, separator) + if e := p + len(reordered); e < end { + scan.deleteRange(e, end) + end = e + } + copy(scan.b[p:], reordered) + break + } + } + case 't': // https://www.ietf.org/rfc/rfc6497.txt + scan.scan() + if n := len(scan.token); n >= 2 && n <= 3 && isAlpha(scan.token[1]) { + _, end = parseTag(scan, false) + scan.toLower(start, end) + } + for len(scan.token) == 2 && !isAlpha(scan.token[1]) { + end = scan.acceptMinSize(3) + } + case 'x': + end = scan.acceptMinSize(1) + default: + end = scan.acceptMinSize(2) + } + return end +} + +// getExtension returns the name, body and end position of the extension. +func getExtension(s string, p int) (end int, ext string) { + if s[p] == '-' { + p++ + } + if s[p] == 'x' { + return len(s), s[p:] + } + end = nextExtension(s, p) + return end, s[p:end] +} + +// nextExtension finds the next extension within the string, searching +// for the -- pattern from position p. +// In the fast majority of cases, language tags will have at most +// one extension and extensions tend to be small. +func nextExtension(s string, p int) int { + for n := len(s) - 3; p < n; { + if s[p] == '-' { + if s[p+2] == '-' { + return p + } + p += 3 + } else { + p++ + } + } + return len(s) +} diff --git a/vendor/golang.org/x/text/internal/language/tables.go b/vendor/golang.org/x/text/internal/language/tables.go new file mode 100644 index 0000000000..14167e74e4 --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/tables.go @@ -0,0 +1,3494 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +package language + +import "golang.org/x/text/internal/tag" + +// CLDRVersion is the CLDR version from which the tables in this package are derived. +const CLDRVersion = "32" + +const NumLanguages = 8798 + +const NumScripts = 261 + +const NumRegions = 358 + +type FromTo struct { + From uint16 + To uint16 +} + +const nonCanonicalUnd = 1201 +const ( + _af = 22 + _am = 39 + _ar = 58 + _az = 88 + _bg = 126 + _bn = 165 + _ca = 215 + _cs = 250 + _da = 257 + _de = 269 + _el = 310 + _en = 313 + _es = 318 + _et = 320 + _fa = 328 + _fi = 337 + _fil = 339 + _fr = 350 + _gu = 420 + _he = 444 + _hi = 446 + _hr = 465 + _hu = 469 + _hy = 471 + _id = 481 + _is = 504 + _it = 505 + _ja = 512 + _ka = 528 + _kk = 578 + _km = 586 + _kn = 593 + _ko = 596 + _ky = 650 + _lo = 696 + _lt = 704 + _lv = 711 + _mk = 767 + _ml = 772 + _mn = 779 + _mo = 784 + _mr = 795 + _ms = 799 + _mul = 806 + _my = 817 + _nb = 839 + _ne = 849 + _nl = 871 + _no = 879 + _pa = 925 + _pl = 947 + _pt = 960 + _ro = 988 + _ru = 994 + _sh = 1031 + _si = 1036 + _sk = 1042 + _sl = 1046 + _sq = 1073 + _sr = 1074 + _sv = 1092 + _sw = 1093 + _ta = 1104 + _te = 1121 + _th = 1131 + _tl = 1146 + _tn = 1152 + _tr = 1162 + _uk = 1198 + _ur = 1204 + _uz = 1212 + _vi = 1219 + _zh = 1321 + _zu = 1327 + _jbo = 515 + _ami = 1650 + _bnn = 2357 + _hak = 438 + _tlh = 14467 + _lb = 661 + _nv = 899 + _pwn = 12055 + _tao = 14188 + _tay = 14198 + _tsu = 14662 + _nn = 874 + _sfb = 13629 + _vgt = 15701 + _sgg = 13660 + _cmn = 3007 + _nan = 835 + _hsn = 467 +) + +const langPrivateStart = 0x2f72 + +const langPrivateEnd = 0x3179 + +// lang holds an alphabetically sorted list of ISO-639 language identifiers. +// All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag. +// For 2-byte language identifiers, the two successive bytes have the following meaning: +// - if the first letter of the 2- and 3-letter ISO codes are the same: +// the second and third letter of the 3-letter ISO code. +// - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3. +// +// For 3-byte language identifiers the 4th byte is 0. +const lang tag.Index = "" + // Size: 5324 bytes + "---\x00aaaraai\x00aak\x00aau\x00abbkabi\x00abq\x00abr\x00abt\x00aby\x00a" + + "cd\x00ace\x00ach\x00ada\x00ade\x00adj\x00ady\x00adz\x00aeveaeb\x00aey" + + "\x00affragc\x00agd\x00agg\x00agm\x00ago\x00agq\x00aha\x00ahl\x00aho\x00a" + + "jg\x00akkaakk\x00ala\x00ali\x00aln\x00alt\x00ammhamm\x00amn\x00amo\x00am" + + "p\x00anrganc\x00ank\x00ann\x00any\x00aoj\x00aom\x00aoz\x00apc\x00apd\x00" + + "ape\x00apr\x00aps\x00apz\x00arraarc\x00arh\x00arn\x00aro\x00arq\x00ars" + + "\x00ary\x00arz\x00assmasa\x00ase\x00asg\x00aso\x00ast\x00ata\x00atg\x00a" + + "tj\x00auy\x00avvaavl\x00avn\x00avt\x00avu\x00awa\x00awb\x00awo\x00awx" + + "\x00ayymayb\x00azzebaakbal\x00ban\x00bap\x00bar\x00bas\x00bav\x00bax\x00" + + "bba\x00bbb\x00bbc\x00bbd\x00bbj\x00bbp\x00bbr\x00bcf\x00bch\x00bci\x00bc" + + "m\x00bcn\x00bco\x00bcq\x00bcu\x00bdd\x00beelbef\x00beh\x00bej\x00bem\x00" + + "bet\x00bew\x00bex\x00bez\x00bfd\x00bfq\x00bft\x00bfy\x00bgulbgc\x00bgn" + + "\x00bgx\x00bhihbhb\x00bhg\x00bhi\x00bhk\x00bhl\x00bho\x00bhy\x00biisbib" + + "\x00big\x00bik\x00bim\x00bin\x00bio\x00biq\x00bjh\x00bji\x00bjj\x00bjn" + + "\x00bjo\x00bjr\x00bjt\x00bjz\x00bkc\x00bkm\x00bkq\x00bku\x00bkv\x00blt" + + "\x00bmambmh\x00bmk\x00bmq\x00bmu\x00bnenbng\x00bnm\x00bnp\x00boodboj\x00" + + "bom\x00bon\x00bpy\x00bqc\x00bqi\x00bqp\x00bqv\x00brrebra\x00brh\x00brx" + + "\x00brz\x00bsosbsj\x00bsq\x00bss\x00bst\x00bto\x00btt\x00btv\x00bua\x00b" + + "uc\x00bud\x00bug\x00buk\x00bum\x00buo\x00bus\x00buu\x00bvb\x00bwd\x00bwr" + + "\x00bxh\x00bye\x00byn\x00byr\x00bys\x00byv\x00byx\x00bza\x00bze\x00bzf" + + "\x00bzh\x00bzw\x00caatcan\x00cbj\x00cch\x00ccp\x00ceheceb\x00cfa\x00cgg" + + "\x00chhachk\x00chm\x00cho\x00chp\x00chr\x00cja\x00cjm\x00cjv\x00ckb\x00c" + + "kl\x00cko\x00cky\x00cla\x00cme\x00cmg\x00cooscop\x00cps\x00crrecrh\x00cr" + + "j\x00crk\x00crl\x00crm\x00crs\x00csescsb\x00csw\x00ctd\x00cuhucvhvcyymda" + + "andad\x00daf\x00dag\x00dah\x00dak\x00dar\x00dav\x00dbd\x00dbq\x00dcc\x00" + + "ddn\x00deeuded\x00den\x00dga\x00dgh\x00dgi\x00dgl\x00dgr\x00dgz\x00dia" + + "\x00dje\x00dnj\x00dob\x00doi\x00dop\x00dow\x00dri\x00drs\x00dsb\x00dtm" + + "\x00dtp\x00dts\x00dty\x00dua\x00duc\x00dud\x00dug\x00dvivdva\x00dww\x00d" + + "yo\x00dyu\x00dzzodzg\x00ebu\x00eeweefi\x00egl\x00egy\x00eka\x00eky\x00el" + + "llema\x00emi\x00enngenn\x00enq\x00eopoeri\x00es\x00\x05esu\x00etstetr" + + "\x00ett\x00etu\x00etx\x00euusewo\x00ext\x00faasfaa\x00fab\x00fag\x00fai" + + "\x00fan\x00ffulffi\x00ffm\x00fiinfia\x00fil\x00fit\x00fjijflr\x00fmp\x00" + + "foaofod\x00fon\x00for\x00fpe\x00fqs\x00frrafrc\x00frp\x00frr\x00frs\x00f" + + "ub\x00fud\x00fue\x00fuf\x00fuh\x00fuq\x00fur\x00fuv\x00fuy\x00fvr\x00fyr" + + "ygalegaa\x00gaf\x00gag\x00gah\x00gaj\x00gam\x00gan\x00gaw\x00gay\x00gba" + + "\x00gbf\x00gbm\x00gby\x00gbz\x00gcr\x00gdlagde\x00gdn\x00gdr\x00geb\x00g" + + "ej\x00gel\x00gez\x00gfk\x00ggn\x00ghs\x00gil\x00gim\x00gjk\x00gjn\x00gju" + + "\x00gkn\x00gkp\x00gllgglk\x00gmm\x00gmv\x00gnrngnd\x00gng\x00god\x00gof" + + "\x00goi\x00gom\x00gon\x00gor\x00gos\x00got\x00grb\x00grc\x00grt\x00grw" + + "\x00gsw\x00guujgub\x00guc\x00gud\x00gur\x00guw\x00gux\x00guz\x00gvlvgvf" + + "\x00gvr\x00gvs\x00gwc\x00gwi\x00gwt\x00gyi\x00haauhag\x00hak\x00ham\x00h" + + "aw\x00haz\x00hbb\x00hdy\x00heebhhy\x00hiinhia\x00hif\x00hig\x00hih\x00hi" + + "l\x00hla\x00hlu\x00hmd\x00hmt\x00hnd\x00hne\x00hnj\x00hnn\x00hno\x00homo" + + "hoc\x00hoj\x00hot\x00hrrvhsb\x00hsn\x00htathuunhui\x00hyyehzerianaian" + + "\x00iar\x00iba\x00ibb\x00iby\x00ica\x00ich\x00idndidd\x00idi\x00idu\x00i" + + "eleife\x00igboigb\x00ige\x00iiiiijj\x00ikpkikk\x00ikt\x00ikw\x00ikx\x00i" + + "lo\x00imo\x00inndinh\x00iodoiou\x00iri\x00isslittaiukuiw\x00\x03iwm\x00i" + + "ws\x00izh\x00izi\x00japnjab\x00jam\x00jbo\x00jbu\x00jen\x00jgk\x00jgo" + + "\x00ji\x00\x06jib\x00jmc\x00jml\x00jra\x00jut\x00jvavjwavkaatkaa\x00kab" + + "\x00kac\x00kad\x00kai\x00kaj\x00kam\x00kao\x00kbd\x00kbm\x00kbp\x00kbq" + + "\x00kbx\x00kby\x00kcg\x00kck\x00kcl\x00kct\x00kde\x00kdh\x00kdl\x00kdt" + + "\x00kea\x00ken\x00kez\x00kfo\x00kfr\x00kfy\x00kgonkge\x00kgf\x00kgp\x00k" + + "ha\x00khb\x00khn\x00khq\x00khs\x00kht\x00khw\x00khz\x00kiikkij\x00kiu" + + "\x00kiw\x00kjuakjd\x00kjg\x00kjs\x00kjy\x00kkazkkc\x00kkj\x00klalkln\x00" + + "klq\x00klt\x00klx\x00kmhmkmb\x00kmh\x00kmo\x00kms\x00kmu\x00kmw\x00knank" + + "nf\x00knp\x00koorkoi\x00kok\x00kol\x00kos\x00koz\x00kpe\x00kpf\x00kpo" + + "\x00kpr\x00kpx\x00kqb\x00kqf\x00kqs\x00kqy\x00kraukrc\x00kri\x00krj\x00k" + + "rl\x00krs\x00kru\x00ksasksb\x00ksd\x00ksf\x00ksh\x00ksj\x00ksr\x00ktb" + + "\x00ktm\x00kto\x00kuurkub\x00kud\x00kue\x00kuj\x00kum\x00kun\x00kup\x00k" + + "us\x00kvomkvg\x00kvr\x00kvx\x00kw\x00\x01kwj\x00kwo\x00kxa\x00kxc\x00kxm" + + "\x00kxp\x00kxw\x00kxz\x00kyirkye\x00kyx\x00kzr\x00laatlab\x00lad\x00lag" + + "\x00lah\x00laj\x00las\x00lbtzlbe\x00lbu\x00lbw\x00lcm\x00lcp\x00ldb\x00l" + + "ed\x00lee\x00lem\x00lep\x00leq\x00leu\x00lez\x00lguglgg\x00liimlia\x00li" + + "d\x00lif\x00lig\x00lih\x00lij\x00lis\x00ljp\x00lki\x00lkt\x00lle\x00lln" + + "\x00lmn\x00lmo\x00lmp\x00lninlns\x00lnu\x00loaoloj\x00lok\x00lol\x00lor" + + "\x00los\x00loz\x00lrc\x00ltitltg\x00luublua\x00luo\x00luy\x00luz\x00lvav" + + "lwl\x00lzh\x00lzz\x00mad\x00maf\x00mag\x00mai\x00mak\x00man\x00mas\x00ma" + + "w\x00maz\x00mbh\x00mbo\x00mbq\x00mbu\x00mbw\x00mci\x00mcp\x00mcq\x00mcr" + + "\x00mcu\x00mda\x00mde\x00mdf\x00mdh\x00mdj\x00mdr\x00mdx\x00med\x00mee" + + "\x00mek\x00men\x00mer\x00met\x00meu\x00mfa\x00mfe\x00mfn\x00mfo\x00mfq" + + "\x00mglgmgh\x00mgl\x00mgo\x00mgp\x00mgy\x00mhahmhi\x00mhl\x00mirimif\x00" + + "min\x00mis\x00miw\x00mkkdmki\x00mkl\x00mkp\x00mkw\x00mlalmle\x00mlp\x00m" + + "ls\x00mmo\x00mmu\x00mmx\x00mnonmna\x00mnf\x00mni\x00mnw\x00moolmoa\x00mo" + + "e\x00moh\x00mos\x00mox\x00mpp\x00mps\x00mpt\x00mpx\x00mql\x00mrarmrd\x00" + + "mrj\x00mro\x00mssamtltmtc\x00mtf\x00mti\x00mtr\x00mua\x00mul\x00mur\x00m" + + "us\x00mva\x00mvn\x00mvy\x00mwk\x00mwr\x00mwv\x00mxc\x00mxm\x00myyamyk" + + "\x00mym\x00myv\x00myw\x00myx\x00myz\x00mzk\x00mzm\x00mzn\x00mzp\x00mzw" + + "\x00mzz\x00naaunac\x00naf\x00nah\x00nak\x00nan\x00nap\x00naq\x00nas\x00n" + + "bobnca\x00nce\x00ncf\x00nch\x00nco\x00ncu\x00nddendc\x00nds\x00neepneb" + + "\x00new\x00nex\x00nfr\x00ngdonga\x00ngb\x00ngl\x00nhb\x00nhe\x00nhw\x00n" + + "if\x00nii\x00nij\x00nin\x00niu\x00niy\x00niz\x00njo\x00nkg\x00nko\x00nll" + + "dnmg\x00nmz\x00nnnonnf\x00nnh\x00nnk\x00nnm\x00noornod\x00noe\x00non\x00" + + "nop\x00nou\x00nqo\x00nrblnrb\x00nsk\x00nsn\x00nso\x00nss\x00ntm\x00ntr" + + "\x00nui\x00nup\x00nus\x00nuv\x00nux\x00nvavnwb\x00nxq\x00nxr\x00nyyanym" + + "\x00nyn\x00nzi\x00occiogc\x00ojjiokr\x00okv\x00omrmong\x00onn\x00ons\x00" + + "opm\x00orrioro\x00oru\x00osssosa\x00ota\x00otk\x00ozm\x00paanpag\x00pal" + + "\x00pam\x00pap\x00pau\x00pbi\x00pcd\x00pcm\x00pdc\x00pdt\x00ped\x00peo" + + "\x00pex\x00pfl\x00phl\x00phn\x00pilipil\x00pip\x00pka\x00pko\x00plolpla" + + "\x00pms\x00png\x00pnn\x00pnt\x00pon\x00ppo\x00pra\x00prd\x00prg\x00psusp" + + "ss\x00ptorptp\x00puu\x00pwa\x00quuequc\x00qug\x00rai\x00raj\x00rao\x00rc" + + "f\x00rej\x00rel\x00res\x00rgn\x00rhg\x00ria\x00rif\x00rjs\x00rkt\x00rmoh" + + "rmf\x00rmo\x00rmt\x00rmu\x00rnunrna\x00rng\x00roonrob\x00rof\x00roo\x00r" + + "ro\x00rtm\x00ruusrue\x00rug\x00rw\x00\x04rwk\x00rwo\x00ryu\x00saansaf" + + "\x00sah\x00saq\x00sas\x00sat\x00sav\x00saz\x00sba\x00sbe\x00sbp\x00scrds" + + "ck\x00scl\x00scn\x00sco\x00scs\x00sdndsdc\x00sdh\x00semesef\x00seh\x00se" + + "i\x00ses\x00sgagsga\x00sgs\x00sgw\x00sgz\x00sh\x00\x02shi\x00shk\x00shn" + + "\x00shu\x00siinsid\x00sig\x00sil\x00sim\x00sjr\x00sklkskc\x00skr\x00sks" + + "\x00sllvsld\x00sli\x00sll\x00sly\x00smmosma\x00smi\x00smj\x00smn\x00smp" + + "\x00smq\x00sms\x00snnasnc\x00snk\x00snp\x00snx\x00sny\x00soomsok\x00soq" + + "\x00sou\x00soy\x00spd\x00spl\x00sps\x00sqqisrrpsrb\x00srn\x00srr\x00srx" + + "\x00ssswssd\x00ssg\x00ssy\x00stotstk\x00stq\x00suunsua\x00sue\x00suk\x00" + + "sur\x00sus\x00svweswwaswb\x00swc\x00swg\x00swp\x00swv\x00sxn\x00sxw\x00s" + + "yl\x00syr\x00szl\x00taamtaj\x00tal\x00tan\x00taq\x00tbc\x00tbd\x00tbf" + + "\x00tbg\x00tbo\x00tbw\x00tbz\x00tci\x00tcy\x00tdd\x00tdg\x00tdh\x00teelt" + + "ed\x00tem\x00teo\x00tet\x00tfi\x00tggktgc\x00tgo\x00tgu\x00thhathl\x00th" + + "q\x00thr\x00tiirtif\x00tig\x00tik\x00tim\x00tio\x00tiv\x00tkuktkl\x00tkr" + + "\x00tkt\x00tlgltlf\x00tlx\x00tly\x00tmh\x00tmy\x00tnsntnh\x00toontof\x00" + + "tog\x00toq\x00tpi\x00tpm\x00tpz\x00tqo\x00trurtru\x00trv\x00trw\x00tssot" + + "sd\x00tsf\x00tsg\x00tsj\x00tsw\x00ttatttd\x00tte\x00ttj\x00ttr\x00tts" + + "\x00ttt\x00tuh\x00tul\x00tum\x00tuq\x00tvd\x00tvl\x00tvu\x00twwitwh\x00t" + + "wq\x00txg\x00tyahtya\x00tyv\x00tzm\x00ubu\x00udm\x00ugiguga\x00ukkruli" + + "\x00umb\x00und\x00unr\x00unx\x00urrduri\x00urt\x00urw\x00usa\x00utr\x00u" + + "vh\x00uvl\x00uzzbvag\x00vai\x00van\x00veenvec\x00vep\x00viievic\x00viv" + + "\x00vls\x00vmf\x00vmw\x00voolvot\x00vro\x00vun\x00vut\x00walnwae\x00waj" + + "\x00wal\x00wan\x00war\x00wbp\x00wbq\x00wbr\x00wci\x00wer\x00wgi\x00whg" + + "\x00wib\x00wiu\x00wiv\x00wja\x00wji\x00wls\x00wmo\x00wnc\x00wni\x00wnu" + + "\x00woolwob\x00wos\x00wrs\x00wsk\x00wtm\x00wuu\x00wuv\x00wwa\x00xav\x00x" + + "bi\x00xcr\x00xes\x00xhhoxla\x00xlc\x00xld\x00xmf\x00xmn\x00xmr\x00xna" + + "\x00xnr\x00xog\x00xon\x00xpr\x00xrb\x00xsa\x00xsi\x00xsm\x00xsr\x00xwe" + + "\x00yam\x00yao\x00yap\x00yas\x00yat\x00yav\x00yay\x00yaz\x00yba\x00ybb" + + "\x00yby\x00yer\x00ygr\x00ygw\x00yiidyko\x00yle\x00ylg\x00yll\x00yml\x00y" + + "ooryon\x00yrb\x00yre\x00yrl\x00yss\x00yua\x00yue\x00yuj\x00yut\x00yuw" + + "\x00zahazag\x00zbl\x00zdj\x00zea\x00zgh\x00zhhozhx\x00zia\x00zlm\x00zmi" + + "\x00zne\x00zuulzxx\x00zza\x00\xff\xff\xff\xff" + +const langNoIndexOffset = 1330 + +// langNoIndex is a bit vector of all 3-letter language codes that are not used as an index +// in lookup tables. The language ids for these language codes are derived directly +// from the letters and are not consecutive. +// Size: 2197 bytes, 2197 elements +var langNoIndex = [2197]uint8{ + // Entry 0 - 3F + 0xff, 0xf8, 0xed, 0xfe, 0xeb, 0xd3, 0x3b, 0xd2, + 0xfb, 0xbf, 0x7a, 0xfa, 0x37, 0x1d, 0x3c, 0x57, + 0x6e, 0x97, 0x73, 0x38, 0xfb, 0xea, 0xbf, 0x70, + 0xad, 0x03, 0xff, 0xff, 0xcf, 0x05, 0x84, 0x72, + 0xe9, 0xbf, 0xfd, 0xbf, 0xbf, 0xf7, 0xfd, 0x77, + 0x0f, 0xff, 0xef, 0x6f, 0xff, 0xfb, 0xdf, 0xe2, + 0xc9, 0xf8, 0x7f, 0x7e, 0x4d, 0xbc, 0x0a, 0x6a, + 0x7c, 0xea, 0xe3, 0xfa, 0x7a, 0xbf, 0x67, 0xff, + // Entry 40 - 7F + 0xff, 0xff, 0xff, 0xdf, 0x2a, 0x54, 0x91, 0xc0, + 0x5d, 0xe3, 0x97, 0x14, 0x07, 0x20, 0xdd, 0xed, + 0x9f, 0x3f, 0xc9, 0x21, 0xf8, 0x3f, 0x94, 0x35, + 0x7c, 0x5f, 0xff, 0x5f, 0x8e, 0x6e, 0xdf, 0xff, + 0xff, 0xff, 0x55, 0x7c, 0xd3, 0xfd, 0xbf, 0xb5, + 0x7b, 0xdf, 0x7f, 0xf7, 0xca, 0xfe, 0xdb, 0xa3, + 0xa8, 0xff, 0x1f, 0x67, 0x7d, 0xeb, 0xef, 0xce, + 0xff, 0xff, 0x9f, 0xff, 0xb7, 0xef, 0xfe, 0xcf, + // Entry 80 - BF + 0xdb, 0xff, 0xf3, 0xcd, 0xfb, 0x7f, 0xff, 0xff, + 0xbb, 0xee, 0xf7, 0xbd, 0xdb, 0xff, 0x5f, 0xf7, + 0xfd, 0xf2, 0xfd, 0xff, 0x5e, 0x2f, 0x3b, 0xba, + 0x7e, 0xff, 0xff, 0xfe, 0xf7, 0xff, 0xdd, 0xff, + 0xfd, 0xdf, 0xfb, 0xfe, 0x9d, 0xb4, 0xd3, 0xff, + 0xef, 0xff, 0xdf, 0xf7, 0x7f, 0xb7, 0xfd, 0xd5, + 0xa5, 0x77, 0x40, 0xff, 0x9c, 0xc1, 0x41, 0x2c, + 0x08, 0x21, 0x41, 0x00, 0x50, 0x40, 0x00, 0x80, + // Entry C0 - FF + 0xfb, 0x4a, 0xf2, 0x9f, 0xb4, 0x42, 0x41, 0x96, + 0x1b, 0x14, 0x08, 0xf3, 0x2b, 0xe7, 0x17, 0x56, + 0x05, 0x7d, 0x0e, 0x1c, 0x37, 0x7f, 0xf3, 0xef, + 0x97, 0xff, 0x5d, 0x38, 0x64, 0x08, 0x00, 0x10, + 0xbc, 0x85, 0xaf, 0xdf, 0xff, 0xff, 0x7b, 0x35, + 0x3e, 0xc7, 0xc7, 0xdf, 0xff, 0x01, 0x81, 0x00, + 0xb0, 0x05, 0x80, 0x00, 0x20, 0x00, 0x00, 0x03, + 0x40, 0x00, 0x40, 0x92, 0x21, 0x50, 0xb1, 0x5d, + // Entry 100 - 13F + 0xfd, 0xdc, 0xbe, 0x5e, 0x00, 0x00, 0x02, 0x64, + 0x0d, 0x19, 0x41, 0xdf, 0x79, 0x22, 0x00, 0x00, + 0x00, 0x5e, 0x64, 0xdc, 0x24, 0xe5, 0xd9, 0xe3, + 0xfe, 0xff, 0xfd, 0xcb, 0x9f, 0x14, 0x41, 0x0c, + 0x86, 0x00, 0xd1, 0x00, 0xf0, 0xc7, 0x67, 0x5f, + 0x56, 0x99, 0x5e, 0xb5, 0x6c, 0xaf, 0x03, 0x00, + 0x02, 0x00, 0x00, 0x00, 0xc0, 0x37, 0xda, 0x56, + 0x90, 0x6d, 0x01, 0x2e, 0x96, 0x69, 0x20, 0xfb, + // Entry 140 - 17F + 0xff, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x16, + 0x03, 0x00, 0x00, 0xb0, 0x14, 0x23, 0x50, 0x06, + 0x0a, 0x00, 0x01, 0x00, 0x00, 0x10, 0x11, 0x09, + 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x44, 0x00, 0x00, 0x10, 0x00, 0x05, + 0x08, 0x00, 0x00, 0x05, 0x00, 0x80, 0x28, 0x04, + 0x00, 0x00, 0x40, 0xd5, 0x2d, 0x00, 0x64, 0x35, + 0x24, 0x52, 0xf4, 0xd5, 0xbf, 0x62, 0xc9, 0x03, + // Entry 180 - 1BF + 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x13, 0x39, 0x01, 0xdd, 0x57, 0x98, + 0x21, 0x18, 0x81, 0x08, 0x00, 0x01, 0x40, 0x82, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x40, 0x00, 0x44, 0x00, 0x00, 0x80, 0xea, + 0xa9, 0x39, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + // Entry 1C0 - 1FF + 0x00, 0x03, 0x28, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x20, 0x04, 0xa6, 0x00, 0x04, 0x00, 0x00, + 0x81, 0x50, 0x00, 0x00, 0x00, 0x11, 0x84, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x55, + 0x02, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x40, + 0x30, 0x83, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1e, 0xcd, 0xbf, 0x7a, 0xbf, + // Entry 200 - 23F + 0xdf, 0xc3, 0x83, 0x82, 0xc0, 0xfb, 0x57, 0x27, + 0xed, 0x55, 0xe7, 0x01, 0x00, 0x20, 0xb2, 0xc5, + 0xa4, 0x45, 0x25, 0x9b, 0x02, 0xdf, 0xe1, 0xdf, + 0x03, 0x44, 0x08, 0x90, 0x01, 0x04, 0x81, 0xe3, + 0x92, 0x54, 0xdb, 0x28, 0xd3, 0x5f, 0xfe, 0x6d, + 0x79, 0xed, 0x1c, 0x7f, 0x04, 0x08, 0x00, 0x01, + 0x21, 0x12, 0x64, 0x5f, 0xdd, 0x0e, 0x85, 0x4f, + 0x40, 0x40, 0x00, 0x04, 0xf1, 0xfd, 0x3d, 0x54, + // Entry 240 - 27F + 0xe8, 0x03, 0xb4, 0x27, 0x23, 0x0d, 0x00, 0x00, + 0x20, 0x7b, 0x78, 0x02, 0x07, 0x84, 0x00, 0xf0, + 0xbb, 0x7e, 0x5a, 0x00, 0x18, 0x04, 0x81, 0x00, + 0x00, 0x00, 0x80, 0x10, 0x90, 0x1c, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x04, + 0x08, 0xa0, 0x70, 0xa5, 0x0c, 0x40, 0x00, 0x00, + 0x91, 0x24, 0x04, 0x68, 0x00, 0x20, 0x70, 0xff, + 0x7b, 0x7f, 0x70, 0x00, 0x05, 0x9b, 0xdd, 0x66, + // Entry 280 - 2BF + 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x40, 0x05, + 0xb5, 0xb6, 0x80, 0x08, 0x04, 0x00, 0x04, 0x51, + 0xe2, 0xef, 0xfd, 0x3f, 0x05, 0x09, 0x08, 0x05, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x60, + 0xe7, 0x48, 0x00, 0x81, 0x20, 0xc0, 0x05, 0x80, + 0x03, 0x00, 0x00, 0x00, 0x8c, 0x50, 0x40, 0x04, + 0x84, 0x47, 0x84, 0x40, 0x20, 0x10, 0x00, 0x20, + // Entry 2C0 - 2FF + 0x02, 0x50, 0x80, 0x11, 0x00, 0x99, 0x6c, 0xe2, + 0x50, 0x27, 0x1d, 0x11, 0x29, 0x0e, 0x59, 0xe9, + 0x33, 0x08, 0x00, 0x20, 0x04, 0x40, 0x10, 0x00, + 0x00, 0x00, 0x50, 0x44, 0x92, 0x49, 0xd6, 0x5d, + 0xa7, 0x81, 0x47, 0x97, 0xfb, 0x00, 0x10, 0x00, + 0x08, 0x00, 0x80, 0x00, 0x40, 0x04, 0x00, 0x01, + 0x02, 0x00, 0x01, 0x40, 0x80, 0x00, 0x40, 0x08, + 0xd8, 0xeb, 0xf6, 0x39, 0xc4, 0x8d, 0x12, 0x00, + // Entry 300 - 33F + 0x00, 0x0c, 0x04, 0x01, 0x20, 0x20, 0xdd, 0xa0, + 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x04, 0x10, 0xd0, 0x9d, 0x95, 0x13, 0x04, 0x80, + 0x00, 0x01, 0xd0, 0x16, 0x40, 0x00, 0x10, 0xb0, + 0x10, 0x62, 0x4c, 0xd2, 0x02, 0x01, 0x4a, 0x00, + 0x46, 0x04, 0x00, 0x08, 0x02, 0x00, 0x20, 0x80, + 0x00, 0x80, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0xd8, 0x6f, 0x15, 0x02, 0x08, 0x00, + // Entry 340 - 37F + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, + 0x00, 0x10, 0x00, 0x00, 0x00, 0xf0, 0x84, 0xe3, + 0xdd, 0xbf, 0xf9, 0xf9, 0x3b, 0x7f, 0x7f, 0xdb, + 0xfd, 0xfc, 0xfe, 0xdf, 0xff, 0xfd, 0xff, 0xf6, + 0xfb, 0xfc, 0xf7, 0x1f, 0xff, 0xb3, 0x6c, 0xff, + 0xd9, 0xad, 0xdf, 0xfe, 0xef, 0xba, 0xdf, 0xff, + 0xff, 0xff, 0xb7, 0xdd, 0x7d, 0xbf, 0xab, 0x7f, + 0xfd, 0xfd, 0xdf, 0x2f, 0x9c, 0xdf, 0xf3, 0x6f, + // Entry 380 - 3BF + 0xdf, 0xdd, 0xff, 0xfb, 0xee, 0xd2, 0xab, 0x5f, + 0xd5, 0xdf, 0x7f, 0xff, 0xeb, 0xff, 0xe4, 0x4d, + 0xf9, 0xff, 0xfe, 0xf7, 0xfd, 0xdf, 0xfb, 0xbf, + 0xee, 0xdb, 0x6f, 0xef, 0xff, 0x7f, 0xff, 0xff, + 0xf7, 0x5f, 0xd3, 0x3b, 0xfd, 0xd9, 0xdf, 0xeb, + 0xbc, 0x08, 0x05, 0x24, 0xff, 0x07, 0x70, 0xfe, + 0xe6, 0x5e, 0x00, 0x08, 0x00, 0x83, 0x7d, 0x1f, + 0x06, 0xe6, 0x72, 0x60, 0xd1, 0x3c, 0x7f, 0x44, + // Entry 3C0 - 3FF + 0x02, 0x30, 0x9f, 0x7a, 0x16, 0xbd, 0x7f, 0x57, + 0xf2, 0xff, 0x31, 0xff, 0xf2, 0x1e, 0x90, 0xf7, + 0xf1, 0xf9, 0x45, 0x80, 0x01, 0x02, 0x00, 0x20, + 0x40, 0x54, 0x9f, 0x8a, 0xdf, 0xf9, 0x6e, 0x11, + 0x86, 0x51, 0xc0, 0xf3, 0xfb, 0x47, 0x40, 0x03, + 0x05, 0xd1, 0x50, 0x5c, 0x00, 0x40, 0x00, 0x10, + 0x04, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x17, 0xd2, + 0xb9, 0xfd, 0xfc, 0xba, 0xfe, 0xef, 0xc7, 0xbe, + // Entry 400 - 43F + 0x53, 0x6f, 0xdf, 0xe7, 0xdb, 0x65, 0xbb, 0x7f, + 0xfa, 0xff, 0x77, 0xf3, 0xef, 0xbf, 0xfd, 0xf7, + 0xdf, 0xdf, 0x9b, 0x7f, 0xff, 0xff, 0x7f, 0x6f, + 0xf7, 0xfb, 0xeb, 0xdf, 0xbc, 0xff, 0xbf, 0x6b, + 0x7b, 0xfb, 0xff, 0xce, 0x76, 0xbd, 0xf7, 0xf7, + 0xdf, 0xdc, 0xf7, 0xf7, 0xff, 0xdf, 0xf3, 0xfe, + 0xef, 0xff, 0xff, 0xff, 0xb6, 0x7f, 0x7f, 0xde, + 0xf7, 0xb9, 0xeb, 0x77, 0xff, 0xfb, 0xbf, 0xdf, + // Entry 440 - 47F + 0xfd, 0xfe, 0xfb, 0xff, 0xfe, 0xeb, 0x1f, 0x7d, + 0x2f, 0xfd, 0xb6, 0xb5, 0xa5, 0xfc, 0xff, 0xfd, + 0x7f, 0x4e, 0xbf, 0x8f, 0xae, 0xff, 0xee, 0xdf, + 0x7f, 0xf7, 0x73, 0x02, 0x02, 0x04, 0xfc, 0xf7, + 0xff, 0xb7, 0xd7, 0xef, 0xfe, 0xcd, 0xf5, 0xce, + 0xe2, 0x8e, 0xe7, 0xbf, 0xb7, 0xff, 0x56, 0xfd, + 0xcd, 0xff, 0xfb, 0xff, 0xdf, 0xd7, 0xea, 0xff, + 0xe5, 0x5f, 0x6d, 0x0f, 0xa7, 0x51, 0x06, 0xc4, + // Entry 480 - 4BF + 0x93, 0x50, 0x5d, 0xaf, 0xa6, 0xff, 0x99, 0xfb, + 0x63, 0x1d, 0x53, 0xff, 0xef, 0xb7, 0x35, 0x20, + 0x14, 0x00, 0x55, 0x51, 0xc2, 0x65, 0xf5, 0x41, + 0xe2, 0xff, 0xfc, 0xdf, 0x02, 0x85, 0xc5, 0x05, + 0x00, 0x22, 0x00, 0x74, 0x69, 0x10, 0x08, 0x05, + 0x41, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x51, 0x20, 0x05, 0x04, 0x01, 0x00, 0x00, + 0x06, 0x11, 0x20, 0x00, 0x18, 0x01, 0x92, 0xf1, + // Entry 4C0 - 4FF + 0xfd, 0x47, 0x69, 0x06, 0x95, 0x06, 0x57, 0xed, + 0xfb, 0x4d, 0x1c, 0x6b, 0x83, 0x04, 0x62, 0x40, + 0x00, 0x11, 0x42, 0x00, 0x00, 0x00, 0x54, 0x83, + 0xb8, 0x4f, 0x10, 0x8e, 0x89, 0x46, 0xde, 0xf7, + 0x13, 0x31, 0x00, 0x20, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x00, + 0x01, 0x00, 0x00, 0xf0, 0x5b, 0xf4, 0xbe, 0x3d, + 0xbe, 0xcf, 0xf7, 0xaf, 0x42, 0x04, 0x84, 0x41, + // Entry 500 - 53F + 0x30, 0xff, 0x79, 0x72, 0x04, 0x00, 0x00, 0x49, + 0x2d, 0x14, 0x27, 0x5f, 0xed, 0xf1, 0x3f, 0xe7, + 0x3f, 0x00, 0x00, 0x02, 0xc6, 0xa0, 0x1e, 0xf8, + 0xbb, 0xff, 0xfd, 0xfb, 0xb7, 0xfd, 0xe7, 0xf7, + 0xfd, 0xfc, 0xd5, 0xed, 0x47, 0xf4, 0x7e, 0x10, + 0x01, 0x01, 0x84, 0x6d, 0xff, 0xf7, 0xdd, 0xf9, + 0x5b, 0x05, 0x86, 0xed, 0xf5, 0x77, 0xbd, 0x3c, + 0x00, 0x00, 0x00, 0x42, 0x71, 0x42, 0x00, 0x40, + // Entry 540 - 57F + 0x00, 0x00, 0x01, 0x43, 0x19, 0x24, 0x08, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + // Entry 580 - 5BF + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xab, 0xbd, 0xe7, 0x57, 0xee, 0x13, 0x5d, + 0x09, 0xc1, 0x40, 0x21, 0xfa, 0x17, 0x01, 0x80, + 0x00, 0x00, 0x00, 0x00, 0xf0, 0xce, 0xfb, 0xbf, + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x30, 0x15, 0xa3, 0x10, 0x00, 0x00, 0x00, + 0x11, 0x04, 0x16, 0x00, 0x00, 0x02, 0x20, 0x81, + 0xa3, 0x01, 0x50, 0x00, 0x00, 0x83, 0x11, 0x40, + // Entry 5C0 - 5FF + 0x00, 0x00, 0x00, 0xf0, 0xdd, 0x7b, 0xbe, 0x02, + 0xaa, 0x10, 0x5d, 0x98, 0x52, 0x00, 0x80, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x02, + 0x3d, 0x40, 0x10, 0x02, 0x10, 0x61, 0x5a, 0x9d, + 0x31, 0x00, 0x00, 0x00, 0x01, 0x18, 0x02, 0x20, + 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x20, 0x00, + 0x00, 0x1f, 0xdf, 0xd2, 0xb9, 0xff, 0xfd, 0x3f, + 0x1f, 0x98, 0xcf, 0x9c, 0xff, 0xaf, 0x5f, 0xfe, + // Entry 600 - 63F + 0x7b, 0x4b, 0x40, 0x10, 0xe1, 0xfd, 0xaf, 0xd9, + 0xb7, 0xf6, 0xfb, 0xb3, 0xc7, 0xff, 0x6f, 0xf1, + 0x73, 0xb1, 0x7f, 0x9f, 0x7f, 0xbd, 0xfc, 0xb7, + 0xee, 0x1c, 0xfa, 0xcb, 0xef, 0xdd, 0xf9, 0xbd, + 0x6e, 0xae, 0x55, 0xfd, 0x6e, 0x81, 0x76, 0x9f, + 0xd4, 0x77, 0xf5, 0x7d, 0xfb, 0xff, 0xeb, 0xfe, + 0xbe, 0x5f, 0x46, 0x5b, 0xe9, 0x5f, 0x50, 0x18, + 0x02, 0xfa, 0xf7, 0x9d, 0x15, 0x97, 0x05, 0x0f, + // Entry 640 - 67F + 0x75, 0xc4, 0x7d, 0x81, 0x92, 0xf5, 0x57, 0x6c, + 0xff, 0xe4, 0xef, 0x6f, 0xff, 0xfc, 0xdd, 0xde, + 0xfc, 0xfd, 0x76, 0x5f, 0x7a, 0x3f, 0x00, 0x98, + 0x02, 0xfb, 0xa3, 0xef, 0xf3, 0xd6, 0xf2, 0xff, + 0xb9, 0xda, 0x7d, 0xd0, 0x3e, 0x15, 0x7b, 0xb4, + 0xf5, 0x3e, 0xff, 0xff, 0xf1, 0xf7, 0xff, 0xe7, + 0x5f, 0xff, 0xff, 0x9e, 0xdf, 0xf6, 0xd7, 0xb9, + 0xef, 0x27, 0x80, 0xbb, 0xc5, 0xff, 0xff, 0xe3, + // Entry 680 - 6BF + 0x97, 0x9d, 0xbf, 0x9f, 0xf7, 0xc7, 0xfd, 0x37, + 0xce, 0x7f, 0x44, 0x1d, 0x73, 0x7f, 0xf8, 0xda, + 0x5d, 0xce, 0x7d, 0x06, 0xb9, 0xea, 0x79, 0xa0, + 0x1a, 0x20, 0x00, 0x30, 0x02, 0x04, 0x24, 0x08, + 0x04, 0x00, 0x00, 0x40, 0xd4, 0x02, 0x04, 0x00, + 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x09, 0x06, + 0x50, 0x00, 0x08, 0x00, 0x00, 0x00, 0x24, 0x00, + 0x04, 0x00, 0x10, 0xdc, 0x58, 0xd7, 0x0d, 0x0f, + // Entry 6C0 - 6FF + 0x54, 0x4d, 0xf1, 0x16, 0x44, 0xd5, 0x42, 0x08, + 0x40, 0x02, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00, + 0x00, 0xdc, 0xfb, 0xcb, 0x0e, 0x58, 0x48, 0x41, + 0x24, 0x20, 0x04, 0x00, 0x30, 0x12, 0x40, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x80, 0x10, 0x10, 0xab, + 0x6d, 0x93, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x80, 0x25, 0x00, 0x00, + // Entry 700 - 73F + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x80, 0x86, 0xc2, 0x00, 0x00, 0x01, 0x00, 0x01, + 0xff, 0x18, 0x02, 0x00, 0x02, 0xf0, 0xfd, 0x79, + 0x3b, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x03, 0x00, 0x09, 0x20, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 740 - 77F + 0x00, 0x00, 0x00, 0xef, 0xd5, 0xfd, 0xcf, 0x7e, + 0xb0, 0x11, 0x00, 0x00, 0x00, 0x92, 0x01, 0x46, + 0xcd, 0xf9, 0x5c, 0x00, 0x01, 0x00, 0x30, 0x04, + 0x04, 0x55, 0x00, 0x01, 0x04, 0xf4, 0x3f, 0x4a, + 0x01, 0x00, 0x00, 0xb0, 0x80, 0x20, 0x55, 0x75, + 0x97, 0x7c, 0xdf, 0x31, 0xcc, 0x68, 0xd1, 0x03, + 0xd5, 0x57, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x2c, 0xf7, 0xcb, 0x1f, 0x14, 0x60, + // Entry 780 - 7BF + 0x83, 0x68, 0x01, 0x10, 0x8b, 0x38, 0x8a, 0x01, + 0x00, 0x00, 0x20, 0x00, 0x24, 0x44, 0x00, 0x00, + 0x10, 0x03, 0x31, 0x02, 0x01, 0x00, 0x00, 0xf0, + 0xf5, 0xff, 0xd5, 0x97, 0xbc, 0x70, 0xd6, 0x78, + 0x78, 0x15, 0x50, 0x05, 0xa4, 0x84, 0xa9, 0x41, + 0x00, 0x00, 0x00, 0x6b, 0x39, 0x52, 0x74, 0x40, + 0xe8, 0x30, 0x90, 0x6a, 0x92, 0x00, 0x00, 0x02, + 0xff, 0xef, 0xff, 0x4b, 0x85, 0x53, 0xf4, 0xed, + // Entry 7C0 - 7FF + 0xdd, 0xbf, 0xf2, 0x5d, 0xc7, 0x0c, 0xd5, 0x42, + 0xfc, 0xff, 0xf7, 0x1f, 0x00, 0x80, 0x40, 0x56, + 0xcc, 0x16, 0x9e, 0xea, 0x35, 0x7d, 0xef, 0xff, + 0xbd, 0xa4, 0xaf, 0x01, 0x44, 0x18, 0x01, 0x4d, + 0x4e, 0x4a, 0x08, 0x50, 0x28, 0x30, 0xe0, 0x80, + 0x10, 0x20, 0x24, 0x00, 0xff, 0x2f, 0xd3, 0x60, + 0xfe, 0x01, 0x02, 0x88, 0x2a, 0x40, 0x16, 0x01, + 0x01, 0x15, 0x2b, 0x3c, 0x01, 0x00, 0x00, 0x10, + // Entry 800 - 83F + 0x90, 0x49, 0x41, 0x02, 0x02, 0x01, 0xe1, 0xbf, + 0xbf, 0x03, 0x00, 0x00, 0x10, 0xdc, 0xa3, 0xd1, + 0x40, 0x9c, 0x44, 0xdf, 0xf5, 0x8f, 0x66, 0xb3, + 0x55, 0x20, 0xd4, 0xc1, 0xd8, 0x30, 0x3d, 0x80, + 0x00, 0x00, 0x00, 0x04, 0xd4, 0x11, 0xc5, 0x84, + 0x2f, 0x50, 0x00, 0x22, 0x50, 0x6e, 0xbd, 0x93, + 0x07, 0x00, 0x20, 0x10, 0x84, 0xb2, 0x45, 0x10, + 0x06, 0x44, 0x00, 0x00, 0x12, 0x02, 0x11, 0x00, + // Entry 840 - 87F + 0xf0, 0xfb, 0xfd, 0x7f, 0x05, 0x00, 0x16, 0x89, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x02, 0x28, + 0x84, 0x00, 0x21, 0xc0, 0x23, 0x24, 0x00, 0x00, + 0x00, 0xcb, 0xe4, 0x3a, 0x46, 0x88, 0x54, 0xf1, + 0xef, 0xff, 0x7f, 0x12, 0x01, 0x01, 0x84, 0x50, + 0x07, 0xfc, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x40, + 0x10, 0x38, 0x01, 0x01, 0x1c, 0x12, 0x40, 0xe1, + // Entry 880 - 8BF + 0x76, 0x16, 0x08, 0x03, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x24, + 0x0a, 0x00, 0x80, 0x00, 0x00, +} + +// altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives +// to 2-letter language codes that cannot be derived using the method described above. +// Each 3-letter code is followed by its 1-byte langID. +const altLangISO3 tag.Index = "---\x00cor\x00hbs\x01heb\x02kin\x03spa\x04yid\x05\xff\xff\xff\xff" + +// altLangIndex is used to convert indexes in altLangISO3 to langIDs. +// Size: 12 bytes, 6 elements +var altLangIndex = [6]uint16{ + 0x0281, 0x0407, 0x01fb, 0x03e5, 0x013e, 0x0208, +} + +// AliasMap maps langIDs to their suggested replacements. +// Size: 772 bytes, 193 elements +var AliasMap = [193]FromTo{ + 0: {From: 0x82, To: 0x88}, + 1: {From: 0x187, To: 0x1ae}, + 2: {From: 0x1f3, To: 0x1e1}, + 3: {From: 0x1fb, To: 0x1bc}, + 4: {From: 0x208, To: 0x512}, + 5: {From: 0x20f, To: 0x20e}, + 6: {From: 0x310, To: 0x3dc}, + 7: {From: 0x347, To: 0x36f}, + 8: {From: 0x407, To: 0x432}, + 9: {From: 0x47a, To: 0x153}, + 10: {From: 0x490, To: 0x451}, + 11: {From: 0x4a2, To: 0x21}, + 12: {From: 0x53e, To: 0x544}, + 13: {From: 0x58f, To: 0x12d}, + 14: {From: 0x62b, To: 0x34}, + 15: {From: 0x62f, To: 0x14}, + 16: {From: 0x630, To: 0x1eb1}, + 17: {From: 0x651, To: 0x431}, + 18: {From: 0x662, To: 0x431}, + 19: {From: 0x6ed, To: 0x3a}, + 20: {From: 0x6f8, To: 0x1d7}, + 21: {From: 0x709, To: 0x3625}, + 22: {From: 0x73e, To: 0x21a1}, + 23: {From: 0x7b3, To: 0x56}, + 24: {From: 0x7b9, To: 0x299b}, + 25: {From: 0x7c5, To: 0x58}, + 26: {From: 0x7e6, To: 0x145}, + 27: {From: 0x80c, To: 0x5a}, + 28: {From: 0x815, To: 0x8d}, + 29: {From: 0x87e, To: 0x810}, + 30: {From: 0x8a8, To: 0x8b7}, + 31: {From: 0x8c3, To: 0xee3}, + 32: {From: 0x8fa, To: 0x1dc}, + 33: {From: 0x9ef, To: 0x331}, + 34: {From: 0xa36, To: 0x2c5}, + 35: {From: 0xa3d, To: 0xbf}, + 36: {From: 0xabe, To: 0x3322}, + 37: {From: 0xb38, To: 0x529}, + 38: {From: 0xb75, To: 0x265a}, + 39: {From: 0xb7e, To: 0xbc3}, + 40: {From: 0xb9b, To: 0x44e}, + 41: {From: 0xbbc, To: 0x4229}, + 42: {From: 0xbbf, To: 0x529}, + 43: {From: 0xbfe, To: 0x2da7}, + 44: {From: 0xc2e, To: 0x3181}, + 45: {From: 0xcb9, To: 0xf3}, + 46: {From: 0xd08, To: 0xfa}, + 47: {From: 0xdc8, To: 0x11a}, + 48: {From: 0xdd7, To: 0x32d}, + 49: {From: 0xdf8, To: 0xdfb}, + 50: {From: 0xdfe, To: 0x531}, + 51: {From: 0xe01, To: 0xdf3}, + 52: {From: 0xedf, To: 0x205a}, + 53: {From: 0xee9, To: 0x222e}, + 54: {From: 0xeee, To: 0x2e9a}, + 55: {From: 0xf39, To: 0x367}, + 56: {From: 0x10d0, To: 0x140}, + 57: {From: 0x1104, To: 0x2d0}, + 58: {From: 0x11a0, To: 0x1ec}, + 59: {From: 0x1279, To: 0x21}, + 60: {From: 0x1424, To: 0x15e}, + 61: {From: 0x1470, To: 0x14e}, + 62: {From: 0x151f, To: 0xd9b}, + 63: {From: 0x1523, To: 0x390}, + 64: {From: 0x1532, To: 0x19f}, + 65: {From: 0x1580, To: 0x210}, + 66: {From: 0x1583, To: 0x10d}, + 67: {From: 0x15a3, To: 0x3caf}, + 68: {From: 0x1630, To: 0x222e}, + 69: {From: 0x166a, To: 0x19b}, + 70: {From: 0x16c8, To: 0x136}, + 71: {From: 0x1700, To: 0x29f8}, + 72: {From: 0x1718, To: 0x194}, + 73: {From: 0x1727, To: 0xf3f}, + 74: {From: 0x177a, To: 0x178}, + 75: {From: 0x1809, To: 0x17b6}, + 76: {From: 0x1816, To: 0x18f3}, + 77: {From: 0x188a, To: 0x436}, + 78: {From: 0x1979, To: 0x1d01}, + 79: {From: 0x1a74, To: 0x2bb0}, + 80: {From: 0x1a8a, To: 0x1f8}, + 81: {From: 0x1b5a, To: 0x1fa}, + 82: {From: 0x1b86, To: 0x1515}, + 83: {From: 0x1d64, To: 0x2c9b}, + 84: {From: 0x2038, To: 0x37b1}, + 85: {From: 0x203d, To: 0x20dd}, + 86: {From: 0x2042, To: 0x2e00}, + 87: {From: 0x205a, To: 0x30b}, + 88: {From: 0x20e3, To: 0x274}, + 89: {From: 0x20ee, To: 0x263}, + 90: {From: 0x20f2, To: 0x22d}, + 91: {From: 0x20f9, To: 0x256}, + 92: {From: 0x210f, To: 0x21eb}, + 93: {From: 0x2135, To: 0x27d}, + 94: {From: 0x2160, To: 0x913}, + 95: {From: 0x2199, To: 0x121}, + 96: {From: 0x21ce, To: 0x1561}, + 97: {From: 0x21e6, To: 0x504}, + 98: {From: 0x21f4, To: 0x49f}, + 99: {From: 0x21fb, To: 0x269}, + 100: {From: 0x222d, To: 0x121}, + 101: {From: 0x2237, To: 0x121}, + 102: {From: 0x2248, To: 0x217d}, + 103: {From: 0x2262, To: 0x92a}, + 104: {From: 0x2316, To: 0x3226}, + 105: {From: 0x236a, To: 0x2835}, + 106: {From: 0x2382, To: 0x3365}, + 107: {From: 0x2472, To: 0x2c7}, + 108: {From: 0x24e4, To: 0x2ff}, + 109: {From: 0x24f0, To: 0x2fa}, + 110: {From: 0x24fa, To: 0x31f}, + 111: {From: 0x2550, To: 0xb5b}, + 112: {From: 0x25a9, To: 0xe2}, + 113: {From: 0x263e, To: 0x2d0}, + 114: {From: 0x26c9, To: 0x26b4}, + 115: {From: 0x26f9, To: 0x3c8}, + 116: {From: 0x2727, To: 0x3caf}, + 117: {From: 0x2755, To: 0x6a4}, + 118: {From: 0x2765, To: 0x26b4}, + 119: {From: 0x2789, To: 0x4358}, + 120: {From: 0x27c9, To: 0x2001}, + 121: {From: 0x28ea, To: 0x27b1}, + 122: {From: 0x28ef, To: 0x2837}, + 123: {From: 0x28fe, To: 0xaa5}, + 124: {From: 0x2914, To: 0x351}, + 125: {From: 0x2986, To: 0x2da7}, + 126: {From: 0x29f0, To: 0x96b}, + 127: {From: 0x2b1a, To: 0x38d}, + 128: {From: 0x2bfc, To: 0x395}, + 129: {From: 0x2c3f, To: 0x3caf}, + 130: {From: 0x2ce1, To: 0x2201}, + 131: {From: 0x2cfc, To: 0x3be}, + 132: {From: 0x2d13, To: 0x597}, + 133: {From: 0x2d47, To: 0x148}, + 134: {From: 0x2d48, To: 0x148}, + 135: {From: 0x2dff, To: 0x2f1}, + 136: {From: 0x2e08, To: 0x19cc}, + 137: {From: 0x2e10, To: 0xc45}, + 138: {From: 0x2e1a, To: 0x2d95}, + 139: {From: 0x2e21, To: 0x292}, + 140: {From: 0x2e54, To: 0x7d}, + 141: {From: 0x2e65, To: 0x2282}, + 142: {From: 0x2e97, To: 0x1a4}, + 143: {From: 0x2ea0, To: 0x2e9b}, + 144: {From: 0x2eef, To: 0x2ed7}, + 145: {From: 0x3193, To: 0x3c4}, + 146: {From: 0x3366, To: 0x338e}, + 147: {From: 0x342a, To: 0x3dc}, + 148: {From: 0x34ee, To: 0x18d0}, + 149: {From: 0x35c8, To: 0x2c9b}, + 150: {From: 0x35e6, To: 0x412}, + 151: {From: 0x35f5, To: 0x24b}, + 152: {From: 0x360d, To: 0x1dc}, + 153: {From: 0x3658, To: 0x246}, + 154: {From: 0x3676, To: 0x3f4}, + 155: {From: 0x36fd, To: 0x445}, + 156: {From: 0x3747, To: 0x3b42}, + 157: {From: 0x37c0, To: 0x121}, + 158: {From: 0x3816, To: 0x38f2}, + 159: {From: 0x382a, To: 0x2b48}, + 160: {From: 0x382b, To: 0x2c9b}, + 161: {From: 0x382f, To: 0xa9}, + 162: {From: 0x3832, To: 0x3228}, + 163: {From: 0x386c, To: 0x39a6}, + 164: {From: 0x3892, To: 0x3fc0}, + 165: {From: 0x38a0, To: 0x45f}, + 166: {From: 0x38a5, To: 0x39d7}, + 167: {From: 0x38b4, To: 0x1fa4}, + 168: {From: 0x38b5, To: 0x2e9a}, + 169: {From: 0x38fa, To: 0x38f1}, + 170: {From: 0x395c, To: 0x47e}, + 171: {From: 0x3b4e, To: 0xd91}, + 172: {From: 0x3b78, To: 0x137}, + 173: {From: 0x3c99, To: 0x4bc}, + 174: {From: 0x3fbd, To: 0x100}, + 175: {From: 0x4208, To: 0xa91}, + 176: {From: 0x42be, To: 0x573}, + 177: {From: 0x42f9, To: 0x3f60}, + 178: {From: 0x4378, To: 0x25a}, + 179: {From: 0x43b8, To: 0xe6c}, + 180: {From: 0x43cd, To: 0x10f}, + 181: {From: 0x43d4, To: 0x4848}, + 182: {From: 0x44af, To: 0x3322}, + 183: {From: 0x44e3, To: 0x512}, + 184: {From: 0x45ca, To: 0x2409}, + 185: {From: 0x45dd, To: 0x26dc}, + 186: {From: 0x4610, To: 0x48ae}, + 187: {From: 0x46ae, To: 0x46a0}, + 188: {From: 0x473e, To: 0x4745}, + 189: {From: 0x4817, To: 0x3503}, + 190: {From: 0x483b, To: 0x208b}, + 191: {From: 0x4916, To: 0x31f}, + 192: {From: 0x49a7, To: 0x523}, +} + +// Size: 193 bytes, 193 elements +var AliasTypes = [193]AliasType{ + // Entry 0 - 3F + 1, 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 1, 0, 0, 0, 0, + 1, 2, 1, 1, 2, 0, 0, 1, 0, 1, 2, 1, 1, 0, 0, 0, + 0, 2, 1, 1, 0, 2, 0, 0, 1, 0, 1, 0, 0, 1, 2, 1, + 1, 1, 1, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 1, 0, 1, + // Entry 40 - 7F + 1, 2, 2, 0, 0, 1, 2, 0, 1, 0, 1, 1, 1, 1, 0, 0, + 2, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 2, 2, 0, + 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, + // Entry 80 - BF + 1, 0, 0, 1, 0, 2, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 1, 1, 2, 0, 0, 2, 0, 0, 1, 1, 1, 0, 0, 0, 0, + 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 2, 0, + 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, + // Entry C0 - FF + 1, +} + +const ( + _Latn = 91 + _Hani = 57 + _Hans = 59 + _Hant = 60 + _Qaaa = 149 + _Qaai = 157 + _Qabx = 198 + _Zinh = 255 + _Zyyy = 260 + _Zzzz = 261 +) + +// script is an alphabetically sorted list of ISO 15924 codes. The index +// of the script in the string, divided by 4, is the internal scriptID. +const script tag.Index = "" + // Size: 1052 bytes + "----AdlmAfakAghbAhomArabAranArmiArmnAvstBaliBamuBassBatkBengBhksBlisBopo" + + "BrahBraiBugiBuhdCakmCansCariChamCherChrsCirtCoptCpmnCprtCyrlCyrsDevaDiak" + + "DogrDsrtDuplEgydEgyhEgypElbaElymEthiGeokGeorGlagGongGonmGothGranGrekGujr" + + "GuruHanbHangHaniHanoHansHantHatrHebrHiraHluwHmngHmnpHrktHungIndsItalJamo" + + "JavaJpanJurcKaliKanaKawiKharKhmrKhojKitlKitsKndaKoreKpelKthiLanaLaooLatf" + + "LatgLatnLekeLepcLimbLinaLinbLisuLomaLyciLydiMahjMakaMandManiMarcMayaMedf" + + "MendMercMeroMlymModiMongMoonMrooMteiMultMymrNagmNandNarbNbatNewaNkdbNkgb" + + "NkooNshuOgamOlckOrkhOryaOsgeOsmaOugrPalmPaucPcunPelmPermPhagPhliPhlpPhlv" + + "PhnxPiqdPlrdPrtiPsinQaaaQaabQaacQaadQaaeQaafQaagQaahQaaiQaajQaakQaalQaam" + + "QaanQaaoQaapQaaqQaarQaasQaatQaauQaavQaawQaaxQaayQaazQabaQabbQabcQabdQabe" + + "QabfQabgQabhQabiQabjQabkQablQabmQabnQaboQabpQabqQabrQabsQabtQabuQabvQabw" + + "QabxRanjRjngRohgRoroRunrSamrSaraSarbSaurSgnwShawShrdShuiSiddSindSinhSogd" + + "SogoSoraSoyoSundSunuSyloSyrcSyreSyrjSyrnTagbTakrTaleTaluTamlTangTavtTelu" + + "TengTfngTglgThaaThaiTibtTirhTnsaTotoUgarVaiiVispVithWaraWchoWoleXpeoXsux" + + "YeziYiiiZanbZinhZmthZsyeZsymZxxxZyyyZzzz\xff\xff\xff\xff" + +// suppressScript is an index from langID to the dominant script for that language, +// if it exists. If a script is given, it should be suppressed from the language tag. +// Size: 1330 bytes, 1330 elements +var suppressScript = [1330]uint8{ + // Entry 0 - 3F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 40 - 7F + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, + // Entry 80 - BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry C0 - FF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 100 - 13F + 0x5b, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xed, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, + 0x00, 0x5b, 0x00, 0x00, 0x5b, 0x00, 0x5b, 0x00, + // Entry 140 - 17F + 0x5b, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, + 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, + 0x00, 0x5b, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5b, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 180 - 1BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5b, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x5b, 0x35, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x22, 0x00, + // Entry 1C0 - 1FF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x5b, 0x5b, 0x00, 0x5b, 0x5b, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, + 0x5b, 0x5b, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, + // Entry 200 - 23F + 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 240 - 27F + 0x00, 0x00, 0x20, 0x00, 0x00, 0x5b, 0x00, 0x00, + 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x53, 0x00, 0x00, 0x54, 0x00, 0x22, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 280 - 2BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, + 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 2C0 - 2FF + 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + // Entry 300 - 33F + 0x00, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x5b, + 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, + // Entry 340 - 37F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, + 0x5b, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5b, 0x00, + 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 380 - 3BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5b, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, + // Entry 3C0 - 3FF + 0x5b, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, + 0x00, 0x5b, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x5b, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 400 - 43F + 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5b, 0x00, + 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, + // Entry 440 - 47F + 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5b, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe9, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x2c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5b, 0x00, + // Entry 480 - 4BF + 0x5b, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5b, 0x00, + 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5b, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 4C0 - 4FF + 0x5b, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 500 - 53F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, + 0x00, 0x00, +} + +const ( + _001 = 1 + _419 = 31 + _BR = 65 + _CA = 73 + _ES = 111 + _GB = 124 + _MD = 189 + _PT = 239 + _UK = 307 + _US = 310 + _ZZ = 358 + _XA = 324 + _XC = 326 + _XK = 334 +) + +// isoRegionOffset needs to be added to the index of regionISO to obtain the regionID +// for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for +// the UN.M49 codes used for groups.) +const isoRegionOffset = 32 + +// regionTypes defines the status of a region for various standards. +// Size: 359 bytes, 359 elements +var regionTypes = [359]uint8{ + // Entry 0 - 3F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry 40 - 7F + 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, 0x06, + 0x04, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x04, 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x00, + 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x00, 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry 80 - BF + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x00, 0x04, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry C0 - FF + 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x00, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x04, + 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x00, 0x06, 0x06, 0x00, 0x06, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + // Entry 100 - 13F + 0x05, 0x05, 0x05, 0x06, 0x00, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x02, 0x06, 0x04, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, + // Entry 140 - 17F + 0x06, 0x06, 0x00, 0x06, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x06, + 0x06, 0x04, 0x06, 0x06, 0x04, 0x06, 0x05, +} + +// regionISO holds a list of alphabetically sorted 2-letter ISO region codes. +// Each 2-letter codes is followed by two bytes with the following meaning: +// - [A-Z}{2}: the first letter of the 2-letter code plus these two +// letters form the 3-letter ISO code. +// - 0, n: index into altRegionISO3. +const regionISO tag.Index = "" + // Size: 1312 bytes + "AAAAACSCADNDAEREAFFGAGTGAIIAALLBAMRMANNTAOGOAQTAARRGASSMATUTAUUSAWBWAXLA" + + "AZZEBAIHBBRBBDGDBEELBFFABGGRBHHRBIDIBJENBLLMBMMUBNRNBOOLBQESBRRABSHSBTTN" + + "BUURBVVTBWWABYLRBZLZCAANCCCKCDODCFAFCGOGCHHECIIVCKOKCLHLCMMRCNHNCOOLCPPT" + + "CQ CRRICS\x00\x00CTTECUUBCVPVCWUWCXXRCYYPCZZEDDDRDEEUDGGADJJIDKNKDMMADO" + + "OMDYHYDZZAEA ECCUEESTEGGYEHSHERRIESSPETTHEU\x00\x03EZ FIINFJJIFKLKFMSM" + + "FOROFQ\x00\x18FRRAFXXXGAABGBBRGDRDGEEOGFUFGGGYGHHAGIIBGLRLGMMBGNINGPLPGQ" + + "NQGRRCGS\x00\x06GTTMGUUMGWNBGYUYHKKGHMMDHNNDHRRVHTTIHUUNHVVOIC IDDNIERL" + + "ILSRIMMNINNDIOOTIQRQIRRNISSLITTAJEEYJMAMJOORJPPNJTTNKEENKGGZKHHMKIIRKM" + + "\x00\x09KNNAKP\x00\x0cKRORKWWTKY\x00\x0fKZAZLAAOLBBNLCCALIIELKKALRBRLSSO" + + "LTTULUUXLVVALYBYMAARMCCOMDDAMENEMFAFMGDGMHHLMIIDMKKDMLLIMMMRMNNGMOACMPNP" + + "MQTQMRRTMSSRMTLTMUUSMVDVMWWIMXEXMYYSMZOZNAAMNCCLNEERNFFKNGGANHHBNIICNLLD" + + "NOORNPPLNQ\x00\x1eNRRUNTTZNUIUNZZLOMMNPAANPCCIPEERPFYFPGNGPHHLPKAKPLOLPM" + + "\x00\x12PNCNPRRIPSSEPTRTPUUSPWLWPYRYPZCZQAATQMMMQNNNQOOOQPPPQQQQQRRRQSSS" + + "QTTTQU\x00\x03QVVVQWWWQXXXQYYYQZZZREEURHHOROOURS\x00\x15RUUSRWWASAAUSBLB" + + "SCYCSDDNSEWESGGPSHHNSIVNSJJMSKVKSLLESMMRSNENSOOMSRURSSSDSTTPSUUNSVLVSXXM" + + "SYYRSZWZTAAATCCATDCDTF\x00\x18TGGOTHHATJJKTKKLTLLSTMKMTNUNTOONTPMPTRURTT" + + "TOTVUVTWWNTZZAUAKRUGGAUK UMMIUN USSAUYRYUZZBVAATVCCTVDDRVEENVGGBVIIRVN" + + "NMVUUTWFLFWKAKWSSMXAAAXBBBXCCCXDDDXEEEXFFFXGGGXHHHXIIIXJJJXKKKXLLLXMMMXN" + + "NNXOOOXPPPXQQQXRRRXSSSXTTTXUUUXVVVXWWWXXXXXYYYXZZZYDMDYEEMYT\x00\x1bYUUG" + + "ZAAFZMMBZRARZWWEZZZZ\xff\xff\xff\xff" + +// altRegionISO3 holds a list of 3-letter region codes that cannot be +// mapped to 2-letter codes using the default algorithm. This is a short list. +const altRegionISO3 string = "SCGQUUSGSCOMPRKCYMSPMSRBATFMYTATN" + +// altRegionIDs holds a list of regionIDs the positions of which match those +// of the 3-letter ISO codes in altRegionISO3. +// Size: 22 bytes, 11 elements +var altRegionIDs = [11]uint16{ + 0x0058, 0x0071, 0x0089, 0x00a9, 0x00ab, 0x00ae, 0x00eb, 0x0106, + 0x0122, 0x0160, 0x00dd, +} + +// Size: 80 bytes, 20 elements +var regionOldMap = [20]FromTo{ + 0: {From: 0x44, To: 0xc5}, + 1: {From: 0x59, To: 0xa8}, + 2: {From: 0x60, To: 0x61}, + 3: {From: 0x67, To: 0x3b}, + 4: {From: 0x7a, To: 0x79}, + 5: {From: 0x94, To: 0x37}, + 6: {From: 0xa4, To: 0x134}, + 7: {From: 0xc2, To: 0x134}, + 8: {From: 0xd8, To: 0x140}, + 9: {From: 0xdd, To: 0x2b}, + 10: {From: 0xf0, To: 0x134}, + 11: {From: 0xf3, To: 0xe3}, + 12: {From: 0xfd, To: 0x71}, + 13: {From: 0x104, To: 0x165}, + 14: {From: 0x12b, To: 0x127}, + 15: {From: 0x133, To: 0x7c}, + 16: {From: 0x13b, To: 0x13f}, + 17: {From: 0x142, To: 0x134}, + 18: {From: 0x15e, To: 0x15f}, + 19: {From: 0x164, To: 0x4b}, +} + +// m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are +// codes indicating collections of regions. +// Size: 718 bytes, 359 elements +var m49 = [359]int16{ + // Entry 0 - 3F + 0, 1, 2, 3, 5, 9, 11, 13, + 14, 15, 17, 18, 19, 21, 29, 30, + 34, 35, 39, 53, 54, 57, 61, 142, + 143, 145, 150, 151, 154, 155, 202, 419, + 958, 0, 20, 784, 4, 28, 660, 8, + 51, 530, 24, 10, 32, 16, 40, 36, + 533, 248, 31, 70, 52, 50, 56, 854, + 100, 48, 108, 204, 652, 60, 96, 68, + // Entry 40 - 7F + 535, 76, 44, 64, 104, 74, 72, 112, + 84, 124, 166, 180, 140, 178, 756, 384, + 184, 152, 120, 156, 170, 0, 0, 188, + 891, 296, 192, 132, 531, 162, 196, 203, + 278, 276, 0, 262, 208, 212, 214, 204, + 12, 0, 218, 233, 818, 732, 232, 724, + 231, 967, 0, 246, 242, 238, 583, 234, + 0, 250, 249, 266, 826, 308, 268, 254, + // Entry 80 - BF + 831, 288, 292, 304, 270, 324, 312, 226, + 300, 239, 320, 316, 624, 328, 344, 334, + 340, 191, 332, 348, 854, 0, 360, 372, + 376, 833, 356, 86, 368, 364, 352, 380, + 832, 388, 400, 392, 581, 404, 417, 116, + 296, 174, 659, 408, 410, 414, 136, 398, + 418, 422, 662, 438, 144, 430, 426, 440, + 442, 428, 434, 504, 492, 498, 499, 663, + // Entry C0 - FF + 450, 584, 581, 807, 466, 104, 496, 446, + 580, 474, 478, 500, 470, 480, 462, 454, + 484, 458, 508, 516, 540, 562, 574, 566, + 548, 558, 528, 578, 524, 10, 520, 536, + 570, 554, 512, 591, 0, 604, 258, 598, + 608, 586, 616, 666, 612, 630, 275, 620, + 581, 585, 600, 591, 634, 959, 960, 961, + 962, 963, 964, 965, 966, 967, 968, 969, + // Entry 100 - 13F + 970, 971, 972, 638, 716, 642, 688, 643, + 646, 682, 90, 690, 729, 752, 702, 654, + 705, 744, 703, 694, 674, 686, 706, 740, + 728, 678, 810, 222, 534, 760, 748, 0, + 796, 148, 260, 768, 764, 762, 772, 626, + 795, 788, 776, 626, 792, 780, 798, 158, + 834, 804, 800, 826, 581, 0, 840, 858, + 860, 336, 670, 704, 862, 92, 850, 704, + // Entry 140 - 17F + 548, 876, 581, 882, 973, 974, 975, 976, + 977, 978, 979, 980, 981, 982, 983, 984, + 985, 986, 987, 988, 989, 990, 991, 992, + 993, 994, 995, 996, 997, 998, 720, 887, + 175, 891, 710, 894, 180, 716, 999, +} + +// m49Index gives indexes into fromM49 based on the three most significant bits +// of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in +// +// fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]] +// +// for an entry where the first 7 bits match the 7 lsb of the UN.M49 code. +// The region code is stored in the 9 lsb of the indexed value. +// Size: 18 bytes, 9 elements +var m49Index = [9]int16{ + 0, 59, 108, 143, 181, 220, 259, 291, + 333, +} + +// fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details. +// Size: 666 bytes, 333 elements +var fromM49 = [333]uint16{ + // Entry 0 - 3F + 0x0201, 0x0402, 0x0603, 0x0824, 0x0a04, 0x1027, 0x1205, 0x142b, + 0x1606, 0x1868, 0x1a07, 0x1c08, 0x1e09, 0x202d, 0x220a, 0x240b, + 0x260c, 0x2822, 0x2a0d, 0x302a, 0x3825, 0x3a0e, 0x3c0f, 0x3e32, + 0x402c, 0x4410, 0x4611, 0x482f, 0x4e12, 0x502e, 0x5842, 0x6039, + 0x6435, 0x6628, 0x6834, 0x6a13, 0x6c14, 0x7036, 0x7215, 0x783d, + 0x7a16, 0x8043, 0x883f, 0x8c33, 0x9046, 0x9445, 0x9841, 0xa848, + 0xac9b, 0xb50a, 0xb93d, 0xc03e, 0xc838, 0xd0c5, 0xd83a, 0xe047, + 0xe8a7, 0xf052, 0xf849, 0x085b, 0x10ae, 0x184c, 0x1c17, 0x1e18, + // Entry 40 - 7F + 0x20b4, 0x2219, 0x2921, 0x2c1a, 0x2e1b, 0x3051, 0x341c, 0x361d, + 0x3853, 0x3d2f, 0x445d, 0x4c4a, 0x5454, 0x5ca9, 0x5f60, 0x644d, + 0x684b, 0x7050, 0x7857, 0x7e91, 0x805a, 0x885e, 0x941e, 0x965f, + 0x983b, 0xa064, 0xa865, 0xac66, 0xb46a, 0xbd1b, 0xc487, 0xcc70, + 0xce70, 0xd06e, 0xd26b, 0xd477, 0xdc75, 0xde89, 0xe474, 0xec73, + 0xf031, 0xf27a, 0xf479, 0xfc7f, 0x04e6, 0x0922, 0x0c63, 0x147b, + 0x187e, 0x1c84, 0x26ee, 0x2861, 0x2c60, 0x3061, 0x4081, 0x4882, + 0x50a8, 0x5888, 0x6083, 0x687d, 0x7086, 0x788b, 0x808a, 0x8885, + // Entry 80 - BF + 0x908d, 0x9892, 0x9c8f, 0xa139, 0xa890, 0xb08e, 0xb893, 0xc09e, + 0xc89a, 0xd096, 0xd89d, 0xe09c, 0xe897, 0xf098, 0xf89f, 0x004f, + 0x08a1, 0x10a3, 0x1caf, 0x20a2, 0x28a5, 0x30ab, 0x34ac, 0x3cad, + 0x42a6, 0x44b0, 0x461f, 0x4cb1, 0x54b6, 0x58b9, 0x5cb5, 0x64ba, + 0x6cb3, 0x70b7, 0x74b8, 0x7cc7, 0x84c0, 0x8ccf, 0x94d1, 0x9cce, + 0xa4c4, 0xaccc, 0xb4c9, 0xbcca, 0xc0cd, 0xc8d0, 0xd8bc, 0xe0c6, + 0xe4bd, 0xe6be, 0xe8cb, 0xf0bb, 0xf8d2, 0x00e2, 0x08d3, 0x10de, + 0x18dc, 0x20da, 0x2429, 0x265c, 0x2a30, 0x2d1c, 0x2e40, 0x30df, + // Entry C0 - FF + 0x38d4, 0x4940, 0x54e1, 0x5cd9, 0x64d5, 0x6cd7, 0x74e0, 0x7cd6, + 0x84db, 0x88c8, 0x8b34, 0x8e76, 0x90c1, 0x92f1, 0x94e9, 0x9ee3, + 0xace7, 0xb0f2, 0xb8e5, 0xc0e8, 0xc8ec, 0xd0ea, 0xd8ef, 0xe08c, + 0xe527, 0xeced, 0xf4f4, 0xfd03, 0x0505, 0x0707, 0x0d08, 0x183c, + 0x1d0f, 0x26aa, 0x2826, 0x2cb2, 0x2ebf, 0x34eb, 0x3d3a, 0x4514, + 0x4d19, 0x5509, 0x5d15, 0x6106, 0x650b, 0x6d13, 0x7d0e, 0x7f12, + 0x813f, 0x8310, 0x8516, 0x8d62, 0x9965, 0xa15e, 0xa86f, 0xb118, + 0xb30c, 0xb86d, 0xc10c, 0xc917, 0xd111, 0xd91e, 0xe10d, 0xe84e, + // Entry 100 - 13F + 0xf11d, 0xf525, 0xf924, 0x0123, 0x0926, 0x112a, 0x192d, 0x2023, + 0x2929, 0x312c, 0x3728, 0x3920, 0x3d2e, 0x4132, 0x4931, 0x4ec3, + 0x551a, 0x646c, 0x747c, 0x7e80, 0x80a0, 0x8299, 0x8530, 0x9136, + 0xa53e, 0xac37, 0xb537, 0xb938, 0xbd3c, 0xd941, 0xe543, 0xed5f, + 0xef5f, 0xf658, 0xfd63, 0x7c20, 0x7ef5, 0x80f6, 0x82f7, 0x84f8, + 0x86f9, 0x88fa, 0x8afb, 0x8cfc, 0x8e71, 0x90fe, 0x92ff, 0x9500, + 0x9701, 0x9902, 0x9b44, 0x9d45, 0x9f46, 0xa147, 0xa348, 0xa549, + 0xa74a, 0xa94b, 0xab4c, 0xad4d, 0xaf4e, 0xb14f, 0xb350, 0xb551, + // Entry 140 - 17F + 0xb752, 0xb953, 0xbb54, 0xbd55, 0xbf56, 0xc157, 0xc358, 0xc559, + 0xc75a, 0xc95b, 0xcb5c, 0xcd5d, 0xcf66, +} + +// Size: 2128 bytes +var variantIndex = map[string]uint8{ + "1606nict": 0x0, + "1694acad": 0x1, + "1901": 0x2, + "1959acad": 0x3, + "1994": 0x67, + "1996": 0x4, + "abl1943": 0x5, + "akuapem": 0x6, + "alalc97": 0x69, + "aluku": 0x7, + "ao1990": 0x8, + "aranes": 0x9, + "arevela": 0xa, + "arevmda": 0xb, + "arkaika": 0xc, + "asante": 0xd, + "auvern": 0xe, + "baku1926": 0xf, + "balanka": 0x10, + "barla": 0x11, + "basiceng": 0x12, + "bauddha": 0x13, + "bciav": 0x14, + "bcizbl": 0x15, + "biscayan": 0x16, + "biske": 0x62, + "bohoric": 0x17, + "boont": 0x18, + "bornholm": 0x19, + "cisaup": 0x1a, + "colb1945": 0x1b, + "cornu": 0x1c, + "creiss": 0x1d, + "dajnko": 0x1e, + "ekavsk": 0x1f, + "emodeng": 0x20, + "fonipa": 0x6a, + "fonkirsh": 0x6b, + "fonnapa": 0x6c, + "fonupa": 0x6d, + "fonxsamp": 0x6e, + "gallo": 0x21, + "gascon": 0x22, + "grclass": 0x23, + "grital": 0x24, + "grmistr": 0x25, + "hepburn": 0x26, + "heploc": 0x68, + "hognorsk": 0x27, + "hsistemo": 0x28, + "ijekavsk": 0x29, + "itihasa": 0x2a, + "ivanchov": 0x2b, + "jauer": 0x2c, + "jyutping": 0x2d, + "kkcor": 0x2e, + "kociewie": 0x2f, + "kscor": 0x30, + "laukika": 0x31, + "lemosin": 0x32, + "lengadoc": 0x33, + "lipaw": 0x63, + "ltg1929": 0x34, + "ltg2007": 0x35, + "luna1918": 0x36, + "metelko": 0x37, + "monoton": 0x38, + "ndyuka": 0x39, + "nedis": 0x3a, + "newfound": 0x3b, + "nicard": 0x3c, + "njiva": 0x64, + "nulik": 0x3d, + "osojs": 0x65, + "oxendict": 0x3e, + "pahawh2": 0x3f, + "pahawh3": 0x40, + "pahawh4": 0x41, + "pamaka": 0x42, + "peano": 0x43, + "petr1708": 0x44, + "pinyin": 0x45, + "polyton": 0x46, + "provenc": 0x47, + "puter": 0x48, + "rigik": 0x49, + "rozaj": 0x4a, + "rumgr": 0x4b, + "scotland": 0x4c, + "scouse": 0x4d, + "simple": 0x6f, + "solba": 0x66, + "sotav": 0x4e, + "spanglis": 0x4f, + "surmiran": 0x50, + "sursilv": 0x51, + "sutsilv": 0x52, + "synnejyl": 0x53, + "tarask": 0x54, + "tongyong": 0x55, + "tunumiit": 0x56, + "uccor": 0x57, + "ucrcor": 0x58, + "ulster": 0x59, + "unifon": 0x5a, + "vaidika": 0x5b, + "valencia": 0x5c, + "vallader": 0x5d, + "vecdruka": 0x5e, + "vivaraup": 0x5f, + "wadegile": 0x60, + "xsistemo": 0x61, +} + +// variantNumSpecialized is the number of specialized variants in variants. +const variantNumSpecialized = 105 + +// nRegionGroups is the number of region groups. +const nRegionGroups = 33 + +type likelyLangRegion struct { + lang uint16 + region uint16 +} + +// likelyScript is a lookup table, indexed by scriptID, for the most likely +// languages and regions given a script. +// Size: 1052 bytes, 263 elements +var likelyScript = [263]likelyLangRegion{ + 1: {lang: 0x14e, region: 0x85}, + 3: {lang: 0x2a2, region: 0x107}, + 4: {lang: 0x1f, region: 0x9a}, + 5: {lang: 0x3a, region: 0x6c}, + 7: {lang: 0x3b, region: 0x9d}, + 8: {lang: 0x1d7, region: 0x28}, + 9: {lang: 0x13, region: 0x9d}, + 10: {lang: 0x5b, region: 0x96}, + 11: {lang: 0x60, region: 0x52}, + 12: {lang: 0xb9, region: 0xb5}, + 13: {lang: 0x63, region: 0x96}, + 14: {lang: 0xa5, region: 0x35}, + 15: {lang: 0x3e9, region: 0x9a}, + 17: {lang: 0x529, region: 0x12f}, + 18: {lang: 0x3b1, region: 0x9a}, + 19: {lang: 0x15e, region: 0x79}, + 20: {lang: 0xc2, region: 0x96}, + 21: {lang: 0x9d, region: 0xe8}, + 22: {lang: 0xdb, region: 0x35}, + 23: {lang: 0xf3, region: 0x49}, + 24: {lang: 0x4f0, region: 0x12c}, + 25: {lang: 0xe7, region: 0x13f}, + 26: {lang: 0xe5, region: 0x136}, + 29: {lang: 0xf1, region: 0x6c}, + 31: {lang: 0x1a0, region: 0x5e}, + 32: {lang: 0x3e2, region: 0x107}, + 34: {lang: 0x1be, region: 0x9a}, + 38: {lang: 0x15e, region: 0x79}, + 41: {lang: 0x133, region: 0x6c}, + 42: {lang: 0x431, region: 0x27}, + 44: {lang: 0x27, region: 0x70}, + 46: {lang: 0x210, region: 0x7e}, + 47: {lang: 0xfe, region: 0x38}, + 49: {lang: 0x19b, region: 0x9a}, + 50: {lang: 0x19e, region: 0x131}, + 51: {lang: 0x3e9, region: 0x9a}, + 52: {lang: 0x136, region: 0x88}, + 53: {lang: 0x1a4, region: 0x9a}, + 54: {lang: 0x39d, region: 0x9a}, + 55: {lang: 0x529, region: 0x12f}, + 56: {lang: 0x254, region: 0xac}, + 57: {lang: 0x529, region: 0x53}, + 58: {lang: 0x1cb, region: 0xe8}, + 59: {lang: 0x529, region: 0x53}, + 60: {lang: 0x529, region: 0x12f}, + 61: {lang: 0x2fd, region: 0x9c}, + 62: {lang: 0x1bc, region: 0x98}, + 63: {lang: 0x200, region: 0xa3}, + 64: {lang: 0x1c5, region: 0x12c}, + 65: {lang: 0x1ca, region: 0xb0}, + 68: {lang: 0x1d5, region: 0x93}, + 70: {lang: 0x142, region: 0x9f}, + 71: {lang: 0x254, region: 0xac}, + 72: {lang: 0x20e, region: 0x96}, + 73: {lang: 0x200, region: 0xa3}, + 75: {lang: 0x135, region: 0xc5}, + 76: {lang: 0x200, region: 0xa3}, + 78: {lang: 0x3bb, region: 0xe9}, + 79: {lang: 0x24a, region: 0xa7}, + 80: {lang: 0x3fa, region: 0x9a}, + 83: {lang: 0x251, region: 0x9a}, + 84: {lang: 0x254, region: 0xac}, + 86: {lang: 0x88, region: 0x9a}, + 87: {lang: 0x370, region: 0x124}, + 88: {lang: 0x2b8, region: 0xb0}, + 93: {lang: 0x29f, region: 0x9a}, + 94: {lang: 0x2a8, region: 0x9a}, + 95: {lang: 0x28f, region: 0x88}, + 96: {lang: 0x1a0, region: 0x88}, + 97: {lang: 0x2ac, region: 0x53}, + 99: {lang: 0x4f4, region: 0x12c}, + 100: {lang: 0x4f5, region: 0x12c}, + 101: {lang: 0x1be, region: 0x9a}, + 103: {lang: 0x337, region: 0x9d}, + 104: {lang: 0x4f7, region: 0x53}, + 105: {lang: 0xa9, region: 0x53}, + 108: {lang: 0x2e8, region: 0x113}, + 109: {lang: 0x4f8, region: 0x10c}, + 110: {lang: 0x4f8, region: 0x10c}, + 111: {lang: 0x304, region: 0x9a}, + 112: {lang: 0x31b, region: 0x9a}, + 113: {lang: 0x30b, region: 0x53}, + 115: {lang: 0x31e, region: 0x35}, + 116: {lang: 0x30e, region: 0x9a}, + 117: {lang: 0x414, region: 0xe9}, + 118: {lang: 0x331, region: 0xc5}, + 121: {lang: 0x4f9, region: 0x109}, + 122: {lang: 0x3b, region: 0xa2}, + 123: {lang: 0x353, region: 0xdc}, + 126: {lang: 0x2d0, region: 0x85}, + 127: {lang: 0x52a, region: 0x53}, + 128: {lang: 0x403, region: 0x97}, + 129: {lang: 0x3ee, region: 0x9a}, + 130: {lang: 0x39b, region: 0xc6}, + 131: {lang: 0x395, region: 0x9a}, + 132: {lang: 0x399, region: 0x136}, + 133: {lang: 0x429, region: 0x116}, + 135: {lang: 0x3b, region: 0x11d}, + 136: {lang: 0xfd, region: 0xc5}, + 139: {lang: 0x27d, region: 0x107}, + 140: {lang: 0x2c9, region: 0x53}, + 141: {lang: 0x39f, region: 0x9d}, + 142: {lang: 0x39f, region: 0x53}, + 144: {lang: 0x3ad, region: 0xb1}, + 146: {lang: 0x1c6, region: 0x53}, + 147: {lang: 0x4fd, region: 0x9d}, + 200: {lang: 0x3cb, region: 0x96}, + 203: {lang: 0x372, region: 0x10d}, + 204: {lang: 0x420, region: 0x98}, + 206: {lang: 0x4ff, region: 0x15f}, + 207: {lang: 0x3f0, region: 0x9a}, + 208: {lang: 0x45, region: 0x136}, + 209: {lang: 0x139, region: 0x7c}, + 210: {lang: 0x3e9, region: 0x9a}, + 212: {lang: 0x3e9, region: 0x9a}, + 213: {lang: 0x3fa, region: 0x9a}, + 214: {lang: 0x40c, region: 0xb4}, + 217: {lang: 0x433, region: 0x9a}, + 218: {lang: 0xef, region: 0xc6}, + 219: {lang: 0x43e, region: 0x96}, + 221: {lang: 0x44d, region: 0x35}, + 222: {lang: 0x44e, region: 0x9c}, + 226: {lang: 0x45a, region: 0xe8}, + 227: {lang: 0x11a, region: 0x9a}, + 228: {lang: 0x45e, region: 0x53}, + 229: {lang: 0x232, region: 0x53}, + 230: {lang: 0x450, region: 0x9a}, + 231: {lang: 0x4a5, region: 0x53}, + 232: {lang: 0x9f, region: 0x13f}, + 233: {lang: 0x461, region: 0x9a}, + 235: {lang: 0x528, region: 0xbb}, + 236: {lang: 0x153, region: 0xe8}, + 237: {lang: 0x128, region: 0xce}, + 238: {lang: 0x46b, region: 0x124}, + 239: {lang: 0xa9, region: 0x53}, + 240: {lang: 0x2ce, region: 0x9a}, + 243: {lang: 0x4ad, region: 0x11d}, + 244: {lang: 0x4be, region: 0xb5}, + 247: {lang: 0x1ce, region: 0x9a}, + 250: {lang: 0x3a9, region: 0x9d}, + 251: {lang: 0x22, region: 0x9c}, + 253: {lang: 0x1ea, region: 0x53}, + 254: {lang: 0xef, region: 0xc6}, +} + +type likelyScriptRegion struct { + region uint16 + script uint16 + flags uint8 +} + +// likelyLang is a lookup table, indexed by langID, for the most likely +// scripts and regions given incomplete information. If more entries exist for a +// given language, region and script are the index and size respectively +// of the list in likelyLangList. +// Size: 7980 bytes, 1330 elements +var likelyLang = [1330]likelyScriptRegion{ + 0: {region: 0x136, script: 0x5b, flags: 0x0}, + 1: {region: 0x70, script: 0x5b, flags: 0x0}, + 2: {region: 0x166, script: 0x5b, flags: 0x0}, + 3: {region: 0x166, script: 0x5b, flags: 0x0}, + 4: {region: 0x166, script: 0x5b, flags: 0x0}, + 5: {region: 0x7e, script: 0x20, flags: 0x0}, + 6: {region: 0x166, script: 0x5b, flags: 0x0}, + 7: {region: 0x166, script: 0x20, flags: 0x0}, + 8: {region: 0x81, script: 0x5b, flags: 0x0}, + 9: {region: 0x166, script: 0x5b, flags: 0x0}, + 10: {region: 0x166, script: 0x5b, flags: 0x0}, + 11: {region: 0x166, script: 0x5b, flags: 0x0}, + 12: {region: 0x96, script: 0x5b, flags: 0x0}, + 13: {region: 0x132, script: 0x5b, flags: 0x0}, + 14: {region: 0x81, script: 0x5b, flags: 0x0}, + 15: {region: 0x166, script: 0x5b, flags: 0x0}, + 16: {region: 0x166, script: 0x5b, flags: 0x0}, + 17: {region: 0x107, script: 0x20, flags: 0x0}, + 18: {region: 0x166, script: 0x5b, flags: 0x0}, + 19: {region: 0x9d, script: 0x9, flags: 0x0}, + 20: {region: 0x129, script: 0x5, flags: 0x0}, + 21: {region: 0x166, script: 0x5b, flags: 0x0}, + 22: {region: 0x162, script: 0x5b, flags: 0x0}, + 23: {region: 0x166, script: 0x5b, flags: 0x0}, + 24: {region: 0x166, script: 0x5b, flags: 0x0}, + 25: {region: 0x166, script: 0x5b, flags: 0x0}, + 26: {region: 0x166, script: 0x5b, flags: 0x0}, + 27: {region: 0x166, script: 0x5b, flags: 0x0}, + 28: {region: 0x52, script: 0x5b, flags: 0x0}, + 29: {region: 0x166, script: 0x5b, flags: 0x0}, + 30: {region: 0x166, script: 0x5b, flags: 0x0}, + 31: {region: 0x9a, script: 0x4, flags: 0x0}, + 32: {region: 0x166, script: 0x5b, flags: 0x0}, + 33: {region: 0x81, script: 0x5b, flags: 0x0}, + 34: {region: 0x9c, script: 0xfb, flags: 0x0}, + 35: {region: 0x166, script: 0x5b, flags: 0x0}, + 36: {region: 0x166, script: 0x5b, flags: 0x0}, + 37: {region: 0x14e, script: 0x5b, flags: 0x0}, + 38: {region: 0x107, script: 0x20, flags: 0x0}, + 39: {region: 0x70, script: 0x2c, flags: 0x0}, + 40: {region: 0x166, script: 0x5b, flags: 0x0}, + 41: {region: 0x166, script: 0x5b, flags: 0x0}, + 42: {region: 0xd7, script: 0x5b, flags: 0x0}, + 43: {region: 0x166, script: 0x5b, flags: 0x0}, + 45: {region: 0x166, script: 0x5b, flags: 0x0}, + 46: {region: 0x166, script: 0x5b, flags: 0x0}, + 47: {region: 0x166, script: 0x5b, flags: 0x0}, + 48: {region: 0x166, script: 0x5b, flags: 0x0}, + 49: {region: 0x166, script: 0x5b, flags: 0x0}, + 50: {region: 0x166, script: 0x5b, flags: 0x0}, + 51: {region: 0x96, script: 0x5b, flags: 0x0}, + 52: {region: 0x166, script: 0x5, flags: 0x0}, + 53: {region: 0x123, script: 0x5, flags: 0x0}, + 54: {region: 0x166, script: 0x5b, flags: 0x0}, + 55: {region: 0x166, script: 0x5b, flags: 0x0}, + 56: {region: 0x166, script: 0x5b, flags: 0x0}, + 57: {region: 0x166, script: 0x5b, flags: 0x0}, + 58: {region: 0x6c, script: 0x5, flags: 0x0}, + 59: {region: 0x0, script: 0x3, flags: 0x1}, + 60: {region: 0x166, script: 0x5b, flags: 0x0}, + 61: {region: 0x51, script: 0x5b, flags: 0x0}, + 62: {region: 0x3f, script: 0x5b, flags: 0x0}, + 63: {region: 0x68, script: 0x5, flags: 0x0}, + 65: {region: 0xbb, script: 0x5, flags: 0x0}, + 66: {region: 0x6c, script: 0x5, flags: 0x0}, + 67: {region: 0x9a, script: 0xe, flags: 0x0}, + 68: {region: 0x130, script: 0x5b, flags: 0x0}, + 69: {region: 0x136, script: 0xd0, flags: 0x0}, + 70: {region: 0x166, script: 0x5b, flags: 0x0}, + 71: {region: 0x166, script: 0x5b, flags: 0x0}, + 72: {region: 0x6f, script: 0x5b, flags: 0x0}, + 73: {region: 0x166, script: 0x5b, flags: 0x0}, + 74: {region: 0x166, script: 0x5b, flags: 0x0}, + 75: {region: 0x49, script: 0x5b, flags: 0x0}, + 76: {region: 0x166, script: 0x5b, flags: 0x0}, + 77: {region: 0x107, script: 0x20, flags: 0x0}, + 78: {region: 0x166, script: 0x5, flags: 0x0}, + 79: {region: 0x166, script: 0x5b, flags: 0x0}, + 80: {region: 0x166, script: 0x5b, flags: 0x0}, + 81: {region: 0x166, script: 0x5b, flags: 0x0}, + 82: {region: 0x9a, script: 0x22, flags: 0x0}, + 83: {region: 0x166, script: 0x5b, flags: 0x0}, + 84: {region: 0x166, script: 0x5b, flags: 0x0}, + 85: {region: 0x166, script: 0x5b, flags: 0x0}, + 86: {region: 0x3f, script: 0x5b, flags: 0x0}, + 87: {region: 0x166, script: 0x5b, flags: 0x0}, + 88: {region: 0x3, script: 0x5, flags: 0x1}, + 89: {region: 0x107, script: 0x20, flags: 0x0}, + 90: {region: 0xe9, script: 0x5, flags: 0x0}, + 91: {region: 0x96, script: 0x5b, flags: 0x0}, + 92: {region: 0xdc, script: 0x22, flags: 0x0}, + 93: {region: 0x2e, script: 0x5b, flags: 0x0}, + 94: {region: 0x52, script: 0x5b, flags: 0x0}, + 95: {region: 0x166, script: 0x5b, flags: 0x0}, + 96: {region: 0x52, script: 0xb, flags: 0x0}, + 97: {region: 0x166, script: 0x5b, flags: 0x0}, + 98: {region: 0x166, script: 0x5b, flags: 0x0}, + 99: {region: 0x96, script: 0x5b, flags: 0x0}, + 100: {region: 0x166, script: 0x5b, flags: 0x0}, + 101: {region: 0x52, script: 0x5b, flags: 0x0}, + 102: {region: 0x166, script: 0x5b, flags: 0x0}, + 103: {region: 0x166, script: 0x5b, flags: 0x0}, + 104: {region: 0x166, script: 0x5b, flags: 0x0}, + 105: {region: 0x166, script: 0x5b, flags: 0x0}, + 106: {region: 0x4f, script: 0x5b, flags: 0x0}, + 107: {region: 0x166, script: 0x5b, flags: 0x0}, + 108: {region: 0x166, script: 0x5b, flags: 0x0}, + 109: {region: 0x166, script: 0x5b, flags: 0x0}, + 110: {region: 0x166, script: 0x2c, flags: 0x0}, + 111: {region: 0x166, script: 0x5b, flags: 0x0}, + 112: {region: 0x166, script: 0x5b, flags: 0x0}, + 113: {region: 0x47, script: 0x20, flags: 0x0}, + 114: {region: 0x166, script: 0x5b, flags: 0x0}, + 115: {region: 0x166, script: 0x5b, flags: 0x0}, + 116: {region: 0x10c, script: 0x5, flags: 0x0}, + 117: {region: 0x163, script: 0x5b, flags: 0x0}, + 118: {region: 0x166, script: 0x5b, flags: 0x0}, + 119: {region: 0x96, script: 0x5b, flags: 0x0}, + 120: {region: 0x166, script: 0x5b, flags: 0x0}, + 121: {region: 0x130, script: 0x5b, flags: 0x0}, + 122: {region: 0x52, script: 0x5b, flags: 0x0}, + 123: {region: 0x9a, script: 0xe6, flags: 0x0}, + 124: {region: 0xe9, script: 0x5, flags: 0x0}, + 125: {region: 0x9a, script: 0x22, flags: 0x0}, + 126: {region: 0x38, script: 0x20, flags: 0x0}, + 127: {region: 0x9a, script: 0x22, flags: 0x0}, + 128: {region: 0xe9, script: 0x5, flags: 0x0}, + 129: {region: 0x12c, script: 0x34, flags: 0x0}, + 131: {region: 0x9a, script: 0x22, flags: 0x0}, + 132: {region: 0x166, script: 0x5b, flags: 0x0}, + 133: {region: 0x9a, script: 0x22, flags: 0x0}, + 134: {region: 0xe8, script: 0x5b, flags: 0x0}, + 135: {region: 0x166, script: 0x5b, flags: 0x0}, + 136: {region: 0x9a, script: 0x22, flags: 0x0}, + 137: {region: 0x166, script: 0x5b, flags: 0x0}, + 138: {region: 0x140, script: 0x5b, flags: 0x0}, + 139: {region: 0x166, script: 0x5b, flags: 0x0}, + 140: {region: 0x166, script: 0x5b, flags: 0x0}, + 141: {region: 0xe8, script: 0x5b, flags: 0x0}, + 142: {region: 0x166, script: 0x5b, flags: 0x0}, + 143: {region: 0xd7, script: 0x5b, flags: 0x0}, + 144: {region: 0x166, script: 0x5b, flags: 0x0}, + 145: {region: 0x166, script: 0x5b, flags: 0x0}, + 146: {region: 0x166, script: 0x5b, flags: 0x0}, + 147: {region: 0x166, script: 0x2c, flags: 0x0}, + 148: {region: 0x9a, script: 0x22, flags: 0x0}, + 149: {region: 0x96, script: 0x5b, flags: 0x0}, + 150: {region: 0x166, script: 0x5b, flags: 0x0}, + 151: {region: 0x166, script: 0x5b, flags: 0x0}, + 152: {region: 0x115, script: 0x5b, flags: 0x0}, + 153: {region: 0x166, script: 0x5b, flags: 0x0}, + 154: {region: 0x166, script: 0x5b, flags: 0x0}, + 155: {region: 0x52, script: 0x5b, flags: 0x0}, + 156: {region: 0x166, script: 0x5b, flags: 0x0}, + 157: {region: 0xe8, script: 0x5b, flags: 0x0}, + 158: {region: 0x166, script: 0x5b, flags: 0x0}, + 159: {region: 0x13f, script: 0xe8, flags: 0x0}, + 160: {region: 0xc4, script: 0x5b, flags: 0x0}, + 161: {region: 0x166, script: 0x5b, flags: 0x0}, + 162: {region: 0x166, script: 0x5b, flags: 0x0}, + 163: {region: 0xc4, script: 0x5b, flags: 0x0}, + 164: {region: 0x166, script: 0x5b, flags: 0x0}, + 165: {region: 0x35, script: 0xe, flags: 0x0}, + 166: {region: 0x166, script: 0x5b, flags: 0x0}, + 167: {region: 0x166, script: 0x5b, flags: 0x0}, + 168: {region: 0x166, script: 0x5b, flags: 0x0}, + 169: {region: 0x53, script: 0xef, flags: 0x0}, + 170: {region: 0x166, script: 0x5b, flags: 0x0}, + 171: {region: 0x166, script: 0x5b, flags: 0x0}, + 172: {region: 0x166, script: 0x5b, flags: 0x0}, + 173: {region: 0x9a, script: 0xe, flags: 0x0}, + 174: {region: 0x166, script: 0x5b, flags: 0x0}, + 175: {region: 0x9d, script: 0x5, flags: 0x0}, + 176: {region: 0x166, script: 0x5b, flags: 0x0}, + 177: {region: 0x4f, script: 0x5b, flags: 0x0}, + 178: {region: 0x79, script: 0x5b, flags: 0x0}, + 179: {region: 0x9a, script: 0x22, flags: 0x0}, + 180: {region: 0xe9, script: 0x5, flags: 0x0}, + 181: {region: 0x9a, script: 0x22, flags: 0x0}, + 182: {region: 0x166, script: 0x5b, flags: 0x0}, + 183: {region: 0x33, script: 0x5b, flags: 0x0}, + 184: {region: 0x166, script: 0x5b, flags: 0x0}, + 185: {region: 0xb5, script: 0xc, flags: 0x0}, + 186: {region: 0x52, script: 0x5b, flags: 0x0}, + 187: {region: 0x166, script: 0x2c, flags: 0x0}, + 188: {region: 0xe8, script: 0x5b, flags: 0x0}, + 189: {region: 0x166, script: 0x5b, flags: 0x0}, + 190: {region: 0xe9, script: 0x22, flags: 0x0}, + 191: {region: 0x107, script: 0x20, flags: 0x0}, + 192: {region: 0x160, script: 0x5b, flags: 0x0}, + 193: {region: 0x166, script: 0x5b, flags: 0x0}, + 194: {region: 0x96, script: 0x5b, flags: 0x0}, + 195: {region: 0x166, script: 0x5b, flags: 0x0}, + 196: {region: 0x52, script: 0x5b, flags: 0x0}, + 197: {region: 0x166, script: 0x5b, flags: 0x0}, + 198: {region: 0x166, script: 0x5b, flags: 0x0}, + 199: {region: 0x166, script: 0x5b, flags: 0x0}, + 200: {region: 0x87, script: 0x5b, flags: 0x0}, + 201: {region: 0x166, script: 0x5b, flags: 0x0}, + 202: {region: 0x166, script: 0x5b, flags: 0x0}, + 203: {region: 0x166, script: 0x5b, flags: 0x0}, + 204: {region: 0x166, script: 0x5b, flags: 0x0}, + 205: {region: 0x6e, script: 0x2c, flags: 0x0}, + 206: {region: 0x166, script: 0x5b, flags: 0x0}, + 207: {region: 0x166, script: 0x5b, flags: 0x0}, + 208: {region: 0x52, script: 0x5b, flags: 0x0}, + 209: {region: 0x166, script: 0x5b, flags: 0x0}, + 210: {region: 0x166, script: 0x5b, flags: 0x0}, + 211: {region: 0xc4, script: 0x5b, flags: 0x0}, + 212: {region: 0x166, script: 0x5b, flags: 0x0}, + 213: {region: 0x166, script: 0x5b, flags: 0x0}, + 214: {region: 0x166, script: 0x5b, flags: 0x0}, + 215: {region: 0x6f, script: 0x5b, flags: 0x0}, + 216: {region: 0x166, script: 0x5b, flags: 0x0}, + 217: {region: 0x166, script: 0x5b, flags: 0x0}, + 218: {region: 0xd7, script: 0x5b, flags: 0x0}, + 219: {region: 0x35, script: 0x16, flags: 0x0}, + 220: {region: 0x107, script: 0x20, flags: 0x0}, + 221: {region: 0xe8, script: 0x5b, flags: 0x0}, + 222: {region: 0x166, script: 0x5b, flags: 0x0}, + 223: {region: 0x132, script: 0x5b, flags: 0x0}, + 224: {region: 0x8b, script: 0x5b, flags: 0x0}, + 225: {region: 0x76, script: 0x5b, flags: 0x0}, + 226: {region: 0x107, script: 0x20, flags: 0x0}, + 227: {region: 0x136, script: 0x5b, flags: 0x0}, + 228: {region: 0x49, script: 0x5b, flags: 0x0}, + 229: {region: 0x136, script: 0x1a, flags: 0x0}, + 230: {region: 0xa7, script: 0x5, flags: 0x0}, + 231: {region: 0x13f, script: 0x19, flags: 0x0}, + 232: {region: 0x166, script: 0x5b, flags: 0x0}, + 233: {region: 0x9c, script: 0x5, flags: 0x0}, + 234: {region: 0x166, script: 0x5b, flags: 0x0}, + 235: {region: 0x166, script: 0x5b, flags: 0x0}, + 236: {region: 0x166, script: 0x5b, flags: 0x0}, + 237: {region: 0x166, script: 0x5b, flags: 0x0}, + 238: {region: 0x166, script: 0x5b, flags: 0x0}, + 239: {region: 0xc6, script: 0xda, flags: 0x0}, + 240: {region: 0x79, script: 0x5b, flags: 0x0}, + 241: {region: 0x6c, script: 0x1d, flags: 0x0}, + 242: {region: 0xe8, script: 0x5b, flags: 0x0}, + 243: {region: 0x49, script: 0x17, flags: 0x0}, + 244: {region: 0x131, script: 0x20, flags: 0x0}, + 245: {region: 0x49, script: 0x17, flags: 0x0}, + 246: {region: 0x49, script: 0x17, flags: 0x0}, + 247: {region: 0x49, script: 0x17, flags: 0x0}, + 248: {region: 0x49, script: 0x17, flags: 0x0}, + 249: {region: 0x10b, script: 0x5b, flags: 0x0}, + 250: {region: 0x5f, script: 0x5b, flags: 0x0}, + 251: {region: 0xea, script: 0x5b, flags: 0x0}, + 252: {region: 0x49, script: 0x17, flags: 0x0}, + 253: {region: 0xc5, script: 0x88, flags: 0x0}, + 254: {region: 0x8, script: 0x2, flags: 0x1}, + 255: {region: 0x107, script: 0x20, flags: 0x0}, + 256: {region: 0x7c, script: 0x5b, flags: 0x0}, + 257: {region: 0x64, script: 0x5b, flags: 0x0}, + 258: {region: 0x166, script: 0x5b, flags: 0x0}, + 259: {region: 0x166, script: 0x5b, flags: 0x0}, + 260: {region: 0x166, script: 0x5b, flags: 0x0}, + 261: {region: 0x166, script: 0x5b, flags: 0x0}, + 262: {region: 0x136, script: 0x5b, flags: 0x0}, + 263: {region: 0x107, script: 0x20, flags: 0x0}, + 264: {region: 0xa5, script: 0x5b, flags: 0x0}, + 265: {region: 0x166, script: 0x5b, flags: 0x0}, + 266: {region: 0x166, script: 0x5b, flags: 0x0}, + 267: {region: 0x9a, script: 0x5, flags: 0x0}, + 268: {region: 0x166, script: 0x5b, flags: 0x0}, + 269: {region: 0x61, script: 0x5b, flags: 0x0}, + 270: {region: 0x166, script: 0x5b, flags: 0x0}, + 271: {region: 0x49, script: 0x5b, flags: 0x0}, + 272: {region: 0x166, script: 0x5b, flags: 0x0}, + 273: {region: 0x166, script: 0x5b, flags: 0x0}, + 274: {region: 0x166, script: 0x5b, flags: 0x0}, + 275: {region: 0x166, script: 0x5, flags: 0x0}, + 276: {region: 0x49, script: 0x5b, flags: 0x0}, + 277: {region: 0x166, script: 0x5b, flags: 0x0}, + 278: {region: 0x166, script: 0x5b, flags: 0x0}, + 279: {region: 0xd5, script: 0x5b, flags: 0x0}, + 280: {region: 0x4f, script: 0x5b, flags: 0x0}, + 281: {region: 0x166, script: 0x5b, flags: 0x0}, + 282: {region: 0x9a, script: 0x5, flags: 0x0}, + 283: {region: 0x166, script: 0x5b, flags: 0x0}, + 284: {region: 0x166, script: 0x5b, flags: 0x0}, + 285: {region: 0x166, script: 0x5b, flags: 0x0}, + 286: {region: 0x166, script: 0x2c, flags: 0x0}, + 287: {region: 0x61, script: 0x5b, flags: 0x0}, + 288: {region: 0xc4, script: 0x5b, flags: 0x0}, + 289: {region: 0xd1, script: 0x5b, flags: 0x0}, + 290: {region: 0x166, script: 0x5b, flags: 0x0}, + 291: {region: 0xdc, script: 0x22, flags: 0x0}, + 292: {region: 0x52, script: 0x5b, flags: 0x0}, + 293: {region: 0x166, script: 0x5b, flags: 0x0}, + 294: {region: 0x166, script: 0x5b, flags: 0x0}, + 295: {region: 0x166, script: 0x5b, flags: 0x0}, + 296: {region: 0xce, script: 0xed, flags: 0x0}, + 297: {region: 0x166, script: 0x5b, flags: 0x0}, + 298: {region: 0x166, script: 0x5b, flags: 0x0}, + 299: {region: 0x115, script: 0x5b, flags: 0x0}, + 300: {region: 0x37, script: 0x5b, flags: 0x0}, + 301: {region: 0x43, script: 0xef, flags: 0x0}, + 302: {region: 0x166, script: 0x5b, flags: 0x0}, + 303: {region: 0xa5, script: 0x5b, flags: 0x0}, + 304: {region: 0x81, script: 0x5b, flags: 0x0}, + 305: {region: 0xd7, script: 0x5b, flags: 0x0}, + 306: {region: 0x9f, script: 0x5b, flags: 0x0}, + 307: {region: 0x6c, script: 0x29, flags: 0x0}, + 308: {region: 0x166, script: 0x5b, flags: 0x0}, + 309: {region: 0xc5, script: 0x4b, flags: 0x0}, + 310: {region: 0x88, script: 0x34, flags: 0x0}, + 311: {region: 0x166, script: 0x5b, flags: 0x0}, + 312: {region: 0x166, script: 0x5b, flags: 0x0}, + 313: {region: 0xa, script: 0x2, flags: 0x1}, + 314: {region: 0x166, script: 0x5b, flags: 0x0}, + 315: {region: 0x166, script: 0x5b, flags: 0x0}, + 316: {region: 0x1, script: 0x5b, flags: 0x0}, + 317: {region: 0x166, script: 0x5b, flags: 0x0}, + 318: {region: 0x6f, script: 0x5b, flags: 0x0}, + 319: {region: 0x136, script: 0x5b, flags: 0x0}, + 320: {region: 0x6b, script: 0x5b, flags: 0x0}, + 321: {region: 0x166, script: 0x5b, flags: 0x0}, + 322: {region: 0x9f, script: 0x46, flags: 0x0}, + 323: {region: 0x166, script: 0x5b, flags: 0x0}, + 324: {region: 0x166, script: 0x5b, flags: 0x0}, + 325: {region: 0x6f, script: 0x5b, flags: 0x0}, + 326: {region: 0x52, script: 0x5b, flags: 0x0}, + 327: {region: 0x6f, script: 0x5b, flags: 0x0}, + 328: {region: 0x9d, script: 0x5, flags: 0x0}, + 329: {region: 0x166, script: 0x5b, flags: 0x0}, + 330: {region: 0x166, script: 0x5b, flags: 0x0}, + 331: {region: 0x166, script: 0x5b, flags: 0x0}, + 332: {region: 0x166, script: 0x5b, flags: 0x0}, + 333: {region: 0x87, script: 0x5b, flags: 0x0}, + 334: {region: 0xc, script: 0x2, flags: 0x1}, + 335: {region: 0x166, script: 0x5b, flags: 0x0}, + 336: {region: 0xc4, script: 0x5b, flags: 0x0}, + 337: {region: 0x73, script: 0x5b, flags: 0x0}, + 338: {region: 0x10c, script: 0x5, flags: 0x0}, + 339: {region: 0xe8, script: 0x5b, flags: 0x0}, + 340: {region: 0x10d, script: 0x5b, flags: 0x0}, + 341: {region: 0x74, script: 0x5b, flags: 0x0}, + 342: {region: 0x166, script: 0x5b, flags: 0x0}, + 343: {region: 0x166, script: 0x5b, flags: 0x0}, + 344: {region: 0x77, script: 0x5b, flags: 0x0}, + 345: {region: 0x166, script: 0x5b, flags: 0x0}, + 346: {region: 0x3b, script: 0x5b, flags: 0x0}, + 347: {region: 0x166, script: 0x5b, flags: 0x0}, + 348: {region: 0x166, script: 0x5b, flags: 0x0}, + 349: {region: 0x166, script: 0x5b, flags: 0x0}, + 350: {region: 0x79, script: 0x5b, flags: 0x0}, + 351: {region: 0x136, script: 0x5b, flags: 0x0}, + 352: {region: 0x79, script: 0x5b, flags: 0x0}, + 353: {region: 0x61, script: 0x5b, flags: 0x0}, + 354: {region: 0x61, script: 0x5b, flags: 0x0}, + 355: {region: 0x52, script: 0x5, flags: 0x0}, + 356: {region: 0x141, script: 0x5b, flags: 0x0}, + 357: {region: 0x166, script: 0x5b, flags: 0x0}, + 358: {region: 0x85, script: 0x5b, flags: 0x0}, + 359: {region: 0x166, script: 0x5b, flags: 0x0}, + 360: {region: 0xd5, script: 0x5b, flags: 0x0}, + 361: {region: 0x9f, script: 0x5b, flags: 0x0}, + 362: {region: 0xd7, script: 0x5b, flags: 0x0}, + 363: {region: 0x166, script: 0x5b, flags: 0x0}, + 364: {region: 0x10c, script: 0x5b, flags: 0x0}, + 365: {region: 0xda, script: 0x5b, flags: 0x0}, + 366: {region: 0x97, script: 0x5b, flags: 0x0}, + 367: {region: 0x81, script: 0x5b, flags: 0x0}, + 368: {region: 0x166, script: 0x5b, flags: 0x0}, + 369: {region: 0xbd, script: 0x5b, flags: 0x0}, + 370: {region: 0x166, script: 0x5b, flags: 0x0}, + 371: {region: 0x166, script: 0x5b, flags: 0x0}, + 372: {region: 0x166, script: 0x5b, flags: 0x0}, + 373: {region: 0x53, script: 0x3b, flags: 0x0}, + 374: {region: 0x166, script: 0x5b, flags: 0x0}, + 375: {region: 0x96, script: 0x5b, flags: 0x0}, + 376: {region: 0x166, script: 0x5b, flags: 0x0}, + 377: {region: 0x166, script: 0x5b, flags: 0x0}, + 378: {region: 0x9a, script: 0x22, flags: 0x0}, + 379: {region: 0x166, script: 0x5b, flags: 0x0}, + 380: {region: 0x9d, script: 0x5, flags: 0x0}, + 381: {region: 0x7f, script: 0x5b, flags: 0x0}, + 382: {region: 0x7c, script: 0x5b, flags: 0x0}, + 383: {region: 0x166, script: 0x5b, flags: 0x0}, + 384: {region: 0x166, script: 0x5b, flags: 0x0}, + 385: {region: 0x166, script: 0x5b, flags: 0x0}, + 386: {region: 0x166, script: 0x5b, flags: 0x0}, + 387: {region: 0x166, script: 0x5b, flags: 0x0}, + 388: {region: 0x166, script: 0x5b, flags: 0x0}, + 389: {region: 0x70, script: 0x2c, flags: 0x0}, + 390: {region: 0x166, script: 0x5b, flags: 0x0}, + 391: {region: 0xdc, script: 0x22, flags: 0x0}, + 392: {region: 0x166, script: 0x5b, flags: 0x0}, + 393: {region: 0xa8, script: 0x5b, flags: 0x0}, + 394: {region: 0x166, script: 0x5b, flags: 0x0}, + 395: {region: 0xe9, script: 0x5, flags: 0x0}, + 396: {region: 0x166, script: 0x5b, flags: 0x0}, + 397: {region: 0xe9, script: 0x5, flags: 0x0}, + 398: {region: 0x166, script: 0x5b, flags: 0x0}, + 399: {region: 0x166, script: 0x5b, flags: 0x0}, + 400: {region: 0x6f, script: 0x5b, flags: 0x0}, + 401: {region: 0x9d, script: 0x5, flags: 0x0}, + 402: {region: 0x166, script: 0x5b, flags: 0x0}, + 403: {region: 0x166, script: 0x2c, flags: 0x0}, + 404: {region: 0xf2, script: 0x5b, flags: 0x0}, + 405: {region: 0x166, script: 0x5b, flags: 0x0}, + 406: {region: 0x166, script: 0x5b, flags: 0x0}, + 407: {region: 0x166, script: 0x5b, flags: 0x0}, + 408: {region: 0x166, script: 0x2c, flags: 0x0}, + 409: {region: 0x166, script: 0x5b, flags: 0x0}, + 410: {region: 0x9a, script: 0x22, flags: 0x0}, + 411: {region: 0x9a, script: 0xe9, flags: 0x0}, + 412: {region: 0x96, script: 0x5b, flags: 0x0}, + 413: {region: 0xda, script: 0x5b, flags: 0x0}, + 414: {region: 0x131, script: 0x32, flags: 0x0}, + 415: {region: 0x166, script: 0x5b, flags: 0x0}, + 416: {region: 0xe, script: 0x2, flags: 0x1}, + 417: {region: 0x9a, script: 0xe, flags: 0x0}, + 418: {region: 0x166, script: 0x5b, flags: 0x0}, + 419: {region: 0x4e, script: 0x5b, flags: 0x0}, + 420: {region: 0x9a, script: 0x35, flags: 0x0}, + 421: {region: 0x41, script: 0x5b, flags: 0x0}, + 422: {region: 0x54, script: 0x5b, flags: 0x0}, + 423: {region: 0x166, script: 0x5b, flags: 0x0}, + 424: {region: 0x81, script: 0x5b, flags: 0x0}, + 425: {region: 0x166, script: 0x5b, flags: 0x0}, + 426: {region: 0x166, script: 0x5b, flags: 0x0}, + 427: {region: 0xa5, script: 0x5b, flags: 0x0}, + 428: {region: 0x99, script: 0x5b, flags: 0x0}, + 429: {region: 0x166, script: 0x5b, flags: 0x0}, + 430: {region: 0xdc, script: 0x22, flags: 0x0}, + 431: {region: 0x166, script: 0x5b, flags: 0x0}, + 432: {region: 0x166, script: 0x5, flags: 0x0}, + 433: {region: 0x49, script: 0x5b, flags: 0x0}, + 434: {region: 0x166, script: 0x5, flags: 0x0}, + 435: {region: 0x166, script: 0x5b, flags: 0x0}, + 436: {region: 0x10, script: 0x3, flags: 0x1}, + 437: {region: 0x166, script: 0x5b, flags: 0x0}, + 438: {region: 0x53, script: 0x3b, flags: 0x0}, + 439: {region: 0x166, script: 0x5b, flags: 0x0}, + 440: {region: 0x136, script: 0x5b, flags: 0x0}, + 441: {region: 0x24, script: 0x5, flags: 0x0}, + 442: {region: 0x166, script: 0x5b, flags: 0x0}, + 443: {region: 0x166, script: 0x2c, flags: 0x0}, + 444: {region: 0x98, script: 0x3e, flags: 0x0}, + 445: {region: 0x166, script: 0x5b, flags: 0x0}, + 446: {region: 0x9a, script: 0x22, flags: 0x0}, + 447: {region: 0x166, script: 0x5b, flags: 0x0}, + 448: {region: 0x74, script: 0x5b, flags: 0x0}, + 449: {region: 0x166, script: 0x5b, flags: 0x0}, + 450: {region: 0x166, script: 0x5b, flags: 0x0}, + 451: {region: 0xe8, script: 0x5b, flags: 0x0}, + 452: {region: 0x166, script: 0x5b, flags: 0x0}, + 453: {region: 0x12c, script: 0x40, flags: 0x0}, + 454: {region: 0x53, script: 0x92, flags: 0x0}, + 455: {region: 0x166, script: 0x5b, flags: 0x0}, + 456: {region: 0xe9, script: 0x5, flags: 0x0}, + 457: {region: 0x9a, script: 0x22, flags: 0x0}, + 458: {region: 0xb0, script: 0x41, flags: 0x0}, + 459: {region: 0xe8, script: 0x5b, flags: 0x0}, + 460: {region: 0xe9, script: 0x5, flags: 0x0}, + 461: {region: 0xe7, script: 0x5b, flags: 0x0}, + 462: {region: 0x9a, script: 0x22, flags: 0x0}, + 463: {region: 0x9a, script: 0x22, flags: 0x0}, + 464: {region: 0x166, script: 0x5b, flags: 0x0}, + 465: {region: 0x91, script: 0x5b, flags: 0x0}, + 466: {region: 0x61, script: 0x5b, flags: 0x0}, + 467: {region: 0x53, script: 0x3b, flags: 0x0}, + 468: {region: 0x92, script: 0x5b, flags: 0x0}, + 469: {region: 0x93, script: 0x5b, flags: 0x0}, + 470: {region: 0x166, script: 0x5b, flags: 0x0}, + 471: {region: 0x28, script: 0x8, flags: 0x0}, + 472: {region: 0xd3, script: 0x5b, flags: 0x0}, + 473: {region: 0x79, script: 0x5b, flags: 0x0}, + 474: {region: 0x166, script: 0x5b, flags: 0x0}, + 475: {region: 0x166, script: 0x5b, flags: 0x0}, + 476: {region: 0xd1, script: 0x5b, flags: 0x0}, + 477: {region: 0xd7, script: 0x5b, flags: 0x0}, + 478: {region: 0x166, script: 0x5b, flags: 0x0}, + 479: {region: 0x166, script: 0x5b, flags: 0x0}, + 480: {region: 0x166, script: 0x5b, flags: 0x0}, + 481: {region: 0x96, script: 0x5b, flags: 0x0}, + 482: {region: 0x166, script: 0x5b, flags: 0x0}, + 483: {region: 0x166, script: 0x5b, flags: 0x0}, + 484: {region: 0x166, script: 0x5b, flags: 0x0}, + 486: {region: 0x123, script: 0x5b, flags: 0x0}, + 487: {region: 0xd7, script: 0x5b, flags: 0x0}, + 488: {region: 0x166, script: 0x5b, flags: 0x0}, + 489: {region: 0x166, script: 0x5b, flags: 0x0}, + 490: {region: 0x53, script: 0xfd, flags: 0x0}, + 491: {region: 0x166, script: 0x5b, flags: 0x0}, + 492: {region: 0x136, script: 0x5b, flags: 0x0}, + 493: {region: 0x166, script: 0x5b, flags: 0x0}, + 494: {region: 0x49, script: 0x5b, flags: 0x0}, + 495: {region: 0x166, script: 0x5b, flags: 0x0}, + 496: {region: 0x166, script: 0x5b, flags: 0x0}, + 497: {region: 0xe8, script: 0x5b, flags: 0x0}, + 498: {region: 0x166, script: 0x5b, flags: 0x0}, + 499: {region: 0x96, script: 0x5b, flags: 0x0}, + 500: {region: 0x107, script: 0x20, flags: 0x0}, + 501: {region: 0x1, script: 0x5b, flags: 0x0}, + 502: {region: 0x166, script: 0x5b, flags: 0x0}, + 503: {region: 0x166, script: 0x5b, flags: 0x0}, + 504: {region: 0x9e, script: 0x5b, flags: 0x0}, + 505: {region: 0x9f, script: 0x5b, flags: 0x0}, + 506: {region: 0x49, script: 0x17, flags: 0x0}, + 507: {region: 0x98, script: 0x3e, flags: 0x0}, + 508: {region: 0x166, script: 0x5b, flags: 0x0}, + 509: {region: 0x166, script: 0x5b, flags: 0x0}, + 510: {region: 0x107, script: 0x5b, flags: 0x0}, + 511: {region: 0x166, script: 0x5b, flags: 0x0}, + 512: {region: 0xa3, script: 0x49, flags: 0x0}, + 513: {region: 0x166, script: 0x5b, flags: 0x0}, + 514: {region: 0xa1, script: 0x5b, flags: 0x0}, + 515: {region: 0x1, script: 0x5b, flags: 0x0}, + 516: {region: 0x166, script: 0x5b, flags: 0x0}, + 517: {region: 0x166, script: 0x5b, flags: 0x0}, + 518: {region: 0x166, script: 0x5b, flags: 0x0}, + 519: {region: 0x52, script: 0x5b, flags: 0x0}, + 520: {region: 0x131, script: 0x3e, flags: 0x0}, + 521: {region: 0x166, script: 0x5b, flags: 0x0}, + 522: {region: 0x130, script: 0x5b, flags: 0x0}, + 523: {region: 0xdc, script: 0x22, flags: 0x0}, + 524: {region: 0x166, script: 0x5b, flags: 0x0}, + 525: {region: 0x64, script: 0x5b, flags: 0x0}, + 526: {region: 0x96, script: 0x5b, flags: 0x0}, + 527: {region: 0x96, script: 0x5b, flags: 0x0}, + 528: {region: 0x7e, script: 0x2e, flags: 0x0}, + 529: {region: 0x138, script: 0x20, flags: 0x0}, + 530: {region: 0x68, script: 0x5b, flags: 0x0}, + 531: {region: 0xc5, script: 0x5b, flags: 0x0}, + 532: {region: 0x166, script: 0x5b, flags: 0x0}, + 533: {region: 0x166, script: 0x5b, flags: 0x0}, + 534: {region: 0xd7, script: 0x5b, flags: 0x0}, + 535: {region: 0xa5, script: 0x5b, flags: 0x0}, + 536: {region: 0xc4, script: 0x5b, flags: 0x0}, + 537: {region: 0x107, script: 0x20, flags: 0x0}, + 538: {region: 0x166, script: 0x5b, flags: 0x0}, + 539: {region: 0x166, script: 0x5b, flags: 0x0}, + 540: {region: 0x166, script: 0x5b, flags: 0x0}, + 541: {region: 0x166, script: 0x5b, flags: 0x0}, + 542: {region: 0xd5, script: 0x5, flags: 0x0}, + 543: {region: 0xd7, script: 0x5b, flags: 0x0}, + 544: {region: 0x165, script: 0x5b, flags: 0x0}, + 545: {region: 0x166, script: 0x5b, flags: 0x0}, + 546: {region: 0x166, script: 0x5b, flags: 0x0}, + 547: {region: 0x130, script: 0x5b, flags: 0x0}, + 548: {region: 0x123, script: 0x5, flags: 0x0}, + 549: {region: 0x166, script: 0x5b, flags: 0x0}, + 550: {region: 0x124, script: 0xee, flags: 0x0}, + 551: {region: 0x5b, script: 0x5b, flags: 0x0}, + 552: {region: 0x52, script: 0x5b, flags: 0x0}, + 553: {region: 0x166, script: 0x5b, flags: 0x0}, + 554: {region: 0x4f, script: 0x5b, flags: 0x0}, + 555: {region: 0x9a, script: 0x22, flags: 0x0}, + 556: {region: 0x9a, script: 0x22, flags: 0x0}, + 557: {region: 0x4b, script: 0x5b, flags: 0x0}, + 558: {region: 0x96, script: 0x5b, flags: 0x0}, + 559: {region: 0x166, script: 0x5b, flags: 0x0}, + 560: {region: 0x41, script: 0x5b, flags: 0x0}, + 561: {region: 0x9a, script: 0x5b, flags: 0x0}, + 562: {region: 0x53, script: 0xe5, flags: 0x0}, + 563: {region: 0x9a, script: 0x22, flags: 0x0}, + 564: {region: 0xc4, script: 0x5b, flags: 0x0}, + 565: {region: 0x166, script: 0x5b, flags: 0x0}, + 566: {region: 0x9a, script: 0x76, flags: 0x0}, + 567: {region: 0xe9, script: 0x5, flags: 0x0}, + 568: {region: 0x166, script: 0x5b, flags: 0x0}, + 569: {region: 0xa5, script: 0x5b, flags: 0x0}, + 570: {region: 0x166, script: 0x5b, flags: 0x0}, + 571: {region: 0x12c, script: 0x5b, flags: 0x0}, + 572: {region: 0x166, script: 0x5b, flags: 0x0}, + 573: {region: 0xd3, script: 0x5b, flags: 0x0}, + 574: {region: 0x166, script: 0x5b, flags: 0x0}, + 575: {region: 0xb0, script: 0x58, flags: 0x0}, + 576: {region: 0x166, script: 0x5b, flags: 0x0}, + 577: {region: 0x166, script: 0x5b, flags: 0x0}, + 578: {region: 0x13, script: 0x6, flags: 0x1}, + 579: {region: 0x166, script: 0x5b, flags: 0x0}, + 580: {region: 0x52, script: 0x5b, flags: 0x0}, + 581: {region: 0x83, script: 0x5b, flags: 0x0}, + 582: {region: 0xa5, script: 0x5b, flags: 0x0}, + 583: {region: 0x166, script: 0x5b, flags: 0x0}, + 584: {region: 0x166, script: 0x5b, flags: 0x0}, + 585: {region: 0x166, script: 0x5b, flags: 0x0}, + 586: {region: 0xa7, script: 0x4f, flags: 0x0}, + 587: {region: 0x2a, script: 0x5b, flags: 0x0}, + 588: {region: 0x166, script: 0x5b, flags: 0x0}, + 589: {region: 0x166, script: 0x5b, flags: 0x0}, + 590: {region: 0x166, script: 0x5b, flags: 0x0}, + 591: {region: 0x166, script: 0x5b, flags: 0x0}, + 592: {region: 0x166, script: 0x5b, flags: 0x0}, + 593: {region: 0x9a, script: 0x53, flags: 0x0}, + 594: {region: 0x8c, script: 0x5b, flags: 0x0}, + 595: {region: 0x166, script: 0x5b, flags: 0x0}, + 596: {region: 0xac, script: 0x54, flags: 0x0}, + 597: {region: 0x107, script: 0x20, flags: 0x0}, + 598: {region: 0x9a, script: 0x22, flags: 0x0}, + 599: {region: 0x166, script: 0x5b, flags: 0x0}, + 600: {region: 0x76, script: 0x5b, flags: 0x0}, + 601: {region: 0x166, script: 0x5b, flags: 0x0}, + 602: {region: 0xb5, script: 0x5b, flags: 0x0}, + 603: {region: 0x166, script: 0x5b, flags: 0x0}, + 604: {region: 0x166, script: 0x5b, flags: 0x0}, + 605: {region: 0x166, script: 0x5b, flags: 0x0}, + 606: {region: 0x166, script: 0x5b, flags: 0x0}, + 607: {region: 0x166, script: 0x5b, flags: 0x0}, + 608: {region: 0x166, script: 0x5b, flags: 0x0}, + 609: {region: 0x166, script: 0x5b, flags: 0x0}, + 610: {region: 0x166, script: 0x2c, flags: 0x0}, + 611: {region: 0x166, script: 0x5b, flags: 0x0}, + 612: {region: 0x107, script: 0x20, flags: 0x0}, + 613: {region: 0x113, script: 0x5b, flags: 0x0}, + 614: {region: 0xe8, script: 0x5b, flags: 0x0}, + 615: {region: 0x107, script: 0x5b, flags: 0x0}, + 616: {region: 0x166, script: 0x5b, flags: 0x0}, + 617: {region: 0x9a, script: 0x22, flags: 0x0}, + 618: {region: 0x9a, script: 0x5, flags: 0x0}, + 619: {region: 0x130, script: 0x5b, flags: 0x0}, + 620: {region: 0x166, script: 0x5b, flags: 0x0}, + 621: {region: 0x52, script: 0x5b, flags: 0x0}, + 622: {region: 0x61, script: 0x5b, flags: 0x0}, + 623: {region: 0x166, script: 0x5b, flags: 0x0}, + 624: {region: 0x166, script: 0x5b, flags: 0x0}, + 625: {region: 0x166, script: 0x2c, flags: 0x0}, + 626: {region: 0x166, script: 0x5b, flags: 0x0}, + 627: {region: 0x166, script: 0x5b, flags: 0x0}, + 628: {region: 0x19, script: 0x3, flags: 0x1}, + 629: {region: 0x166, script: 0x5b, flags: 0x0}, + 630: {region: 0x166, script: 0x5b, flags: 0x0}, + 631: {region: 0x166, script: 0x5b, flags: 0x0}, + 632: {region: 0x166, script: 0x5b, flags: 0x0}, + 633: {region: 0x107, script: 0x20, flags: 0x0}, + 634: {region: 0x166, script: 0x5b, flags: 0x0}, + 635: {region: 0x166, script: 0x5b, flags: 0x0}, + 636: {region: 0x166, script: 0x5b, flags: 0x0}, + 637: {region: 0x107, script: 0x20, flags: 0x0}, + 638: {region: 0x166, script: 0x5b, flags: 0x0}, + 639: {region: 0x96, script: 0x5b, flags: 0x0}, + 640: {region: 0xe9, script: 0x5, flags: 0x0}, + 641: {region: 0x7c, script: 0x5b, flags: 0x0}, + 642: {region: 0x166, script: 0x5b, flags: 0x0}, + 643: {region: 0x166, script: 0x5b, flags: 0x0}, + 644: {region: 0x166, script: 0x5b, flags: 0x0}, + 645: {region: 0x166, script: 0x2c, flags: 0x0}, + 646: {region: 0x124, script: 0xee, flags: 0x0}, + 647: {region: 0xe9, script: 0x5, flags: 0x0}, + 648: {region: 0x166, script: 0x5b, flags: 0x0}, + 649: {region: 0x166, script: 0x5b, flags: 0x0}, + 650: {region: 0x1c, script: 0x5, flags: 0x1}, + 651: {region: 0x166, script: 0x5b, flags: 0x0}, + 652: {region: 0x166, script: 0x5b, flags: 0x0}, + 653: {region: 0x166, script: 0x5b, flags: 0x0}, + 654: {region: 0x139, script: 0x5b, flags: 0x0}, + 655: {region: 0x88, script: 0x5f, flags: 0x0}, + 656: {region: 0x98, script: 0x3e, flags: 0x0}, + 657: {region: 0x130, script: 0x5b, flags: 0x0}, + 658: {region: 0xe9, script: 0x5, flags: 0x0}, + 659: {region: 0x132, script: 0x5b, flags: 0x0}, + 660: {region: 0x166, script: 0x5b, flags: 0x0}, + 661: {region: 0xb8, script: 0x5b, flags: 0x0}, + 662: {region: 0x107, script: 0x20, flags: 0x0}, + 663: {region: 0x166, script: 0x5b, flags: 0x0}, + 664: {region: 0x96, script: 0x5b, flags: 0x0}, + 665: {region: 0x166, script: 0x5b, flags: 0x0}, + 666: {region: 0x53, script: 0xee, flags: 0x0}, + 667: {region: 0x166, script: 0x5b, flags: 0x0}, + 668: {region: 0x166, script: 0x5b, flags: 0x0}, + 669: {region: 0x166, script: 0x5b, flags: 0x0}, + 670: {region: 0x166, script: 0x5b, flags: 0x0}, + 671: {region: 0x9a, script: 0x5d, flags: 0x0}, + 672: {region: 0x166, script: 0x5b, flags: 0x0}, + 673: {region: 0x166, script: 0x5b, flags: 0x0}, + 674: {region: 0x107, script: 0x20, flags: 0x0}, + 675: {region: 0x132, script: 0x5b, flags: 0x0}, + 676: {region: 0x166, script: 0x5b, flags: 0x0}, + 677: {region: 0xda, script: 0x5b, flags: 0x0}, + 678: {region: 0x166, script: 0x5b, flags: 0x0}, + 679: {region: 0x166, script: 0x5b, flags: 0x0}, + 680: {region: 0x21, script: 0x2, flags: 0x1}, + 681: {region: 0x166, script: 0x5b, flags: 0x0}, + 682: {region: 0x166, script: 0x5b, flags: 0x0}, + 683: {region: 0x9f, script: 0x5b, flags: 0x0}, + 684: {region: 0x53, script: 0x61, flags: 0x0}, + 685: {region: 0x96, script: 0x5b, flags: 0x0}, + 686: {region: 0x9d, script: 0x5, flags: 0x0}, + 687: {region: 0x136, script: 0x5b, flags: 0x0}, + 688: {region: 0x166, script: 0x5b, flags: 0x0}, + 689: {region: 0x166, script: 0x5b, flags: 0x0}, + 690: {region: 0x9a, script: 0xe9, flags: 0x0}, + 691: {region: 0x9f, script: 0x5b, flags: 0x0}, + 692: {region: 0x166, script: 0x5b, flags: 0x0}, + 693: {region: 0x4b, script: 0x5b, flags: 0x0}, + 694: {region: 0x166, script: 0x5b, flags: 0x0}, + 695: {region: 0x166, script: 0x5b, flags: 0x0}, + 696: {region: 0xb0, script: 0x58, flags: 0x0}, + 697: {region: 0x166, script: 0x5b, flags: 0x0}, + 698: {region: 0x166, script: 0x5b, flags: 0x0}, + 699: {region: 0x4b, script: 0x5b, flags: 0x0}, + 700: {region: 0x166, script: 0x5b, flags: 0x0}, + 701: {region: 0x166, script: 0x5b, flags: 0x0}, + 702: {region: 0x163, script: 0x5b, flags: 0x0}, + 703: {region: 0x9d, script: 0x5, flags: 0x0}, + 704: {region: 0xb7, script: 0x5b, flags: 0x0}, + 705: {region: 0xb9, script: 0x5b, flags: 0x0}, + 706: {region: 0x4b, script: 0x5b, flags: 0x0}, + 707: {region: 0x4b, script: 0x5b, flags: 0x0}, + 708: {region: 0xa5, script: 0x5b, flags: 0x0}, + 709: {region: 0xa5, script: 0x5b, flags: 0x0}, + 710: {region: 0x9d, script: 0x5, flags: 0x0}, + 711: {region: 0xb9, script: 0x5b, flags: 0x0}, + 712: {region: 0x124, script: 0xee, flags: 0x0}, + 713: {region: 0x53, script: 0x3b, flags: 0x0}, + 714: {region: 0x12c, script: 0x5b, flags: 0x0}, + 715: {region: 0x96, script: 0x5b, flags: 0x0}, + 716: {region: 0x52, script: 0x5b, flags: 0x0}, + 717: {region: 0x9a, script: 0x22, flags: 0x0}, + 718: {region: 0x9a, script: 0x22, flags: 0x0}, + 719: {region: 0x96, script: 0x5b, flags: 0x0}, + 720: {region: 0x23, script: 0x3, flags: 0x1}, + 721: {region: 0xa5, script: 0x5b, flags: 0x0}, + 722: {region: 0x166, script: 0x5b, flags: 0x0}, + 723: {region: 0xd0, script: 0x5b, flags: 0x0}, + 724: {region: 0x166, script: 0x5b, flags: 0x0}, + 725: {region: 0x166, script: 0x5b, flags: 0x0}, + 726: {region: 0x166, script: 0x5b, flags: 0x0}, + 727: {region: 0x166, script: 0x5b, flags: 0x0}, + 728: {region: 0x166, script: 0x5b, flags: 0x0}, + 729: {region: 0x166, script: 0x5b, flags: 0x0}, + 730: {region: 0x166, script: 0x5b, flags: 0x0}, + 731: {region: 0x166, script: 0x5b, flags: 0x0}, + 732: {region: 0x166, script: 0x5b, flags: 0x0}, + 733: {region: 0x166, script: 0x5b, flags: 0x0}, + 734: {region: 0x166, script: 0x5b, flags: 0x0}, + 735: {region: 0x166, script: 0x5, flags: 0x0}, + 736: {region: 0x107, script: 0x20, flags: 0x0}, + 737: {region: 0xe8, script: 0x5b, flags: 0x0}, + 738: {region: 0x166, script: 0x5b, flags: 0x0}, + 739: {region: 0x96, script: 0x5b, flags: 0x0}, + 740: {region: 0x166, script: 0x2c, flags: 0x0}, + 741: {region: 0x166, script: 0x5b, flags: 0x0}, + 742: {region: 0x166, script: 0x5b, flags: 0x0}, + 743: {region: 0x166, script: 0x5b, flags: 0x0}, + 744: {region: 0x113, script: 0x5b, flags: 0x0}, + 745: {region: 0xa5, script: 0x5b, flags: 0x0}, + 746: {region: 0x166, script: 0x5b, flags: 0x0}, + 747: {region: 0x166, script: 0x5b, flags: 0x0}, + 748: {region: 0x124, script: 0x5, flags: 0x0}, + 749: {region: 0xcd, script: 0x5b, flags: 0x0}, + 750: {region: 0x166, script: 0x5b, flags: 0x0}, + 751: {region: 0x166, script: 0x5b, flags: 0x0}, + 752: {region: 0x166, script: 0x5b, flags: 0x0}, + 753: {region: 0xc0, script: 0x5b, flags: 0x0}, + 754: {region: 0xd2, script: 0x5b, flags: 0x0}, + 755: {region: 0x166, script: 0x5b, flags: 0x0}, + 756: {region: 0x52, script: 0x5b, flags: 0x0}, + 757: {region: 0xdc, script: 0x22, flags: 0x0}, + 758: {region: 0x130, script: 0x5b, flags: 0x0}, + 759: {region: 0xc1, script: 0x5b, flags: 0x0}, + 760: {region: 0x166, script: 0x5b, flags: 0x0}, + 761: {region: 0x166, script: 0x5b, flags: 0x0}, + 762: {region: 0xe1, script: 0x5b, flags: 0x0}, + 763: {region: 0x166, script: 0x5b, flags: 0x0}, + 764: {region: 0x96, script: 0x5b, flags: 0x0}, + 765: {region: 0x9c, script: 0x3d, flags: 0x0}, + 766: {region: 0x166, script: 0x5b, flags: 0x0}, + 767: {region: 0xc3, script: 0x20, flags: 0x0}, + 768: {region: 0x166, script: 0x5, flags: 0x0}, + 769: {region: 0x166, script: 0x5b, flags: 0x0}, + 770: {region: 0x166, script: 0x5b, flags: 0x0}, + 771: {region: 0x166, script: 0x5b, flags: 0x0}, + 772: {region: 0x9a, script: 0x6f, flags: 0x0}, + 773: {region: 0x166, script: 0x5b, flags: 0x0}, + 774: {region: 0x166, script: 0x5b, flags: 0x0}, + 775: {region: 0x10c, script: 0x5b, flags: 0x0}, + 776: {region: 0x166, script: 0x5b, flags: 0x0}, + 777: {region: 0x166, script: 0x5b, flags: 0x0}, + 778: {region: 0x166, script: 0x5b, flags: 0x0}, + 779: {region: 0x26, script: 0x3, flags: 0x1}, + 780: {region: 0x166, script: 0x5b, flags: 0x0}, + 781: {region: 0x166, script: 0x5b, flags: 0x0}, + 782: {region: 0x9a, script: 0xe, flags: 0x0}, + 783: {region: 0xc5, script: 0x76, flags: 0x0}, + 785: {region: 0x166, script: 0x5b, flags: 0x0}, + 786: {region: 0x49, script: 0x5b, flags: 0x0}, + 787: {region: 0x49, script: 0x5b, flags: 0x0}, + 788: {region: 0x37, script: 0x5b, flags: 0x0}, + 789: {region: 0x166, script: 0x5b, flags: 0x0}, + 790: {region: 0x166, script: 0x5b, flags: 0x0}, + 791: {region: 0x166, script: 0x5b, flags: 0x0}, + 792: {region: 0x166, script: 0x5b, flags: 0x0}, + 793: {region: 0x166, script: 0x5b, flags: 0x0}, + 794: {region: 0x166, script: 0x5b, flags: 0x0}, + 795: {region: 0x9a, script: 0x22, flags: 0x0}, + 796: {region: 0xdc, script: 0x22, flags: 0x0}, + 797: {region: 0x107, script: 0x20, flags: 0x0}, + 798: {region: 0x35, script: 0x73, flags: 0x0}, + 799: {region: 0x29, script: 0x3, flags: 0x1}, + 800: {region: 0xcc, script: 0x5b, flags: 0x0}, + 801: {region: 0x166, script: 0x5b, flags: 0x0}, + 802: {region: 0x166, script: 0x5b, flags: 0x0}, + 803: {region: 0x166, script: 0x5b, flags: 0x0}, + 804: {region: 0x9a, script: 0x22, flags: 0x0}, + 805: {region: 0x52, script: 0x5b, flags: 0x0}, + 807: {region: 0x166, script: 0x5b, flags: 0x0}, + 808: {region: 0x136, script: 0x5b, flags: 0x0}, + 809: {region: 0x166, script: 0x5b, flags: 0x0}, + 810: {region: 0x166, script: 0x5b, flags: 0x0}, + 811: {region: 0xe9, script: 0x5, flags: 0x0}, + 812: {region: 0xc4, script: 0x5b, flags: 0x0}, + 813: {region: 0x9a, script: 0x22, flags: 0x0}, + 814: {region: 0x96, script: 0x5b, flags: 0x0}, + 815: {region: 0x165, script: 0x5b, flags: 0x0}, + 816: {region: 0x166, script: 0x5b, flags: 0x0}, + 817: {region: 0xc5, script: 0x76, flags: 0x0}, + 818: {region: 0x166, script: 0x5b, flags: 0x0}, + 819: {region: 0x166, script: 0x2c, flags: 0x0}, + 820: {region: 0x107, script: 0x20, flags: 0x0}, + 821: {region: 0x166, script: 0x5b, flags: 0x0}, + 822: {region: 0x132, script: 0x5b, flags: 0x0}, + 823: {region: 0x9d, script: 0x67, flags: 0x0}, + 824: {region: 0x166, script: 0x5b, flags: 0x0}, + 825: {region: 0x166, script: 0x5b, flags: 0x0}, + 826: {region: 0x9d, script: 0x5, flags: 0x0}, + 827: {region: 0x166, script: 0x5b, flags: 0x0}, + 828: {region: 0x166, script: 0x5b, flags: 0x0}, + 829: {region: 0x166, script: 0x5b, flags: 0x0}, + 830: {region: 0xde, script: 0x5b, flags: 0x0}, + 831: {region: 0x166, script: 0x5b, flags: 0x0}, + 832: {region: 0x166, script: 0x5b, flags: 0x0}, + 834: {region: 0x166, script: 0x5b, flags: 0x0}, + 835: {region: 0x53, script: 0x3b, flags: 0x0}, + 836: {region: 0x9f, script: 0x5b, flags: 0x0}, + 837: {region: 0xd3, script: 0x5b, flags: 0x0}, + 838: {region: 0x166, script: 0x5b, flags: 0x0}, + 839: {region: 0xdb, script: 0x5b, flags: 0x0}, + 840: {region: 0x166, script: 0x5b, flags: 0x0}, + 841: {region: 0x166, script: 0x5b, flags: 0x0}, + 842: {region: 0x166, script: 0x5b, flags: 0x0}, + 843: {region: 0xd0, script: 0x5b, flags: 0x0}, + 844: {region: 0x166, script: 0x5b, flags: 0x0}, + 845: {region: 0x166, script: 0x5b, flags: 0x0}, + 846: {region: 0x165, script: 0x5b, flags: 0x0}, + 847: {region: 0xd2, script: 0x5b, flags: 0x0}, + 848: {region: 0x61, script: 0x5b, flags: 0x0}, + 849: {region: 0xdc, script: 0x22, flags: 0x0}, + 850: {region: 0x166, script: 0x5b, flags: 0x0}, + 851: {region: 0xdc, script: 0x22, flags: 0x0}, + 852: {region: 0x166, script: 0x5b, flags: 0x0}, + 853: {region: 0x166, script: 0x5b, flags: 0x0}, + 854: {region: 0xd3, script: 0x5b, flags: 0x0}, + 855: {region: 0x166, script: 0x5b, flags: 0x0}, + 856: {region: 0x166, script: 0x5b, flags: 0x0}, + 857: {region: 0xd2, script: 0x5b, flags: 0x0}, + 858: {region: 0x166, script: 0x5b, flags: 0x0}, + 859: {region: 0xd0, script: 0x5b, flags: 0x0}, + 860: {region: 0xd0, script: 0x5b, flags: 0x0}, + 861: {region: 0x166, script: 0x5b, flags: 0x0}, + 862: {region: 0x166, script: 0x5b, flags: 0x0}, + 863: {region: 0x96, script: 0x5b, flags: 0x0}, + 864: {region: 0x166, script: 0x5b, flags: 0x0}, + 865: {region: 0xe0, script: 0x5b, flags: 0x0}, + 866: {region: 0x166, script: 0x5b, flags: 0x0}, + 867: {region: 0x166, script: 0x5b, flags: 0x0}, + 868: {region: 0x9a, script: 0x5b, flags: 0x0}, + 869: {region: 0x166, script: 0x5b, flags: 0x0}, + 870: {region: 0x166, script: 0x5b, flags: 0x0}, + 871: {region: 0xda, script: 0x5b, flags: 0x0}, + 872: {region: 0x52, script: 0x5b, flags: 0x0}, + 873: {region: 0x166, script: 0x5b, flags: 0x0}, + 874: {region: 0xdb, script: 0x5b, flags: 0x0}, + 875: {region: 0x166, script: 0x5b, flags: 0x0}, + 876: {region: 0x52, script: 0x5b, flags: 0x0}, + 877: {region: 0x166, script: 0x5b, flags: 0x0}, + 878: {region: 0x166, script: 0x5b, flags: 0x0}, + 879: {region: 0xdb, script: 0x5b, flags: 0x0}, + 880: {region: 0x124, script: 0x57, flags: 0x0}, + 881: {region: 0x9a, script: 0x22, flags: 0x0}, + 882: {region: 0x10d, script: 0xcb, flags: 0x0}, + 883: {region: 0x166, script: 0x5b, flags: 0x0}, + 884: {region: 0x166, script: 0x5b, flags: 0x0}, + 885: {region: 0x85, script: 0x7e, flags: 0x0}, + 886: {region: 0x162, script: 0x5b, flags: 0x0}, + 887: {region: 0x166, script: 0x5b, flags: 0x0}, + 888: {region: 0x49, script: 0x17, flags: 0x0}, + 889: {region: 0x166, script: 0x5b, flags: 0x0}, + 890: {region: 0x162, script: 0x5b, flags: 0x0}, + 891: {region: 0x166, script: 0x5b, flags: 0x0}, + 892: {region: 0x166, script: 0x5b, flags: 0x0}, + 893: {region: 0x166, script: 0x5b, flags: 0x0}, + 894: {region: 0x166, script: 0x5b, flags: 0x0}, + 895: {region: 0x166, script: 0x5b, flags: 0x0}, + 896: {region: 0x118, script: 0x5b, flags: 0x0}, + 897: {region: 0x166, script: 0x5b, flags: 0x0}, + 898: {region: 0x166, script: 0x5b, flags: 0x0}, + 899: {region: 0x136, script: 0x5b, flags: 0x0}, + 900: {region: 0x166, script: 0x5b, flags: 0x0}, + 901: {region: 0x53, script: 0x5b, flags: 0x0}, + 902: {region: 0x166, script: 0x5b, flags: 0x0}, + 903: {region: 0xcf, script: 0x5b, flags: 0x0}, + 904: {region: 0x130, script: 0x5b, flags: 0x0}, + 905: {region: 0x132, script: 0x5b, flags: 0x0}, + 906: {region: 0x81, script: 0x5b, flags: 0x0}, + 907: {region: 0x79, script: 0x5b, flags: 0x0}, + 908: {region: 0x166, script: 0x5b, flags: 0x0}, + 910: {region: 0x166, script: 0x5b, flags: 0x0}, + 911: {region: 0x166, script: 0x5b, flags: 0x0}, + 912: {region: 0x70, script: 0x5b, flags: 0x0}, + 913: {region: 0x166, script: 0x5b, flags: 0x0}, + 914: {region: 0x166, script: 0x5b, flags: 0x0}, + 915: {region: 0x166, script: 0x5b, flags: 0x0}, + 916: {region: 0x166, script: 0x5b, flags: 0x0}, + 917: {region: 0x9a, script: 0x83, flags: 0x0}, + 918: {region: 0x166, script: 0x5b, flags: 0x0}, + 919: {region: 0x166, script: 0x5, flags: 0x0}, + 920: {region: 0x7e, script: 0x20, flags: 0x0}, + 921: {region: 0x136, script: 0x84, flags: 0x0}, + 922: {region: 0x166, script: 0x5, flags: 0x0}, + 923: {region: 0xc6, script: 0x82, flags: 0x0}, + 924: {region: 0x166, script: 0x5b, flags: 0x0}, + 925: {region: 0x2c, script: 0x3, flags: 0x1}, + 926: {region: 0xe8, script: 0x5b, flags: 0x0}, + 927: {region: 0x2f, script: 0x2, flags: 0x1}, + 928: {region: 0xe8, script: 0x5b, flags: 0x0}, + 929: {region: 0x30, script: 0x5b, flags: 0x0}, + 930: {region: 0xf1, script: 0x5b, flags: 0x0}, + 931: {region: 0x166, script: 0x5b, flags: 0x0}, + 932: {region: 0x79, script: 0x5b, flags: 0x0}, + 933: {region: 0xd7, script: 0x5b, flags: 0x0}, + 934: {region: 0x136, script: 0x5b, flags: 0x0}, + 935: {region: 0x49, script: 0x5b, flags: 0x0}, + 936: {region: 0x166, script: 0x5b, flags: 0x0}, + 937: {region: 0x9d, script: 0xfa, flags: 0x0}, + 938: {region: 0x166, script: 0x5b, flags: 0x0}, + 939: {region: 0x61, script: 0x5b, flags: 0x0}, + 940: {region: 0x166, script: 0x5, flags: 0x0}, + 941: {region: 0xb1, script: 0x90, flags: 0x0}, + 943: {region: 0x166, script: 0x5b, flags: 0x0}, + 944: {region: 0x166, script: 0x5b, flags: 0x0}, + 945: {region: 0x9a, script: 0x12, flags: 0x0}, + 946: {region: 0xa5, script: 0x5b, flags: 0x0}, + 947: {region: 0xea, script: 0x5b, flags: 0x0}, + 948: {region: 0x166, script: 0x5b, flags: 0x0}, + 949: {region: 0x9f, script: 0x5b, flags: 0x0}, + 950: {region: 0x166, script: 0x5b, flags: 0x0}, + 951: {region: 0x166, script: 0x5b, flags: 0x0}, + 952: {region: 0x88, script: 0x34, flags: 0x0}, + 953: {region: 0x76, script: 0x5b, flags: 0x0}, + 954: {region: 0x166, script: 0x5b, flags: 0x0}, + 955: {region: 0xe9, script: 0x4e, flags: 0x0}, + 956: {region: 0x9d, script: 0x5, flags: 0x0}, + 957: {region: 0x1, script: 0x5b, flags: 0x0}, + 958: {region: 0x24, script: 0x5, flags: 0x0}, + 959: {region: 0x166, script: 0x5b, flags: 0x0}, + 960: {region: 0x41, script: 0x5b, flags: 0x0}, + 961: {region: 0x166, script: 0x5b, flags: 0x0}, + 962: {region: 0x7b, script: 0x5b, flags: 0x0}, + 963: {region: 0x166, script: 0x5b, flags: 0x0}, + 964: {region: 0xe5, script: 0x5b, flags: 0x0}, + 965: {region: 0x8a, script: 0x5b, flags: 0x0}, + 966: {region: 0x6a, script: 0x5b, flags: 0x0}, + 967: {region: 0x166, script: 0x5b, flags: 0x0}, + 968: {region: 0x9a, script: 0x22, flags: 0x0}, + 969: {region: 0x166, script: 0x5b, flags: 0x0}, + 970: {region: 0x103, script: 0x5b, flags: 0x0}, + 971: {region: 0x96, script: 0x5b, flags: 0x0}, + 972: {region: 0x166, script: 0x5b, flags: 0x0}, + 973: {region: 0x166, script: 0x5b, flags: 0x0}, + 974: {region: 0x9f, script: 0x5b, flags: 0x0}, + 975: {region: 0x166, script: 0x5, flags: 0x0}, + 976: {region: 0x9a, script: 0x5b, flags: 0x0}, + 977: {region: 0x31, script: 0x2, flags: 0x1}, + 978: {region: 0xdc, script: 0x22, flags: 0x0}, + 979: {region: 0x35, script: 0xe, flags: 0x0}, + 980: {region: 0x4e, script: 0x5b, flags: 0x0}, + 981: {region: 0x73, script: 0x5b, flags: 0x0}, + 982: {region: 0x4e, script: 0x5b, flags: 0x0}, + 983: {region: 0x9d, script: 0x5, flags: 0x0}, + 984: {region: 0x10d, script: 0x5b, flags: 0x0}, + 985: {region: 0x3a, script: 0x5b, flags: 0x0}, + 986: {region: 0x166, script: 0x5b, flags: 0x0}, + 987: {region: 0xd2, script: 0x5b, flags: 0x0}, + 988: {region: 0x105, script: 0x5b, flags: 0x0}, + 989: {region: 0x96, script: 0x5b, flags: 0x0}, + 990: {region: 0x130, script: 0x5b, flags: 0x0}, + 991: {region: 0x166, script: 0x5b, flags: 0x0}, + 992: {region: 0x166, script: 0x5b, flags: 0x0}, + 993: {region: 0x74, script: 0x5b, flags: 0x0}, + 994: {region: 0x107, script: 0x20, flags: 0x0}, + 995: {region: 0x131, script: 0x20, flags: 0x0}, + 996: {region: 0x10a, script: 0x5b, flags: 0x0}, + 997: {region: 0x108, script: 0x5b, flags: 0x0}, + 998: {region: 0x130, script: 0x5b, flags: 0x0}, + 999: {region: 0x166, script: 0x5b, flags: 0x0}, + 1000: {region: 0xa3, script: 0x4c, flags: 0x0}, + 1001: {region: 0x9a, script: 0x22, flags: 0x0}, + 1002: {region: 0x81, script: 0x5b, flags: 0x0}, + 1003: {region: 0x107, script: 0x20, flags: 0x0}, + 1004: {region: 0xa5, script: 0x5b, flags: 0x0}, + 1005: {region: 0x96, script: 0x5b, flags: 0x0}, + 1006: {region: 0x9a, script: 0x5b, flags: 0x0}, + 1007: {region: 0x115, script: 0x5b, flags: 0x0}, + 1008: {region: 0x9a, script: 0xcf, flags: 0x0}, + 1009: {region: 0x166, script: 0x5b, flags: 0x0}, + 1010: {region: 0x166, script: 0x5b, flags: 0x0}, + 1011: {region: 0x130, script: 0x5b, flags: 0x0}, + 1012: {region: 0x9f, script: 0x5b, flags: 0x0}, + 1013: {region: 0x9a, script: 0x22, flags: 0x0}, + 1014: {region: 0x166, script: 0x5, flags: 0x0}, + 1015: {region: 0x9f, script: 0x5b, flags: 0x0}, + 1016: {region: 0x7c, script: 0x5b, flags: 0x0}, + 1017: {region: 0x49, script: 0x5b, flags: 0x0}, + 1018: {region: 0x33, script: 0x4, flags: 0x1}, + 1019: {region: 0x9f, script: 0x5b, flags: 0x0}, + 1020: {region: 0x9d, script: 0x5, flags: 0x0}, + 1021: {region: 0xdb, script: 0x5b, flags: 0x0}, + 1022: {region: 0x4f, script: 0x5b, flags: 0x0}, + 1023: {region: 0xd2, script: 0x5b, flags: 0x0}, + 1024: {region: 0xd0, script: 0x5b, flags: 0x0}, + 1025: {region: 0xc4, script: 0x5b, flags: 0x0}, + 1026: {region: 0x4c, script: 0x5b, flags: 0x0}, + 1027: {region: 0x97, script: 0x80, flags: 0x0}, + 1028: {region: 0xb7, script: 0x5b, flags: 0x0}, + 1029: {region: 0x166, script: 0x2c, flags: 0x0}, + 1030: {region: 0x166, script: 0x5b, flags: 0x0}, + 1032: {region: 0xbb, script: 0xeb, flags: 0x0}, + 1033: {region: 0x166, script: 0x5b, flags: 0x0}, + 1034: {region: 0xc5, script: 0x76, flags: 0x0}, + 1035: {region: 0x166, script: 0x5, flags: 0x0}, + 1036: {region: 0xb4, script: 0xd6, flags: 0x0}, + 1037: {region: 0x70, script: 0x5b, flags: 0x0}, + 1038: {region: 0x166, script: 0x5b, flags: 0x0}, + 1039: {region: 0x166, script: 0x5b, flags: 0x0}, + 1040: {region: 0x166, script: 0x5b, flags: 0x0}, + 1041: {region: 0x166, script: 0x5b, flags: 0x0}, + 1042: {region: 0x112, script: 0x5b, flags: 0x0}, + 1043: {region: 0x166, script: 0x5b, flags: 0x0}, + 1044: {region: 0xe9, script: 0x5, flags: 0x0}, + 1045: {region: 0x166, script: 0x5b, flags: 0x0}, + 1046: {region: 0x110, script: 0x5b, flags: 0x0}, + 1047: {region: 0x166, script: 0x5b, flags: 0x0}, + 1048: {region: 0xea, script: 0x5b, flags: 0x0}, + 1049: {region: 0x166, script: 0x5b, flags: 0x0}, + 1050: {region: 0x96, script: 0x5b, flags: 0x0}, + 1051: {region: 0x143, script: 0x5b, flags: 0x0}, + 1052: {region: 0x10d, script: 0x5b, flags: 0x0}, + 1054: {region: 0x10d, script: 0x5b, flags: 0x0}, + 1055: {region: 0x73, script: 0x5b, flags: 0x0}, + 1056: {region: 0x98, script: 0xcc, flags: 0x0}, + 1057: {region: 0x166, script: 0x5b, flags: 0x0}, + 1058: {region: 0x73, script: 0x5b, flags: 0x0}, + 1059: {region: 0x165, script: 0x5b, flags: 0x0}, + 1060: {region: 0x166, script: 0x5b, flags: 0x0}, + 1061: {region: 0xc4, script: 0x5b, flags: 0x0}, + 1062: {region: 0x166, script: 0x5b, flags: 0x0}, + 1063: {region: 0x166, script: 0x5b, flags: 0x0}, + 1064: {region: 0x166, script: 0x5b, flags: 0x0}, + 1065: {region: 0x116, script: 0x5b, flags: 0x0}, + 1066: {region: 0x166, script: 0x5b, flags: 0x0}, + 1067: {region: 0x166, script: 0x5b, flags: 0x0}, + 1068: {region: 0x124, script: 0xee, flags: 0x0}, + 1069: {region: 0x166, script: 0x5b, flags: 0x0}, + 1070: {region: 0x166, script: 0x5b, flags: 0x0}, + 1071: {region: 0x166, script: 0x5b, flags: 0x0}, + 1072: {region: 0x166, script: 0x5b, flags: 0x0}, + 1073: {region: 0x27, script: 0x5b, flags: 0x0}, + 1074: {region: 0x37, script: 0x5, flags: 0x1}, + 1075: {region: 0x9a, script: 0xd9, flags: 0x0}, + 1076: {region: 0x117, script: 0x5b, flags: 0x0}, + 1077: {region: 0x115, script: 0x5b, flags: 0x0}, + 1078: {region: 0x9a, script: 0x22, flags: 0x0}, + 1079: {region: 0x162, script: 0x5b, flags: 0x0}, + 1080: {region: 0x166, script: 0x5b, flags: 0x0}, + 1081: {region: 0x166, script: 0x5b, flags: 0x0}, + 1082: {region: 0x6e, script: 0x5b, flags: 0x0}, + 1083: {region: 0x162, script: 0x5b, flags: 0x0}, + 1084: {region: 0x166, script: 0x5b, flags: 0x0}, + 1085: {region: 0x61, script: 0x5b, flags: 0x0}, + 1086: {region: 0x96, script: 0x5b, flags: 0x0}, + 1087: {region: 0x166, script: 0x5b, flags: 0x0}, + 1088: {region: 0x166, script: 0x5b, flags: 0x0}, + 1089: {region: 0x130, script: 0x5b, flags: 0x0}, + 1090: {region: 0x166, script: 0x5b, flags: 0x0}, + 1091: {region: 0x85, script: 0x5b, flags: 0x0}, + 1092: {region: 0x10d, script: 0x5b, flags: 0x0}, + 1093: {region: 0x130, script: 0x5b, flags: 0x0}, + 1094: {region: 0x160, script: 0x5, flags: 0x0}, + 1095: {region: 0x4b, script: 0x5b, flags: 0x0}, + 1096: {region: 0x61, script: 0x5b, flags: 0x0}, + 1097: {region: 0x166, script: 0x5b, flags: 0x0}, + 1098: {region: 0x9a, script: 0x22, flags: 0x0}, + 1099: {region: 0x96, script: 0x5b, flags: 0x0}, + 1100: {region: 0x166, script: 0x5b, flags: 0x0}, + 1101: {region: 0x35, script: 0xe, flags: 0x0}, + 1102: {region: 0x9c, script: 0xde, flags: 0x0}, + 1103: {region: 0xea, script: 0x5b, flags: 0x0}, + 1104: {region: 0x9a, script: 0xe6, flags: 0x0}, + 1105: {region: 0xdc, script: 0x22, flags: 0x0}, + 1106: {region: 0x166, script: 0x5b, flags: 0x0}, + 1107: {region: 0x166, script: 0x5b, flags: 0x0}, + 1108: {region: 0x166, script: 0x5b, flags: 0x0}, + 1109: {region: 0x166, script: 0x5b, flags: 0x0}, + 1110: {region: 0x166, script: 0x5b, flags: 0x0}, + 1111: {region: 0x166, script: 0x5b, flags: 0x0}, + 1112: {region: 0x166, script: 0x5b, flags: 0x0}, + 1113: {region: 0x166, script: 0x5b, flags: 0x0}, + 1114: {region: 0xe8, script: 0x5b, flags: 0x0}, + 1115: {region: 0x166, script: 0x5b, flags: 0x0}, + 1116: {region: 0x166, script: 0x5b, flags: 0x0}, + 1117: {region: 0x9a, script: 0x53, flags: 0x0}, + 1118: {region: 0x53, script: 0xe4, flags: 0x0}, + 1119: {region: 0xdc, script: 0x22, flags: 0x0}, + 1120: {region: 0xdc, script: 0x22, flags: 0x0}, + 1121: {region: 0x9a, script: 0xe9, flags: 0x0}, + 1122: {region: 0x166, script: 0x5b, flags: 0x0}, + 1123: {region: 0x113, script: 0x5b, flags: 0x0}, + 1124: {region: 0x132, script: 0x5b, flags: 0x0}, + 1125: {region: 0x127, script: 0x5b, flags: 0x0}, + 1126: {region: 0x166, script: 0x5b, flags: 0x0}, + 1127: {region: 0x3c, script: 0x3, flags: 0x1}, + 1128: {region: 0x166, script: 0x5b, flags: 0x0}, + 1129: {region: 0x166, script: 0x5b, flags: 0x0}, + 1130: {region: 0x166, script: 0x5b, flags: 0x0}, + 1131: {region: 0x124, script: 0xee, flags: 0x0}, + 1132: {region: 0xdc, script: 0x22, flags: 0x0}, + 1133: {region: 0xdc, script: 0x22, flags: 0x0}, + 1134: {region: 0xdc, script: 0x22, flags: 0x0}, + 1135: {region: 0x70, script: 0x2c, flags: 0x0}, + 1136: {region: 0x166, script: 0x5b, flags: 0x0}, + 1137: {region: 0x6e, script: 0x2c, flags: 0x0}, + 1138: {region: 0x166, script: 0x5b, flags: 0x0}, + 1139: {region: 0x166, script: 0x5b, flags: 0x0}, + 1140: {region: 0x166, script: 0x5b, flags: 0x0}, + 1141: {region: 0xd7, script: 0x5b, flags: 0x0}, + 1142: {region: 0x128, script: 0x5b, flags: 0x0}, + 1143: {region: 0x126, script: 0x5b, flags: 0x0}, + 1144: {region: 0x32, script: 0x5b, flags: 0x0}, + 1145: {region: 0xdc, script: 0x22, flags: 0x0}, + 1146: {region: 0xe8, script: 0x5b, flags: 0x0}, + 1147: {region: 0x166, script: 0x5b, flags: 0x0}, + 1148: {region: 0x166, script: 0x5b, flags: 0x0}, + 1149: {region: 0x32, script: 0x5b, flags: 0x0}, + 1150: {region: 0xd5, script: 0x5b, flags: 0x0}, + 1151: {region: 0x166, script: 0x5b, flags: 0x0}, + 1152: {region: 0x162, script: 0x5b, flags: 0x0}, + 1153: {region: 0x166, script: 0x5b, flags: 0x0}, + 1154: {region: 0x12a, script: 0x5b, flags: 0x0}, + 1155: {region: 0x166, script: 0x5b, flags: 0x0}, + 1156: {region: 0xcf, script: 0x5b, flags: 0x0}, + 1157: {region: 0x166, script: 0x5b, flags: 0x0}, + 1158: {region: 0xe7, script: 0x5b, flags: 0x0}, + 1159: {region: 0x166, script: 0x5b, flags: 0x0}, + 1160: {region: 0x166, script: 0x5b, flags: 0x0}, + 1161: {region: 0x166, script: 0x5b, flags: 0x0}, + 1162: {region: 0x12c, script: 0x5b, flags: 0x0}, + 1163: {region: 0x12c, script: 0x5b, flags: 0x0}, + 1164: {region: 0x12f, script: 0x5b, flags: 0x0}, + 1165: {region: 0x166, script: 0x5, flags: 0x0}, + 1166: {region: 0x162, script: 0x5b, flags: 0x0}, + 1167: {region: 0x88, script: 0x34, flags: 0x0}, + 1168: {region: 0xdc, script: 0x22, flags: 0x0}, + 1169: {region: 0xe8, script: 0x5b, flags: 0x0}, + 1170: {region: 0x43, script: 0xef, flags: 0x0}, + 1171: {region: 0x166, script: 0x5b, flags: 0x0}, + 1172: {region: 0x107, script: 0x20, flags: 0x0}, + 1173: {region: 0x166, script: 0x5b, flags: 0x0}, + 1174: {region: 0x166, script: 0x5b, flags: 0x0}, + 1175: {region: 0x132, script: 0x5b, flags: 0x0}, + 1176: {region: 0x166, script: 0x5b, flags: 0x0}, + 1177: {region: 0x124, script: 0xee, flags: 0x0}, + 1178: {region: 0x32, script: 0x5b, flags: 0x0}, + 1179: {region: 0x166, script: 0x5b, flags: 0x0}, + 1180: {region: 0x166, script: 0x5b, flags: 0x0}, + 1181: {region: 0xcf, script: 0x5b, flags: 0x0}, + 1182: {region: 0x166, script: 0x5b, flags: 0x0}, + 1183: {region: 0x166, script: 0x5b, flags: 0x0}, + 1184: {region: 0x12e, script: 0x5b, flags: 0x0}, + 1185: {region: 0x166, script: 0x5b, flags: 0x0}, + 1187: {region: 0x166, script: 0x5b, flags: 0x0}, + 1188: {region: 0xd5, script: 0x5b, flags: 0x0}, + 1189: {region: 0x53, script: 0xe7, flags: 0x0}, + 1190: {region: 0xe6, script: 0x5b, flags: 0x0}, + 1191: {region: 0x166, script: 0x5b, flags: 0x0}, + 1192: {region: 0x107, script: 0x20, flags: 0x0}, + 1193: {region: 0xbb, script: 0x5b, flags: 0x0}, + 1194: {region: 0x166, script: 0x5b, flags: 0x0}, + 1195: {region: 0x107, script: 0x20, flags: 0x0}, + 1196: {region: 0x3f, script: 0x4, flags: 0x1}, + 1197: {region: 0x11d, script: 0xf3, flags: 0x0}, + 1198: {region: 0x131, script: 0x20, flags: 0x0}, + 1199: {region: 0x76, script: 0x5b, flags: 0x0}, + 1200: {region: 0x2a, script: 0x5b, flags: 0x0}, + 1202: {region: 0x43, script: 0x3, flags: 0x1}, + 1203: {region: 0x9a, script: 0xe, flags: 0x0}, + 1204: {region: 0xe9, script: 0x5, flags: 0x0}, + 1205: {region: 0x166, script: 0x5b, flags: 0x0}, + 1206: {region: 0x166, script: 0x5b, flags: 0x0}, + 1207: {region: 0x166, script: 0x5b, flags: 0x0}, + 1208: {region: 0x166, script: 0x5b, flags: 0x0}, + 1209: {region: 0x166, script: 0x5b, flags: 0x0}, + 1210: {region: 0x166, script: 0x5b, flags: 0x0}, + 1211: {region: 0x166, script: 0x5b, flags: 0x0}, + 1212: {region: 0x46, script: 0x4, flags: 0x1}, + 1213: {region: 0x166, script: 0x5b, flags: 0x0}, + 1214: {region: 0xb5, script: 0xf4, flags: 0x0}, + 1215: {region: 0x166, script: 0x5b, flags: 0x0}, + 1216: {region: 0x162, script: 0x5b, flags: 0x0}, + 1217: {region: 0x9f, script: 0x5b, flags: 0x0}, + 1218: {region: 0x107, script: 0x5b, flags: 0x0}, + 1219: {region: 0x13f, script: 0x5b, flags: 0x0}, + 1220: {region: 0x11c, script: 0x5b, flags: 0x0}, + 1221: {region: 0x166, script: 0x5b, flags: 0x0}, + 1222: {region: 0x36, script: 0x5b, flags: 0x0}, + 1223: {region: 0x61, script: 0x5b, flags: 0x0}, + 1224: {region: 0xd2, script: 0x5b, flags: 0x0}, + 1225: {region: 0x1, script: 0x5b, flags: 0x0}, + 1226: {region: 0x107, script: 0x5b, flags: 0x0}, + 1227: {region: 0x6b, script: 0x5b, flags: 0x0}, + 1228: {region: 0x130, script: 0x5b, flags: 0x0}, + 1229: {region: 0x166, script: 0x5b, flags: 0x0}, + 1230: {region: 0x36, script: 0x5b, flags: 0x0}, + 1231: {region: 0x4e, script: 0x5b, flags: 0x0}, + 1232: {region: 0x166, script: 0x5b, flags: 0x0}, + 1233: {region: 0x70, script: 0x2c, flags: 0x0}, + 1234: {region: 0x166, script: 0x5b, flags: 0x0}, + 1235: {region: 0xe8, script: 0x5b, flags: 0x0}, + 1236: {region: 0x2f, script: 0x5b, flags: 0x0}, + 1237: {region: 0x9a, script: 0xe9, flags: 0x0}, + 1238: {region: 0x9a, script: 0x22, flags: 0x0}, + 1239: {region: 0x166, script: 0x5b, flags: 0x0}, + 1240: {region: 0x166, script: 0x5b, flags: 0x0}, + 1241: {region: 0x166, script: 0x5b, flags: 0x0}, + 1242: {region: 0x166, script: 0x5b, flags: 0x0}, + 1243: {region: 0x166, script: 0x5b, flags: 0x0}, + 1244: {region: 0x166, script: 0x5b, flags: 0x0}, + 1245: {region: 0x166, script: 0x5b, flags: 0x0}, + 1246: {region: 0x166, script: 0x5b, flags: 0x0}, + 1247: {region: 0x166, script: 0x5b, flags: 0x0}, + 1248: {region: 0x141, script: 0x5b, flags: 0x0}, + 1249: {region: 0x166, script: 0x5b, flags: 0x0}, + 1250: {region: 0x166, script: 0x5b, flags: 0x0}, + 1251: {region: 0xa9, script: 0x5, flags: 0x0}, + 1252: {region: 0x166, script: 0x5b, flags: 0x0}, + 1253: {region: 0x115, script: 0x5b, flags: 0x0}, + 1254: {region: 0x166, script: 0x5b, flags: 0x0}, + 1255: {region: 0x166, script: 0x5b, flags: 0x0}, + 1256: {region: 0x166, script: 0x5b, flags: 0x0}, + 1257: {region: 0x166, script: 0x5b, flags: 0x0}, + 1258: {region: 0x9a, script: 0x22, flags: 0x0}, + 1259: {region: 0x53, script: 0x3b, flags: 0x0}, + 1260: {region: 0x166, script: 0x5b, flags: 0x0}, + 1261: {region: 0x166, script: 0x5b, flags: 0x0}, + 1262: {region: 0x41, script: 0x5b, flags: 0x0}, + 1263: {region: 0x166, script: 0x5b, flags: 0x0}, + 1264: {region: 0x12c, script: 0x18, flags: 0x0}, + 1265: {region: 0x166, script: 0x5b, flags: 0x0}, + 1266: {region: 0x162, script: 0x5b, flags: 0x0}, + 1267: {region: 0x166, script: 0x5b, flags: 0x0}, + 1268: {region: 0x12c, script: 0x63, flags: 0x0}, + 1269: {region: 0x12c, script: 0x64, flags: 0x0}, + 1270: {region: 0x7e, script: 0x2e, flags: 0x0}, + 1271: {region: 0x53, script: 0x68, flags: 0x0}, + 1272: {region: 0x10c, script: 0x6d, flags: 0x0}, + 1273: {region: 0x109, script: 0x79, flags: 0x0}, + 1274: {region: 0x9a, script: 0x22, flags: 0x0}, + 1275: {region: 0x132, script: 0x5b, flags: 0x0}, + 1276: {region: 0x166, script: 0x5b, flags: 0x0}, + 1277: {region: 0x9d, script: 0x93, flags: 0x0}, + 1278: {region: 0x166, script: 0x5b, flags: 0x0}, + 1279: {region: 0x15f, script: 0xce, flags: 0x0}, + 1280: {region: 0x166, script: 0x5b, flags: 0x0}, + 1281: {region: 0x166, script: 0x5b, flags: 0x0}, + 1282: {region: 0xdc, script: 0x22, flags: 0x0}, + 1283: {region: 0x166, script: 0x5b, flags: 0x0}, + 1284: {region: 0x166, script: 0x5b, flags: 0x0}, + 1285: {region: 0xd2, script: 0x5b, flags: 0x0}, + 1286: {region: 0x76, script: 0x5b, flags: 0x0}, + 1287: {region: 0x166, script: 0x5b, flags: 0x0}, + 1288: {region: 0x166, script: 0x5b, flags: 0x0}, + 1289: {region: 0x52, script: 0x5b, flags: 0x0}, + 1290: {region: 0x166, script: 0x5b, flags: 0x0}, + 1291: {region: 0x166, script: 0x5b, flags: 0x0}, + 1292: {region: 0x166, script: 0x5b, flags: 0x0}, + 1293: {region: 0x52, script: 0x5b, flags: 0x0}, + 1294: {region: 0x166, script: 0x5b, flags: 0x0}, + 1295: {region: 0x166, script: 0x5b, flags: 0x0}, + 1296: {region: 0x166, script: 0x5b, flags: 0x0}, + 1297: {region: 0x166, script: 0x5b, flags: 0x0}, + 1298: {region: 0x1, script: 0x3e, flags: 0x0}, + 1299: {region: 0x166, script: 0x5b, flags: 0x0}, + 1300: {region: 0x166, script: 0x5b, flags: 0x0}, + 1301: {region: 0x166, script: 0x5b, flags: 0x0}, + 1302: {region: 0x166, script: 0x5b, flags: 0x0}, + 1303: {region: 0x166, script: 0x5b, flags: 0x0}, + 1304: {region: 0xd7, script: 0x5b, flags: 0x0}, + 1305: {region: 0x166, script: 0x5b, flags: 0x0}, + 1306: {region: 0x166, script: 0x5b, flags: 0x0}, + 1307: {region: 0x166, script: 0x5b, flags: 0x0}, + 1308: {region: 0x41, script: 0x5b, flags: 0x0}, + 1309: {region: 0x166, script: 0x5b, flags: 0x0}, + 1310: {region: 0xd0, script: 0x5b, flags: 0x0}, + 1311: {region: 0x4a, script: 0x3, flags: 0x1}, + 1312: {region: 0x166, script: 0x5b, flags: 0x0}, + 1313: {region: 0x166, script: 0x5b, flags: 0x0}, + 1314: {region: 0x166, script: 0x5b, flags: 0x0}, + 1315: {region: 0x53, script: 0x5b, flags: 0x0}, + 1316: {region: 0x10c, script: 0x5b, flags: 0x0}, + 1318: {region: 0xa9, script: 0x5, flags: 0x0}, + 1319: {region: 0xda, script: 0x5b, flags: 0x0}, + 1320: {region: 0xbb, script: 0xeb, flags: 0x0}, + 1321: {region: 0x4d, script: 0x14, flags: 0x1}, + 1322: {region: 0x53, script: 0x7f, flags: 0x0}, + 1323: {region: 0x166, script: 0x5b, flags: 0x0}, + 1324: {region: 0x123, script: 0x5b, flags: 0x0}, + 1325: {region: 0xd1, script: 0x5b, flags: 0x0}, + 1326: {region: 0x166, script: 0x5b, flags: 0x0}, + 1327: {region: 0x162, script: 0x5b, flags: 0x0}, + 1329: {region: 0x12c, script: 0x5b, flags: 0x0}, +} + +// likelyLangList holds lists info associated with likelyLang. +// Size: 582 bytes, 97 elements +var likelyLangList = [97]likelyScriptRegion{ + 0: {region: 0x9d, script: 0x7, flags: 0x0}, + 1: {region: 0xa2, script: 0x7a, flags: 0x2}, + 2: {region: 0x11d, script: 0x87, flags: 0x2}, + 3: {region: 0x32, script: 0x5b, flags: 0x0}, + 4: {region: 0x9c, script: 0x5, flags: 0x4}, + 5: {region: 0x9d, script: 0x5, flags: 0x4}, + 6: {region: 0x107, script: 0x20, flags: 0x4}, + 7: {region: 0x9d, script: 0x5, flags: 0x2}, + 8: {region: 0x107, script: 0x20, flags: 0x0}, + 9: {region: 0x38, script: 0x2f, flags: 0x2}, + 10: {region: 0x136, script: 0x5b, flags: 0x0}, + 11: {region: 0x7c, script: 0xd1, flags: 0x2}, + 12: {region: 0x115, script: 0x5b, flags: 0x0}, + 13: {region: 0x85, script: 0x1, flags: 0x2}, + 14: {region: 0x5e, script: 0x1f, flags: 0x0}, + 15: {region: 0x88, script: 0x60, flags: 0x2}, + 16: {region: 0xd7, script: 0x5b, flags: 0x0}, + 17: {region: 0x52, script: 0x5, flags: 0x4}, + 18: {region: 0x10c, script: 0x5, flags: 0x4}, + 19: {region: 0xaf, script: 0x20, flags: 0x0}, + 20: {region: 0x24, script: 0x5, flags: 0x4}, + 21: {region: 0x53, script: 0x5, flags: 0x4}, + 22: {region: 0x9d, script: 0x5, flags: 0x4}, + 23: {region: 0xc6, script: 0x5, flags: 0x4}, + 24: {region: 0x53, script: 0x5, flags: 0x2}, + 25: {region: 0x12c, script: 0x5b, flags: 0x0}, + 26: {region: 0xb1, script: 0x5, flags: 0x4}, + 27: {region: 0x9c, script: 0x5, flags: 0x2}, + 28: {region: 0xa6, script: 0x20, flags: 0x0}, + 29: {region: 0x53, script: 0x5, flags: 0x4}, + 30: {region: 0x12c, script: 0x5b, flags: 0x4}, + 31: {region: 0x53, script: 0x5, flags: 0x2}, + 32: {region: 0x12c, script: 0x5b, flags: 0x2}, + 33: {region: 0xdc, script: 0x22, flags: 0x0}, + 34: {region: 0x9a, script: 0x5e, flags: 0x2}, + 35: {region: 0x84, script: 0x5b, flags: 0x0}, + 36: {region: 0x85, script: 0x7e, flags: 0x4}, + 37: {region: 0x85, script: 0x7e, flags: 0x2}, + 38: {region: 0xc6, script: 0x20, flags: 0x0}, + 39: {region: 0x53, script: 0x71, flags: 0x4}, + 40: {region: 0x53, script: 0x71, flags: 0x2}, + 41: {region: 0xd1, script: 0x5b, flags: 0x0}, + 42: {region: 0x4a, script: 0x5, flags: 0x4}, + 43: {region: 0x96, script: 0x5, flags: 0x4}, + 44: {region: 0x9a, script: 0x36, flags: 0x0}, + 45: {region: 0xe9, script: 0x5, flags: 0x4}, + 46: {region: 0xe9, script: 0x5, flags: 0x2}, + 47: {region: 0x9d, script: 0x8d, flags: 0x0}, + 48: {region: 0x53, script: 0x8e, flags: 0x2}, + 49: {region: 0xbb, script: 0xeb, flags: 0x0}, + 50: {region: 0xda, script: 0x5b, flags: 0x4}, + 51: {region: 0xe9, script: 0x5, flags: 0x0}, + 52: {region: 0x9a, script: 0x22, flags: 0x2}, + 53: {region: 0x9a, script: 0x50, flags: 0x2}, + 54: {region: 0x9a, script: 0xd5, flags: 0x2}, + 55: {region: 0x106, script: 0x20, flags: 0x0}, + 56: {region: 0xbe, script: 0x5b, flags: 0x4}, + 57: {region: 0x105, script: 0x5b, flags: 0x4}, + 58: {region: 0x107, script: 0x5b, flags: 0x4}, + 59: {region: 0x12c, script: 0x5b, flags: 0x4}, + 60: {region: 0x125, script: 0x20, flags: 0x0}, + 61: {region: 0xe9, script: 0x5, flags: 0x4}, + 62: {region: 0xe9, script: 0x5, flags: 0x2}, + 63: {region: 0x53, script: 0x5, flags: 0x0}, + 64: {region: 0xaf, script: 0x20, flags: 0x4}, + 65: {region: 0xc6, script: 0x20, flags: 0x4}, + 66: {region: 0xaf, script: 0x20, flags: 0x2}, + 67: {region: 0x9a, script: 0xe, flags: 0x0}, + 68: {region: 0xdc, script: 0x22, flags: 0x4}, + 69: {region: 0xdc, script: 0x22, flags: 0x2}, + 70: {region: 0x138, script: 0x5b, flags: 0x0}, + 71: {region: 0x24, script: 0x5, flags: 0x4}, + 72: {region: 0x53, script: 0x20, flags: 0x4}, + 73: {region: 0x24, script: 0x5, flags: 0x2}, + 74: {region: 0x8e, script: 0x3c, flags: 0x0}, + 75: {region: 0x53, script: 0x3b, flags: 0x4}, + 76: {region: 0x53, script: 0x3b, flags: 0x2}, + 77: {region: 0x53, script: 0x3b, flags: 0x0}, + 78: {region: 0x2f, script: 0x3c, flags: 0x4}, + 79: {region: 0x3e, script: 0x3c, flags: 0x4}, + 80: {region: 0x7c, script: 0x3c, flags: 0x4}, + 81: {region: 0x7f, script: 0x3c, flags: 0x4}, + 82: {region: 0x8e, script: 0x3c, flags: 0x4}, + 83: {region: 0x96, script: 0x3c, flags: 0x4}, + 84: {region: 0xc7, script: 0x3c, flags: 0x4}, + 85: {region: 0xd1, script: 0x3c, flags: 0x4}, + 86: {region: 0xe3, script: 0x3c, flags: 0x4}, + 87: {region: 0xe6, script: 0x3c, flags: 0x4}, + 88: {region: 0xe8, script: 0x3c, flags: 0x4}, + 89: {region: 0x117, script: 0x3c, flags: 0x4}, + 90: {region: 0x124, script: 0x3c, flags: 0x4}, + 91: {region: 0x12f, script: 0x3c, flags: 0x4}, + 92: {region: 0x136, script: 0x3c, flags: 0x4}, + 93: {region: 0x13f, script: 0x3c, flags: 0x4}, + 94: {region: 0x12f, script: 0x11, flags: 0x2}, + 95: {region: 0x12f, script: 0x37, flags: 0x2}, + 96: {region: 0x12f, script: 0x3c, flags: 0x2}, +} + +type likelyLangScript struct { + lang uint16 + script uint16 + flags uint8 +} + +// likelyRegion is a lookup table, indexed by regionID, for the most likely +// languages and scripts given incomplete information. If more entries exist +// for a given regionID, lang and script are the index and size respectively +// of the list in likelyRegionList. +// TODO: exclude containers and user-definable regions from the list. +// Size: 2154 bytes, 359 elements +var likelyRegion = [359]likelyLangScript{ + 34: {lang: 0xd7, script: 0x5b, flags: 0x0}, + 35: {lang: 0x3a, script: 0x5, flags: 0x0}, + 36: {lang: 0x0, script: 0x2, flags: 0x1}, + 39: {lang: 0x2, script: 0x2, flags: 0x1}, + 40: {lang: 0x4, script: 0x2, flags: 0x1}, + 42: {lang: 0x3c0, script: 0x5b, flags: 0x0}, + 43: {lang: 0x0, script: 0x5b, flags: 0x0}, + 44: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 45: {lang: 0x41b, script: 0x5b, flags: 0x0}, + 46: {lang: 0x10d, script: 0x5b, flags: 0x0}, + 48: {lang: 0x367, script: 0x5b, flags: 0x0}, + 49: {lang: 0x444, script: 0x5b, flags: 0x0}, + 50: {lang: 0x58, script: 0x5b, flags: 0x0}, + 51: {lang: 0x6, script: 0x2, flags: 0x1}, + 53: {lang: 0xa5, script: 0xe, flags: 0x0}, + 54: {lang: 0x367, script: 0x5b, flags: 0x0}, + 55: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 56: {lang: 0x7e, script: 0x20, flags: 0x0}, + 57: {lang: 0x3a, script: 0x5, flags: 0x0}, + 58: {lang: 0x3d9, script: 0x5b, flags: 0x0}, + 59: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 60: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 62: {lang: 0x31f, script: 0x5b, flags: 0x0}, + 63: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 64: {lang: 0x3a1, script: 0x5b, flags: 0x0}, + 65: {lang: 0x3c0, script: 0x5b, flags: 0x0}, + 67: {lang: 0x8, script: 0x2, flags: 0x1}, + 69: {lang: 0x0, script: 0x5b, flags: 0x0}, + 71: {lang: 0x71, script: 0x20, flags: 0x0}, + 73: {lang: 0x512, script: 0x3e, flags: 0x2}, + 74: {lang: 0x31f, script: 0x5, flags: 0x2}, + 75: {lang: 0x445, script: 0x5b, flags: 0x0}, + 76: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 77: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 78: {lang: 0x10d, script: 0x5b, flags: 0x0}, + 79: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 81: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 82: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 83: {lang: 0xa, script: 0x4, flags: 0x1}, + 84: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 85: {lang: 0x0, script: 0x5b, flags: 0x0}, + 87: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 90: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 91: {lang: 0x3c0, script: 0x5b, flags: 0x0}, + 92: {lang: 0x3a1, script: 0x5b, flags: 0x0}, + 94: {lang: 0xe, script: 0x2, flags: 0x1}, + 95: {lang: 0xfa, script: 0x5b, flags: 0x0}, + 97: {lang: 0x10d, script: 0x5b, flags: 0x0}, + 99: {lang: 0x1, script: 0x5b, flags: 0x0}, + 100: {lang: 0x101, script: 0x5b, flags: 0x0}, + 102: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 104: {lang: 0x10, script: 0x2, flags: 0x1}, + 105: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 106: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 107: {lang: 0x140, script: 0x5b, flags: 0x0}, + 108: {lang: 0x3a, script: 0x5, flags: 0x0}, + 109: {lang: 0x3a, script: 0x5, flags: 0x0}, + 110: {lang: 0x46f, script: 0x2c, flags: 0x0}, + 111: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 112: {lang: 0x12, script: 0x2, flags: 0x1}, + 114: {lang: 0x10d, script: 0x5b, flags: 0x0}, + 115: {lang: 0x151, script: 0x5b, flags: 0x0}, + 116: {lang: 0x1c0, script: 0x22, flags: 0x2}, + 119: {lang: 0x158, script: 0x5b, flags: 0x0}, + 121: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 123: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 124: {lang: 0x14, script: 0x2, flags: 0x1}, + 126: {lang: 0x16, script: 0x3, flags: 0x1}, + 127: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 129: {lang: 0x21, script: 0x5b, flags: 0x0}, + 131: {lang: 0x245, script: 0x5b, flags: 0x0}, + 133: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 134: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 135: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 136: {lang: 0x19, script: 0x2, flags: 0x1}, + 137: {lang: 0x0, script: 0x5b, flags: 0x0}, + 138: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 140: {lang: 0x3c0, script: 0x5b, flags: 0x0}, + 142: {lang: 0x529, script: 0x3c, flags: 0x0}, + 143: {lang: 0x0, script: 0x5b, flags: 0x0}, + 144: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 145: {lang: 0x1d1, script: 0x5b, flags: 0x0}, + 146: {lang: 0x1d4, script: 0x5b, flags: 0x0}, + 147: {lang: 0x1d5, script: 0x5b, flags: 0x0}, + 149: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 150: {lang: 0x1b, script: 0x2, flags: 0x1}, + 152: {lang: 0x1bc, script: 0x3e, flags: 0x0}, + 154: {lang: 0x1d, script: 0x3, flags: 0x1}, + 156: {lang: 0x3a, script: 0x5, flags: 0x0}, + 157: {lang: 0x20, script: 0x2, flags: 0x1}, + 158: {lang: 0x1f8, script: 0x5b, flags: 0x0}, + 159: {lang: 0x1f9, script: 0x5b, flags: 0x0}, + 162: {lang: 0x3a, script: 0x5, flags: 0x0}, + 163: {lang: 0x200, script: 0x49, flags: 0x0}, + 165: {lang: 0x445, script: 0x5b, flags: 0x0}, + 166: {lang: 0x28a, script: 0x20, flags: 0x0}, + 167: {lang: 0x22, script: 0x3, flags: 0x1}, + 169: {lang: 0x25, script: 0x2, flags: 0x1}, + 171: {lang: 0x254, script: 0x54, flags: 0x0}, + 172: {lang: 0x254, script: 0x54, flags: 0x0}, + 173: {lang: 0x3a, script: 0x5, flags: 0x0}, + 175: {lang: 0x3e2, script: 0x20, flags: 0x0}, + 176: {lang: 0x27, script: 0x2, flags: 0x1}, + 177: {lang: 0x3a, script: 0x5, flags: 0x0}, + 179: {lang: 0x10d, script: 0x5b, flags: 0x0}, + 180: {lang: 0x40c, script: 0xd6, flags: 0x0}, + 182: {lang: 0x43b, script: 0x5b, flags: 0x0}, + 183: {lang: 0x2c0, script: 0x5b, flags: 0x0}, + 184: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 185: {lang: 0x2c7, script: 0x5b, flags: 0x0}, + 186: {lang: 0x3a, script: 0x5, flags: 0x0}, + 187: {lang: 0x29, script: 0x2, flags: 0x1}, + 188: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 189: {lang: 0x2b, script: 0x2, flags: 0x1}, + 190: {lang: 0x432, script: 0x5b, flags: 0x0}, + 191: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 192: {lang: 0x2f1, script: 0x5b, flags: 0x0}, + 195: {lang: 0x2d, script: 0x2, flags: 0x1}, + 196: {lang: 0xa0, script: 0x5b, flags: 0x0}, + 197: {lang: 0x2f, script: 0x2, flags: 0x1}, + 198: {lang: 0x31, script: 0x2, flags: 0x1}, + 199: {lang: 0x33, script: 0x2, flags: 0x1}, + 201: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 202: {lang: 0x35, script: 0x2, flags: 0x1}, + 204: {lang: 0x320, script: 0x5b, flags: 0x0}, + 205: {lang: 0x37, script: 0x3, flags: 0x1}, + 206: {lang: 0x128, script: 0xed, flags: 0x0}, + 208: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 209: {lang: 0x31f, script: 0x5b, flags: 0x0}, + 210: {lang: 0x3c0, script: 0x5b, flags: 0x0}, + 211: {lang: 0x16, script: 0x5b, flags: 0x0}, + 212: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 213: {lang: 0x1b4, script: 0x5b, flags: 0x0}, + 215: {lang: 0x1b4, script: 0x5, flags: 0x2}, + 217: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 218: {lang: 0x367, script: 0x5b, flags: 0x0}, + 219: {lang: 0x347, script: 0x5b, flags: 0x0}, + 220: {lang: 0x351, script: 0x22, flags: 0x0}, + 226: {lang: 0x3a, script: 0x5, flags: 0x0}, + 227: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 229: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 230: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 231: {lang: 0x486, script: 0x5b, flags: 0x0}, + 232: {lang: 0x153, script: 0x5b, flags: 0x0}, + 233: {lang: 0x3a, script: 0x3, flags: 0x1}, + 234: {lang: 0x3b3, script: 0x5b, flags: 0x0}, + 235: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 237: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 238: {lang: 0x3a, script: 0x5, flags: 0x0}, + 239: {lang: 0x3c0, script: 0x5b, flags: 0x0}, + 241: {lang: 0x3a2, script: 0x5b, flags: 0x0}, + 242: {lang: 0x194, script: 0x5b, flags: 0x0}, + 244: {lang: 0x3a, script: 0x5, flags: 0x0}, + 259: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 261: {lang: 0x3d, script: 0x2, flags: 0x1}, + 262: {lang: 0x432, script: 0x20, flags: 0x0}, + 263: {lang: 0x3f, script: 0x2, flags: 0x1}, + 264: {lang: 0x3e5, script: 0x5b, flags: 0x0}, + 265: {lang: 0x3a, script: 0x5, flags: 0x0}, + 267: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 268: {lang: 0x3a, script: 0x5, flags: 0x0}, + 269: {lang: 0x41, script: 0x2, flags: 0x1}, + 272: {lang: 0x416, script: 0x5b, flags: 0x0}, + 273: {lang: 0x347, script: 0x5b, flags: 0x0}, + 274: {lang: 0x43, script: 0x2, flags: 0x1}, + 276: {lang: 0x1f9, script: 0x5b, flags: 0x0}, + 277: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 278: {lang: 0x429, script: 0x5b, flags: 0x0}, + 279: {lang: 0x367, script: 0x5b, flags: 0x0}, + 281: {lang: 0x3c0, script: 0x5b, flags: 0x0}, + 283: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 285: {lang: 0x45, script: 0x2, flags: 0x1}, + 289: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 290: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 291: {lang: 0x47, script: 0x2, flags: 0x1}, + 292: {lang: 0x49, script: 0x3, flags: 0x1}, + 293: {lang: 0x4c, script: 0x2, flags: 0x1}, + 294: {lang: 0x477, script: 0x5b, flags: 0x0}, + 295: {lang: 0x3c0, script: 0x5b, flags: 0x0}, + 296: {lang: 0x476, script: 0x5b, flags: 0x0}, + 297: {lang: 0x4e, script: 0x2, flags: 0x1}, + 298: {lang: 0x482, script: 0x5b, flags: 0x0}, + 300: {lang: 0x50, script: 0x4, flags: 0x1}, + 302: {lang: 0x4a0, script: 0x5b, flags: 0x0}, + 303: {lang: 0x54, script: 0x2, flags: 0x1}, + 304: {lang: 0x445, script: 0x5b, flags: 0x0}, + 305: {lang: 0x56, script: 0x3, flags: 0x1}, + 306: {lang: 0x445, script: 0x5b, flags: 0x0}, + 310: {lang: 0x512, script: 0x3e, flags: 0x2}, + 311: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 312: {lang: 0x4bc, script: 0x5b, flags: 0x0}, + 313: {lang: 0x1f9, script: 0x5b, flags: 0x0}, + 316: {lang: 0x13e, script: 0x5b, flags: 0x0}, + 319: {lang: 0x4c3, script: 0x5b, flags: 0x0}, + 320: {lang: 0x8a, script: 0x5b, flags: 0x0}, + 321: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 323: {lang: 0x41b, script: 0x5b, flags: 0x0}, + 334: {lang: 0x59, script: 0x2, flags: 0x1}, + 351: {lang: 0x3a, script: 0x5, flags: 0x0}, + 352: {lang: 0x5b, script: 0x2, flags: 0x1}, + 357: {lang: 0x423, script: 0x5b, flags: 0x0}, +} + +// likelyRegionList holds lists info associated with likelyRegion. +// Size: 558 bytes, 93 elements +var likelyRegionList = [93]likelyLangScript{ + 0: {lang: 0x148, script: 0x5, flags: 0x0}, + 1: {lang: 0x476, script: 0x5b, flags: 0x0}, + 2: {lang: 0x431, script: 0x5b, flags: 0x0}, + 3: {lang: 0x2ff, script: 0x20, flags: 0x0}, + 4: {lang: 0x1d7, script: 0x8, flags: 0x0}, + 5: {lang: 0x274, script: 0x5b, flags: 0x0}, + 6: {lang: 0xb7, script: 0x5b, flags: 0x0}, + 7: {lang: 0x432, script: 0x20, flags: 0x0}, + 8: {lang: 0x12d, script: 0xef, flags: 0x0}, + 9: {lang: 0x351, script: 0x22, flags: 0x0}, + 10: {lang: 0x529, script: 0x3b, flags: 0x0}, + 11: {lang: 0x4ac, script: 0x5, flags: 0x0}, + 12: {lang: 0x523, script: 0x5b, flags: 0x0}, + 13: {lang: 0x29a, script: 0xee, flags: 0x0}, + 14: {lang: 0x136, script: 0x34, flags: 0x0}, + 15: {lang: 0x48a, script: 0x5b, flags: 0x0}, + 16: {lang: 0x3a, script: 0x5, flags: 0x0}, + 17: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 18: {lang: 0x27, script: 0x2c, flags: 0x0}, + 19: {lang: 0x139, script: 0x5b, flags: 0x0}, + 20: {lang: 0x26a, script: 0x5, flags: 0x2}, + 21: {lang: 0x512, script: 0x3e, flags: 0x2}, + 22: {lang: 0x210, script: 0x2e, flags: 0x0}, + 23: {lang: 0x5, script: 0x20, flags: 0x0}, + 24: {lang: 0x274, script: 0x5b, flags: 0x0}, + 25: {lang: 0x136, script: 0x34, flags: 0x0}, + 26: {lang: 0x2ff, script: 0x20, flags: 0x0}, + 27: {lang: 0x1e1, script: 0x5b, flags: 0x0}, + 28: {lang: 0x31f, script: 0x5, flags: 0x0}, + 29: {lang: 0x1be, script: 0x22, flags: 0x0}, + 30: {lang: 0x4b4, script: 0x5, flags: 0x0}, + 31: {lang: 0x236, script: 0x76, flags: 0x0}, + 32: {lang: 0x148, script: 0x5, flags: 0x0}, + 33: {lang: 0x476, script: 0x5b, flags: 0x0}, + 34: {lang: 0x24a, script: 0x4f, flags: 0x0}, + 35: {lang: 0xe6, script: 0x5, flags: 0x0}, + 36: {lang: 0x226, script: 0xee, flags: 0x0}, + 37: {lang: 0x3a, script: 0x5, flags: 0x0}, + 38: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 39: {lang: 0x2b8, script: 0x58, flags: 0x0}, + 40: {lang: 0x226, script: 0xee, flags: 0x0}, + 41: {lang: 0x3a, script: 0x5, flags: 0x0}, + 42: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 43: {lang: 0x3dc, script: 0x5b, flags: 0x0}, + 44: {lang: 0x4ae, script: 0x20, flags: 0x0}, + 45: {lang: 0x2ff, script: 0x20, flags: 0x0}, + 46: {lang: 0x431, script: 0x5b, flags: 0x0}, + 47: {lang: 0x331, script: 0x76, flags: 0x0}, + 48: {lang: 0x213, script: 0x5b, flags: 0x0}, + 49: {lang: 0x30b, script: 0x20, flags: 0x0}, + 50: {lang: 0x242, script: 0x5, flags: 0x0}, + 51: {lang: 0x529, script: 0x3c, flags: 0x0}, + 52: {lang: 0x3c0, script: 0x5b, flags: 0x0}, + 53: {lang: 0x3a, script: 0x5, flags: 0x0}, + 54: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 55: {lang: 0x2ed, script: 0x5b, flags: 0x0}, + 56: {lang: 0x4b4, script: 0x5, flags: 0x0}, + 57: {lang: 0x88, script: 0x22, flags: 0x0}, + 58: {lang: 0x4b4, script: 0x5, flags: 0x0}, + 59: {lang: 0x4b4, script: 0x5, flags: 0x0}, + 60: {lang: 0xbe, script: 0x22, flags: 0x0}, + 61: {lang: 0x3dc, script: 0x5b, flags: 0x0}, + 62: {lang: 0x7e, script: 0x20, flags: 0x0}, + 63: {lang: 0x3e2, script: 0x20, flags: 0x0}, + 64: {lang: 0x267, script: 0x5b, flags: 0x0}, + 65: {lang: 0x444, script: 0x5b, flags: 0x0}, + 66: {lang: 0x512, script: 0x3e, flags: 0x0}, + 67: {lang: 0x412, script: 0x5b, flags: 0x0}, + 68: {lang: 0x4ae, script: 0x20, flags: 0x0}, + 69: {lang: 0x3a, script: 0x5, flags: 0x0}, + 70: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 71: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 72: {lang: 0x35, script: 0x5, flags: 0x0}, + 73: {lang: 0x46b, script: 0xee, flags: 0x0}, + 74: {lang: 0x2ec, script: 0x5, flags: 0x0}, + 75: {lang: 0x30f, script: 0x76, flags: 0x0}, + 76: {lang: 0x467, script: 0x20, flags: 0x0}, + 77: {lang: 0x148, script: 0x5, flags: 0x0}, + 78: {lang: 0x3a, script: 0x5, flags: 0x0}, + 79: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 80: {lang: 0x48a, script: 0x5b, flags: 0x0}, + 81: {lang: 0x58, script: 0x5, flags: 0x0}, + 82: {lang: 0x219, script: 0x20, flags: 0x0}, + 83: {lang: 0x81, script: 0x34, flags: 0x0}, + 84: {lang: 0x529, script: 0x3c, flags: 0x0}, + 85: {lang: 0x48c, script: 0x5b, flags: 0x0}, + 86: {lang: 0x4ae, script: 0x20, flags: 0x0}, + 87: {lang: 0x512, script: 0x3e, flags: 0x0}, + 88: {lang: 0x3b3, script: 0x5b, flags: 0x0}, + 89: {lang: 0x431, script: 0x5b, flags: 0x0}, + 90: {lang: 0x432, script: 0x20, flags: 0x0}, + 91: {lang: 0x15e, script: 0x5b, flags: 0x0}, + 92: {lang: 0x446, script: 0x5, flags: 0x0}, +} + +type likelyTag struct { + lang uint16 + region uint16 + script uint16 +} + +// Size: 198 bytes, 33 elements +var likelyRegionGroup = [33]likelyTag{ + 1: {lang: 0x139, region: 0xd7, script: 0x5b}, + 2: {lang: 0x139, region: 0x136, script: 0x5b}, + 3: {lang: 0x3c0, region: 0x41, script: 0x5b}, + 4: {lang: 0x139, region: 0x2f, script: 0x5b}, + 5: {lang: 0x139, region: 0xd7, script: 0x5b}, + 6: {lang: 0x13e, region: 0xd0, script: 0x5b}, + 7: {lang: 0x445, region: 0x130, script: 0x5b}, + 8: {lang: 0x3a, region: 0x6c, script: 0x5}, + 9: {lang: 0x445, region: 0x4b, script: 0x5b}, + 10: {lang: 0x139, region: 0x162, script: 0x5b}, + 11: {lang: 0x139, region: 0x136, script: 0x5b}, + 12: {lang: 0x139, region: 0x136, script: 0x5b}, + 13: {lang: 0x13e, region: 0x5a, script: 0x5b}, + 14: {lang: 0x529, region: 0x53, script: 0x3b}, + 15: {lang: 0x1be, region: 0x9a, script: 0x22}, + 16: {lang: 0x1e1, region: 0x96, script: 0x5b}, + 17: {lang: 0x1f9, region: 0x9f, script: 0x5b}, + 18: {lang: 0x139, region: 0x2f, script: 0x5b}, + 19: {lang: 0x139, region: 0xe7, script: 0x5b}, + 20: {lang: 0x139, region: 0x8b, script: 0x5b}, + 21: {lang: 0x41b, region: 0x143, script: 0x5b}, + 22: {lang: 0x529, region: 0x53, script: 0x3b}, + 23: {lang: 0x4bc, region: 0x138, script: 0x5b}, + 24: {lang: 0x3a, region: 0x109, script: 0x5}, + 25: {lang: 0x3e2, region: 0x107, script: 0x20}, + 26: {lang: 0x3e2, region: 0x107, script: 0x20}, + 27: {lang: 0x139, region: 0x7c, script: 0x5b}, + 28: {lang: 0x10d, region: 0x61, script: 0x5b}, + 29: {lang: 0x139, region: 0xd7, script: 0x5b}, + 30: {lang: 0x13e, region: 0x1f, script: 0x5b}, + 31: {lang: 0x139, region: 0x9b, script: 0x5b}, + 32: {lang: 0x139, region: 0x7c, script: 0x5b}, +} + +// Size: 264 bytes, 33 elements +var regionContainment = [33]uint64{ + // Entry 0 - 1F + 0x00000001ffffffff, 0x00000000200007a2, 0x0000000000003044, 0x0000000000000008, + 0x00000000803c0010, 0x0000000000000020, 0x0000000000000040, 0x0000000000000080, + 0x0000000000000100, 0x0000000000000200, 0x0000000000000400, 0x000000004000384c, + 0x0000000000001000, 0x0000000000002000, 0x0000000000004000, 0x0000000000008000, + 0x0000000000010000, 0x0000000000020000, 0x0000000000040000, 0x0000000000080000, + 0x0000000000100000, 0x0000000000200000, 0x0000000001c1c000, 0x0000000000800000, + 0x0000000001000000, 0x000000001e020000, 0x0000000004000000, 0x0000000008000000, + 0x0000000010000000, 0x00000000200006a0, 0x0000000040002048, 0x0000000080000000, + // Entry 20 - 3F + 0x0000000100000000, +} + +// regionInclusion maps region identifiers to sets of regions in regionInclusionBits, +// where each set holds all groupings that are directly connected in a region +// containment graph. +// Size: 359 bytes, 359 elements +var regionInclusion = [359]uint8{ + // Entry 0 - 3F + 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x26, 0x23, + 0x24, 0x26, 0x27, 0x22, 0x28, 0x29, 0x2a, 0x2b, + 0x26, 0x2c, 0x24, 0x23, 0x26, 0x25, 0x2a, 0x2d, + 0x2e, 0x24, 0x2f, 0x2d, 0x26, 0x30, 0x31, 0x28, + // Entry 40 - 7F + 0x26, 0x28, 0x26, 0x25, 0x31, 0x22, 0x32, 0x33, + 0x34, 0x30, 0x22, 0x27, 0x27, 0x27, 0x35, 0x2d, + 0x29, 0x28, 0x27, 0x36, 0x28, 0x22, 0x21, 0x34, + 0x23, 0x21, 0x26, 0x2d, 0x26, 0x22, 0x37, 0x2e, + 0x35, 0x2a, 0x22, 0x2f, 0x38, 0x26, 0x26, 0x21, + 0x39, 0x39, 0x28, 0x38, 0x39, 0x39, 0x2f, 0x3a, + 0x2f, 0x20, 0x21, 0x38, 0x3b, 0x28, 0x3c, 0x2c, + 0x21, 0x2a, 0x35, 0x27, 0x38, 0x26, 0x24, 0x28, + // Entry 80 - BF + 0x2c, 0x2d, 0x23, 0x30, 0x2d, 0x2d, 0x26, 0x27, + 0x3a, 0x22, 0x34, 0x3c, 0x2d, 0x28, 0x36, 0x22, + 0x34, 0x3a, 0x26, 0x2e, 0x21, 0x39, 0x31, 0x38, + 0x24, 0x2c, 0x25, 0x22, 0x24, 0x25, 0x2c, 0x3a, + 0x2c, 0x26, 0x24, 0x36, 0x21, 0x2f, 0x3d, 0x31, + 0x3c, 0x2f, 0x26, 0x36, 0x36, 0x24, 0x26, 0x3d, + 0x31, 0x24, 0x26, 0x35, 0x25, 0x2d, 0x32, 0x38, + 0x2a, 0x38, 0x39, 0x39, 0x35, 0x33, 0x23, 0x26, + // Entry C0 - FF + 0x2f, 0x3c, 0x21, 0x23, 0x2d, 0x31, 0x36, 0x36, + 0x3c, 0x26, 0x2d, 0x26, 0x3a, 0x2f, 0x25, 0x2f, + 0x34, 0x31, 0x2f, 0x32, 0x3b, 0x2d, 0x2b, 0x2d, + 0x21, 0x34, 0x2a, 0x2c, 0x25, 0x21, 0x3c, 0x24, + 0x29, 0x2b, 0x24, 0x34, 0x21, 0x28, 0x29, 0x3b, + 0x31, 0x25, 0x2e, 0x30, 0x29, 0x26, 0x24, 0x3a, + 0x21, 0x3c, 0x28, 0x21, 0x24, 0x21, 0x21, 0x1f, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, + // Entry 100 - 13F + 0x21, 0x21, 0x21, 0x2f, 0x21, 0x2e, 0x23, 0x33, + 0x2f, 0x24, 0x3b, 0x2f, 0x39, 0x38, 0x31, 0x2d, + 0x3a, 0x2c, 0x2e, 0x2d, 0x23, 0x2d, 0x2f, 0x28, + 0x2f, 0x27, 0x33, 0x34, 0x26, 0x24, 0x32, 0x22, + 0x26, 0x27, 0x22, 0x2d, 0x31, 0x3d, 0x29, 0x31, + 0x3d, 0x39, 0x29, 0x31, 0x24, 0x26, 0x29, 0x36, + 0x2f, 0x33, 0x2f, 0x21, 0x22, 0x21, 0x30, 0x28, + 0x3d, 0x23, 0x26, 0x21, 0x28, 0x26, 0x26, 0x31, + // Entry 140 - 17F + 0x3b, 0x29, 0x21, 0x29, 0x21, 0x21, 0x21, 0x21, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x23, 0x21, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, + 0x2f, 0x23, 0x32, 0x2f, 0x27, 0x2f, 0x21, +} + +// regionInclusionBits is an array of bit vectors where every vector represents +// a set of region groupings. These sets are used to compute the distance +// between two regions for the purpose of language matching. +// Size: 584 bytes, 73 elements +var regionInclusionBits = [73]uint64{ + // Entry 0 - 1F + 0x0000000102400813, 0x00000000200007a3, 0x0000000000003844, 0x0000000040000808, + 0x00000000803c0011, 0x0000000020000022, 0x0000000040000844, 0x0000000020000082, + 0x0000000000000102, 0x0000000020000202, 0x0000000020000402, 0x000000004000384d, + 0x0000000000001804, 0x0000000040002804, 0x0000000000404000, 0x0000000000408000, + 0x0000000000410000, 0x0000000002020000, 0x0000000000040010, 0x0000000000080010, + 0x0000000000100010, 0x0000000000200010, 0x0000000001c1c001, 0x0000000000c00000, + 0x0000000001400000, 0x000000001e020001, 0x0000000006000000, 0x000000000a000000, + 0x0000000012000000, 0x00000000200006a2, 0x0000000040002848, 0x0000000080000010, + // Entry 20 - 3F + 0x0000000100000001, 0x0000000000000001, 0x0000000080000000, 0x0000000000020000, + 0x0000000001000000, 0x0000000000008000, 0x0000000000002000, 0x0000000000000200, + 0x0000000000000008, 0x0000000000200000, 0x0000000110000000, 0x0000000000040000, + 0x0000000008000000, 0x0000000000000020, 0x0000000104000000, 0x0000000000000080, + 0x0000000000001000, 0x0000000000010000, 0x0000000000000400, 0x0000000004000000, + 0x0000000000000040, 0x0000000010000000, 0x0000000000004000, 0x0000000101000000, + 0x0000000108000000, 0x0000000000000100, 0x0000000100020000, 0x0000000000080000, + 0x0000000000100000, 0x0000000000800000, 0x00000001ffffffff, 0x0000000122400fb3, + // Entry 40 - 5F + 0x00000001827c0813, 0x000000014240385f, 0x0000000103c1c813, 0x000000011e420813, + 0x0000000112000001, 0x0000000106000001, 0x0000000101400001, 0x000000010a000001, + 0x0000000102020001, +} + +// regionInclusionNext marks, for each entry in regionInclusionBits, the set of +// all groups that are reachable from the groups set in the respective entry. +// Size: 73 bytes, 73 elements +var regionInclusionNext = [73]uint8{ + // Entry 0 - 3F + 0x3e, 0x3f, 0x0b, 0x0b, 0x40, 0x01, 0x0b, 0x01, + 0x01, 0x01, 0x01, 0x41, 0x0b, 0x0b, 0x16, 0x16, + 0x16, 0x19, 0x04, 0x04, 0x04, 0x04, 0x42, 0x16, + 0x16, 0x43, 0x19, 0x19, 0x19, 0x01, 0x0b, 0x04, + 0x00, 0x00, 0x1f, 0x11, 0x18, 0x0f, 0x0d, 0x09, + 0x03, 0x15, 0x44, 0x12, 0x1b, 0x05, 0x45, 0x07, + 0x0c, 0x10, 0x0a, 0x1a, 0x06, 0x1c, 0x0e, 0x46, + 0x47, 0x08, 0x48, 0x13, 0x14, 0x17, 0x3e, 0x3e, + // Entry 40 - 7F + 0x3e, 0x3e, 0x3e, 0x3e, 0x43, 0x43, 0x42, 0x43, + 0x43, +} + +type parentRel struct { + lang uint16 + script uint16 + maxScript uint16 + toRegion uint16 + fromRegion []uint16 +} + +// Size: 414 bytes, 5 elements +var parents = [5]parentRel{ + 0: {lang: 0x139, script: 0x0, maxScript: 0x5b, toRegion: 0x1, fromRegion: []uint16{0x1a, 0x25, 0x26, 0x2f, 0x34, 0x36, 0x3d, 0x42, 0x46, 0x48, 0x49, 0x4a, 0x50, 0x52, 0x5d, 0x5e, 0x62, 0x65, 0x6e, 0x74, 0x75, 0x76, 0x7c, 0x7d, 0x80, 0x81, 0x82, 0x84, 0x8d, 0x8e, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0xa0, 0xa1, 0xa5, 0xa8, 0xaa, 0xae, 0xb2, 0xb5, 0xb6, 0xc0, 0xc7, 0xcb, 0xcc, 0xcd, 0xcf, 0xd1, 0xd3, 0xd6, 0xd7, 0xde, 0xe0, 0xe1, 0xe7, 0xe8, 0xe9, 0xec, 0xf1, 0x108, 0x10a, 0x10b, 0x10c, 0x10e, 0x10f, 0x113, 0x118, 0x11c, 0x11e, 0x120, 0x126, 0x12a, 0x12d, 0x12e, 0x130, 0x132, 0x13a, 0x13d, 0x140, 0x143, 0x162, 0x163, 0x165}}, + 1: {lang: 0x139, script: 0x0, maxScript: 0x5b, toRegion: 0x1a, fromRegion: []uint16{0x2e, 0x4e, 0x61, 0x64, 0x73, 0xda, 0x10d, 0x110}}, + 2: {lang: 0x13e, script: 0x0, maxScript: 0x5b, toRegion: 0x1f, fromRegion: []uint16{0x2c, 0x3f, 0x41, 0x48, 0x51, 0x54, 0x57, 0x5a, 0x66, 0x6a, 0x8a, 0x90, 0xd0, 0xd9, 0xe3, 0xe5, 0xed, 0xf2, 0x11b, 0x136, 0x137, 0x13c}}, + 3: {lang: 0x3c0, script: 0x0, maxScript: 0x5b, toRegion: 0xef, fromRegion: []uint16{0x2a, 0x4e, 0x5b, 0x87, 0x8c, 0xb8, 0xc7, 0xd2, 0x119, 0x127}}, + 4: {lang: 0x529, script: 0x3c, maxScript: 0x3c, toRegion: 0x8e, fromRegion: []uint16{0xc7}}, +} + +// Total table size 30466 bytes (29KiB); checksum: 7544152B diff --git a/vendor/golang.org/x/text/internal/language/tags.go b/vendor/golang.org/x/text/internal/language/tags.go new file mode 100644 index 0000000000..e7afd3188e --- /dev/null +++ b/vendor/golang.org/x/text/internal/language/tags.go @@ -0,0 +1,48 @@ +// 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 language + +// MustParse is like Parse, but panics if the given BCP 47 tag cannot be parsed. +// It simplifies safe initialization of Tag values. +func MustParse(s string) Tag { + t, err := Parse(s) + if err != nil { + panic(err) + } + return t +} + +// MustParseBase is like ParseBase, but panics if the given base cannot be parsed. +// It simplifies safe initialization of Base values. +func MustParseBase(s string) Language { + b, err := ParseBase(s) + if err != nil { + panic(err) + } + return b +} + +// MustParseScript is like ParseScript, but panics if the given script cannot be +// parsed. It simplifies safe initialization of Script values. +func MustParseScript(s string) Script { + scr, err := ParseScript(s) + if err != nil { + panic(err) + } + return scr +} + +// MustParseRegion is like ParseRegion, but panics if the given region cannot be +// parsed. It simplifies safe initialization of Region values. +func MustParseRegion(s string) Region { + r, err := ParseRegion(s) + if err != nil { + panic(err) + } + return r +} + +// Und is the root language. +var Und Tag diff --git a/vendor/golang.org/x/text/internal/match.go b/vendor/golang.org/x/text/internal/match.go new file mode 100644 index 0000000000..1cc004a6d5 --- /dev/null +++ b/vendor/golang.org/x/text/internal/match.go @@ -0,0 +1,67 @@ +// Copyright 2015 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 internal + +// This file contains matchers that implement CLDR inheritance. +// +// See https://unicode.org/reports/tr35/#Locale_Inheritance. +// +// Some of the inheritance described in this document is already handled by +// the cldr package. + +import ( + "golang.org/x/text/language" +) + +// TODO: consider if (some of the) matching algorithm needs to be public after +// getting some feel about what is generic and what is specific. + +// NewInheritanceMatcher returns a matcher that matches based on the inheritance +// chain. +// +// The matcher uses canonicalization and the parent relationship to find a +// match. The resulting match will always be either Und or a language with the +// same language and script as the requested language. It will not match +// languages for which there is understood to be mutual or one-directional +// intelligibility. +// +// A Match will indicate an Exact match if the language matches after +// canonicalization and High if the matched tag is a parent. +func NewInheritanceMatcher(t []language.Tag) *InheritanceMatcher { + tags := &InheritanceMatcher{make(map[language.Tag]int)} + for i, tag := range t { + ct, err := language.All.Canonicalize(tag) + if err != nil { + ct = tag + } + tags.index[ct] = i + } + return tags +} + +type InheritanceMatcher struct { + index map[language.Tag]int +} + +func (m InheritanceMatcher) Match(want ...language.Tag) (language.Tag, int, language.Confidence) { + for _, t := range want { + ct, err := language.All.Canonicalize(t) + if err != nil { + ct = t + } + conf := language.Exact + for { + if index, ok := m.index[ct]; ok { + return ct, index, conf + } + if ct == language.Und { + break + } + ct = ct.Parent() + conf = language.High + } + } + return language.Und, 0, language.No +} diff --git a/vendor/golang.org/x/text/internal/tag/tag.go b/vendor/golang.org/x/text/internal/tag/tag.go new file mode 100644 index 0000000000..b5d348891d --- /dev/null +++ b/vendor/golang.org/x/text/internal/tag/tag.go @@ -0,0 +1,100 @@ +// Copyright 2015 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 tag contains functionality handling tags and related data. +package tag // import "golang.org/x/text/internal/tag" + +import "sort" + +// An Index converts tags to a compact numeric value. +// +// All elements are of size 4. Tags may be up to 4 bytes long. Excess bytes can +// be used to store additional information about the tag. +type Index string + +// Elem returns the element data at the given index. +func (s Index) Elem(x int) string { + return string(s[x*4 : x*4+4]) +} + +// Index reports the index of the given key or -1 if it could not be found. +// Only the first len(key) bytes from the start of the 4-byte entries will be +// considered for the search and the first match in Index will be returned. +func (s Index) Index(key []byte) int { + n := len(key) + // search the index of the first entry with an equal or higher value than + // key in s. + index := sort.Search(len(s)/4, func(i int) bool { + return cmp(s[i*4:i*4+n], key) != -1 + }) + i := index * 4 + if cmp(s[i:i+len(key)], key) != 0 { + return -1 + } + return index +} + +// Next finds the next occurrence of key after index x, which must have been +// obtained from a call to Index using the same key. It returns x+1 or -1. +func (s Index) Next(key []byte, x int) int { + if x++; x*4 < len(s) && cmp(s[x*4:x*4+len(key)], key) == 0 { + return x + } + return -1 +} + +// cmp returns an integer comparing a and b lexicographically. +func cmp(a Index, b []byte) int { + n := len(a) + if len(b) < n { + n = len(b) + } + for i, c := range b[:n] { + switch { + case a[i] > c: + return 1 + case a[i] < c: + return -1 + } + } + switch { + case len(a) < len(b): + return -1 + case len(a) > len(b): + return 1 + } + return 0 +} + +// Compare returns an integer comparing a and b lexicographically. +func Compare(a string, b []byte) int { + return cmp(Index(a), b) +} + +// FixCase reformats b to the same pattern of cases as form. +// If returns false if string b is malformed. +func FixCase(form string, b []byte) bool { + if len(form) != len(b) { + return false + } + for i, c := range b { + if form[i] <= 'Z' { + if c >= 'a' { + c -= 'z' - 'Z' + } + if c < 'A' || 'Z' < c { + return false + } + } else { + if c <= 'Z' { + c += 'z' - 'Z' + } + if c < 'a' || 'z' < c { + return false + } + } + b[i] = c + } + return true +} diff --git a/vendor/golang.org/x/text/language/coverage.go b/vendor/golang.org/x/text/language/coverage.go new file mode 100644 index 0000000000..a24fd1a4d6 --- /dev/null +++ b/vendor/golang.org/x/text/language/coverage.go @@ -0,0 +1,187 @@ +// Copyright 2014 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 language + +import ( + "fmt" + "sort" + + "golang.org/x/text/internal/language" +) + +// The Coverage interface is used to define the level of coverage of an +// internationalization service. Note that not all types are supported by all +// services. As lists may be generated on the fly, it is recommended that users +// of a Coverage cache the results. +type Coverage interface { + // Tags returns the list of supported tags. + Tags() []Tag + + // BaseLanguages returns the list of supported base languages. + BaseLanguages() []Base + + // Scripts returns the list of supported scripts. + Scripts() []Script + + // Regions returns the list of supported regions. + Regions() []Region +} + +var ( + // Supported defines a Coverage that lists all supported subtags. Tags + // always returns nil. + Supported Coverage = allSubtags{} +) + +// TODO: +// - Support Variants, numbering systems. +// - CLDR coverage levels. +// - Set of common tags defined in this package. + +type allSubtags struct{} + +// Regions returns the list of supported regions. As all regions are in a +// consecutive range, it simply returns a slice of numbers in increasing order. +// The "undefined" region is not returned. +func (s allSubtags) Regions() []Region { + reg := make([]Region, language.NumRegions) + for i := range reg { + reg[i] = Region{language.Region(i + 1)} + } + return reg +} + +// Scripts returns the list of supported scripts. As all scripts are in a +// consecutive range, it simply returns a slice of numbers in increasing order. +// The "undefined" script is not returned. +func (s allSubtags) Scripts() []Script { + scr := make([]Script, language.NumScripts) + for i := range scr { + scr[i] = Script{language.Script(i + 1)} + } + return scr +} + +// BaseLanguages returns the list of all supported base languages. It generates +// the list by traversing the internal structures. +func (s allSubtags) BaseLanguages() []Base { + bs := language.BaseLanguages() + base := make([]Base, len(bs)) + for i, b := range bs { + base[i] = Base{b} + } + return base +} + +// Tags always returns nil. +func (s allSubtags) Tags() []Tag { + return nil +} + +// coverage is used by NewCoverage which is used as a convenient way for +// creating Coverage implementations for partially defined data. Very often a +// package will only need to define a subset of slices. coverage provides a +// convenient way to do this. Moreover, packages using NewCoverage, instead of +// their own implementation, will not break if later new slice types are added. +type coverage struct { + tags func() []Tag + bases func() []Base + scripts func() []Script + regions func() []Region +} + +func (s *coverage) Tags() []Tag { + if s.tags == nil { + return nil + } + return s.tags() +} + +// bases implements sort.Interface and is used to sort base languages. +type bases []Base + +func (b bases) Len() int { + return len(b) +} + +func (b bases) Swap(i, j int) { + b[i], b[j] = b[j], b[i] +} + +func (b bases) Less(i, j int) bool { + return b[i].langID < b[j].langID +} + +// BaseLanguages returns the result from calling s.bases if it is specified or +// otherwise derives the set of supported base languages from tags. +func (s *coverage) BaseLanguages() []Base { + if s.bases == nil { + tags := s.Tags() + if len(tags) == 0 { + return nil + } + a := make([]Base, len(tags)) + for i, t := range tags { + a[i] = Base{language.Language(t.lang())} + } + sort.Sort(bases(a)) + k := 0 + for i := 1; i < len(a); i++ { + if a[k] != a[i] { + k++ + a[k] = a[i] + } + } + return a[:k+1] + } + return s.bases() +} + +func (s *coverage) Scripts() []Script { + if s.scripts == nil { + return nil + } + return s.scripts() +} + +func (s *coverage) Regions() []Region { + if s.regions == nil { + return nil + } + return s.regions() +} + +// NewCoverage returns a Coverage for the given lists. It is typically used by +// packages providing internationalization services to define their level of +// coverage. A list may be of type []T or func() []T, where T is either Tag, +// Base, Script or Region. The returned Coverage derives the value for Bases +// from Tags if no func or slice for []Base is specified. For other unspecified +// types the returned Coverage will return nil for the respective methods. +func NewCoverage(list ...interface{}) Coverage { + s := &coverage{} + for _, x := range list { + switch v := x.(type) { + case func() []Base: + s.bases = v + case func() []Script: + s.scripts = v + case func() []Region: + s.regions = v + case func() []Tag: + s.tags = v + case []Base: + s.bases = func() []Base { return v } + case []Script: + s.scripts = func() []Script { return v } + case []Region: + s.regions = func() []Region { return v } + case []Tag: + s.tags = func() []Tag { return v } + default: + panic(fmt.Sprintf("language: unsupported set type %T", v)) + } + } + return s +} diff --git a/vendor/golang.org/x/text/language/doc.go b/vendor/golang.org/x/text/language/doc.go new file mode 100644 index 0000000000..212b77c906 --- /dev/null +++ b/vendor/golang.org/x/text/language/doc.go @@ -0,0 +1,98 @@ +// Copyright 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. + +// Package language implements BCP 47 language tags and related functionality. +// +// The most important function of package language is to match a list of +// user-preferred languages to a list of supported languages. +// It alleviates the developer of dealing with the complexity of this process +// and provides the user with the best experience +// (see https://blog.golang.org/matchlang). +// +// # Matching preferred against supported languages +// +// A Matcher for an application that supports English, Australian English, +// Danish, and standard Mandarin can be created as follows: +// +// var matcher = language.NewMatcher([]language.Tag{ +// language.English, // The first language is used as fallback. +// language.MustParse("en-AU"), +// language.Danish, +// language.Chinese, +// }) +// +// This list of supported languages is typically implied by the languages for +// which there exists translations of the user interface. +// +// User-preferred languages usually come as a comma-separated list of BCP 47 +// language tags. +// The MatchString finds best matches for such strings: +// +// handler(w http.ResponseWriter, r *http.Request) { +// lang, _ := r.Cookie("lang") +// accept := r.Header.Get("Accept-Language") +// tag, _ := language.MatchStrings(matcher, lang.String(), accept) +// +// // tag should now be used for the initialization of any +// // locale-specific service. +// } +// +// The Matcher's Match method can be used to match Tags directly. +// +// Matchers are aware of the intricacies of equivalence between languages, such +// as deprecated subtags, legacy tags, macro languages, mutual +// intelligibility between scripts and languages, and transparently passing +// BCP 47 user configuration. +// For instance, it will know that a reader of Bokmål Danish can read Norwegian +// and will know that Cantonese ("yue") is a good match for "zh-HK". +// +// # Using match results +// +// To guarantee a consistent user experience to the user it is important to +// use the same language tag for the selection of any locale-specific services. +// For example, it is utterly confusing to substitute spelled-out numbers +// or dates in one language in text of another language. +// More subtly confusing is using the wrong sorting order or casing +// algorithm for a certain language. +// +// All the packages in x/text that provide locale-specific services +// (e.g. collate, cases) should be initialized with the tag that was +// obtained at the start of an interaction with the user. +// +// Note that Tag that is returned by Match and MatchString may differ from any +// of the supported languages, as it may contain carried over settings from +// the user tags. +// This may be inconvenient when your application has some additional +// locale-specific data for your supported languages. +// Match and MatchString both return the index of the matched supported tag +// to simplify associating such data with the matched tag. +// +// # Canonicalization +// +// If one uses the Matcher to compare languages one does not need to +// worry about canonicalization. +// +// The meaning of a Tag varies per application. The language package +// therefore delays canonicalization and preserves information as much +// as possible. The Matcher, however, will always take into account that +// two different tags may represent the same language. +// +// By default, only legacy and deprecated tags are converted into their +// canonical equivalent. All other information is preserved. This approach makes +// the confidence scores more accurate and allows matchers to distinguish +// between variants that are otherwise lost. +// +// As a consequence, two tags that should be treated as identical according to +// BCP 47 or CLDR, like "en-Latn" and "en", will be represented differently. The +// Matcher handles such distinctions, though, and is aware of the +// equivalence relations. The CanonType type can be used to alter the +// canonicalization form. +// +// # References +// +// BCP 47 - Tags for Identifying Languages http://tools.ietf.org/html/bcp47 +package language // import "golang.org/x/text/language" + +// TODO: explanation on how to match languages for your own locale-specific +// service. diff --git a/vendor/golang.org/x/text/language/language.go b/vendor/golang.org/x/text/language/language.go new file mode 100644 index 0000000000..4d9c661212 --- /dev/null +++ b/vendor/golang.org/x/text/language/language.go @@ -0,0 +1,605 @@ +// 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. + +//go:generate go run gen.go -output tables.go + +package language + +// TODO: Remove above NOTE after: +// - verifying that tables are dropped correctly (most notably matcher tables). + +import ( + "strings" + + "golang.org/x/text/internal/language" + "golang.org/x/text/internal/language/compact" +) + +// Tag represents a BCP 47 language tag. It is used to specify an instance of a +// specific language or locale. All language tag values are guaranteed to be +// well-formed. +type Tag compact.Tag + +func makeTag(t language.Tag) (tag Tag) { + return Tag(compact.Make(t)) +} + +func (t *Tag) tag() language.Tag { + return (*compact.Tag)(t).Tag() +} + +func (t *Tag) isCompact() bool { + return (*compact.Tag)(t).IsCompact() +} + +// TODO: improve performance. +func (t *Tag) lang() language.Language { return t.tag().LangID } +func (t *Tag) region() language.Region { return t.tag().RegionID } +func (t *Tag) script() language.Script { return t.tag().ScriptID } + +// Make is a convenience wrapper for Parse that omits the error. +// In case of an error, a sensible default is returned. +func Make(s string) Tag { + return Default.Make(s) +} + +// Make is a convenience wrapper for c.Parse that omits the error. +// In case of an error, a sensible default is returned. +func (c CanonType) Make(s string) Tag { + t, _ := c.Parse(s) + return t +} + +// Raw returns the raw base language, script and region, without making an +// attempt to infer their values. +func (t Tag) Raw() (b Base, s Script, r Region) { + tt := t.tag() + return Base{tt.LangID}, Script{tt.ScriptID}, Region{tt.RegionID} +} + +// IsRoot returns true if t is equal to language "und". +func (t Tag) IsRoot() bool { + return compact.Tag(t).IsRoot() +} + +// CanonType can be used to enable or disable various types of canonicalization. +type CanonType int + +const ( + // Replace deprecated base languages with their preferred replacements. + DeprecatedBase CanonType = 1 << iota + // Replace deprecated scripts with their preferred replacements. + DeprecatedScript + // Replace deprecated regions with their preferred replacements. + DeprecatedRegion + // Remove redundant scripts. + SuppressScript + // Normalize legacy encodings. This includes legacy languages defined in + // CLDR as well as bibliographic codes defined in ISO-639. + Legacy + // Map the dominant language of a macro language group to the macro language + // subtag. For example cmn -> zh. + Macro + // The CLDR flag should be used if full compatibility with CLDR is required. + // There are a few cases where language.Tag may differ from CLDR. To follow all + // of CLDR's suggestions, use All|CLDR. + CLDR + + // Raw can be used to Compose or Parse without Canonicalization. + Raw CanonType = 0 + + // Replace all deprecated tags with their preferred replacements. + Deprecated = DeprecatedBase | DeprecatedScript | DeprecatedRegion + + // All canonicalizations recommended by BCP 47. + BCP47 = Deprecated | SuppressScript + + // All canonicalizations. + All = BCP47 | Legacy | Macro + + // Default is the canonicalization used by Parse, Make and Compose. To + // preserve as much information as possible, canonicalizations that remove + // potentially valuable information are not included. The Matcher is + // designed to recognize similar tags that would be the same if + // they were canonicalized using All. + Default = Deprecated | Legacy + + canonLang = DeprecatedBase | Legacy | Macro + + // TODO: LikelyScript, LikelyRegion: suppress similar to ICU. +) + +// canonicalize returns the canonicalized equivalent of the tag and +// whether there was any change. +func canonicalize(c CanonType, t language.Tag) (language.Tag, bool) { + if c == Raw { + return t, false + } + changed := false + if c&SuppressScript != 0 { + if t.LangID.SuppressScript() == t.ScriptID { + t.ScriptID = 0 + changed = true + } + } + if c&canonLang != 0 { + for { + if l, aliasType := t.LangID.Canonicalize(); l != t.LangID { + switch aliasType { + case language.Legacy: + if c&Legacy != 0 { + if t.LangID == _sh && t.ScriptID == 0 { + t.ScriptID = _Latn + } + t.LangID = l + changed = true + } + case language.Macro: + if c&Macro != 0 { + // We deviate here from CLDR. The mapping "nb" -> "no" + // qualifies as a typical Macro language mapping. However, + // for legacy reasons, CLDR maps "no", the macro language + // code for Norwegian, to the dominant variant "nb". This + // change is currently under consideration for CLDR as well. + // See https://unicode.org/cldr/trac/ticket/2698 and also + // https://unicode.org/cldr/trac/ticket/1790 for some of the + // practical implications. TODO: this check could be removed + // if CLDR adopts this change. + if c&CLDR == 0 || t.LangID != _nb { + changed = true + t.LangID = l + } + } + case language.Deprecated: + if c&DeprecatedBase != 0 { + if t.LangID == _mo && t.RegionID == 0 { + t.RegionID = _MD + } + t.LangID = l + changed = true + // Other canonicalization types may still apply. + continue + } + } + } else if c&Legacy != 0 && t.LangID == _no && c&CLDR != 0 { + t.LangID = _nb + changed = true + } + break + } + } + if c&DeprecatedScript != 0 { + if t.ScriptID == _Qaai { + changed = true + t.ScriptID = _Zinh + } + } + if c&DeprecatedRegion != 0 { + if r := t.RegionID.Canonicalize(); r != t.RegionID { + changed = true + t.RegionID = r + } + } + return t, changed +} + +// Canonicalize returns the canonicalized equivalent of the tag. +func (c CanonType) Canonicalize(t Tag) (Tag, error) { + // First try fast path. + if t.isCompact() { + if _, changed := canonicalize(c, compact.Tag(t).Tag()); !changed { + return t, nil + } + } + // It is unlikely that one will canonicalize a tag after matching. So do + // a slow but simple approach here. + if tag, changed := canonicalize(c, t.tag()); changed { + tag.RemakeString() + return makeTag(tag), nil + } + return t, nil + +} + +// Confidence indicates the level of certainty for a given return value. +// For example, Serbian may be written in Cyrillic or Latin script. +// The confidence level indicates whether a value was explicitly specified, +// whether it is typically the only possible value, or whether there is +// an ambiguity. +type Confidence int + +const ( + No Confidence = iota // full confidence that there was no match + Low // most likely value picked out of a set of alternatives + High // value is generally assumed to be the correct match + Exact // exact match or explicitly specified value +) + +var confName = []string{"No", "Low", "High", "Exact"} + +func (c Confidence) String() string { + return confName[c] +} + +// String returns the canonical string representation of the language tag. +func (t Tag) String() string { + return t.tag().String() +} + +// MarshalText implements encoding.TextMarshaler. +func (t Tag) MarshalText() (text []byte, err error) { + return t.tag().MarshalText() +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (t *Tag) UnmarshalText(text []byte) error { + var tag language.Tag + err := tag.UnmarshalText(text) + *t = makeTag(tag) + return err +} + +// Base returns the base language of the language tag. If the base language is +// unspecified, an attempt will be made to infer it from the context. +// It uses a variant of CLDR's Add Likely Subtags algorithm. This is subject to change. +func (t Tag) Base() (Base, Confidence) { + if b := t.lang(); b != 0 { + return Base{b}, Exact + } + tt := t.tag() + c := High + if tt.ScriptID == 0 && !tt.RegionID.IsCountry() { + c = Low + } + if tag, err := tt.Maximize(); err == nil && tag.LangID != 0 { + return Base{tag.LangID}, c + } + return Base{0}, No +} + +// Script infers the script for the language tag. If it was not explicitly given, it will infer +// a most likely candidate. +// If more than one script is commonly used for a language, the most likely one +// is returned with a low confidence indication. For example, it returns (Cyrl, Low) +// for Serbian. +// If a script cannot be inferred (Zzzz, No) is returned. We do not use Zyyy (undetermined) +// as one would suspect from the IANA registry for BCP 47. In a Unicode context Zyyy marks +// common characters (like 1, 2, 3, '.', etc.) and is therefore more like multiple scripts. +// See https://www.unicode.org/reports/tr24/#Values for more details. Zzzz is also used for +// unknown value in CLDR. (Zzzz, Exact) is returned if Zzzz was explicitly specified. +// Note that an inferred script is never guaranteed to be the correct one. Latin is +// almost exclusively used for Afrikaans, but Arabic has been used for some texts +// in the past. Also, the script that is commonly used may change over time. +// It uses a variant of CLDR's Add Likely Subtags algorithm. This is subject to change. +func (t Tag) Script() (Script, Confidence) { + if scr := t.script(); scr != 0 { + return Script{scr}, Exact + } + tt := t.tag() + sc, c := language.Script(_Zzzz), No + if scr := tt.LangID.SuppressScript(); scr != 0 { + // Note: it is not always the case that a language with a suppress + // script value is only written in one script (e.g. kk, ms, pa). + if tt.RegionID == 0 { + return Script{scr}, High + } + sc, c = scr, High + } + if tag, err := tt.Maximize(); err == nil { + if tag.ScriptID != sc { + sc, c = tag.ScriptID, Low + } + } else { + tt, _ = canonicalize(Deprecated|Macro, tt) + if tag, err := tt.Maximize(); err == nil && tag.ScriptID != sc { + sc, c = tag.ScriptID, Low + } + } + return Script{sc}, c +} + +// Region returns the region for the language tag. If it was not explicitly given, it will +// infer a most likely candidate from the context. +// It uses a variant of CLDR's Add Likely Subtags algorithm. This is subject to change. +func (t Tag) Region() (Region, Confidence) { + if r := t.region(); r != 0 { + return Region{r}, Exact + } + tt := t.tag() + if tt, err := tt.Maximize(); err == nil { + return Region{tt.RegionID}, Low // TODO: differentiate between high and low. + } + tt, _ = canonicalize(Deprecated|Macro, tt) + if tag, err := tt.Maximize(); err == nil { + return Region{tag.RegionID}, Low + } + return Region{_ZZ}, No // TODO: return world instead of undetermined? +} + +// Variants returns the variants specified explicitly for this language tag. +// or nil if no variant was specified. +func (t Tag) Variants() []Variant { + if !compact.Tag(t).MayHaveVariants() { + return nil + } + v := []Variant{} + x, str := "", t.tag().Variants() + for str != "" { + x, str = nextToken(str) + v = append(v, Variant{x}) + } + return v +} + +// Parent returns the CLDR parent of t. In CLDR, missing fields in data for a +// specific language are substituted with fields from the parent language. +// The parent for a language may change for newer versions of CLDR. +// +// Parent returns a tag for a less specific language that is mutually +// intelligible or Und if there is no such language. This may not be the same as +// simply stripping the last BCP 47 subtag. For instance, the parent of "zh-TW" +// is "zh-Hant", and the parent of "zh-Hant" is "und". +func (t Tag) Parent() Tag { + return Tag(compact.Tag(t).Parent()) +} + +// nextToken returns token t and the rest of the string. +func nextToken(s string) (t, tail string) { + p := strings.Index(s[1:], "-") + if p == -1 { + return s[1:], "" + } + p++ + return s[1:p], s[p:] +} + +// Extension is a single BCP 47 extension. +type Extension struct { + s string +} + +// String returns the string representation of the extension, including the +// type tag. +func (e Extension) String() string { + return e.s +} + +// ParseExtension parses s as an extension and returns it on success. +func ParseExtension(s string) (e Extension, err error) { + ext, err := language.ParseExtension(s) + return Extension{ext}, err +} + +// Type returns the one-byte extension type of e. It returns 0 for the zero +// exception. +func (e Extension) Type() byte { + if e.s == "" { + return 0 + } + return e.s[0] +} + +// Tokens returns the list of tokens of e. +func (e Extension) Tokens() []string { + return strings.Split(e.s, "-") +} + +// Extension returns the extension of type x for tag t. It will return +// false for ok if t does not have the requested extension. The returned +// extension will be invalid in this case. +func (t Tag) Extension(x byte) (ext Extension, ok bool) { + if !compact.Tag(t).MayHaveExtensions() { + return Extension{}, false + } + e, ok := t.tag().Extension(x) + return Extension{e}, ok +} + +// Extensions returns all extensions of t. +func (t Tag) Extensions() []Extension { + if !compact.Tag(t).MayHaveExtensions() { + return nil + } + e := []Extension{} + for _, ext := range t.tag().Extensions() { + e = append(e, Extension{ext}) + } + return e +} + +// TypeForKey returns the type associated with the given key, where key and type +// are of the allowed values defined for the Unicode locale extension ('u') in +// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// TypeForKey will traverse the inheritance chain to get the correct value. +// +// If there are multiple types associated with a key, only the first will be +// returned. If there is no type associated with a key, it returns the empty +// string. +func (t Tag) TypeForKey(key string) string { + if !compact.Tag(t).MayHaveExtensions() { + if key != "rg" && key != "va" { + return "" + } + } + return t.tag().TypeForKey(key) +} + +// SetTypeForKey returns a new Tag with the key set to type, where key and type +// are of the allowed values defined for the Unicode locale extension ('u') in +// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// An empty value removes an existing pair with the same key. +func (t Tag) SetTypeForKey(key, value string) (Tag, error) { + tt, err := t.tag().SetTypeForKey(key, value) + return makeTag(tt), err +} + +// NumCompactTags is the number of compact tags. The maximum tag is +// NumCompactTags-1. +const NumCompactTags = compact.NumCompactTags + +// CompactIndex returns an index, where 0 <= index < NumCompactTags, for tags +// for which data exists in the text repository.The index will change over time +// and should not be stored in persistent storage. If t does not match a compact +// index, exact will be false and the compact index will be returned for the +// first match after repeatedly taking the Parent of t. +func CompactIndex(t Tag) (index int, exact bool) { + id, exact := compact.LanguageID(compact.Tag(t)) + return int(id), exact +} + +var root = language.Tag{} + +// Base is an ISO 639 language code, used for encoding the base language +// of a language tag. +type Base struct { + langID language.Language +} + +// ParseBase parses a 2- or 3-letter ISO 639 code. +// It returns a ValueError if s is a well-formed but unknown language identifier +// or another error if another error occurred. +func ParseBase(s string) (Base, error) { + l, err := language.ParseBase(s) + return Base{l}, err +} + +// String returns the BCP 47 representation of the base language. +func (b Base) String() string { + return b.langID.String() +} + +// ISO3 returns the ISO 639-3 language code. +func (b Base) ISO3() string { + return b.langID.ISO3() +} + +// IsPrivateUse reports whether this language code is reserved for private use. +func (b Base) IsPrivateUse() bool { + return b.langID.IsPrivateUse() +} + +// Script is a 4-letter ISO 15924 code for representing scripts. +// It is idiomatically represented in title case. +type Script struct { + scriptID language.Script +} + +// ParseScript parses a 4-letter ISO 15924 code. +// It returns a ValueError if s is a well-formed but unknown script identifier +// or another error if another error occurred. +func ParseScript(s string) (Script, error) { + sc, err := language.ParseScript(s) + return Script{sc}, err +} + +// String returns the script code in title case. +// It returns "Zzzz" for an unspecified script. +func (s Script) String() string { + return s.scriptID.String() +} + +// IsPrivateUse reports whether this script code is reserved for private use. +func (s Script) IsPrivateUse() bool { + return s.scriptID.IsPrivateUse() +} + +// Region is an ISO 3166-1 or UN M.49 code for representing countries and regions. +type Region struct { + regionID language.Region +} + +// EncodeM49 returns the Region for the given UN M.49 code. +// It returns an error if r is not a valid code. +func EncodeM49(r int) (Region, error) { + rid, err := language.EncodeM49(r) + return Region{rid}, err +} + +// ParseRegion parses a 2- or 3-letter ISO 3166-1 or a UN M.49 code. +// It returns a ValueError if s is a well-formed but unknown region identifier +// or another error if another error occurred. +func ParseRegion(s string) (Region, error) { + r, err := language.ParseRegion(s) + return Region{r}, err +} + +// String returns the BCP 47 representation for the region. +// It returns "ZZ" for an unspecified region. +func (r Region) String() string { + return r.regionID.String() +} + +// ISO3 returns the 3-letter ISO code of r. +// Note that not all regions have a 3-letter ISO code. +// In such cases this method returns "ZZZ". +func (r Region) ISO3() string { + return r.regionID.ISO3() +} + +// M49 returns the UN M.49 encoding of r, or 0 if this encoding +// is not defined for r. +func (r Region) M49() int { + return r.regionID.M49() +} + +// IsPrivateUse reports whether r has the ISO 3166 User-assigned status. This +// may include private-use tags that are assigned by CLDR and used in this +// implementation. So IsPrivateUse and IsCountry can be simultaneously true. +func (r Region) IsPrivateUse() bool { + return r.regionID.IsPrivateUse() +} + +// IsCountry returns whether this region is a country or autonomous area. This +// includes non-standard definitions from CLDR. +func (r Region) IsCountry() bool { + return r.regionID.IsCountry() +} + +// IsGroup returns whether this region defines a collection of regions. This +// includes non-standard definitions from CLDR. +func (r Region) IsGroup() bool { + return r.regionID.IsGroup() +} + +// Contains returns whether Region c is contained by Region r. It returns true +// if c == r. +func (r Region) Contains(c Region) bool { + return r.regionID.Contains(c.regionID) +} + +// TLD returns the country code top-level domain (ccTLD). UK is returned for GB. +// In all other cases it returns either the region itself or an error. +// +// This method may return an error for a region for which there exists a +// canonical form with a ccTLD. To get that ccTLD canonicalize r first. The +// region will already be canonicalized it was obtained from a Tag that was +// obtained using any of the default methods. +func (r Region) TLD() (Region, error) { + tld, err := r.regionID.TLD() + return Region{tld}, err +} + +// Canonicalize returns the region or a possible replacement if the region is +// deprecated. It will not return a replacement for deprecated regions that +// are split into multiple regions. +func (r Region) Canonicalize() Region { + return Region{r.regionID.Canonicalize()} +} + +// Variant represents a registered variant of a language as defined by BCP 47. +type Variant struct { + variant string +} + +// ParseVariant parses and returns a Variant. An error is returned if s is not +// a valid variant. +func ParseVariant(s string) (Variant, error) { + v, err := language.ParseVariant(s) + return Variant{v.String()}, err +} + +// String returns the string representation of the variant. +func (v Variant) String() string { + return v.variant +} diff --git a/vendor/golang.org/x/text/language/match.go b/vendor/golang.org/x/text/language/match.go new file mode 100644 index 0000000000..1153baf291 --- /dev/null +++ b/vendor/golang.org/x/text/language/match.go @@ -0,0 +1,735 @@ +// 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 language + +import ( + "errors" + "strings" + + "golang.org/x/text/internal/language" +) + +// A MatchOption configures a Matcher. +type MatchOption func(*matcher) + +// PreferSameScript will, in the absence of a match, result in the first +// preferred tag with the same script as a supported tag to match this supported +// tag. The default is currently true, but this may change in the future. +func PreferSameScript(preferSame bool) MatchOption { + return func(m *matcher) { m.preferSameScript = preferSame } +} + +// TODO(v1.0.0): consider making Matcher a concrete type, instead of interface. +// There doesn't seem to be too much need for multiple types. +// Making it a concrete type allows MatchStrings to be a method, which will +// improve its discoverability. + +// MatchStrings parses and matches the given strings until one of them matches +// the language in the Matcher. A string may be an Accept-Language header as +// handled by ParseAcceptLanguage. The default language is returned if no +// other language matched. +func MatchStrings(m Matcher, lang ...string) (tag Tag, index int) { + for _, accept := range lang { + desired, _, err := ParseAcceptLanguage(accept) + if err != nil { + continue + } + if tag, index, conf := m.Match(desired...); conf != No { + return tag, index + } + } + tag, index, _ = m.Match() + return +} + +// Matcher is the interface that wraps the Match method. +// +// Match returns the best match for any of the given tags, along with +// a unique index associated with the returned tag and a confidence +// score. +type Matcher interface { + Match(t ...Tag) (tag Tag, index int, c Confidence) +} + +// Comprehends reports the confidence score for a speaker of a given language +// to being able to comprehend the written form of an alternative language. +func Comprehends(speaker, alternative Tag) Confidence { + _, _, c := NewMatcher([]Tag{alternative}).Match(speaker) + return c +} + +// NewMatcher returns a Matcher that matches an ordered list of preferred tags +// against a list of supported tags based on written intelligibility, closeness +// of dialect, equivalence of subtags and various other rules. It is initialized +// with the list of supported tags. The first element is used as the default +// value in case no match is found. +// +// Its Match method matches the first of the given Tags to reach a certain +// confidence threshold. The tags passed to Match should therefore be specified +// in order of preference. Extensions are ignored for matching. +// +// The index returned by the Match method corresponds to the index of the +// matched tag in t, but is augmented with the Unicode extension ('u')of the +// corresponding preferred tag. This allows user locale options to be passed +// transparently. +func NewMatcher(t []Tag, options ...MatchOption) Matcher { + return newMatcher(t, options) +} + +func (m *matcher) Match(want ...Tag) (t Tag, index int, c Confidence) { + var tt language.Tag + match, w, c := m.getBest(want...) + if match != nil { + tt, index = match.tag, match.index + } else { + // TODO: this should be an option + tt = m.default_.tag + if m.preferSameScript { + outer: + for _, w := range want { + script, _ := w.Script() + if script.scriptID == 0 { + // Don't do anything if there is no script, such as with + // private subtags. + continue + } + for i, h := range m.supported { + if script.scriptID == h.maxScript { + tt, index = h.tag, i + break outer + } + } + } + } + // TODO: select first language tag based on script. + } + if w.RegionID != tt.RegionID && w.RegionID != 0 { + if w.RegionID != 0 && tt.RegionID != 0 && tt.RegionID.Contains(w.RegionID) { + tt.RegionID = w.RegionID + tt.RemakeString() + } else if r := w.RegionID.String(); len(r) == 2 { + // TODO: also filter macro and deprecated. + tt, _ = tt.SetTypeForKey("rg", strings.ToLower(r)+"zzzz") + } + } + // Copy options from the user-provided tag into the result tag. This is hard + // to do after the fact, so we do it here. + // TODO: add in alternative variants to -u-va-. + // TODO: add preferred region to -u-rg-. + if e := w.Extensions(); len(e) > 0 { + b := language.Builder{} + b.SetTag(tt) + for _, e := range e { + b.AddExt(e) + } + tt = b.Make() + } + return makeTag(tt), index, c +} + +// ErrMissingLikelyTagsData indicates no information was available +// to compute likely values of missing tags. +var ErrMissingLikelyTagsData = errors.New("missing likely tags data") + +// func (t *Tag) setTagsFrom(id Tag) { +// t.LangID = id.LangID +// t.ScriptID = id.ScriptID +// t.RegionID = id.RegionID +// } + +// Tag Matching +// CLDR defines an algorithm for finding the best match between two sets of language +// tags. The basic algorithm defines how to score a possible match and then find +// the match with the best score +// (see https://www.unicode.org/reports/tr35/#LanguageMatching). +// Using scoring has several disadvantages. The scoring obfuscates the importance of +// the various factors considered, making the algorithm harder to understand. Using +// scoring also requires the full score to be computed for each pair of tags. +// +// We will use a different algorithm which aims to have the following properties: +// - clarity on the precedence of the various selection factors, and +// - improved performance by allowing early termination of a comparison. +// +// Matching algorithm (overview) +// Input: +// - supported: a set of supported tags +// - default: the default tag to return in case there is no match +// - desired: list of desired tags, ordered by preference, starting with +// the most-preferred. +// +// Algorithm: +// 1) Set the best match to the lowest confidence level +// 2) For each tag in "desired": +// a) For each tag in "supported": +// 1) compute the match between the two tags. +// 2) if the match is better than the previous best match, replace it +// with the new match. (see next section) +// b) if the current best match is Exact and pin is true the result will be +// frozen to the language found thusfar, although better matches may +// still be found for the same language. +// 3) If the best match so far is below a certain threshold, return "default". +// +// Ranking: +// We use two phases to determine whether one pair of tags are a better match +// than another pair of tags. First, we determine a rough confidence level. If the +// levels are different, the one with the highest confidence wins. +// Second, if the rough confidence levels are identical, we use a set of tie-breaker +// rules. +// +// The confidence level of matching a pair of tags is determined by finding the +// lowest confidence level of any matches of the corresponding subtags (the +// result is deemed as good as its weakest link). +// We define the following levels: +// Exact - An exact match of a subtag, before adding likely subtags. +// MaxExact - An exact match of a subtag, after adding likely subtags. +// [See Note 2]. +// High - High level of mutual intelligibility between different subtag +// variants. +// Low - Low level of mutual intelligibility between different subtag +// variants. +// No - No mutual intelligibility. +// +// The following levels can occur for each type of subtag: +// Base: Exact, MaxExact, High, Low, No +// Script: Exact, MaxExact [see Note 3], Low, No +// Region: Exact, MaxExact, High +// Variant: Exact, High +// Private: Exact, No +// +// Any result with a confidence level of Low or higher is deemed a possible match. +// Once a desired tag matches any of the supported tags with a level of MaxExact +// or higher, the next desired tag is not considered (see Step 2.b). +// Note that CLDR provides languageMatching data that defines close equivalence +// classes for base languages, scripts and regions. +// +// Tie-breaking +// If we get the same confidence level for two matches, we apply a sequence of +// tie-breaking rules. The first that succeeds defines the result. The rules are +// applied in the following order. +// 1) Original language was defined and was identical. +// 2) Original region was defined and was identical. +// 3) Distance between two maximized regions was the smallest. +// 4) Original script was defined and was identical. +// 5) Distance from want tag to have tag using the parent relation [see Note 5.] +// If there is still no winner after these rules are applied, the first match +// found wins. +// +// Notes: +// [2] In practice, as matching of Exact is done in a separate phase from +// matching the other levels, we reuse the Exact level to mean MaxExact in +// the second phase. As a consequence, we only need the levels defined by +// the Confidence type. The MaxExact confidence level is mapped to High in +// the public API. +// [3] We do not differentiate between maximized script values that were derived +// from suppressScript versus most likely tag data. We determined that in +// ranking the two, one ranks just after the other. Moreover, the two cannot +// occur concurrently. As a consequence, they are identical for practical +// purposes. +// [4] In case of deprecated, macro-equivalents and legacy mappings, we assign +// the MaxExact level to allow iw vs he to still be a closer match than +// en-AU vs en-US, for example. +// [5] In CLDR a locale inherits fields that are unspecified for this locale +// from its parent. Therefore, if a locale is a parent of another locale, +// it is a strong measure for closeness, especially when no other tie +// breaker rule applies. One could also argue it is inconsistent, for +// example, when pt-AO matches pt (which CLDR equates with pt-BR), even +// though its parent is pt-PT according to the inheritance rules. +// +// Implementation Details: +// There are several performance considerations worth pointing out. Most notably, +// we preprocess as much as possible (within reason) at the time of creation of a +// matcher. This includes: +// - creating a per-language map, which includes data for the raw base language +// and its canonicalized variant (if applicable), +// - expanding entries for the equivalence classes defined in CLDR's +// languageMatch data. +// The per-language map ensures that typically only a very small number of tags +// need to be considered. The pre-expansion of canonicalized subtags and +// equivalence classes reduces the amount of map lookups that need to be done at +// runtime. + +// matcher keeps a set of supported language tags, indexed by language. +type matcher struct { + default_ *haveTag + supported []*haveTag + index map[language.Language]*matchHeader + passSettings bool + preferSameScript bool +} + +// matchHeader has the lists of tags for exact matches and matches based on +// maximized and canonicalized tags for a given language. +type matchHeader struct { + haveTags []*haveTag + original bool +} + +// haveTag holds a supported Tag and its maximized script and region. The maximized +// or canonicalized language is not stored as it is not needed during matching. +type haveTag struct { + tag language.Tag + + // index of this tag in the original list of supported tags. + index int + + // conf is the maximum confidence that can result from matching this haveTag. + // When conf < Exact this means it was inserted after applying a CLDR equivalence rule. + conf Confidence + + // Maximized region and script. + maxRegion language.Region + maxScript language.Script + + // altScript may be checked as an alternative match to maxScript. If altScript + // matches, the confidence level for this match is Low. Theoretically there + // could be multiple alternative scripts. This does not occur in practice. + altScript language.Script + + // nextMax is the index of the next haveTag with the same maximized tags. + nextMax uint16 +} + +func makeHaveTag(tag language.Tag, index int) (haveTag, language.Language) { + max := tag + if tag.LangID != 0 || tag.RegionID != 0 || tag.ScriptID != 0 { + max, _ = canonicalize(All, max) + max, _ = max.Maximize() + max.RemakeString() + } + return haveTag{tag, index, Exact, max.RegionID, max.ScriptID, altScript(max.LangID, max.ScriptID), 0}, max.LangID +} + +// altScript returns an alternative script that may match the given script with +// a low confidence. At the moment, the langMatch data allows for at most one +// script to map to another and we rely on this to keep the code simple. +func altScript(l language.Language, s language.Script) language.Script { + for _, alt := range matchScript { + // TODO: also match cases where language is not the same. + if (language.Language(alt.wantLang) == l || language.Language(alt.haveLang) == l) && + language.Script(alt.haveScript) == s { + return language.Script(alt.wantScript) + } + } + return 0 +} + +// addIfNew adds a haveTag to the list of tags only if it is a unique tag. +// Tags that have the same maximized values are linked by index. +func (h *matchHeader) addIfNew(n haveTag, exact bool) { + h.original = h.original || exact + // Don't add new exact matches. + for _, v := range h.haveTags { + if equalsRest(v.tag, n.tag) { + return + } + } + // Allow duplicate maximized tags, but create a linked list to allow quickly + // comparing the equivalents and bail out. + for i, v := range h.haveTags { + if v.maxScript == n.maxScript && + v.maxRegion == n.maxRegion && + v.tag.VariantOrPrivateUseTags() == n.tag.VariantOrPrivateUseTags() { + for h.haveTags[i].nextMax != 0 { + i = int(h.haveTags[i].nextMax) + } + h.haveTags[i].nextMax = uint16(len(h.haveTags)) + break + } + } + h.haveTags = append(h.haveTags, &n) +} + +// header returns the matchHeader for the given language. It creates one if +// it doesn't already exist. +func (m *matcher) header(l language.Language) *matchHeader { + if h := m.index[l]; h != nil { + return h + } + h := &matchHeader{} + m.index[l] = h + return h +} + +func toConf(d uint8) Confidence { + if d <= 10 { + return High + } + if d < 30 { + return Low + } + return No +} + +// newMatcher builds an index for the given supported tags and returns it as +// a matcher. It also expands the index by considering various equivalence classes +// for a given tag. +func newMatcher(supported []Tag, options []MatchOption) *matcher { + m := &matcher{ + index: make(map[language.Language]*matchHeader), + preferSameScript: true, + } + for _, o := range options { + o(m) + } + if len(supported) == 0 { + m.default_ = &haveTag{} + return m + } + // Add supported languages to the index. Add exact matches first to give + // them precedence. + for i, tag := range supported { + tt := tag.tag() + pair, _ := makeHaveTag(tt, i) + m.header(tt.LangID).addIfNew(pair, true) + m.supported = append(m.supported, &pair) + } + m.default_ = m.header(supported[0].lang()).haveTags[0] + // Keep these in two different loops to support the case that two equivalent + // languages are distinguished, such as iw and he. + for i, tag := range supported { + tt := tag.tag() + pair, max := makeHaveTag(tt, i) + if max != tt.LangID { + m.header(max).addIfNew(pair, true) + } + } + + // update is used to add indexes in the map for equivalent languages. + // update will only add entries to original indexes, thus not computing any + // transitive relations. + update := func(want, have uint16, conf Confidence) { + if hh := m.index[language.Language(have)]; hh != nil { + if !hh.original { + return + } + hw := m.header(language.Language(want)) + for _, ht := range hh.haveTags { + v := *ht + if conf < v.conf { + v.conf = conf + } + v.nextMax = 0 // this value needs to be recomputed + if v.altScript != 0 { + v.altScript = altScript(language.Language(want), v.maxScript) + } + hw.addIfNew(v, conf == Exact && hh.original) + } + } + } + + // Add entries for languages with mutual intelligibility as defined by CLDR's + // languageMatch data. + for _, ml := range matchLang { + update(ml.want, ml.have, toConf(ml.distance)) + if !ml.oneway { + update(ml.have, ml.want, toConf(ml.distance)) + } + } + + // Add entries for possible canonicalizations. This is an optimization to + // ensure that only one map lookup needs to be done at runtime per desired tag. + // First we match deprecated equivalents. If they are perfect equivalents + // (their canonicalization simply substitutes a different language code, but + // nothing else), the match confidence is Exact, otherwise it is High. + for i, lm := range language.AliasMap { + // If deprecated codes match and there is no fiddling with the script + // or region, we consider it an exact match. + conf := Exact + if language.AliasTypes[i] != language.Macro { + if !isExactEquivalent(language.Language(lm.From)) { + conf = High + } + update(lm.To, lm.From, conf) + } + update(lm.From, lm.To, conf) + } + return m +} + +// getBest gets the best matching tag in m for any of the given tags, taking into +// account the order of preference of the given tags. +func (m *matcher) getBest(want ...Tag) (got *haveTag, orig language.Tag, c Confidence) { + best := bestMatch{} + for i, ww := range want { + w := ww.tag() + var max language.Tag + // Check for exact match first. + h := m.index[w.LangID] + if w.LangID != 0 { + if h == nil { + continue + } + // Base language is defined. + max, _ = canonicalize(Legacy|Deprecated|Macro, w) + // A region that is added through canonicalization is stronger than + // a maximized region: set it in the original (e.g. mo -> ro-MD). + if w.RegionID != max.RegionID { + w.RegionID = max.RegionID + } + // TODO: should we do the same for scripts? + // See test case: en, sr, nl ; sh ; sr + max, _ = max.Maximize() + } else { + // Base language is not defined. + if h != nil { + for i := range h.haveTags { + have := h.haveTags[i] + if equalsRest(have.tag, w) { + return have, w, Exact + } + } + } + if w.ScriptID == 0 && w.RegionID == 0 { + // We skip all tags matching und for approximate matching, including + // private tags. + continue + } + max, _ = w.Maximize() + if h = m.index[max.LangID]; h == nil { + continue + } + } + pin := true + for _, t := range want[i+1:] { + if w.LangID == t.lang() { + pin = false + break + } + } + // Check for match based on maximized tag. + for i := range h.haveTags { + have := h.haveTags[i] + best.update(have, w, max.ScriptID, max.RegionID, pin) + if best.conf == Exact { + for have.nextMax != 0 { + have = h.haveTags[have.nextMax] + best.update(have, w, max.ScriptID, max.RegionID, pin) + } + return best.have, best.want, best.conf + } + } + } + if best.conf <= No { + if len(want) != 0 { + return nil, want[0].tag(), No + } + return nil, language.Tag{}, No + } + return best.have, best.want, best.conf +} + +// bestMatch accumulates the best match so far. +type bestMatch struct { + have *haveTag + want language.Tag + conf Confidence + pinnedRegion language.Region + pinLanguage bool + sameRegionGroup bool + // Cached results from applying tie-breaking rules. + origLang bool + origReg bool + paradigmReg bool + regGroupDist uint8 + origScript bool +} + +// update updates the existing best match if the new pair is considered to be a +// better match. To determine if the given pair is a better match, it first +// computes the rough confidence level. If this surpasses the current match, it +// will replace it and update the tie-breaker rule cache. If there is a tie, it +// proceeds with applying a series of tie-breaker rules. If there is no +// conclusive winner after applying the tie-breaker rules, it leaves the current +// match as the preferred match. +// +// If pin is true and have and tag are a strong match, it will henceforth only +// consider matches for this language. This corresponds to the idea that most +// users have a strong preference for the first defined language. A user can +// still prefer a second language over a dialect of the preferred language by +// explicitly specifying dialects, e.g. "en, nl, en-GB". In this case pin should +// be false. +func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.Script, maxRegion language.Region, pin bool) { + // Bail if the maximum attainable confidence is below that of the current best match. + c := have.conf + if c < m.conf { + return + } + // Don't change the language once we already have found an exact match. + if m.pinLanguage && tag.LangID != m.want.LangID { + return + } + // Pin the region group if we are comparing tags for the same language. + if tag.LangID == m.want.LangID && m.sameRegionGroup { + _, sameGroup := regionGroupDist(m.pinnedRegion, have.maxRegion, have.maxScript, m.want.LangID) + if !sameGroup { + return + } + } + if c == Exact && have.maxScript == maxScript { + // If there is another language and then another entry of this language, + // don't pin anything, otherwise pin the language. + m.pinLanguage = pin + } + if equalsRest(have.tag, tag) { + } else if have.maxScript != maxScript { + // There is usually very little comprehension between different scripts. + // In a few cases there may still be Low comprehension. This possibility + // is pre-computed and stored in have.altScript. + if Low < m.conf || have.altScript != maxScript { + return + } + c = Low + } else if have.maxRegion != maxRegion { + if High < c { + // There is usually a small difference between languages across regions. + c = High + } + } + + // We store the results of the computations of the tie-breaker rules along + // with the best match. There is no need to do the checks once we determine + // we have a winner, but we do still need to do the tie-breaker computations. + // We use "beaten" to keep track if we still need to do the checks. + beaten := false // true if the new pair defeats the current one. + if c != m.conf { + if c < m.conf { + return + } + beaten = true + } + + // Tie-breaker rules: + // We prefer if the pre-maximized language was specified and identical. + origLang := have.tag.LangID == tag.LangID && tag.LangID != 0 + if !beaten && m.origLang != origLang { + if m.origLang { + return + } + beaten = true + } + + // We prefer if the pre-maximized region was specified and identical. + origReg := have.tag.RegionID == tag.RegionID && tag.RegionID != 0 + if !beaten && m.origReg != origReg { + if m.origReg { + return + } + beaten = true + } + + regGroupDist, sameGroup := regionGroupDist(have.maxRegion, maxRegion, maxScript, tag.LangID) + if !beaten && m.regGroupDist != regGroupDist { + if regGroupDist > m.regGroupDist { + return + } + beaten = true + } + + paradigmReg := isParadigmLocale(tag.LangID, have.maxRegion) + if !beaten && m.paradigmReg != paradigmReg { + if !paradigmReg { + return + } + beaten = true + } + + // Next we prefer if the pre-maximized script was specified and identical. + origScript := have.tag.ScriptID == tag.ScriptID && tag.ScriptID != 0 + if !beaten && m.origScript != origScript { + if m.origScript { + return + } + beaten = true + } + + // Update m to the newly found best match. + if beaten { + m.have = have + m.want = tag + m.conf = c + m.pinnedRegion = maxRegion + m.sameRegionGroup = sameGroup + m.origLang = origLang + m.origReg = origReg + m.paradigmReg = paradigmReg + m.origScript = origScript + m.regGroupDist = regGroupDist + } +} + +func isParadigmLocale(lang language.Language, r language.Region) bool { + for _, e := range paradigmLocales { + if language.Language(e[0]) == lang && (r == language.Region(e[1]) || r == language.Region(e[2])) { + return true + } + } + return false +} + +// regionGroupDist computes the distance between two regions based on their +// CLDR grouping. +func regionGroupDist(a, b language.Region, script language.Script, lang language.Language) (dist uint8, same bool) { + const defaultDistance = 4 + + aGroup := uint(regionToGroups[a]) << 1 + bGroup := uint(regionToGroups[b]) << 1 + for _, ri := range matchRegion { + if language.Language(ri.lang) == lang && (ri.script == 0 || language.Script(ri.script) == script) { + group := uint(1 << (ri.group &^ 0x80)) + if 0x80&ri.group == 0 { + if aGroup&bGroup&group != 0 { // Both regions are in the group. + return ri.distance, ri.distance == defaultDistance + } + } else { + if (aGroup|bGroup)&group == 0 { // Both regions are not in the group. + return ri.distance, ri.distance == defaultDistance + } + } + } + } + return defaultDistance, true +} + +// equalsRest compares everything except the language. +func equalsRest(a, b language.Tag) bool { + // TODO: don't include extensions in this comparison. To do this efficiently, + // though, we should handle private tags separately. + return a.ScriptID == b.ScriptID && a.RegionID == b.RegionID && a.VariantOrPrivateUseTags() == b.VariantOrPrivateUseTags() +} + +// isExactEquivalent returns true if canonicalizing the language will not alter +// the script or region of a tag. +func isExactEquivalent(l language.Language) bool { + for _, o := range notEquivalent { + if o == l { + return false + } + } + return true +} + +var notEquivalent []language.Language + +func init() { + // Create a list of all languages for which canonicalization may alter the + // script or region. + for _, lm := range language.AliasMap { + tag := language.Tag{LangID: language.Language(lm.From)} + if tag, _ = canonicalize(All, tag); tag.ScriptID != 0 || tag.RegionID != 0 { + notEquivalent = append(notEquivalent, language.Language(lm.From)) + } + } + // Maximize undefined regions of paradigm locales. + for i, v := range paradigmLocales { + t := language.Tag{LangID: language.Language(v[0])} + max, _ := t.Maximize() + if v[1] == 0 { + paradigmLocales[i][1] = uint16(max.RegionID) + } + if v[2] == 0 { + paradigmLocales[i][2] = uint16(max.RegionID) + } + } +} diff --git a/vendor/golang.org/x/text/language/parse.go b/vendor/golang.org/x/text/language/parse.go new file mode 100644 index 0000000000..053336e286 --- /dev/null +++ b/vendor/golang.org/x/text/language/parse.go @@ -0,0 +1,256 @@ +// 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 language + +import ( + "errors" + "sort" + "strconv" + "strings" + + "golang.org/x/text/internal/language" +) + +// ValueError is returned by any of the parsing functions when the +// input is well-formed but the respective subtag is not recognized +// as a valid value. +type ValueError interface { + error + + // Subtag returns the subtag for which the error occurred. + Subtag() string +} + +// Parse parses the given BCP 47 string and returns a valid Tag. If parsing +// failed it returns an error and any part of the tag that could be parsed. +// If parsing succeeded but an unknown value was found, it returns +// ValueError. The Tag returned in this case is just stripped of the unknown +// value. All other values are preserved. It accepts tags in the BCP 47 format +// and extensions to this standard defined in +// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// The resulting tag is canonicalized using the default canonicalization type. +func Parse(s string) (t Tag, err error) { + return Default.Parse(s) +} + +// Parse parses the given BCP 47 string and returns a valid Tag. If parsing +// failed it returns an error and any part of the tag that could be parsed. +// If parsing succeeded but an unknown value was found, it returns +// ValueError. The Tag returned in this case is just stripped of the unknown +// value. All other values are preserved. It accepts tags in the BCP 47 format +// and extensions to this standard defined in +// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// The resulting tag is canonicalized using the canonicalization type c. +func (c CanonType) Parse(s string) (t Tag, err error) { + defer func() { + if recover() != nil { + t = Tag{} + err = language.ErrSyntax + } + }() + + tt, err := language.Parse(s) + if err != nil { + return makeTag(tt), err + } + tt, changed := canonicalize(c, tt) + if changed { + tt.RemakeString() + } + return makeTag(tt), nil +} + +// Compose creates a Tag from individual parts, which may be of type Tag, Base, +// Script, Region, Variant, []Variant, Extension, []Extension or error. If a +// Base, Script or Region or slice of type Variant or Extension is passed more +// than once, the latter will overwrite the former. Variants and Extensions are +// accumulated, but if two extensions of the same type are passed, the latter +// will replace the former. For -u extensions, though, the key-type pairs are +// added, where later values overwrite older ones. A Tag overwrites all former +// values and typically only makes sense as the first argument. The resulting +// tag is returned after canonicalizing using the Default CanonType. If one or +// more errors are encountered, one of the errors is returned. +func Compose(part ...interface{}) (t Tag, err error) { + return Default.Compose(part...) +} + +// Compose creates a Tag from individual parts, which may be of type Tag, Base, +// Script, Region, Variant, []Variant, Extension, []Extension or error. If a +// Base, Script or Region or slice of type Variant or Extension is passed more +// than once, the latter will overwrite the former. Variants and Extensions are +// accumulated, but if two extensions of the same type are passed, the latter +// will replace the former. For -u extensions, though, the key-type pairs are +// added, where later values overwrite older ones. A Tag overwrites all former +// values and typically only makes sense as the first argument. The resulting +// tag is returned after canonicalizing using CanonType c. If one or more errors +// are encountered, one of the errors is returned. +func (c CanonType) Compose(part ...interface{}) (t Tag, err error) { + defer func() { + if recover() != nil { + t = Tag{} + err = language.ErrSyntax + } + }() + + var b language.Builder + if err = update(&b, part...); err != nil { + return und, err + } + b.Tag, _ = canonicalize(c, b.Tag) + return makeTag(b.Make()), err +} + +var errInvalidArgument = errors.New("invalid Extension or Variant") + +func update(b *language.Builder, part ...interface{}) (err error) { + for _, x := range part { + switch v := x.(type) { + case Tag: + b.SetTag(v.tag()) + case Base: + b.Tag.LangID = v.langID + case Script: + b.Tag.ScriptID = v.scriptID + case Region: + b.Tag.RegionID = v.regionID + case Variant: + if v.variant == "" { + err = errInvalidArgument + break + } + b.AddVariant(v.variant) + case Extension: + if v.s == "" { + err = errInvalidArgument + break + } + b.SetExt(v.s) + case []Variant: + b.ClearVariants() + for _, v := range v { + b.AddVariant(v.variant) + } + case []Extension: + b.ClearExtensions() + for _, e := range v { + b.SetExt(e.s) + } + // TODO: support parsing of raw strings based on morphology or just extensions? + case error: + if v != nil { + err = v + } + } + } + return +} + +var errInvalidWeight = errors.New("ParseAcceptLanguage: invalid weight") +var errTagListTooLarge = errors.New("tag list exceeds max length") + +// ParseAcceptLanguage parses the contents of an Accept-Language header as +// defined in http://www.ietf.org/rfc/rfc2616.txt and returns a list of Tags and +// a list of corresponding quality weights. It is more permissive than RFC 2616 +// and may return non-nil slices even if the input is not valid. +// The Tags will be sorted by highest weight first and then by first occurrence. +// Tags with a weight of zero will be dropped. An error will be returned if the +// input could not be parsed. +func ParseAcceptLanguage(s string) (tag []Tag, q []float32, err error) { + defer func() { + if recover() != nil { + tag = nil + q = nil + err = language.ErrSyntax + } + }() + + if strings.Count(s, "-") > 1000 { + return nil, nil, errTagListTooLarge + } + + var entry string + for s != "" { + if entry, s = split(s, ','); entry == "" { + continue + } + + entry, weight := split(entry, ';') + + // Scan the language. + t, err := Parse(entry) + if err != nil { + id, ok := acceptFallback[entry] + if !ok { + return nil, nil, err + } + t = makeTag(language.Tag{LangID: id}) + } + + // Scan the optional weight. + w := 1.0 + if weight != "" { + weight = consume(weight, 'q') + weight = consume(weight, '=') + // consume returns the empty string when a token could not be + // consumed, resulting in an error for ParseFloat. + if w, err = strconv.ParseFloat(weight, 32); err != nil { + return nil, nil, errInvalidWeight + } + // Drop tags with a quality weight of 0. + if w <= 0 { + continue + } + } + + tag = append(tag, t) + q = append(q, float32(w)) + } + sort.Stable(&tagSort{tag, q}) + return tag, q, nil +} + +// consume removes a leading token c from s and returns the result or the empty +// string if there is no such token. +func consume(s string, c byte) string { + if s == "" || s[0] != c { + return "" + } + return strings.TrimSpace(s[1:]) +} + +func split(s string, c byte) (head, tail string) { + if i := strings.IndexByte(s, c); i >= 0 { + return strings.TrimSpace(s[:i]), strings.TrimSpace(s[i+1:]) + } + return strings.TrimSpace(s), "" +} + +// Add hack mapping to deal with a small number of cases that occur +// in Accept-Language (with reasonable frequency). +var acceptFallback = map[string]language.Language{ + "english": _en, + "deutsch": _de, + "italian": _it, + "french": _fr, + "*": _mul, // defined in the spec to match all languages. +} + +type tagSort struct { + tag []Tag + q []float32 +} + +func (s *tagSort) Len() int { + return len(s.q) +} + +func (s *tagSort) Less(i, j int) bool { + return s.q[i] > s.q[j] +} + +func (s *tagSort) Swap(i, j int) { + s.tag[i], s.tag[j] = s.tag[j], s.tag[i] + s.q[i], s.q[j] = s.q[j], s.q[i] +} diff --git a/vendor/golang.org/x/text/language/tables.go b/vendor/golang.org/x/text/language/tables.go new file mode 100644 index 0000000000..a6573dcb21 --- /dev/null +++ b/vendor/golang.org/x/text/language/tables.go @@ -0,0 +1,298 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +package language + +// CLDRVersion is the CLDR version from which the tables in this package are derived. +const CLDRVersion = "32" + +const ( + _de = 269 + _en = 313 + _fr = 350 + _it = 505 + _mo = 784 + _no = 879 + _nb = 839 + _pt = 960 + _sh = 1031 + _mul = 806 + _und = 0 +) +const ( + _001 = 1 + _419 = 31 + _BR = 65 + _CA = 73 + _ES = 111 + _GB = 124 + _MD = 189 + _PT = 239 + _UK = 307 + _US = 310 + _ZZ = 358 + _XA = 324 + _XC = 326 + _XK = 334 +) +const ( + _Latn = 91 + _Hani = 57 + _Hans = 59 + _Hant = 60 + _Qaaa = 149 + _Qaai = 157 + _Qabx = 198 + _Zinh = 255 + _Zyyy = 260 + _Zzzz = 261 +) + +var regionToGroups = []uint8{ // 359 elements + // Entry 0 - 3F + 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x04, + // Entry 40 - 7F + 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, + 0x08, 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, + // Entry 80 - BF + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x04, 0x01, 0x00, 0x04, 0x02, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x04, + // Entry C0 - FF + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x01, 0x04, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 100 - 13F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x04, + 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x05, 0x00, + // Entry 140 - 17F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +} // Size: 383 bytes + +var paradigmLocales = [][3]uint16{ // 3 elements + 0: [3]uint16{0x139, 0x0, 0x7c}, + 1: [3]uint16{0x13e, 0x0, 0x1f}, + 2: [3]uint16{0x3c0, 0x41, 0xef}, +} // Size: 42 bytes + +type mutualIntelligibility struct { + want uint16 + have uint16 + distance uint8 + oneway bool +} +type scriptIntelligibility struct { + wantLang uint16 + haveLang uint16 + wantScript uint8 + haveScript uint8 + distance uint8 +} +type regionIntelligibility struct { + lang uint16 + script uint8 + group uint8 + distance uint8 +} + +// matchLang holds pairs of langIDs of base languages that are typically +// mutually intelligible. Each pair is associated with a confidence and +// whether the intelligibility goes one or both ways. +var matchLang = []mutualIntelligibility{ // 113 elements + 0: {want: 0x1d1, have: 0xb7, distance: 0x4, oneway: false}, + 1: {want: 0x407, have: 0xb7, distance: 0x4, oneway: false}, + 2: {want: 0x407, have: 0x1d1, distance: 0x4, oneway: false}, + 3: {want: 0x407, have: 0x432, distance: 0x4, oneway: false}, + 4: {want: 0x43a, have: 0x1, distance: 0x4, oneway: false}, + 5: {want: 0x1a3, have: 0x10d, distance: 0x4, oneway: true}, + 6: {want: 0x295, have: 0x10d, distance: 0x4, oneway: true}, + 7: {want: 0x101, have: 0x36f, distance: 0x8, oneway: false}, + 8: {want: 0x101, have: 0x347, distance: 0x8, oneway: false}, + 9: {want: 0x5, have: 0x3e2, distance: 0xa, oneway: true}, + 10: {want: 0xd, have: 0x139, distance: 0xa, oneway: true}, + 11: {want: 0x16, have: 0x367, distance: 0xa, oneway: true}, + 12: {want: 0x21, have: 0x139, distance: 0xa, oneway: true}, + 13: {want: 0x56, have: 0x13e, distance: 0xa, oneway: true}, + 14: {want: 0x58, have: 0x3e2, distance: 0xa, oneway: true}, + 15: {want: 0x71, have: 0x3e2, distance: 0xa, oneway: true}, + 16: {want: 0x75, have: 0x139, distance: 0xa, oneway: true}, + 17: {want: 0x82, have: 0x1be, distance: 0xa, oneway: true}, + 18: {want: 0xa5, have: 0x139, distance: 0xa, oneway: true}, + 19: {want: 0xb2, have: 0x15e, distance: 0xa, oneway: true}, + 20: {want: 0xdd, have: 0x153, distance: 0xa, oneway: true}, + 21: {want: 0xe5, have: 0x139, distance: 0xa, oneway: true}, + 22: {want: 0xe9, have: 0x3a, distance: 0xa, oneway: true}, + 23: {want: 0xf0, have: 0x15e, distance: 0xa, oneway: true}, + 24: {want: 0xf9, have: 0x15e, distance: 0xa, oneway: true}, + 25: {want: 0x100, have: 0x139, distance: 0xa, oneway: true}, + 26: {want: 0x130, have: 0x139, distance: 0xa, oneway: true}, + 27: {want: 0x13c, have: 0x139, distance: 0xa, oneway: true}, + 28: {want: 0x140, have: 0x151, distance: 0xa, oneway: true}, + 29: {want: 0x145, have: 0x13e, distance: 0xa, oneway: true}, + 30: {want: 0x158, have: 0x101, distance: 0xa, oneway: true}, + 31: {want: 0x16d, have: 0x367, distance: 0xa, oneway: true}, + 32: {want: 0x16e, have: 0x139, distance: 0xa, oneway: true}, + 33: {want: 0x16f, have: 0x139, distance: 0xa, oneway: true}, + 34: {want: 0x17e, have: 0x139, distance: 0xa, oneway: true}, + 35: {want: 0x190, have: 0x13e, distance: 0xa, oneway: true}, + 36: {want: 0x194, have: 0x13e, distance: 0xa, oneway: true}, + 37: {want: 0x1a4, have: 0x1be, distance: 0xa, oneway: true}, + 38: {want: 0x1b4, have: 0x139, distance: 0xa, oneway: true}, + 39: {want: 0x1b8, have: 0x139, distance: 0xa, oneway: true}, + 40: {want: 0x1d4, have: 0x15e, distance: 0xa, oneway: true}, + 41: {want: 0x1d7, have: 0x3e2, distance: 0xa, oneway: true}, + 42: {want: 0x1d9, have: 0x139, distance: 0xa, oneway: true}, + 43: {want: 0x1e7, have: 0x139, distance: 0xa, oneway: true}, + 44: {want: 0x1f8, have: 0x139, distance: 0xa, oneway: true}, + 45: {want: 0x20e, have: 0x1e1, distance: 0xa, oneway: true}, + 46: {want: 0x210, have: 0x139, distance: 0xa, oneway: true}, + 47: {want: 0x22d, have: 0x15e, distance: 0xa, oneway: true}, + 48: {want: 0x242, have: 0x3e2, distance: 0xa, oneway: true}, + 49: {want: 0x24a, have: 0x139, distance: 0xa, oneway: true}, + 50: {want: 0x251, have: 0x139, distance: 0xa, oneway: true}, + 51: {want: 0x265, have: 0x139, distance: 0xa, oneway: true}, + 52: {want: 0x274, have: 0x48a, distance: 0xa, oneway: true}, + 53: {want: 0x28a, have: 0x3e2, distance: 0xa, oneway: true}, + 54: {want: 0x28e, have: 0x1f9, distance: 0xa, oneway: true}, + 55: {want: 0x2a3, have: 0x139, distance: 0xa, oneway: true}, + 56: {want: 0x2b5, have: 0x15e, distance: 0xa, oneway: true}, + 57: {want: 0x2b8, have: 0x139, distance: 0xa, oneway: true}, + 58: {want: 0x2be, have: 0x139, distance: 0xa, oneway: true}, + 59: {want: 0x2c3, have: 0x15e, distance: 0xa, oneway: true}, + 60: {want: 0x2ed, have: 0x139, distance: 0xa, oneway: true}, + 61: {want: 0x2f1, have: 0x15e, distance: 0xa, oneway: true}, + 62: {want: 0x2fa, have: 0x139, distance: 0xa, oneway: true}, + 63: {want: 0x2ff, have: 0x7e, distance: 0xa, oneway: true}, + 64: {want: 0x304, have: 0x139, distance: 0xa, oneway: true}, + 65: {want: 0x30b, have: 0x3e2, distance: 0xa, oneway: true}, + 66: {want: 0x31b, have: 0x1be, distance: 0xa, oneway: true}, + 67: {want: 0x31f, have: 0x1e1, distance: 0xa, oneway: true}, + 68: {want: 0x320, have: 0x139, distance: 0xa, oneway: true}, + 69: {want: 0x331, have: 0x139, distance: 0xa, oneway: true}, + 70: {want: 0x351, have: 0x139, distance: 0xa, oneway: true}, + 71: {want: 0x36a, have: 0x347, distance: 0xa, oneway: false}, + 72: {want: 0x36a, have: 0x36f, distance: 0xa, oneway: true}, + 73: {want: 0x37a, have: 0x139, distance: 0xa, oneway: true}, + 74: {want: 0x387, have: 0x139, distance: 0xa, oneway: true}, + 75: {want: 0x389, have: 0x139, distance: 0xa, oneway: true}, + 76: {want: 0x38b, have: 0x15e, distance: 0xa, oneway: true}, + 77: {want: 0x390, have: 0x139, distance: 0xa, oneway: true}, + 78: {want: 0x395, have: 0x139, distance: 0xa, oneway: true}, + 79: {want: 0x39d, have: 0x139, distance: 0xa, oneway: true}, + 80: {want: 0x3a5, have: 0x139, distance: 0xa, oneway: true}, + 81: {want: 0x3be, have: 0x139, distance: 0xa, oneway: true}, + 82: {want: 0x3c4, have: 0x13e, distance: 0xa, oneway: true}, + 83: {want: 0x3d4, have: 0x10d, distance: 0xa, oneway: true}, + 84: {want: 0x3d9, have: 0x139, distance: 0xa, oneway: true}, + 85: {want: 0x3e5, have: 0x15e, distance: 0xa, oneway: true}, + 86: {want: 0x3e9, have: 0x1be, distance: 0xa, oneway: true}, + 87: {want: 0x3fa, have: 0x139, distance: 0xa, oneway: true}, + 88: {want: 0x40c, have: 0x139, distance: 0xa, oneway: true}, + 89: {want: 0x423, have: 0x139, distance: 0xa, oneway: true}, + 90: {want: 0x429, have: 0x139, distance: 0xa, oneway: true}, + 91: {want: 0x431, have: 0x139, distance: 0xa, oneway: true}, + 92: {want: 0x43b, have: 0x139, distance: 0xa, oneway: true}, + 93: {want: 0x43e, have: 0x1e1, distance: 0xa, oneway: true}, + 94: {want: 0x445, have: 0x139, distance: 0xa, oneway: true}, + 95: {want: 0x450, have: 0x139, distance: 0xa, oneway: true}, + 96: {want: 0x461, have: 0x139, distance: 0xa, oneway: true}, + 97: {want: 0x467, have: 0x3e2, distance: 0xa, oneway: true}, + 98: {want: 0x46f, have: 0x139, distance: 0xa, oneway: true}, + 99: {want: 0x476, have: 0x3e2, distance: 0xa, oneway: true}, + 100: {want: 0x3883, have: 0x139, distance: 0xa, oneway: true}, + 101: {want: 0x480, have: 0x139, distance: 0xa, oneway: true}, + 102: {want: 0x482, have: 0x139, distance: 0xa, oneway: true}, + 103: {want: 0x494, have: 0x3e2, distance: 0xa, oneway: true}, + 104: {want: 0x49d, have: 0x139, distance: 0xa, oneway: true}, + 105: {want: 0x4ac, have: 0x529, distance: 0xa, oneway: true}, + 106: {want: 0x4b4, have: 0x139, distance: 0xa, oneway: true}, + 107: {want: 0x4bc, have: 0x3e2, distance: 0xa, oneway: true}, + 108: {want: 0x4e5, have: 0x15e, distance: 0xa, oneway: true}, + 109: {want: 0x4f2, have: 0x139, distance: 0xa, oneway: true}, + 110: {want: 0x512, have: 0x139, distance: 0xa, oneway: true}, + 111: {want: 0x518, have: 0x139, distance: 0xa, oneway: true}, + 112: {want: 0x52f, have: 0x139, distance: 0xa, oneway: true}, +} // Size: 702 bytes + +// matchScript holds pairs of scriptIDs where readers of one script +// can typically also read the other. Each is associated with a confidence. +var matchScript = []scriptIntelligibility{ // 26 elements + 0: {wantLang: 0x432, haveLang: 0x432, wantScript: 0x5b, haveScript: 0x20, distance: 0x5}, + 1: {wantLang: 0x432, haveLang: 0x432, wantScript: 0x20, haveScript: 0x5b, distance: 0x5}, + 2: {wantLang: 0x58, haveLang: 0x3e2, wantScript: 0x5b, haveScript: 0x20, distance: 0xa}, + 3: {wantLang: 0xa5, haveLang: 0x139, wantScript: 0xe, haveScript: 0x5b, distance: 0xa}, + 4: {wantLang: 0x1d7, haveLang: 0x3e2, wantScript: 0x8, haveScript: 0x20, distance: 0xa}, + 5: {wantLang: 0x210, haveLang: 0x139, wantScript: 0x2e, haveScript: 0x5b, distance: 0xa}, + 6: {wantLang: 0x24a, haveLang: 0x139, wantScript: 0x4f, haveScript: 0x5b, distance: 0xa}, + 7: {wantLang: 0x251, haveLang: 0x139, wantScript: 0x53, haveScript: 0x5b, distance: 0xa}, + 8: {wantLang: 0x2b8, haveLang: 0x139, wantScript: 0x58, haveScript: 0x5b, distance: 0xa}, + 9: {wantLang: 0x304, haveLang: 0x139, wantScript: 0x6f, haveScript: 0x5b, distance: 0xa}, + 10: {wantLang: 0x331, haveLang: 0x139, wantScript: 0x76, haveScript: 0x5b, distance: 0xa}, + 11: {wantLang: 0x351, haveLang: 0x139, wantScript: 0x22, haveScript: 0x5b, distance: 0xa}, + 12: {wantLang: 0x395, haveLang: 0x139, wantScript: 0x83, haveScript: 0x5b, distance: 0xa}, + 13: {wantLang: 0x39d, haveLang: 0x139, wantScript: 0x36, haveScript: 0x5b, distance: 0xa}, + 14: {wantLang: 0x3be, haveLang: 0x139, wantScript: 0x5, haveScript: 0x5b, distance: 0xa}, + 15: {wantLang: 0x3fa, haveLang: 0x139, wantScript: 0x5, haveScript: 0x5b, distance: 0xa}, + 16: {wantLang: 0x40c, haveLang: 0x139, wantScript: 0xd6, haveScript: 0x5b, distance: 0xa}, + 17: {wantLang: 0x450, haveLang: 0x139, wantScript: 0xe6, haveScript: 0x5b, distance: 0xa}, + 18: {wantLang: 0x461, haveLang: 0x139, wantScript: 0xe9, haveScript: 0x5b, distance: 0xa}, + 19: {wantLang: 0x46f, haveLang: 0x139, wantScript: 0x2c, haveScript: 0x5b, distance: 0xa}, + 20: {wantLang: 0x476, haveLang: 0x3e2, wantScript: 0x5b, haveScript: 0x20, distance: 0xa}, + 21: {wantLang: 0x4b4, haveLang: 0x139, wantScript: 0x5, haveScript: 0x5b, distance: 0xa}, + 22: {wantLang: 0x4bc, haveLang: 0x3e2, wantScript: 0x5b, haveScript: 0x20, distance: 0xa}, + 23: {wantLang: 0x512, haveLang: 0x139, wantScript: 0x3e, haveScript: 0x5b, distance: 0xa}, + 24: {wantLang: 0x529, haveLang: 0x529, wantScript: 0x3b, haveScript: 0x3c, distance: 0xf}, + 25: {wantLang: 0x529, haveLang: 0x529, wantScript: 0x3c, haveScript: 0x3b, distance: 0x13}, +} // Size: 232 bytes + +var matchRegion = []regionIntelligibility{ // 15 elements + 0: {lang: 0x3a, script: 0x0, group: 0x4, distance: 0x4}, + 1: {lang: 0x3a, script: 0x0, group: 0x84, distance: 0x4}, + 2: {lang: 0x139, script: 0x0, group: 0x1, distance: 0x4}, + 3: {lang: 0x139, script: 0x0, group: 0x81, distance: 0x4}, + 4: {lang: 0x13e, script: 0x0, group: 0x3, distance: 0x4}, + 5: {lang: 0x13e, script: 0x0, group: 0x83, distance: 0x4}, + 6: {lang: 0x3c0, script: 0x0, group: 0x3, distance: 0x4}, + 7: {lang: 0x3c0, script: 0x0, group: 0x83, distance: 0x4}, + 8: {lang: 0x529, script: 0x3c, group: 0x2, distance: 0x4}, + 9: {lang: 0x529, script: 0x3c, group: 0x82, distance: 0x4}, + 10: {lang: 0x3a, script: 0x0, group: 0x80, distance: 0x5}, + 11: {lang: 0x139, script: 0x0, group: 0x80, distance: 0x5}, + 12: {lang: 0x13e, script: 0x0, group: 0x80, distance: 0x5}, + 13: {lang: 0x3c0, script: 0x0, group: 0x80, distance: 0x5}, + 14: {lang: 0x529, script: 0x3c, group: 0x80, distance: 0x5}, +} // Size: 114 bytes + +// Total table size 1473 bytes (1KiB); checksum: 7BB90B5C diff --git a/vendor/golang.org/x/text/language/tags.go b/vendor/golang.org/x/text/language/tags.go new file mode 100644 index 0000000000..42ea792666 --- /dev/null +++ b/vendor/golang.org/x/text/language/tags.go @@ -0,0 +1,145 @@ +// 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 language + +import "golang.org/x/text/internal/language/compact" + +// TODO: Various sets of commonly use tags and regions. + +// MustParse is like Parse, but panics if the given BCP 47 tag cannot be parsed. +// It simplifies safe initialization of Tag values. +func MustParse(s string) Tag { + t, err := Parse(s) + if err != nil { + panic(err) + } + return t +} + +// MustParse is like Parse, but panics if the given BCP 47 tag cannot be parsed. +// It simplifies safe initialization of Tag values. +func (c CanonType) MustParse(s string) Tag { + t, err := c.Parse(s) + if err != nil { + panic(err) + } + return t +} + +// MustParseBase is like ParseBase, but panics if the given base cannot be parsed. +// It simplifies safe initialization of Base values. +func MustParseBase(s string) Base { + b, err := ParseBase(s) + if err != nil { + panic(err) + } + return b +} + +// MustParseScript is like ParseScript, but panics if the given script cannot be +// parsed. It simplifies safe initialization of Script values. +func MustParseScript(s string) Script { + scr, err := ParseScript(s) + if err != nil { + panic(err) + } + return scr +} + +// MustParseRegion is like ParseRegion, but panics if the given region cannot be +// parsed. It simplifies safe initialization of Region values. +func MustParseRegion(s string) Region { + r, err := ParseRegion(s) + if err != nil { + panic(err) + } + return r +} + +var ( + und = Tag{} + + Und Tag = Tag{} + + Afrikaans Tag = Tag(compact.Afrikaans) + Amharic Tag = Tag(compact.Amharic) + Arabic Tag = Tag(compact.Arabic) + ModernStandardArabic Tag = Tag(compact.ModernStandardArabic) + Azerbaijani Tag = Tag(compact.Azerbaijani) + Bulgarian Tag = Tag(compact.Bulgarian) + Bengali Tag = Tag(compact.Bengali) + Catalan Tag = Tag(compact.Catalan) + Czech Tag = Tag(compact.Czech) + Danish Tag = Tag(compact.Danish) + German Tag = Tag(compact.German) + Greek Tag = Tag(compact.Greek) + English Tag = Tag(compact.English) + AmericanEnglish Tag = Tag(compact.AmericanEnglish) + BritishEnglish Tag = Tag(compact.BritishEnglish) + Spanish Tag = Tag(compact.Spanish) + EuropeanSpanish Tag = Tag(compact.EuropeanSpanish) + LatinAmericanSpanish Tag = Tag(compact.LatinAmericanSpanish) + Estonian Tag = Tag(compact.Estonian) + Persian Tag = Tag(compact.Persian) + Finnish Tag = Tag(compact.Finnish) + Filipino Tag = Tag(compact.Filipino) + French Tag = Tag(compact.French) + CanadianFrench Tag = Tag(compact.CanadianFrench) + Gujarati Tag = Tag(compact.Gujarati) + Hebrew Tag = Tag(compact.Hebrew) + Hindi Tag = Tag(compact.Hindi) + Croatian Tag = Tag(compact.Croatian) + Hungarian Tag = Tag(compact.Hungarian) + Armenian Tag = Tag(compact.Armenian) + Indonesian Tag = Tag(compact.Indonesian) + Icelandic Tag = Tag(compact.Icelandic) + Italian Tag = Tag(compact.Italian) + Japanese Tag = Tag(compact.Japanese) + Georgian Tag = Tag(compact.Georgian) + Kazakh Tag = Tag(compact.Kazakh) + Khmer Tag = Tag(compact.Khmer) + Kannada Tag = Tag(compact.Kannada) + Korean Tag = Tag(compact.Korean) + Kirghiz Tag = Tag(compact.Kirghiz) + Lao Tag = Tag(compact.Lao) + Lithuanian Tag = Tag(compact.Lithuanian) + Latvian Tag = Tag(compact.Latvian) + Macedonian Tag = Tag(compact.Macedonian) + Malayalam Tag = Tag(compact.Malayalam) + Mongolian Tag = Tag(compact.Mongolian) + Marathi Tag = Tag(compact.Marathi) + Malay Tag = Tag(compact.Malay) + Burmese Tag = Tag(compact.Burmese) + Nepali Tag = Tag(compact.Nepali) + Dutch Tag = Tag(compact.Dutch) + Norwegian Tag = Tag(compact.Norwegian) + Punjabi Tag = Tag(compact.Punjabi) + Polish Tag = Tag(compact.Polish) + Portuguese Tag = Tag(compact.Portuguese) + BrazilianPortuguese Tag = Tag(compact.BrazilianPortuguese) + EuropeanPortuguese Tag = Tag(compact.EuropeanPortuguese) + Romanian Tag = Tag(compact.Romanian) + Russian Tag = Tag(compact.Russian) + Sinhala Tag = Tag(compact.Sinhala) + Slovak Tag = Tag(compact.Slovak) + Slovenian Tag = Tag(compact.Slovenian) + Albanian Tag = Tag(compact.Albanian) + Serbian Tag = Tag(compact.Serbian) + SerbianLatin Tag = Tag(compact.SerbianLatin) + Swedish Tag = Tag(compact.Swedish) + Swahili Tag = Tag(compact.Swahili) + Tamil Tag = Tag(compact.Tamil) + Telugu Tag = Tag(compact.Telugu) + Thai Tag = Tag(compact.Thai) + Turkish Tag = Tag(compact.Turkish) + Ukrainian Tag = Tag(compact.Ukrainian) + Urdu Tag = Tag(compact.Urdu) + Uzbek Tag = Tag(compact.Uzbek) + Vietnamese Tag = Tag(compact.Vietnamese) + Chinese Tag = Tag(compact.Chinese) + SimplifiedChinese Tag = Tag(compact.SimplifiedChinese) + TraditionalChinese Tag = Tag(compact.TraditionalChinese) + Zulu Tag = Tag(compact.Zulu) +) diff --git a/vendor/golang.org/x/tools/LICENSE b/vendor/golang.org/x/tools/LICENSE new file mode 100644 index 0000000000..2a7cf70da6 --- /dev/null +++ b/vendor/golang.org/x/tools/LICENSE @@ -0,0 +1,27 @@ +Copyright 2009 The Go Authors. + +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 LLC 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/golang.org/x/tools/PATENTS b/vendor/golang.org/x/tools/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/golang.org/x/tools/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google 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, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go b/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go new file mode 100644 index 0000000000..6e34df4613 --- /dev/null +++ b/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go @@ -0,0 +1,654 @@ +// 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 astutil + +// This file defines utilities for working with source positions. + +import ( + "fmt" + "go/ast" + "go/token" + "sort" +) + +// PathEnclosingInterval returns the node that encloses the source +// interval [start, end), and all its ancestors up to the AST root. +// +// The definition of "enclosing" used by this function considers +// additional whitespace abutting a node to be enclosed by it. +// In this example: +// +// z := x + y // add them +// <-A-> +// <----B-----> +// +// the ast.BinaryExpr(+) node is considered to enclose interval B +// even though its [Pos()..End()) is actually only interval A. +// This behaviour makes user interfaces more tolerant of imperfect +// input. +// +// This function treats tokens as nodes, though they are not included +// in the result. e.g. PathEnclosingInterval("+") returns the +// enclosing ast.BinaryExpr("x + y"). +// +// If start==end, the 1-char interval following start is used instead. +// +// The 'exact' result is true if the interval contains only path[0] +// and perhaps some adjacent whitespace. It is false if the interval +// overlaps multiple children of path[0], or if it contains only +// interior whitespace of path[0]. +// In this example: +// +// z := x + y // add them +// <--C--> <---E--> +// ^ +// D +// +// intervals C, D and E are inexact. C is contained by the +// z-assignment statement, because it spans three of its children (:=, +// x, +). So too is the 1-char interval D, because it contains only +// interior whitespace of the assignment. E is considered interior +// whitespace of the BlockStmt containing the assignment. +// +// The resulting path is never empty; it always contains at least the +// 'root' *ast.File. Ideally PathEnclosingInterval would reject +// intervals that lie wholly or partially outside the range of the +// file, but unfortunately ast.File records only the token.Pos of +// the 'package' keyword, but not of the start of the file itself. +func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) { + // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging + + // Precondition: node.[Pos..End) and adjoining whitespace contain [start, end). + var visit func(node ast.Node) bool + visit = func(node ast.Node) bool { + path = append(path, node) + + nodePos := node.Pos() + nodeEnd := node.End() + + // fmt.Printf("visit(%T, %d, %d)\n", node, nodePos, nodeEnd) // debugging + + // Intersect [start, end) with interval of node. + if start < nodePos { + start = nodePos + } + if end > nodeEnd { + end = nodeEnd + } + + // Find sole child that contains [start, end). + children := childrenOf(node) + l := len(children) + for i, child := range children { + // [childPos, childEnd) is unaugmented interval of child. + childPos := child.Pos() + childEnd := child.End() + + // [augPos, augEnd) is whitespace-augmented interval of child. + augPos := childPos + augEnd := childEnd + if i > 0 { + augPos = children[i-1].End() // start of preceding whitespace + } + if i < l-1 { + nextChildPos := children[i+1].Pos() + // Does [start, end) lie between child and next child? + if start >= augEnd && end <= nextChildPos { + return false // inexact match + } + augEnd = nextChildPos // end of following whitespace + } + + // fmt.Printf("\tchild %d: [%d..%d)\tcontains interval [%d..%d)?\n", + // i, augPos, augEnd, start, end) // debugging + + // Does augmented child strictly contain [start, end)? + if augPos <= start && end <= augEnd { + if is[tokenNode](child) { + return true + } + + // childrenOf elides the FuncType node beneath FuncDecl. + // Add it back here for TypeParams, Params, Results, + // all FieldLists). But we don't add it back for the "func" token + // even though it is is the tree at FuncDecl.Type.Func. + if decl, ok := node.(*ast.FuncDecl); ok { + if fields, ok := child.(*ast.FieldList); ok && fields != decl.Recv { + path = append(path, decl.Type) + } + } + + return visit(child) + } + + // Does [start, end) overlap multiple children? + // i.e. left-augmented child contains start + // but LR-augmented child does not contain end. + if start < childEnd && end > augEnd { + break + } + } + + // No single child contained [start, end), + // so node is the result. Is it exact? + + // (It's tempting to put this condition before the + // child loop, but it gives the wrong result in the + // case where a node (e.g. ExprStmt) and its sole + // child have equal intervals.) + if start == nodePos && end == nodeEnd { + return true // exact match + } + + return false // inexact: overlaps multiple children + } + + // Ensure [start,end) is nondecreasing. + if start > end { + start, end = end, start + } + + if start < root.End() && end > root.Pos() { + if start == end { + end = start + 1 // empty interval => interval of size 1 + } + exact = visit(root) + + // Reverse the path: + for i, l := 0, len(path); i < l/2; i++ { + path[i], path[l-1-i] = path[l-1-i], path[i] + } + } else { + // Selection lies within whitespace preceding the + // first (or following the last) declaration in the file. + // The result nonetheless always includes the ast.File. + path = append(path, root) + } + + return +} + +// tokenNode is a dummy implementation of ast.Node for a single token. +// They are used transiently by PathEnclosingInterval but never escape +// this package. +type tokenNode struct { + pos token.Pos + end token.Pos +} + +func (n tokenNode) Pos() token.Pos { + return n.pos +} + +func (n tokenNode) End() token.Pos { + return n.end +} + +func tok(pos token.Pos, len int) ast.Node { + return tokenNode{pos, pos + token.Pos(len)} +} + +// childrenOf returns the direct non-nil children of ast.Node n. +// It may include fake ast.Node implementations for bare tokens. +// it is not safe to call (e.g.) ast.Walk on such nodes. +func childrenOf(n ast.Node) []ast.Node { + var children []ast.Node + + // First add nodes for all true subtrees. + ast.Inspect(n, func(node ast.Node) bool { + if node == n { // push n + return true // recur + } + if node != nil { // push child + children = append(children, node) + } + return false // no recursion + }) + + // Then add fake Nodes for bare tokens. + switch n := n.(type) { + case *ast.ArrayType: + children = append(children, + tok(n.Lbrack, len("[")), + tok(n.Elt.End(), len("]"))) + + case *ast.AssignStmt: + children = append(children, + tok(n.TokPos, len(n.Tok.String()))) + + case *ast.BasicLit: + children = append(children, + tok(n.ValuePos, len(n.Value))) + + case *ast.BinaryExpr: + children = append(children, tok(n.OpPos, len(n.Op.String()))) + + case *ast.BlockStmt: + children = append(children, + tok(n.Lbrace, len("{")), + tok(n.Rbrace, len("}"))) + + case *ast.BranchStmt: + children = append(children, + tok(n.TokPos, len(n.Tok.String()))) + + case *ast.CallExpr: + children = append(children, + tok(n.Lparen, len("(")), + tok(n.Rparen, len(")"))) + if n.Ellipsis != 0 { + children = append(children, tok(n.Ellipsis, len("..."))) + } + + case *ast.CaseClause: + if n.List == nil { + children = append(children, + tok(n.Case, len("default"))) + } else { + children = append(children, + tok(n.Case, len("case"))) + } + children = append(children, tok(n.Colon, len(":"))) + + case *ast.ChanType: + switch n.Dir { + case ast.RECV: + children = append(children, tok(n.Begin, len("<-chan"))) + case ast.SEND: + children = append(children, tok(n.Begin, len("chan<-"))) + case ast.RECV | ast.SEND: + children = append(children, tok(n.Begin, len("chan"))) + } + + case *ast.CommClause: + if n.Comm == nil { + children = append(children, + tok(n.Case, len("default"))) + } else { + children = append(children, + tok(n.Case, len("case"))) + } + children = append(children, tok(n.Colon, len(":"))) + + case *ast.Comment: + // nop + + case *ast.CommentGroup: + // nop + + case *ast.CompositeLit: + children = append(children, + tok(n.Lbrace, len("{")), + tok(n.Rbrace, len("{"))) + + case *ast.DeclStmt: + // nop + + case *ast.DeferStmt: + children = append(children, + tok(n.Defer, len("defer"))) + + case *ast.Ellipsis: + children = append(children, + tok(n.Ellipsis, len("..."))) + + case *ast.EmptyStmt: + // nop + + case *ast.ExprStmt: + // nop + + case *ast.Field: + // TODO(adonovan): Field.{Doc,Comment,Tag}? + + case *ast.FieldList: + children = append(children, + tok(n.Opening, len("(")), // or len("[") + tok(n.Closing, len(")"))) // or len("]") + + case *ast.File: + // TODO test: Doc + children = append(children, + tok(n.Package, len("package"))) + + case *ast.ForStmt: + children = append(children, + tok(n.For, len("for"))) + + case *ast.FuncDecl: + // TODO(adonovan): FuncDecl.Comment? + + // Uniquely, FuncDecl breaks the invariant that + // preorder traversal yields tokens in lexical order: + // in fact, FuncDecl.Recv precedes FuncDecl.Type.Func. + // + // As a workaround, we inline the case for FuncType + // here and order things correctly. + // We also need to insert the elided FuncType just + // before the 'visit' recursion. + // + children = nil // discard ast.Walk(FuncDecl) info subtrees + children = append(children, tok(n.Type.Func, len("func"))) + if n.Recv != nil { + children = append(children, n.Recv) + } + children = append(children, n.Name) + if tparams := n.Type.TypeParams; tparams != nil { + children = append(children, tparams) + } + if n.Type.Params != nil { + children = append(children, n.Type.Params) + } + if n.Type.Results != nil { + children = append(children, n.Type.Results) + } + if n.Body != nil { + children = append(children, n.Body) + } + + case *ast.FuncLit: + // nop + + case *ast.FuncType: + if n.Func != 0 { + children = append(children, + tok(n.Func, len("func"))) + } + + case *ast.GenDecl: + children = append(children, + tok(n.TokPos, len(n.Tok.String()))) + if n.Lparen != 0 { + children = append(children, + tok(n.Lparen, len("(")), + tok(n.Rparen, len(")"))) + } + + case *ast.GoStmt: + children = append(children, + tok(n.Go, len("go"))) + + case *ast.Ident: + children = append(children, + tok(n.NamePos, len(n.Name))) + + case *ast.IfStmt: + children = append(children, + tok(n.If, len("if"))) + + case *ast.ImportSpec: + // TODO(adonovan): ImportSpec.{Doc,EndPos}? + + case *ast.IncDecStmt: + children = append(children, + tok(n.TokPos, len(n.Tok.String()))) + + case *ast.IndexExpr: + children = append(children, + tok(n.Lbrack, len("[")), + tok(n.Rbrack, len("]"))) + + case *ast.IndexListExpr: + children = append(children, + tok(n.Lbrack, len("[")), + tok(n.Rbrack, len("]"))) + + case *ast.InterfaceType: + children = append(children, + tok(n.Interface, len("interface"))) + + case *ast.KeyValueExpr: + children = append(children, + tok(n.Colon, len(":"))) + + case *ast.LabeledStmt: + children = append(children, + tok(n.Colon, len(":"))) + + case *ast.MapType: + children = append(children, + tok(n.Map, len("map"))) + + case *ast.ParenExpr: + children = append(children, + tok(n.Lparen, len("(")), + tok(n.Rparen, len(")"))) + + case *ast.RangeStmt: + children = append(children, + tok(n.For, len("for")), + tok(n.TokPos, len(n.Tok.String()))) + + case *ast.ReturnStmt: + children = append(children, + tok(n.Return, len("return"))) + + case *ast.SelectStmt: + children = append(children, + tok(n.Select, len("select"))) + + case *ast.SelectorExpr: + // nop + + case *ast.SendStmt: + children = append(children, + tok(n.Arrow, len("<-"))) + + case *ast.SliceExpr: + children = append(children, + tok(n.Lbrack, len("[")), + tok(n.Rbrack, len("]"))) + + case *ast.StarExpr: + children = append(children, tok(n.Star, len("*"))) + + case *ast.StructType: + children = append(children, tok(n.Struct, len("struct"))) + + case *ast.SwitchStmt: + children = append(children, tok(n.Switch, len("switch"))) + + case *ast.TypeAssertExpr: + children = append(children, + tok(n.Lparen-1, len(".")), + tok(n.Lparen, len("(")), + tok(n.Rparen, len(")"))) + + case *ast.TypeSpec: + // TODO(adonovan): TypeSpec.{Doc,Comment}? + + case *ast.TypeSwitchStmt: + children = append(children, tok(n.Switch, len("switch"))) + + case *ast.UnaryExpr: + children = append(children, tok(n.OpPos, len(n.Op.String()))) + + case *ast.ValueSpec: + // TODO(adonovan): ValueSpec.{Doc,Comment}? + + case *ast.BadDecl, *ast.BadExpr, *ast.BadStmt: + // nop + } + + // TODO(adonovan): opt: merge the logic of ast.Inspect() into + // the switch above so we can make interleaved callbacks for + // both Nodes and Tokens in the right order and avoid the need + // to sort. + sort.Sort(byPos(children)) + + return children +} + +type byPos []ast.Node + +func (sl byPos) Len() int { + return len(sl) +} +func (sl byPos) Less(i, j int) bool { + return sl[i].Pos() < sl[j].Pos() +} +func (sl byPos) Swap(i, j int) { + sl[i], sl[j] = sl[j], sl[i] +} + +// NodeDescription returns a description of the concrete type of n suitable +// for a user interface. +// +// TODO(adonovan): in some cases (e.g. Field, FieldList, Ident, +// StarExpr) we could be much more specific given the path to the AST +// root. Perhaps we should do that. +func NodeDescription(n ast.Node) string { + switch n := n.(type) { + case *ast.ArrayType: + return "array type" + case *ast.AssignStmt: + return "assignment" + case *ast.BadDecl: + return "bad declaration" + case *ast.BadExpr: + return "bad expression" + case *ast.BadStmt: + return "bad statement" + case *ast.BasicLit: + return "basic literal" + case *ast.BinaryExpr: + return fmt.Sprintf("binary %s operation", n.Op) + case *ast.BlockStmt: + return "block" + case *ast.BranchStmt: + switch n.Tok { + case token.BREAK: + return "break statement" + case token.CONTINUE: + return "continue statement" + case token.GOTO: + return "goto statement" + case token.FALLTHROUGH: + return "fall-through statement" + } + case *ast.CallExpr: + if len(n.Args) == 1 && !n.Ellipsis.IsValid() { + return "function call (or conversion)" + } + return "function call" + case *ast.CaseClause: + return "case clause" + case *ast.ChanType: + return "channel type" + case *ast.CommClause: + return "communication clause" + case *ast.Comment: + return "comment" + case *ast.CommentGroup: + return "comment group" + case *ast.CompositeLit: + return "composite literal" + case *ast.DeclStmt: + return NodeDescription(n.Decl) + " statement" + case *ast.DeferStmt: + return "defer statement" + case *ast.Ellipsis: + return "ellipsis" + case *ast.EmptyStmt: + return "empty statement" + case *ast.ExprStmt: + return "expression statement" + case *ast.Field: + // Can be any of these: + // struct {x, y int} -- struct field(s) + // struct {T} -- anon struct field + // interface {I} -- interface embedding + // interface {f()} -- interface method + // func (A) func(B) C -- receiver, param(s), result(s) + return "field/method/parameter" + case *ast.FieldList: + return "field/method/parameter list" + case *ast.File: + return "source file" + case *ast.ForStmt: + return "for loop" + case *ast.FuncDecl: + return "function declaration" + case *ast.FuncLit: + return "function literal" + case *ast.FuncType: + return "function type" + case *ast.GenDecl: + switch n.Tok { + case token.IMPORT: + return "import declaration" + case token.CONST: + return "constant declaration" + case token.TYPE: + return "type declaration" + case token.VAR: + return "variable declaration" + } + case *ast.GoStmt: + return "go statement" + case *ast.Ident: + return "identifier" + case *ast.IfStmt: + return "if statement" + case *ast.ImportSpec: + return "import specification" + case *ast.IncDecStmt: + if n.Tok == token.INC { + return "increment statement" + } + return "decrement statement" + case *ast.IndexExpr: + return "index expression" + case *ast.IndexListExpr: + return "index list expression" + case *ast.InterfaceType: + return "interface type" + case *ast.KeyValueExpr: + return "key/value association" + case *ast.LabeledStmt: + return "statement label" + case *ast.MapType: + return "map type" + case *ast.Package: + return "package" + case *ast.ParenExpr: + return "parenthesized " + NodeDescription(n.X) + case *ast.RangeStmt: + return "range loop" + case *ast.ReturnStmt: + return "return statement" + case *ast.SelectStmt: + return "select statement" + case *ast.SelectorExpr: + return "selector" + case *ast.SendStmt: + return "channel send" + case *ast.SliceExpr: + return "slice expression" + case *ast.StarExpr: + return "*-operation" // load/store expr or pointer type + case *ast.StructType: + return "struct type" + case *ast.SwitchStmt: + return "switch statement" + case *ast.TypeAssertExpr: + return "type assertion" + case *ast.TypeSpec: + return "type specification" + case *ast.TypeSwitchStmt: + return "type switch" + case *ast.UnaryExpr: + return fmt.Sprintf("unary %s operation", n.Op) + case *ast.ValueSpec: + return "value specification" + + } + panic(fmt.Sprintf("unexpected node type: %T", n)) +} + +func is[T any](x any) bool { + _, ok := x.(T) + return ok +} diff --git a/vendor/golang.org/x/tools/go/ast/astutil/imports.go b/vendor/golang.org/x/tools/go/ast/astutil/imports.go new file mode 100644 index 0000000000..5e5601aa46 --- /dev/null +++ b/vendor/golang.org/x/tools/go/ast/astutil/imports.go @@ -0,0 +1,491 @@ +// 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 astutil contains common utilities for working with the Go AST. +package astutil // import "golang.org/x/tools/go/ast/astutil" + +import ( + "fmt" + "go/ast" + "go/token" + "slices" + "strconv" + "strings" +) + +// AddImport adds the import path to the file f, if absent. +func AddImport(fset *token.FileSet, f *ast.File, path string) (added bool) { + return AddNamedImport(fset, f, "", path) +} + +// AddNamedImport adds the import with the given name and path to the file f, if absent. +// If name is not empty, it is used to rename the import. +// +// For example, calling +// +// AddNamedImport(fset, f, "pathpkg", "path") +// +// adds +// +// import pathpkg "path" +func AddNamedImport(fset *token.FileSet, f *ast.File, name, path string) (added bool) { + if imports(f, name, path) { + return false + } + + newImport := &ast.ImportSpec{ + Path: &ast.BasicLit{ + Kind: token.STRING, + Value: strconv.Quote(path), + }, + } + if name != "" { + newImport.Name = &ast.Ident{Name: name} + } + + // Find an import decl to add to. + // The goal is to find an existing import + // whose import path has the longest shared + // prefix with path. + var ( + bestMatch = -1 // length of longest shared prefix + lastImport = -1 // index in f.Decls of the file's final import decl + impDecl *ast.GenDecl // import decl containing the best match + impIndex = -1 // spec index in impDecl containing the best match + + isThirdPartyPath = isThirdParty(path) + ) + for i, decl := range f.Decls { + gen, ok := decl.(*ast.GenDecl) + if ok && gen.Tok == token.IMPORT { + lastImport = i + // Do not add to import "C", to avoid disrupting the + // association with its doc comment, breaking cgo. + if declImports(gen, "C") { + continue + } + + // Match an empty import decl if that's all that is available. + if len(gen.Specs) == 0 && bestMatch == -1 { + impDecl = gen + } + + // Compute longest shared prefix with imports in this group and find best + // matched import spec. + // 1. Always prefer import spec with longest shared prefix. + // 2. While match length is 0, + // - for stdlib package: prefer first import spec. + // - for third party package: prefer first third party import spec. + // We cannot use last import spec as best match for third party package + // because grouped imports are usually placed last by goimports -local + // flag. + // See issue #19190. + seenAnyThirdParty := false + for j, spec := range gen.Specs { + impspec := spec.(*ast.ImportSpec) + p := importPath(impspec) + n := matchLen(p, path) + if n > bestMatch || (bestMatch == 0 && !seenAnyThirdParty && isThirdPartyPath) { + bestMatch = n + impDecl = gen + impIndex = j + } + seenAnyThirdParty = seenAnyThirdParty || isThirdParty(p) + } + } + } + + // If no import decl found, add one after the last import. + if impDecl == nil { + impDecl = &ast.GenDecl{ + Tok: token.IMPORT, + } + if lastImport >= 0 { + impDecl.TokPos = f.Decls[lastImport].End() + } else { + // There are no existing imports. + // Our new import, preceded by a blank line, goes after the package declaration + // and after the comment, if any, that starts on the same line as the + // package declaration. + impDecl.TokPos = f.Package + + file := fset.File(f.Package) + pkgLine := file.Line(f.Package) + for _, c := range f.Comments { + if file.Line(c.Pos()) > pkgLine { + break + } + // +2 for a blank line + impDecl.TokPos = c.End() + 2 + } + } + f.Decls = append(f.Decls, nil) + copy(f.Decls[lastImport+2:], f.Decls[lastImport+1:]) + f.Decls[lastImport+1] = impDecl + } + + // Insert new import at insertAt. + insertAt := 0 + if impIndex >= 0 { + // insert after the found import + insertAt = impIndex + 1 + } + impDecl.Specs = append(impDecl.Specs, nil) + copy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:]) + impDecl.Specs[insertAt] = newImport + pos := impDecl.Pos() + if insertAt > 0 { + // If there is a comment after an existing import, preserve the comment + // position by adding the new import after the comment. + if spec, ok := impDecl.Specs[insertAt-1].(*ast.ImportSpec); ok && spec.Comment != nil { + pos = spec.Comment.End() + } else { + // Assign same position as the previous import, + // so that the sorter sees it as being in the same block. + pos = impDecl.Specs[insertAt-1].Pos() + } + } + if newImport.Name != nil { + newImport.Name.NamePos = pos + } + newImport.Path.ValuePos = pos + newImport.EndPos = pos + + // Clean up parens. impDecl contains at least one spec. + if len(impDecl.Specs) == 1 { + // Remove unneeded parens. + impDecl.Lparen = token.NoPos + } else if !impDecl.Lparen.IsValid() { + // impDecl needs parens added. + impDecl.Lparen = impDecl.Specs[0].Pos() + } + + f.Imports = append(f.Imports, newImport) + + if len(f.Decls) <= 1 { + return true + } + + // Merge all the import declarations into the first one. + var first *ast.GenDecl + for i := 0; i < len(f.Decls); i++ { + decl := f.Decls[i] + gen, ok := decl.(*ast.GenDecl) + if !ok || gen.Tok != token.IMPORT || declImports(gen, "C") { + continue + } + if first == nil { + first = gen + continue // Don't touch the first one. + } + // We now know there is more than one package in this import + // declaration. Ensure that it ends up parenthesized. + first.Lparen = first.Pos() + // Move the imports of the other import declaration to the first one. + for _, spec := range gen.Specs { + spec.(*ast.ImportSpec).Path.ValuePos = first.Pos() + first.Specs = append(first.Specs, spec) + } + f.Decls = slices.Delete(f.Decls, i, i+1) + i-- + } + + return true +} + +func isThirdParty(importPath string) bool { + // Third party package import path usually contains "." (".com", ".org", ...) + // This logic is taken from golang.org/x/tools/imports package. + return strings.Contains(importPath, ".") +} + +// DeleteImport deletes the import path from the file f, if present. +// If there are duplicate import declarations, all matching ones are deleted. +func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool) { + return DeleteNamedImport(fset, f, "", path) +} + +// DeleteNamedImport deletes the import with the given name and path from the file f, if present. +// If there are duplicate import declarations, all matching ones are deleted. +func DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (deleted bool) { + var delspecs []*ast.ImportSpec + var delcomments []*ast.CommentGroup + + // Find the import nodes that import path, if any. + for i := 0; i < len(f.Decls); i++ { + decl := f.Decls[i] + gen, ok := decl.(*ast.GenDecl) + if !ok || gen.Tok != token.IMPORT { + continue + } + for j := 0; j < len(gen.Specs); j++ { + spec := gen.Specs[j] + impspec := spec.(*ast.ImportSpec) + if importName(impspec) != name || importPath(impspec) != path { + continue + } + + // We found an import spec that imports path. + // Delete it. + delspecs = append(delspecs, impspec) + deleted = true + copy(gen.Specs[j:], gen.Specs[j+1:]) + gen.Specs = gen.Specs[:len(gen.Specs)-1] + + // If this was the last import spec in this decl, + // delete the decl, too. + if len(gen.Specs) == 0 { + copy(f.Decls[i:], f.Decls[i+1:]) + f.Decls = f.Decls[:len(f.Decls)-1] + i-- + break + } else if len(gen.Specs) == 1 { + if impspec.Doc != nil { + delcomments = append(delcomments, impspec.Doc) + } + if impspec.Comment != nil { + delcomments = append(delcomments, impspec.Comment) + } + for _, cg := range f.Comments { + // Found comment on the same line as the import spec. + if cg.End() < impspec.Pos() && fset.Position(cg.End()).Line == fset.Position(impspec.Pos()).Line { + delcomments = append(delcomments, cg) + break + } + } + + spec := gen.Specs[0].(*ast.ImportSpec) + + // Move the documentation right after the import decl. + if spec.Doc != nil { + for fset.Position(gen.TokPos).Line+1 < fset.Position(spec.Doc.Pos()).Line { + fset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line) + } + } + for _, cg := range f.Comments { + if cg.End() < spec.Pos() && fset.Position(cg.End()).Line == fset.Position(spec.Pos()).Line { + for fset.Position(gen.TokPos).Line+1 < fset.Position(spec.Pos()).Line { + fset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line) + } + break + } + } + } + if j > 0 { + lastImpspec := gen.Specs[j-1].(*ast.ImportSpec) + lastLine := fset.PositionFor(lastImpspec.Path.ValuePos, false).Line + line := fset.PositionFor(impspec.Path.ValuePos, false).Line + + // We deleted an entry but now there may be + // a blank line-sized hole where the import was. + if line-lastLine > 1 || !gen.Rparen.IsValid() { + // There was a blank line immediately preceding the deleted import, + // so there's no need to close the hole. The right parenthesis is + // invalid after AddImport to an import statement without parenthesis. + // Do nothing. + } else if line != fset.File(gen.Rparen).LineCount() { + // There was no blank line. Close the hole. + fset.File(gen.Rparen).MergeLine(line) + } + } + j-- + } + } + + // Delete imports from f.Imports. + for i := 0; i < len(f.Imports); i++ { + imp := f.Imports[i] + for j, del := range delspecs { + if imp == del { + copy(f.Imports[i:], f.Imports[i+1:]) + f.Imports = f.Imports[:len(f.Imports)-1] + copy(delspecs[j:], delspecs[j+1:]) + delspecs = delspecs[:len(delspecs)-1] + i-- + break + } + } + } + + // Delete comments from f.Comments. + for i := 0; i < len(f.Comments); i++ { + cg := f.Comments[i] + for j, del := range delcomments { + if cg == del { + copy(f.Comments[i:], f.Comments[i+1:]) + f.Comments = f.Comments[:len(f.Comments)-1] + copy(delcomments[j:], delcomments[j+1:]) + delcomments = delcomments[:len(delcomments)-1] + i-- + break + } + } + } + + if len(delspecs) > 0 { + panic(fmt.Sprintf("deleted specs from Decls but not Imports: %v", delspecs)) + } + + return +} + +// RewriteImport rewrites any import of path oldPath to path newPath. +func RewriteImport(fset *token.FileSet, f *ast.File, oldPath, newPath string) (rewrote bool) { + for _, imp := range f.Imports { + if importPath(imp) == oldPath { + rewrote = true + // record old End, because the default is to compute + // it using the length of imp.Path.Value. + imp.EndPos = imp.End() + imp.Path.Value = strconv.Quote(newPath) + } + } + return +} + +// UsesImport reports whether a given import is used. +// The provided File must have been parsed with syntactic object resolution +// (not using go/parser.SkipObjectResolution). +func UsesImport(f *ast.File, path string) (used bool) { + if f.Scope == nil { + panic("file f was not parsed with syntactic object resolution") + } + spec := importSpec(f, path) + if spec == nil { + return + } + + name := spec.Name.String() + switch name { + case "": + // If the package name is not explicitly specified, + // make an educated guess. This is not guaranteed to be correct. + lastSlash := strings.LastIndex(path, "/") + if lastSlash == -1 { + name = path + } else { + name = path[lastSlash+1:] + } + case "_", ".": + // Not sure if this import is used - err on the side of caution. + return true + } + + ast.Walk(visitFn(func(n ast.Node) { + sel, ok := n.(*ast.SelectorExpr) + if ok && isTopName(sel.X, name) { + used = true + } + }), f) + + return +} + +type visitFn func(node ast.Node) + +func (fn visitFn) Visit(node ast.Node) ast.Visitor { + fn(node) + return fn +} + +// imports reports whether f has an import with the specified name and path. +func imports(f *ast.File, name, path string) bool { + for _, s := range f.Imports { + if importName(s) == name && importPath(s) == path { + return true + } + } + return false +} + +// importSpec returns the import spec if f imports path, +// or nil otherwise. +func importSpec(f *ast.File, path string) *ast.ImportSpec { + for _, s := range f.Imports { + if importPath(s) == path { + return s + } + } + return nil +} + +// importName returns the name of s, +// or "" if the import is not named. +func importName(s *ast.ImportSpec) string { + if s.Name == nil { + return "" + } + return s.Name.Name +} + +// importPath returns the unquoted import path of s, +// or "" if the path is not properly quoted. +func importPath(s *ast.ImportSpec) string { + t, err := strconv.Unquote(s.Path.Value) + if err != nil { + return "" + } + return t +} + +// declImports reports whether gen contains an import of path. +func declImports(gen *ast.GenDecl, path string) bool { + if gen.Tok != token.IMPORT { + return false + } + for _, spec := range gen.Specs { + impspec := spec.(*ast.ImportSpec) + if importPath(impspec) == path { + return true + } + } + return false +} + +// matchLen returns the length of the longest path segment prefix shared by x and y. +func matchLen(x, y string) int { + n := 0 + for i := 0; i < len(x) && i < len(y) && x[i] == y[i]; i++ { + if x[i] == '/' { + n++ + } + } + return n +} + +// isTopName returns true if n is a top-level unresolved identifier with the given name. +func isTopName(n ast.Expr, name string) bool { + id, ok := n.(*ast.Ident) + return ok && id.Name == name && id.Obj == nil +} + +// Imports returns the file imports grouped by paragraph. +func Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec { + var groups [][]*ast.ImportSpec + + for _, decl := range f.Decls { + genDecl, ok := decl.(*ast.GenDecl) + if !ok || genDecl.Tok != token.IMPORT { + break + } + + group := []*ast.ImportSpec{} + + var lastLine int + for _, spec := range genDecl.Specs { + importSpec := spec.(*ast.ImportSpec) + pos := importSpec.Path.ValuePos + line := fset.Position(pos).Line + if lastLine > 0 && pos > 0 && line-lastLine > 1 { + groups = append(groups, group) + group = []*ast.ImportSpec{} + } + group = append(group, importSpec) + lastLine = line + } + groups = append(groups, group) + } + + return groups +} diff --git a/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go b/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go new file mode 100644 index 0000000000..5c8dbbb7a3 --- /dev/null +++ b/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go @@ -0,0 +1,486 @@ +// Copyright 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. + +package astutil + +import ( + "fmt" + "go/ast" + "reflect" + "sort" +) + +// An ApplyFunc is invoked by Apply for each node n, even if n is nil, +// before and/or after the node's children, using a Cursor describing +// the current node and providing operations on it. +// +// The return value of ApplyFunc controls the syntax tree traversal. +// See Apply for details. +type ApplyFunc func(*Cursor) bool + +// Apply traverses a syntax tree recursively, starting with root, +// and calling pre and post for each node as described below. +// Apply returns the syntax tree, possibly modified. +// +// If pre is not nil, it is called for each node before the node's +// children are traversed (pre-order). If pre returns false, no +// children are traversed, and post is not called for that node. +// +// If post is not nil, and a prior call of pre didn't return false, +// post is called for each node after its children are traversed +// (post-order). If post returns false, traversal is terminated and +// Apply returns immediately. +// +// Only fields that refer to AST nodes are considered children; +// i.e., token.Pos, Scopes, Objects, and fields of basic types +// (strings, etc.) are ignored. +// +// Children are traversed in the order in which they appear in the +// respective node's struct definition. A package's files are +// traversed in the filenames' alphabetical order. +func Apply(root ast.Node, pre, post ApplyFunc) (result ast.Node) { + parent := &struct{ ast.Node }{root} + defer func() { + if r := recover(); r != nil && r != abort { + panic(r) + } + result = parent.Node + }() + a := &application{pre: pre, post: post} + a.apply(parent, "Node", nil, root) + return +} + +var abort = new(int) // singleton, to signal termination of Apply + +// A Cursor describes a node encountered during Apply. +// Information about the node and its parent is available +// from the Node, Parent, Name, and Index methods. +// +// If p is a variable of type and value of the current parent node +// c.Parent(), and f is the field identifier with name c.Name(), +// the following invariants hold: +// +// p.f == c.Node() if c.Index() < 0 +// p.f[c.Index()] == c.Node() if c.Index() >= 0 +// +// The methods Replace, Delete, InsertBefore, and InsertAfter +// can be used to change the AST without disrupting Apply. +type Cursor struct { + parent ast.Node + name string + iter *iterator // valid if non-nil + node ast.Node +} + +// Node returns the current Node. +func (c *Cursor) Node() ast.Node { return c.node } + +// Parent returns the parent of the current Node. +func (c *Cursor) Parent() ast.Node { return c.parent } + +// Name returns the name of the parent Node field that contains the current Node. +// If the parent is a *ast.Package and the current Node is a *ast.File, Name returns +// the filename for the current Node. +func (c *Cursor) Name() string { return c.name } + +// Index reports the index >= 0 of the current Node in the slice of Nodes that +// contains it, or a value < 0 if the current Node is not part of a slice. +// The index of the current node changes if InsertBefore is called while +// processing the current node. +func (c *Cursor) Index() int { + if c.iter != nil { + return c.iter.index + } + return -1 +} + +// field returns the current node's parent field value. +func (c *Cursor) field() reflect.Value { + return reflect.Indirect(reflect.ValueOf(c.parent)).FieldByName(c.name) +} + +// Replace replaces the current Node with n. +// The replacement node is not walked by Apply. +func (c *Cursor) Replace(n ast.Node) { + if _, ok := c.node.(*ast.File); ok { + file, ok := n.(*ast.File) + if !ok { + panic("attempt to replace *ast.File with non-*ast.File") + } + c.parent.(*ast.Package).Files[c.name] = file + return + } + + v := c.field() + if i := c.Index(); i >= 0 { + v = v.Index(i) + } + v.Set(reflect.ValueOf(n)) +} + +// Delete deletes the current Node from its containing slice. +// If the current Node is not part of a slice, Delete panics. +// As a special case, if the current node is a package file, +// Delete removes it from the package's Files map. +func (c *Cursor) Delete() { + if _, ok := c.node.(*ast.File); ok { + delete(c.parent.(*ast.Package).Files, c.name) + return + } + + i := c.Index() + if i < 0 { + panic("Delete node not contained in slice") + } + v := c.field() + l := v.Len() + reflect.Copy(v.Slice(i, l), v.Slice(i+1, l)) + v.Index(l - 1).Set(reflect.Zero(v.Type().Elem())) + v.SetLen(l - 1) + c.iter.step-- +} + +// InsertAfter inserts n after the current Node in its containing slice. +// If the current Node is not part of a slice, InsertAfter panics. +// Apply does not walk n. +func (c *Cursor) InsertAfter(n ast.Node) { + i := c.Index() + if i < 0 { + panic("InsertAfter node not contained in slice") + } + v := c.field() + v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem()))) + l := v.Len() + reflect.Copy(v.Slice(i+2, l), v.Slice(i+1, l)) + v.Index(i + 1).Set(reflect.ValueOf(n)) + c.iter.step++ +} + +// InsertBefore inserts n before the current Node in its containing slice. +// If the current Node is not part of a slice, InsertBefore panics. +// Apply will not walk n. +func (c *Cursor) InsertBefore(n ast.Node) { + i := c.Index() + if i < 0 { + panic("InsertBefore node not contained in slice") + } + v := c.field() + v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem()))) + l := v.Len() + reflect.Copy(v.Slice(i+1, l), v.Slice(i, l)) + v.Index(i).Set(reflect.ValueOf(n)) + c.iter.index++ +} + +// application carries all the shared data so we can pass it around cheaply. +type application struct { + pre, post ApplyFunc + cursor Cursor + iter iterator +} + +func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast.Node) { + // convert typed nil into untyped nil + if v := reflect.ValueOf(n); v.Kind() == reflect.Pointer && v.IsNil() { + n = nil + } + + // avoid heap-allocating a new cursor for each apply call; reuse a.cursor instead + saved := a.cursor + a.cursor.parent = parent + a.cursor.name = name + a.cursor.iter = iter + a.cursor.node = n + + if a.pre != nil && !a.pre(&a.cursor) { + a.cursor = saved + return + } + + // walk children + // (the order of the cases matches the order of the corresponding node types in go/ast) + switch n := n.(type) { + case nil: + // nothing to do + + // Comments and fields + case *ast.Comment: + // nothing to do + + case *ast.CommentGroup: + if n != nil { + a.applyList(n, "List") + } + + case *ast.Field: + a.apply(n, "Doc", nil, n.Doc) + a.applyList(n, "Names") + a.apply(n, "Type", nil, n.Type) + a.apply(n, "Tag", nil, n.Tag) + a.apply(n, "Comment", nil, n.Comment) + + case *ast.FieldList: + a.applyList(n, "List") + + // Expressions + case *ast.BadExpr, *ast.Ident, *ast.BasicLit: + // nothing to do + + case *ast.Ellipsis: + a.apply(n, "Elt", nil, n.Elt) + + case *ast.FuncLit: + a.apply(n, "Type", nil, n.Type) + a.apply(n, "Body", nil, n.Body) + + case *ast.CompositeLit: + a.apply(n, "Type", nil, n.Type) + a.applyList(n, "Elts") + + case *ast.ParenExpr: + a.apply(n, "X", nil, n.X) + + case *ast.SelectorExpr: + a.apply(n, "X", nil, n.X) + a.apply(n, "Sel", nil, n.Sel) + + case *ast.IndexExpr: + a.apply(n, "X", nil, n.X) + a.apply(n, "Index", nil, n.Index) + + case *ast.IndexListExpr: + a.apply(n, "X", nil, n.X) + a.applyList(n, "Indices") + + case *ast.SliceExpr: + a.apply(n, "X", nil, n.X) + a.apply(n, "Low", nil, n.Low) + a.apply(n, "High", nil, n.High) + a.apply(n, "Max", nil, n.Max) + + case *ast.TypeAssertExpr: + a.apply(n, "X", nil, n.X) + a.apply(n, "Type", nil, n.Type) + + case *ast.CallExpr: + a.apply(n, "Fun", nil, n.Fun) + a.applyList(n, "Args") + + case *ast.StarExpr: + a.apply(n, "X", nil, n.X) + + case *ast.UnaryExpr: + a.apply(n, "X", nil, n.X) + + case *ast.BinaryExpr: + a.apply(n, "X", nil, n.X) + a.apply(n, "Y", nil, n.Y) + + case *ast.KeyValueExpr: + a.apply(n, "Key", nil, n.Key) + a.apply(n, "Value", nil, n.Value) + + // Types + case *ast.ArrayType: + a.apply(n, "Len", nil, n.Len) + a.apply(n, "Elt", nil, n.Elt) + + case *ast.StructType: + a.apply(n, "Fields", nil, n.Fields) + + case *ast.FuncType: + if tparams := n.TypeParams; tparams != nil { + a.apply(n, "TypeParams", nil, tparams) + } + a.apply(n, "Params", nil, n.Params) + a.apply(n, "Results", nil, n.Results) + + case *ast.InterfaceType: + a.apply(n, "Methods", nil, n.Methods) + + case *ast.MapType: + a.apply(n, "Key", nil, n.Key) + a.apply(n, "Value", nil, n.Value) + + case *ast.ChanType: + a.apply(n, "Value", nil, n.Value) + + // Statements + case *ast.BadStmt: + // nothing to do + + case *ast.DeclStmt: + a.apply(n, "Decl", nil, n.Decl) + + case *ast.EmptyStmt: + // nothing to do + + case *ast.LabeledStmt: + a.apply(n, "Label", nil, n.Label) + a.apply(n, "Stmt", nil, n.Stmt) + + case *ast.ExprStmt: + a.apply(n, "X", nil, n.X) + + case *ast.SendStmt: + a.apply(n, "Chan", nil, n.Chan) + a.apply(n, "Value", nil, n.Value) + + case *ast.IncDecStmt: + a.apply(n, "X", nil, n.X) + + case *ast.AssignStmt: + a.applyList(n, "Lhs") + a.applyList(n, "Rhs") + + case *ast.GoStmt: + a.apply(n, "Call", nil, n.Call) + + case *ast.DeferStmt: + a.apply(n, "Call", nil, n.Call) + + case *ast.ReturnStmt: + a.applyList(n, "Results") + + case *ast.BranchStmt: + a.apply(n, "Label", nil, n.Label) + + case *ast.BlockStmt: + a.applyList(n, "List") + + case *ast.IfStmt: + a.apply(n, "Init", nil, n.Init) + a.apply(n, "Cond", nil, n.Cond) + a.apply(n, "Body", nil, n.Body) + a.apply(n, "Else", nil, n.Else) + + case *ast.CaseClause: + a.applyList(n, "List") + a.applyList(n, "Body") + + case *ast.SwitchStmt: + a.apply(n, "Init", nil, n.Init) + a.apply(n, "Tag", nil, n.Tag) + a.apply(n, "Body", nil, n.Body) + + case *ast.TypeSwitchStmt: + a.apply(n, "Init", nil, n.Init) + a.apply(n, "Assign", nil, n.Assign) + a.apply(n, "Body", nil, n.Body) + + case *ast.CommClause: + a.apply(n, "Comm", nil, n.Comm) + a.applyList(n, "Body") + + case *ast.SelectStmt: + a.apply(n, "Body", nil, n.Body) + + case *ast.ForStmt: + a.apply(n, "Init", nil, n.Init) + a.apply(n, "Cond", nil, n.Cond) + a.apply(n, "Post", nil, n.Post) + a.apply(n, "Body", nil, n.Body) + + case *ast.RangeStmt: + a.apply(n, "Key", nil, n.Key) + a.apply(n, "Value", nil, n.Value) + a.apply(n, "X", nil, n.X) + a.apply(n, "Body", nil, n.Body) + + // Declarations + case *ast.ImportSpec: + a.apply(n, "Doc", nil, n.Doc) + a.apply(n, "Name", nil, n.Name) + a.apply(n, "Path", nil, n.Path) + a.apply(n, "Comment", nil, n.Comment) + + case *ast.ValueSpec: + a.apply(n, "Doc", nil, n.Doc) + a.applyList(n, "Names") + a.apply(n, "Type", nil, n.Type) + a.applyList(n, "Values") + a.apply(n, "Comment", nil, n.Comment) + + case *ast.TypeSpec: + a.apply(n, "Doc", nil, n.Doc) + a.apply(n, "Name", nil, n.Name) + if tparams := n.TypeParams; tparams != nil { + a.apply(n, "TypeParams", nil, tparams) + } + a.apply(n, "Type", nil, n.Type) + a.apply(n, "Comment", nil, n.Comment) + + case *ast.BadDecl: + // nothing to do + + case *ast.GenDecl: + a.apply(n, "Doc", nil, n.Doc) + a.applyList(n, "Specs") + + case *ast.FuncDecl: + a.apply(n, "Doc", nil, n.Doc) + a.apply(n, "Recv", nil, n.Recv) + a.apply(n, "Name", nil, n.Name) + a.apply(n, "Type", nil, n.Type) + a.apply(n, "Body", nil, n.Body) + + // Files and packages + case *ast.File: + a.apply(n, "Doc", nil, n.Doc) + a.apply(n, "Name", nil, n.Name) + a.applyList(n, "Decls") + // Don't walk n.Comments; they have either been walked already if + // they are Doc comments, or they can be easily walked explicitly. + + case *ast.Package: + // collect and sort names for reproducible behavior + var names []string + for name := range n.Files { + names = append(names, name) + } + sort.Strings(names) + for _, name := range names { + a.apply(n, name, nil, n.Files[name]) + } + + default: + panic(fmt.Sprintf("Apply: unexpected node type %T", n)) + } + + if a.post != nil && !a.post(&a.cursor) { + panic(abort) + } + + a.cursor = saved +} + +// An iterator controls iteration over a slice of nodes. +type iterator struct { + index, step int +} + +func (a *application) applyList(parent ast.Node, name string) { + // avoid heap-allocating a new iterator for each applyList call; reuse a.iter instead + saved := a.iter + a.iter.index = 0 + for { + // must reload parent.name each time, since cursor modifications might change it + v := reflect.Indirect(reflect.ValueOf(parent)).FieldByName(name) + if a.iter.index >= v.Len() { + break + } + + // element x may be nil in a bad AST - be cautious + var x ast.Node + if e := v.Index(a.iter.index); e.IsValid() { + x = e.Interface().(ast.Node) + } + + a.iter.step = 1 + a.apply(parent, name, &a.iter, x) + a.iter.index += a.iter.step + } + a.iter = saved +} diff --git a/vendor/golang.org/x/tools/go/ast/astutil/util.go b/vendor/golang.org/x/tools/go/ast/astutil/util.go new file mode 100644 index 0000000000..c820b20849 --- /dev/null +++ b/vendor/golang.org/x/tools/go/ast/astutil/util.go @@ -0,0 +1,13 @@ +// Copyright 2015 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 astutil + +import "go/ast" + +// Unparen returns e with any enclosing parentheses stripped. +// Deprecated: use [ast.Unparen]. +// +//go:fix inline +func Unparen(e ast.Expr) ast.Expr { return ast.Unparen(e) } diff --git a/vendor/golang.org/x/tools/imports/forward.go b/vendor/golang.org/x/tools/imports/forward.go new file mode 100644 index 0000000000..cb6db8893f --- /dev/null +++ b/vendor/golang.org/x/tools/imports/forward.go @@ -0,0 +1,77 @@ +// Copyright 2019 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 imports implements a Go pretty-printer (like package "go/format") +// that also adds or removes import statements as necessary. +package imports // import "golang.org/x/tools/imports" + +import ( + "log" + "os" + + "golang.org/x/tools/internal/gocommand" + intimp "golang.org/x/tools/internal/imports" +) + +// Options specifies options for processing files. +type Options struct { + Fragment bool // Accept fragment of a source file (no package statement) + AllErrors bool // Report all errors (not just the first 10 on different lines) + + Comments bool // Print comments (true if nil *Options provided) + TabIndent bool // Use tabs for indent (true if nil *Options provided) + TabWidth int // Tab width (8 if nil *Options provided) + + FormatOnly bool // Disable the insertion and deletion of imports +} + +// Debug controls verbose logging. +var Debug = false + +// LocalPrefix is a comma-separated string of import path prefixes, which, if +// set, instructs Process to sort the import paths with the given prefixes +// into another group after 3rd-party packages. +var LocalPrefix string + +// Process formats and adjusts imports for the provided file. +// If opt is nil the defaults are used, and if src is nil the source +// is read from the filesystem. +// +// Note that filename's directory influences which imports can be chosen, +// so it is important that filename be accurate. +// To process data “as if” it were in filename, pass the data as a non-nil src. +func Process(filename string, src []byte, opt *Options) ([]byte, error) { + var err error + if src == nil { + src, err = os.ReadFile(filename) + if err != nil { + return nil, err + } + } + if opt == nil { + opt = &Options{Comments: true, TabIndent: true, TabWidth: 8} + } + intopt := &intimp.Options{ + Env: &intimp.ProcessEnv{ + GocmdRunner: &gocommand.Runner{}, + }, + LocalPrefix: LocalPrefix, + AllErrors: opt.AllErrors, + Comments: opt.Comments, + FormatOnly: opt.FormatOnly, + Fragment: opt.Fragment, + TabIndent: opt.TabIndent, + TabWidth: opt.TabWidth, + } + if Debug { + intopt.Env.Logf = log.Printf + } + return intimp.Process(filename, src, intopt) +} + +// VendorlessPath returns the devendorized version of the import path ipath. +// For example, VendorlessPath("foo/bar/vendor/a/b") returns "a/b". +func VendorlessPath(ipath string) string { + return intimp.VendorlessPath(ipath) +} diff --git a/vendor/golang.org/x/tools/internal/event/core/event.go b/vendor/golang.org/x/tools/internal/event/core/event.go new file mode 100644 index 0000000000..a6cf0e64a4 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/event.go @@ -0,0 +1,85 @@ +// Copyright 2019 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 core provides support for event based telemetry. +package core + +import ( + "fmt" + "time" + + "golang.org/x/tools/internal/event/label" +) + +// Event holds the information about an event of note that occurred. +type Event struct { + at time.Time + + // As events are often on the stack, storing the first few labels directly + // in the event can avoid an allocation at all for the very common cases of + // simple events. + // The length needs to be large enough to cope with the majority of events + // but no so large as to cause undue stack pressure. + // A log message with two values will use 3 labels (one for each value and + // one for the message itself). + + static [3]label.Label // inline storage for the first few labels + dynamic []label.Label // dynamically sized storage for remaining labels +} + +// eventLabelMap implements label.Map for a the labels of an Event. +type eventLabelMap struct { + event Event +} + +func (ev Event) At() time.Time { return ev.at } + +func (ev Event) Format(f fmt.State, r rune) { + if !ev.at.IsZero() { + fmt.Fprint(f, ev.at.Format("2006/01/02 15:04:05 ")) + } + for index := 0; ev.Valid(index); index++ { + if l := ev.Label(index); l.Valid() { + fmt.Fprintf(f, "\n\t%v", l) + } + } +} + +func (ev Event) Valid(index int) bool { + return index >= 0 && index < len(ev.static)+len(ev.dynamic) +} + +func (ev Event) Label(index int) label.Label { + if index < len(ev.static) { + return ev.static[index] + } + return ev.dynamic[index-len(ev.static)] +} + +func (ev Event) Find(key label.Key) label.Label { + for _, l := range ev.static { + if l.Key() == key { + return l + } + } + for _, l := range ev.dynamic { + if l.Key() == key { + return l + } + } + return label.Label{} +} + +func MakeEvent(static [3]label.Label, labels []label.Label) Event { + return Event{ + static: static, + dynamic: labels, + } +} + +// CloneEvent event returns a copy of the event with the time adjusted to at. +func CloneEvent(ev Event, at time.Time) Event { + ev.at = at + return ev +} diff --git a/vendor/golang.org/x/tools/internal/event/core/export.go b/vendor/golang.org/x/tools/internal/event/core/export.go new file mode 100644 index 0000000000..05f3a9a579 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/export.go @@ -0,0 +1,70 @@ +// Copyright 2019 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 core + +import ( + "context" + "sync/atomic" + "time" + "unsafe" + + "golang.org/x/tools/internal/event/label" +) + +// Exporter is a function that handles events. +// It may return a modified context and event. +type Exporter func(context.Context, Event, label.Map) context.Context + +var ( + exporter unsafe.Pointer +) + +// SetExporter sets the global exporter function that handles all events. +// The exporter is called synchronously from the event call site, so it should +// return quickly so as not to hold up user code. +func SetExporter(e Exporter) { + p := unsafe.Pointer(&e) + if e == nil { + // &e is always valid, and so p is always valid, but for the early abort + // of ProcessEvent to be efficient it needs to make the nil check on the + // pointer without having to dereference it, so we make the nil function + // also a nil pointer + p = nil + } + atomic.StorePointer(&exporter, p) +} + +// deliver is called to deliver an event to the supplied exporter. +// it will fill in the time. +func deliver(ctx context.Context, exporter Exporter, ev Event) context.Context { + // add the current time to the event + ev.at = time.Now() + // hand the event off to the current exporter + return exporter(ctx, ev, ev) +} + +// Export is called to deliver an event to the global exporter if set. +func Export(ctx context.Context, ev Event) context.Context { + // get the global exporter and abort early if there is not one + exporterPtr := (*Exporter)(atomic.LoadPointer(&exporter)) + if exporterPtr == nil { + return ctx + } + return deliver(ctx, *exporterPtr, ev) +} + +// ExportPair is called to deliver a start event to the supplied exporter. +// It also returns a function that will deliver the end event to the same +// exporter. +// It will fill in the time. +func ExportPair(ctx context.Context, begin, end Event) (context.Context, func()) { + // get the global exporter and abort early if there is not one + exporterPtr := (*Exporter)(atomic.LoadPointer(&exporter)) + if exporterPtr == nil { + return ctx, func() {} + } + ctx = deliver(ctx, *exporterPtr, begin) + return ctx, func() { deliver(ctx, *exporterPtr, end) } +} diff --git a/vendor/golang.org/x/tools/internal/event/core/fast.go b/vendor/golang.org/x/tools/internal/event/core/fast.go new file mode 100644 index 0000000000..06c1d4615e --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/fast.go @@ -0,0 +1,77 @@ +// Copyright 2019 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 core + +import ( + "context" + + "golang.org/x/tools/internal/event/keys" + "golang.org/x/tools/internal/event/label" +) + +// Log1 takes a message and one label delivers a log event to the exporter. +// It is a customized version of Print that is faster and does no allocation. +func Log1(ctx context.Context, message string, t1 label.Label) { + Export(ctx, MakeEvent([3]label.Label{ + keys.Msg.Of(message), + t1, + }, nil)) +} + +// Log2 takes a message and two labels and delivers a log event to the exporter. +// It is a customized version of Print that is faster and does no allocation. +func Log2(ctx context.Context, message string, t1 label.Label, t2 label.Label) { + Export(ctx, MakeEvent([3]label.Label{ + keys.Msg.Of(message), + t1, + t2, + }, nil)) +} + +// Metric1 sends a label event to the exporter with the supplied labels. +func Metric1(ctx context.Context, t1 label.Label) context.Context { + return Export(ctx, MakeEvent([3]label.Label{ + keys.Metric.New(), + t1, + }, nil)) +} + +// Metric2 sends a label event to the exporter with the supplied labels. +func Metric2(ctx context.Context, t1, t2 label.Label) context.Context { + return Export(ctx, MakeEvent([3]label.Label{ + keys.Metric.New(), + t1, + t2, + }, nil)) +} + +// Start1 sends a span start event with the supplied label list to the exporter. +// It also returns a function that will end the span, which should normally be +// deferred. +func Start1(ctx context.Context, name string, t1 label.Label) (context.Context, func()) { + return ExportPair(ctx, + MakeEvent([3]label.Label{ + keys.Start.Of(name), + t1, + }, nil), + MakeEvent([3]label.Label{ + keys.End.New(), + }, nil)) +} + +// Start2 sends a span start event with the supplied label list to the exporter. +// It also returns a function that will end the span, which should normally be +// deferred. +func Start2(ctx context.Context, name string, t1, t2 label.Label) (context.Context, func()) { + return ExportPair(ctx, + MakeEvent([3]label.Label{ + keys.Start.Of(name), + t1, + t2, + }, nil), + MakeEvent([3]label.Label{ + keys.End.New(), + }, nil)) +} diff --git a/vendor/golang.org/x/tools/internal/event/doc.go b/vendor/golang.org/x/tools/internal/event/doc.go new file mode 100644 index 0000000000..5dc6e6babe --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/doc.go @@ -0,0 +1,7 @@ +// Copyright 2019 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 event provides a set of packages that cover the main +// concepts of telemetry in an implementation agnostic way. +package event diff --git a/vendor/golang.org/x/tools/internal/event/event.go b/vendor/golang.org/x/tools/internal/event/event.go new file mode 100644 index 0000000000..4d55e577d1 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/event.go @@ -0,0 +1,127 @@ +// Copyright 2019 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 event + +import ( + "context" + + "golang.org/x/tools/internal/event/core" + "golang.org/x/tools/internal/event/keys" + "golang.org/x/tools/internal/event/label" +) + +// Exporter is a function that handles events. +// It may return a modified context and event. +type Exporter func(context.Context, core.Event, label.Map) context.Context + +// SetExporter sets the global exporter function that handles all events. +// The exporter is called synchronously from the event call site, so it should +// return quickly so as not to hold up user code. +func SetExporter(e Exporter) { + core.SetExporter(core.Exporter(e)) +} + +// Log takes a message and a label list and combines them into a single event +// before delivering them to the exporter. +func Log(ctx context.Context, message string, labels ...label.Label) { + core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Msg.Of(message), + }, labels)) +} + +// IsLog returns true if the event was built by the Log function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsLog(ev core.Event) bool { + return ev.Label(0).Key() == keys.Msg +} + +// Error takes a message and a label list and combines them into a single event +// before delivering them to the exporter. It captures the error in the +// delivered event. +func Error(ctx context.Context, message string, err error, labels ...label.Label) { + core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Msg.Of(message), + keys.Err.Of(err), + }, labels)) +} + +// IsError returns true if the event was built by the Error function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsError(ev core.Event) bool { + return ev.Label(0).Key() == keys.Msg && + ev.Label(1).Key() == keys.Err +} + +// Metric sends a label event to the exporter with the supplied labels. +func Metric(ctx context.Context, labels ...label.Label) { + core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Metric.New(), + }, labels)) +} + +// IsMetric returns true if the event was built by the Metric function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsMetric(ev core.Event) bool { + return ev.Label(0).Key() == keys.Metric +} + +// Label sends a label event to the exporter with the supplied labels. +func Label(ctx context.Context, labels ...label.Label) context.Context { + return core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Label.New(), + }, labels)) +} + +// IsLabel returns true if the event was built by the Label function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsLabel(ev core.Event) bool { + return ev.Label(0).Key() == keys.Label +} + +// Start sends a span start event with the supplied label list to the exporter. +// It also returns a function that will end the span, which should normally be +// deferred. +func Start(ctx context.Context, name string, labels ...label.Label) (context.Context, func()) { + return core.ExportPair(ctx, + core.MakeEvent([3]label.Label{ + keys.Start.Of(name), + }, labels), + core.MakeEvent([3]label.Label{ + keys.End.New(), + }, nil)) +} + +// IsStart returns true if the event was built by the Start function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsStart(ev core.Event) bool { + return ev.Label(0).Key() == keys.Start +} + +// IsEnd returns true if the event was built by the End function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsEnd(ev core.Event) bool { + return ev.Label(0).Key() == keys.End +} + +// Detach returns a context without an associated span. +// This allows the creation of spans that are not children of the current span. +func Detach(ctx context.Context) context.Context { + return core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Detach.New(), + }, nil)) +} + +// IsDetach returns true if the event was built by the Detach function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsDetach(ev core.Event) bool { + return ev.Label(0).Key() == keys.Detach +} diff --git a/vendor/golang.org/x/tools/internal/event/keys/keys.go b/vendor/golang.org/x/tools/internal/event/keys/keys.go new file mode 100644 index 0000000000..4cfa51b612 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/keys/keys.go @@ -0,0 +1,564 @@ +// Copyright 2019 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 keys + +import ( + "fmt" + "io" + "math" + "strconv" + + "golang.org/x/tools/internal/event/label" +) + +// Value represents a key for untyped values. +type Value struct { + name string + description string +} + +// New creates a new Key for untyped values. +func New(name, description string) *Value { + return &Value{name: name, description: description} +} + +func (k *Value) Name() string { return k.name } +func (k *Value) Description() string { return k.description } + +func (k *Value) Format(w io.Writer, buf []byte, l label.Label) { + fmt.Fprint(w, k.From(l)) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Value) Get(lm label.Map) any { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return nil +} + +// From can be used to get a value from a Label. +func (k *Value) From(t label.Label) any { return t.UnpackValue() } + +// Of creates a new Label with this key and the supplied value. +func (k *Value) Of(value any) label.Label { return label.OfValue(k, value) } + +// Tag represents a key for tagging labels that have no value. +// These are used when the existence of the label is the entire information it +// carries, such as marking events to be of a specific kind, or from a specific +// package. +type Tag struct { + name string + description string +} + +// NewTag creates a new Key for tagging labels. +func NewTag(name, description string) *Tag { + return &Tag{name: name, description: description} +} + +func (k *Tag) Name() string { return k.name } +func (k *Tag) Description() string { return k.description } + +func (k *Tag) Format(w io.Writer, buf []byte, l label.Label) {} + +// New creates a new Label with this key. +func (k *Tag) New() label.Label { return label.OfValue(k, nil) } + +// Int represents a key +type Int struct { + name string + description string +} + +// NewInt creates a new Key for int values. +func NewInt(name, description string) *Int { + return &Int{name: name, description: description} +} + +func (k *Int) Name() string { return k.name } +func (k *Int) Description() string { return k.description } + +func (k *Int) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int) Of(v int) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int) Get(lm label.Map) int { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int) From(t label.Label) int { return int(t.Unpack64()) } + +// Int8 represents a key +type Int8 struct { + name string + description string +} + +// NewInt8 creates a new Key for int8 values. +func NewInt8(name, description string) *Int8 { + return &Int8{name: name, description: description} +} + +func (k *Int8) Name() string { return k.name } +func (k *Int8) Description() string { return k.description } + +func (k *Int8) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int8) Of(v int8) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int8) Get(lm label.Map) int8 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int8) From(t label.Label) int8 { return int8(t.Unpack64()) } + +// Int16 represents a key +type Int16 struct { + name string + description string +} + +// NewInt16 creates a new Key for int16 values. +func NewInt16(name, description string) *Int16 { + return &Int16{name: name, description: description} +} + +func (k *Int16) Name() string { return k.name } +func (k *Int16) Description() string { return k.description } + +func (k *Int16) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int16) Of(v int16) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int16) Get(lm label.Map) int16 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int16) From(t label.Label) int16 { return int16(t.Unpack64()) } + +// Int32 represents a key +type Int32 struct { + name string + description string +} + +// NewInt32 creates a new Key for int32 values. +func NewInt32(name, description string) *Int32 { + return &Int32{name: name, description: description} +} + +func (k *Int32) Name() string { return k.name } +func (k *Int32) Description() string { return k.description } + +func (k *Int32) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int32) Of(v int32) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int32) Get(lm label.Map) int32 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int32) From(t label.Label) int32 { return int32(t.Unpack64()) } + +// Int64 represents a key +type Int64 struct { + name string + description string +} + +// NewInt64 creates a new Key for int64 values. +func NewInt64(name, description string) *Int64 { + return &Int64{name: name, description: description} +} + +func (k *Int64) Name() string { return k.name } +func (k *Int64) Description() string { return k.description } + +func (k *Int64) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, k.From(l), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int64) Of(v int64) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int64) Get(lm label.Map) int64 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int64) From(t label.Label) int64 { return int64(t.Unpack64()) } + +// UInt represents a key +type UInt struct { + name string + description string +} + +// NewUInt creates a new Key for uint values. +func NewUInt(name, description string) *UInt { + return &UInt{name: name, description: description} +} + +func (k *UInt) Name() string { return k.name } +func (k *UInt) Description() string { return k.description } + +func (k *UInt) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt) Of(v uint) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt) Get(lm label.Map) uint { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt) From(t label.Label) uint { return uint(t.Unpack64()) } + +// UInt8 represents a key +type UInt8 struct { + name string + description string +} + +// NewUInt8 creates a new Key for uint8 values. +func NewUInt8(name, description string) *UInt8 { + return &UInt8{name: name, description: description} +} + +func (k *UInt8) Name() string { return k.name } +func (k *UInt8) Description() string { return k.description } + +func (k *UInt8) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt8) Of(v uint8) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt8) Get(lm label.Map) uint8 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt8) From(t label.Label) uint8 { return uint8(t.Unpack64()) } + +// UInt16 represents a key +type UInt16 struct { + name string + description string +} + +// NewUInt16 creates a new Key for uint16 values. +func NewUInt16(name, description string) *UInt16 { + return &UInt16{name: name, description: description} +} + +func (k *UInt16) Name() string { return k.name } +func (k *UInt16) Description() string { return k.description } + +func (k *UInt16) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt16) Of(v uint16) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt16) Get(lm label.Map) uint16 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt16) From(t label.Label) uint16 { return uint16(t.Unpack64()) } + +// UInt32 represents a key +type UInt32 struct { + name string + description string +} + +// NewUInt32 creates a new Key for uint32 values. +func NewUInt32(name, description string) *UInt32 { + return &UInt32{name: name, description: description} +} + +func (k *UInt32) Name() string { return k.name } +func (k *UInt32) Description() string { return k.description } + +func (k *UInt32) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt32) Of(v uint32) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt32) Get(lm label.Map) uint32 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt32) From(t label.Label) uint32 { return uint32(t.Unpack64()) } + +// UInt64 represents a key +type UInt64 struct { + name string + description string +} + +// NewUInt64 creates a new Key for uint64 values. +func NewUInt64(name, description string) *UInt64 { + return &UInt64{name: name, description: description} +} + +func (k *UInt64) Name() string { return k.name } +func (k *UInt64) Description() string { return k.description } + +func (k *UInt64) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, k.From(l), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt64) Of(v uint64) label.Label { return label.Of64(k, v) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt64) Get(lm label.Map) uint64 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt64) From(t label.Label) uint64 { return t.Unpack64() } + +// Float32 represents a key +type Float32 struct { + name string + description string +} + +// NewFloat32 creates a new Key for float32 values. +func NewFloat32(name, description string) *Float32 { + return &Float32{name: name, description: description} +} + +func (k *Float32) Name() string { return k.name } +func (k *Float32) Description() string { return k.description } + +func (k *Float32) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendFloat(buf, float64(k.From(l)), 'E', -1, 32)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Float32) Of(v float32) label.Label { + return label.Of64(k, uint64(math.Float32bits(v))) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Float32) Get(lm label.Map) float32 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Float32) From(t label.Label) float32 { + return math.Float32frombits(uint32(t.Unpack64())) +} + +// Float64 represents a key +type Float64 struct { + name string + description string +} + +// NewFloat64 creates a new Key for int64 values. +func NewFloat64(name, description string) *Float64 { + return &Float64{name: name, description: description} +} + +func (k *Float64) Name() string { return k.name } +func (k *Float64) Description() string { return k.description } + +func (k *Float64) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendFloat(buf, k.From(l), 'E', -1, 64)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Float64) Of(v float64) label.Label { + return label.Of64(k, math.Float64bits(v)) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Float64) Get(lm label.Map) float64 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Float64) From(t label.Label) float64 { + return math.Float64frombits(t.Unpack64()) +} + +// String represents a key +type String struct { + name string + description string +} + +// NewString creates a new Key for int64 values. +func NewString(name, description string) *String { + return &String{name: name, description: description} +} + +func (k *String) Name() string { return k.name } +func (k *String) Description() string { return k.description } + +func (k *String) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendQuote(buf, k.From(l))) +} + +// Of creates a new Label with this key and the supplied value. +func (k *String) Of(v string) label.Label { return label.OfString(k, v) } + +// Get can be used to get a label for the key from a label.Map. +func (k *String) Get(lm label.Map) string { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return "" +} + +// From can be used to get a value from a Label. +func (k *String) From(t label.Label) string { return t.UnpackString() } + +// Boolean represents a key +type Boolean struct { + name string + description string +} + +// NewBoolean creates a new Key for bool values. +func NewBoolean(name, description string) *Boolean { + return &Boolean{name: name, description: description} +} + +func (k *Boolean) Name() string { return k.name } +func (k *Boolean) Description() string { return k.description } + +func (k *Boolean) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendBool(buf, k.From(l))) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Boolean) Of(v bool) label.Label { + if v { + return label.Of64(k, 1) + } + return label.Of64(k, 0) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Boolean) Get(lm label.Map) bool { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return false +} + +// From can be used to get a value from a Label. +func (k *Boolean) From(t label.Label) bool { return t.Unpack64() > 0 } + +// Error represents a key +type Error struct { + name string + description string +} + +// NewError creates a new Key for int64 values. +func NewError(name, description string) *Error { + return &Error{name: name, description: description} +} + +func (k *Error) Name() string { return k.name } +func (k *Error) Description() string { return k.description } + +func (k *Error) Format(w io.Writer, buf []byte, l label.Label) { + io.WriteString(w, k.From(l).Error()) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Error) Of(v error) label.Label { return label.OfValue(k, v) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Error) Get(lm label.Map) error { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return nil +} + +// From can be used to get a value from a Label. +func (k *Error) From(t label.Label) error { + err, _ := t.UnpackValue().(error) + return err +} diff --git a/vendor/golang.org/x/tools/internal/event/keys/standard.go b/vendor/golang.org/x/tools/internal/event/keys/standard.go new file mode 100644 index 0000000000..7e95866592 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/keys/standard.go @@ -0,0 +1,22 @@ +// Copyright 2020 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 keys + +var ( + // Msg is a key used to add message strings to label lists. + Msg = NewString("message", "a readable message") + // Label is a key used to indicate an event adds labels to the context. + Label = NewTag("label", "a label context marker") + // Start is used for things like traces that have a name. + Start = NewString("start", "span start") + // Metric is a key used to indicate an event records metrics. + End = NewTag("end", "a span end marker") + // Metric is a key used to indicate an event records metrics. + Detach = NewTag("detach", "a span detach marker") + // Err is a key used to add error values to label lists. + Err = NewError("error", "an error that occurred") + // Metric is a key used to indicate an event records metrics. + Metric = NewTag("metric", "a metric event marker") +) diff --git a/vendor/golang.org/x/tools/internal/event/keys/util.go b/vendor/golang.org/x/tools/internal/event/keys/util.go new file mode 100644 index 0000000000..c0e8e731c9 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/keys/util.go @@ -0,0 +1,21 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package keys + +import ( + "sort" + "strings" +) + +// Join returns a canonical join of the keys in S: +// a sorted comma-separated string list. +func Join[S ~[]T, T ~string](s S) string { + strs := make([]string, 0, len(s)) + for _, v := range s { + strs = append(strs, string(v)) + } + sort.Strings(strs) + return strings.Join(strs, ",") +} diff --git a/vendor/golang.org/x/tools/internal/event/label/label.go b/vendor/golang.org/x/tools/internal/event/label/label.go new file mode 100644 index 0000000000..92a3910573 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/label/label.go @@ -0,0 +1,214 @@ +// Copyright 2019 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 label + +import ( + "fmt" + "io" + "reflect" + "slices" + "unsafe" +) + +// Key is used as the identity of a Label. +// Keys are intended to be compared by pointer only, the name should be unique +// for communicating with external systems, but it is not required or enforced. +type Key interface { + // Name returns the key name. + Name() string + // Description returns a string that can be used to describe the value. + Description() string + + // Format is used in formatting to append the value of the label to the + // supplied buffer. + // The formatter may use the supplied buf as a scratch area to avoid + // allocations. + Format(w io.Writer, buf []byte, l Label) +} + +// Label holds a key and value pair. +// It is normally used when passing around lists of labels. +type Label struct { + key Key + packed uint64 + untyped any +} + +// Map is the interface to a collection of Labels indexed by key. +type Map interface { + // Find returns the label that matches the supplied key. + Find(key Key) Label +} + +// List is the interface to something that provides an iterable +// list of labels. +// Iteration should start from 0 and continue until Valid returns false. +type List interface { + // Valid returns true if the index is within range for the list. + // It does not imply the label at that index will itself be valid. + Valid(index int) bool + // Label returns the label at the given index. + Label(index int) Label +} + +// list implements LabelList for a list of Labels. +type list struct { + labels []Label +} + +// filter wraps a LabelList filtering out specific labels. +type filter struct { + keys []Key + underlying List +} + +// listMap implements LabelMap for a simple list of labels. +type listMap struct { + labels []Label +} + +// mapChain implements LabelMap for a list of underlying LabelMap. +type mapChain struct { + maps []Map +} + +// OfValue creates a new label from the key and value. +// This method is for implementing new key types, label creation should +// normally be done with the Of method of the key. +func OfValue(k Key, value any) Label { return Label{key: k, untyped: value} } + +// UnpackValue assumes the label was built using LabelOfValue and returns the value +// that was passed to that constructor. +// This method is for implementing new key types, for type safety normal +// access should be done with the From method of the key. +func (t Label) UnpackValue() any { return t.untyped } + +// Of64 creates a new label from a key and a uint64. This is often +// used for non uint64 values that can be packed into a uint64. +// This method is for implementing new key types, label creation should +// normally be done with the Of method of the key. +func Of64(k Key, v uint64) Label { return Label{key: k, packed: v} } + +// Unpack64 assumes the label was built using LabelOf64 and returns the value that +// was passed to that constructor. +// This method is for implementing new key types, for type safety normal +// access should be done with the From method of the key. +func (t Label) Unpack64() uint64 { return t.packed } + +type stringptr unsafe.Pointer + +// OfString creates a new label from a key and a string. +// This method is for implementing new key types, label creation should +// normally be done with the Of method of the key. +func OfString(k Key, v string) Label { + hdr := (*reflect.StringHeader)(unsafe.Pointer(&v)) + return Label{ + key: k, + packed: uint64(hdr.Len), + untyped: stringptr(hdr.Data), + } +} + +// UnpackString assumes the label was built using LabelOfString and returns the +// value that was passed to that constructor. +// This method is for implementing new key types, for type safety normal +// access should be done with the From method of the key. +func (t Label) UnpackString() string { + var v string + hdr := (*reflect.StringHeader)(unsafe.Pointer(&v)) + hdr.Data = uintptr(t.untyped.(stringptr)) + hdr.Len = int(t.packed) + return v +} + +// Valid returns true if the Label is a valid one (it has a key). +func (t Label) Valid() bool { return t.key != nil } + +// Key returns the key of this Label. +func (t Label) Key() Key { return t.key } + +// Format is used for debug printing of labels. +func (t Label) Format(f fmt.State, r rune) { + if !t.Valid() { + io.WriteString(f, `nil`) + return + } + io.WriteString(f, t.Key().Name()) + io.WriteString(f, "=") + var buf [128]byte + t.Key().Format(f, buf[:0], t) +} + +func (l *list) Valid(index int) bool { + return index >= 0 && index < len(l.labels) +} + +func (l *list) Label(index int) Label { + return l.labels[index] +} + +func (f *filter) Valid(index int) bool { + return f.underlying.Valid(index) +} + +func (f *filter) Label(index int) Label { + l := f.underlying.Label(index) + if slices.Contains(f.keys, l.Key()) { + return Label{} + } + return l +} + +func (lm listMap) Find(key Key) Label { + for _, l := range lm.labels { + if l.Key() == key { + return l + } + } + return Label{} +} + +func (c mapChain) Find(key Key) Label { + for _, src := range c.maps { + l := src.Find(key) + if l.Valid() { + return l + } + } + return Label{} +} + +var emptyList = &list{} + +func NewList(labels ...Label) List { + if len(labels) == 0 { + return emptyList + } + return &list{labels: labels} +} + +func Filter(l List, keys ...Key) List { + if len(keys) == 0 { + return l + } + return &filter{keys: keys, underlying: l} +} + +func NewMap(labels ...Label) Map { + return listMap{labels: labels} +} + +func MergeMaps(srcs ...Map) Map { + var nonNil []Map + for _, src := range srcs { + if src != nil { + nonNil = append(nonNil, src) + } + } + if len(nonNil) == 1 { + return nonNil[0] + } + return mapChain{maps: nonNil} +} diff --git a/vendor/golang.org/x/tools/internal/gocommand/invoke.go b/vendor/golang.org/x/tools/internal/gocommand/invoke.go new file mode 100644 index 0000000000..58721202de --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/invoke.go @@ -0,0 +1,567 @@ +// Copyright 2020 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 gocommand is a helper for calling the go command. +package gocommand + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "log" + "os" + "os/exec" + "path/filepath" + "regexp" + "runtime" + "strconv" + "strings" + "sync" + "time" + + "golang.org/x/tools/internal/event" + "golang.org/x/tools/internal/event/keys" + "golang.org/x/tools/internal/event/label" +) + +// A Runner will run go command invocations and serialize +// them if it sees a concurrency error. +type Runner struct { + // once guards the runner initialization. + once sync.Once + + // inFlight tracks available workers. + inFlight chan struct{} + + // serialized guards the ability to run a go command serially, + // to avoid deadlocks when claiming workers. + serialized chan struct{} +} + +const maxInFlight = 10 + +func (runner *Runner) initialize() { + runner.once.Do(func() { + runner.inFlight = make(chan struct{}, maxInFlight) + runner.serialized = make(chan struct{}, 1) + }) +} + +// 1.13: go: updates to go.mod needed, but contents have changed +// 1.14: go: updating go.mod: existing contents have changed since last read +var modConcurrencyError = regexp.MustCompile(`go:.*go.mod.*contents have changed`) + +// event keys for go command invocations +var ( + verb = keys.NewString("verb", "go command verb") + directory = keys.NewString("directory", "") +) + +func invLabels(inv Invocation) []label.Label { + return []label.Label{verb.Of(inv.Verb), directory.Of(inv.WorkingDir)} +} + +// Run is a convenience wrapper around RunRaw. +// It returns only stdout and a "friendly" error. +func (runner *Runner) Run(ctx context.Context, inv Invocation) (*bytes.Buffer, error) { + ctx, done := event.Start(ctx, "gocommand.Runner.Run", invLabels(inv)...) + defer done() + + stdout, _, friendly, _ := runner.RunRaw(ctx, inv) + return stdout, friendly +} + +// RunPiped runs the invocation serially, always waiting for any concurrent +// invocations to complete first. +func (runner *Runner) RunPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) error { + ctx, done := event.Start(ctx, "gocommand.Runner.RunPiped", invLabels(inv)...) + defer done() + + _, err := runner.runPiped(ctx, inv, stdout, stderr) + return err +} + +// RunRaw runs the invocation, serializing requests only if they fight over +// go.mod changes. +// Postcondition: both error results have same nilness. +func (runner *Runner) RunRaw(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) { + ctx, done := event.Start(ctx, "gocommand.Runner.RunRaw", invLabels(inv)...) + defer done() + // Make sure the runner is always initialized. + runner.initialize() + + // First, try to run the go command concurrently. + stdout, stderr, friendlyErr, err := runner.runConcurrent(ctx, inv) + + // If we encounter a load concurrency error, we need to retry serially. + if friendlyErr != nil && modConcurrencyError.MatchString(friendlyErr.Error()) { + event.Error(ctx, "Load concurrency error, will retry serially", err) + + // Run serially by calling runPiped. + stdout.Reset() + stderr.Reset() + friendlyErr, err = runner.runPiped(ctx, inv, stdout, stderr) + } + + return stdout, stderr, friendlyErr, err +} + +// Postcondition: both error results have same nilness. +func (runner *Runner) runConcurrent(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) { + // Wait for 1 worker to become available. + select { + case <-ctx.Done(): + return nil, nil, ctx.Err(), ctx.Err() + case runner.inFlight <- struct{}{}: + defer func() { <-runner.inFlight }() + } + + stdout, stderr := &bytes.Buffer{}, &bytes.Buffer{} + friendlyErr, err := inv.runWithFriendlyError(ctx, stdout, stderr) + return stdout, stderr, friendlyErr, err +} + +// Postcondition: both error results have same nilness. +func (runner *Runner) runPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) (error, error) { + // Make sure the runner is always initialized. + runner.initialize() + + // Acquire the serialization lock. This avoids deadlocks between two + // runPiped commands. + select { + case <-ctx.Done(): + return ctx.Err(), ctx.Err() + case runner.serialized <- struct{}{}: + defer func() { <-runner.serialized }() + } + + // Wait for all in-progress go commands to return before proceeding, + // to avoid load concurrency errors. + for range maxInFlight { + select { + case <-ctx.Done(): + return ctx.Err(), ctx.Err() + case runner.inFlight <- struct{}{}: + // Make sure we always "return" any workers we took. + defer func() { <-runner.inFlight }() + } + } + + return inv.runWithFriendlyError(ctx, stdout, stderr) +} + +// An Invocation represents a call to the go command. +type Invocation struct { + Verb string + Args []string + BuildFlags []string + + // If ModFlag is set, the go command is invoked with -mod=ModFlag. + // TODO(rfindley): remove, in favor of Args. + ModFlag string + + // If ModFile is set, the go command is invoked with -modfile=ModFile. + // TODO(rfindley): remove, in favor of Args. + ModFile string + + // Overlay is the name of the JSON overlay file that describes + // unsaved editor buffers; see [WriteOverlays]. + // If set, the go command is invoked with -overlay=Overlay. + // TODO(rfindley): remove, in favor of Args. + Overlay string + + // If CleanEnv is set, the invocation will run only with the environment + // in Env, not starting with os.Environ. + CleanEnv bool + Env []string + WorkingDir string + Logf func(format string, args ...any) +} + +// Postcondition: both error results have same nilness. +func (i *Invocation) runWithFriendlyError(ctx context.Context, stdout, stderr io.Writer) (friendlyError error, rawError error) { + rawError = i.run(ctx, stdout, stderr) + if rawError != nil { + friendlyError = rawError + // Check for 'go' executable not being found. + if ee, ok := rawError.(*exec.Error); ok && ee.Err == exec.ErrNotFound { + friendlyError = fmt.Errorf("go command required, not found: %v", ee) + } + if ctx.Err() != nil { + friendlyError = ctx.Err() + } + friendlyError = fmt.Errorf("err: %v: stderr: %s", friendlyError, stderr) + } + return +} + +// logf logs if i.Logf is non-nil. +func (i *Invocation) logf(format string, args ...any) { + if i.Logf != nil { + i.Logf(format, args...) + } +} + +func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error { + goArgs := []string{i.Verb} + + appendModFile := func() { + if i.ModFile != "" { + goArgs = append(goArgs, "-modfile="+i.ModFile) + } + } + appendModFlag := func() { + if i.ModFlag != "" { + goArgs = append(goArgs, "-mod="+i.ModFlag) + } + } + appendOverlayFlag := func() { + if i.Overlay != "" { + goArgs = append(goArgs, "-overlay="+i.Overlay) + } + } + + switch i.Verb { + case "env", "version": + goArgs = append(goArgs, i.Args...) + case "mod": + // mod needs the sub-verb before flags. + goArgs = append(goArgs, i.Args[0]) + appendModFile() + goArgs = append(goArgs, i.Args[1:]...) + case "get": + goArgs = append(goArgs, i.BuildFlags...) + appendModFile() + goArgs = append(goArgs, i.Args...) + + default: // notably list and build. + goArgs = append(goArgs, i.BuildFlags...) + appendModFile() + appendModFlag() + appendOverlayFlag() + goArgs = append(goArgs, i.Args...) + } + cmd := exec.Command("go", goArgs...) + cmd.Stdout = stdout + cmd.Stderr = stderr + + // https://go.dev/issue/59541: don't wait forever copying stderr + // after the command has exited. + // After CL 484741 we copy stdout manually, so we we'll stop reading that as + // soon as ctx is done. However, we also don't want to wait around forever + // for stderr. Give a much-longer-than-reasonable delay and then assume that + // something has wedged in the kernel or runtime. + cmd.WaitDelay = 30 * time.Second + + // The cwd gets resolved to the real path. On Darwin, where + // /tmp is a symlink, this breaks anything that expects the + // working directory to keep the original path, including the + // go command when dealing with modules. + // + // os.Getwd has a special feature where if the cwd and the PWD + // are the same node then it trusts the PWD, so by setting it + // in the env for the child process we fix up all the paths + // returned by the go command. + if !i.CleanEnv { + cmd.Env = os.Environ() + } + cmd.Env = append(cmd.Env, i.Env...) + if i.WorkingDir != "" { + cmd.Env = append(cmd.Env, "PWD="+i.WorkingDir) + cmd.Dir = i.WorkingDir + } + + debugStr := cmdDebugStr(cmd) + i.logf("starting %v", debugStr) + start := time.Now() + defer func() { + i.logf("%s for %v", time.Since(start), debugStr) + }() + + return runCmdContext(ctx, cmd) +} + +// DebugHangingGoCommands may be set by tests to enable additional +// instrumentation (including panics) for debugging hanging Go commands. +// +// See golang/go#54461 for details. +var DebugHangingGoCommands = false + +// runCmdContext is like exec.CommandContext except it sends os.Interrupt +// before os.Kill. +func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) { + // If cmd.Stdout is not an *os.File, the exec package will create a pipe and + // copy it to the Writer in a goroutine until the process has finished and + // either the pipe reaches EOF or command's WaitDelay expires. + // + // However, the output from 'go list' can be quite large, and we don't want to + // keep reading (and allocating buffers) if we've already decided we don't + // care about the output. We don't want to wait for the process to finish, and + // we don't wait to wait for the WaitDelay to expire either. + // + // Instead, if cmd.Stdout requires a copying goroutine we explicitly replace + // it with a pipe (which is an *os.File), which we can close in order to stop + // copying output as soon as we realize we don't care about it. + var stdoutW *os.File + if cmd.Stdout != nil { + if _, ok := cmd.Stdout.(*os.File); !ok { + var stdoutR *os.File + stdoutR, stdoutW, err = os.Pipe() + if err != nil { + return err + } + prevStdout := cmd.Stdout + cmd.Stdout = stdoutW + + stdoutErr := make(chan error, 1) + go func() { + _, err := io.Copy(prevStdout, stdoutR) + if err != nil { + err = fmt.Errorf("copying stdout: %w", err) + } + stdoutErr <- err + }() + defer func() { + // We started a goroutine to copy a stdout pipe. + // Wait for it to finish, or terminate it if need be. + var err2 error + select { + case err2 = <-stdoutErr: + stdoutR.Close() + case <-ctx.Done(): + stdoutR.Close() + // Per https://pkg.go.dev/os#File.Close, the call to stdoutR.Close + // should cause the Read call in io.Copy to unblock and return + // immediately, but we still need to receive from stdoutErr to confirm + // that it has happened. + <-stdoutErr + err2 = ctx.Err() + } + if err == nil { + err = err2 + } + }() + + // Per https://pkg.go.dev/os/exec#Cmd, “If Stdout and Stderr are the + // same writer, and have a type that can be compared with ==, at most + // one goroutine at a time will call Write.” + // + // Since we're starting a goroutine that writes to cmd.Stdout, we must + // also update cmd.Stderr so that it still holds. + func() { + defer func() { recover() }() + if cmd.Stderr == prevStdout { + cmd.Stderr = cmd.Stdout + } + }() + } + } + + startTime := time.Now() + err = cmd.Start() + if stdoutW != nil { + // The child process has inherited the pipe file, + // so close the copy held in this process. + stdoutW.Close() + stdoutW = nil + } + if err != nil { + return err + } + + resChan := make(chan error, 1) + go func() { + resChan <- cmd.Wait() + }() + + // If we're interested in debugging hanging Go commands, stop waiting after a + // minute and panic with interesting information. + debug := DebugHangingGoCommands + if debug { + timer := time.NewTimer(1 * time.Minute) + defer timer.Stop() + select { + case err := <-resChan: + return err + case <-timer.C: + // HandleHangingGoCommand terminates this process. + // Pass off resChan in case we can collect the command error. + handleHangingGoCommand(startTime, cmd, resChan) + case <-ctx.Done(): + } + } else { + select { + case err := <-resChan: + return err + case <-ctx.Done(): + } + } + + // Cancelled. Interrupt and see if it ends voluntarily. + if err := cmd.Process.Signal(os.Interrupt); err == nil { + // (We used to wait only 1s but this proved + // fragile on loaded builder machines.) + timer := time.NewTimer(5 * time.Second) + defer timer.Stop() + select { + case err := <-resChan: + return err + case <-timer.C: + } + } + + // Didn't shut down in response to interrupt. Kill it hard. + if err := cmd.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) && debug { + log.Printf("error killing the Go command: %v", err) + } + + return <-resChan +} + +// handleHangingGoCommand outputs debugging information to help diagnose the +// cause of a hanging Go command, and then exits with log.Fatalf. +func handleHangingGoCommand(start time.Time, cmd *exec.Cmd, resChan chan error) { + switch runtime.GOOS { + case "linux", "darwin", "freebsd", "netbsd", "openbsd": + fmt.Fprintln(os.Stderr, `DETECTED A HANGING GO COMMAND + + The gopls test runner has detected a hanging go command. In order to debug + this, the output of ps and lsof/fstat is printed below. + + See golang/go#54461 for more details.`) + + fmt.Fprintln(os.Stderr, "\nps axo ppid,pid,command:") + fmt.Fprintln(os.Stderr, "-------------------------") + psCmd := exec.Command("ps", "axo", "ppid,pid,command") + psCmd.Stdout = os.Stderr + psCmd.Stderr = os.Stderr + if err := psCmd.Run(); err != nil { + log.Printf("Handling hanging Go command: running ps: %v", err) + } + + listFiles := "lsof" + if runtime.GOOS == "freebsd" || runtime.GOOS == "netbsd" { + listFiles = "fstat" + } + + fmt.Fprintln(os.Stderr, "\n"+listFiles+":") + fmt.Fprintln(os.Stderr, "-----") + listFilesCmd := exec.Command(listFiles) + listFilesCmd.Stdout = os.Stderr + listFilesCmd.Stderr = os.Stderr + if err := listFilesCmd.Run(); err != nil { + log.Printf("Handling hanging Go command: running %s: %v", listFiles, err) + } + // Try to extract information about the slow go process by issuing a SIGQUIT. + if err := cmd.Process.Signal(sigStuckProcess); err == nil { + select { + case err := <-resChan: + stderr := "not a bytes.Buffer" + if buf, _ := cmd.Stderr.(*bytes.Buffer); buf != nil { + stderr = buf.String() + } + log.Printf("Quit hanging go command:\n\terr:%v\n\tstderr:\n%v\n\n", err, stderr) + case <-time.After(5 * time.Second): + } + } else { + log.Printf("Sending signal %d to hanging go command: %v", sigStuckProcess, err) + } + } + log.Fatalf("detected hanging go command (golang/go#54461); waited %s\n\tcommand:%s\n\tpid:%d", time.Since(start), cmd, cmd.Process.Pid) +} + +func cmdDebugStr(cmd *exec.Cmd) string { + env := make(map[string]string) + for _, kv := range cmd.Env { + split := strings.SplitN(kv, "=", 2) + if len(split) == 2 { + k, v := split[0], split[1] + env[k] = v + } + } + + var args []string + for _, arg := range cmd.Args { + quoted := strconv.Quote(arg) + if quoted[1:len(quoted)-1] != arg || strings.Contains(arg, " ") { + args = append(args, quoted) + } else { + args = append(args, arg) + } + } + return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v GOPROXY=%v PWD=%v %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["GOPROXY"], env["PWD"], strings.Join(args, " ")) +} + +// WriteOverlays writes each value in the overlay (see the Overlay +// field of go/packages.Config) to a temporary file and returns the name +// of a JSON file describing the mapping that is suitable for the "go +// list -overlay" flag. +// +// On success, the caller must call the cleanup function exactly once +// when the files are no longer needed. +func WriteOverlays(overlay map[string][]byte) (filename string, cleanup func(), err error) { + // Do nothing if there are no overlays in the config. + if len(overlay) == 0 { + return "", func() {}, nil + } + + dir, err := os.MkdirTemp("", "gocommand-*") + if err != nil { + return "", nil, err + } + + // The caller must clean up this directory, + // unless this function returns an error. + // (The cleanup operand of each return + // statement below is ignored.) + defer func() { + cleanup = func() { + os.RemoveAll(dir) + } + if err != nil { + cleanup() + cleanup = nil + } + }() + + // Write each map entry to a temporary file. + overlays := make(map[string]string) + for k, v := range overlay { + // Use a unique basename for each file (001-foo.go), + // to avoid creating nested directories. + base := fmt.Sprintf("%d-%s", 1+len(overlays), filepath.Base(k)) + filename := filepath.Join(dir, base) + err := os.WriteFile(filename, v, 0666) + if err != nil { + return "", nil, err + } + overlays[k] = filename + } + + // Write the JSON overlay file that maps logical file names to temp files. + // + // OverlayJSON is the format overlay files are expected to be in. + // The Replace map maps from overlaid paths to replacement paths: + // the Go command will forward all reads trying to open + // each overlaid path to its replacement path, or consider the overlaid + // path not to exist if the replacement path is empty. + // + // From golang/go#39958. + type OverlayJSON struct { + Replace map[string]string `json:"replace,omitempty"` + } + b, err := json.Marshal(OverlayJSON{Replace: overlays}) + if err != nil { + return "", nil, err + } + filename = filepath.Join(dir, "overlay.json") + if err := os.WriteFile(filename, b, 0666); err != nil { + return "", nil, err + } + + return filename, nil, nil +} diff --git a/vendor/golang.org/x/tools/internal/gocommand/invoke_notunix.go b/vendor/golang.org/x/tools/internal/gocommand/invoke_notunix.go new file mode 100644 index 0000000000..469c648e4d --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/invoke_notunix.go @@ -0,0 +1,13 @@ +// Copyright 2025 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. + +//go:build !unix + +package gocommand + +import "os" + +// sigStuckProcess is the signal to send to kill a hanging subprocess. +// On Unix we send SIGQUIT, but on non-Unix we only have os.Kill. +var sigStuckProcess = os.Kill diff --git a/vendor/golang.org/x/tools/internal/gocommand/invoke_unix.go b/vendor/golang.org/x/tools/internal/gocommand/invoke_unix.go new file mode 100644 index 0000000000..169d37c8e9 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/invoke_unix.go @@ -0,0 +1,13 @@ +// Copyright 2025 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. + +//go:build unix + +package gocommand + +import "syscall" + +// Sigstuckprocess is the signal to send to kill a hanging subprocess. +// Send SIGQUIT to get a stack trace. +var sigStuckProcess = syscall.SIGQUIT diff --git a/vendor/golang.org/x/tools/internal/gocommand/vendor.go b/vendor/golang.org/x/tools/internal/gocommand/vendor.go new file mode 100644 index 0000000000..e38d1fb488 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/vendor.go @@ -0,0 +1,163 @@ +// Copyright 2020 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 gocommand + +import ( + "bytes" + "context" + "fmt" + "os" + "path/filepath" + "regexp" + "strings" + "time" + + "golang.org/x/mod/semver" +) + +// ModuleJSON holds information about a module. +type ModuleJSON struct { + Path string // module path + Version string // module version + Versions []string // available module versions (with -versions) + Replace *ModuleJSON // replaced by this module + Time *time.Time // time version was created + Update *ModuleJSON // available update, if any (with -u) + Main bool // is this the main module? + Indirect bool // is this module only an indirect dependency of main module? + Dir string // directory holding files for this module, if any + GoMod string // path to go.mod file used when loading this module, if any + GoVersion string // go version used in module +} + +var modFlagRegexp = regexp.MustCompile(`-mod[ =](\w+)`) + +// VendorEnabled reports whether vendoring is enabled. It takes a *Runner to execute Go commands +// with the supplied context.Context and Invocation. The Invocation can contain pre-defined fields, +// of which only Verb and Args are modified to run the appropriate Go command. +// Inspired by setDefaultBuildMod in modload/init.go +func VendorEnabled(ctx context.Context, inv Invocation, r *Runner) (bool, *ModuleJSON, error) { + mainMod, go114, err := getMainModuleAnd114(ctx, inv, r) + if err != nil { + return false, nil, err + } + + // We check the GOFLAGS to see if there is anything overridden or not. + inv.Verb = "env" + inv.Args = []string{"GOFLAGS"} + stdout, err := r.Run(ctx, inv) + if err != nil { + return false, nil, err + } + goflags := string(bytes.TrimSpace(stdout.Bytes())) + matches := modFlagRegexp.FindStringSubmatch(goflags) + var modFlag string + if len(matches) != 0 { + modFlag = matches[1] + } + // Don't override an explicit '-mod=' argument. + if modFlag == "vendor" { + return true, mainMod, nil + } else if modFlag != "" { + return false, nil, nil + } + if mainMod == nil || !go114 { + return false, nil, nil + } + // Check 1.14's automatic vendor mode. + if fi, err := os.Stat(filepath.Join(mainMod.Dir, "vendor")); err == nil && fi.IsDir() { + if mainMod.GoVersion != "" && semver.Compare("v"+mainMod.GoVersion, "v1.14") >= 0 { + // The Go version is at least 1.14, and a vendor directory exists. + // Set -mod=vendor by default. + return true, mainMod, nil + } + } + return false, nil, nil +} + +// getMainModuleAnd114 gets one of the main modules' information and whether the +// go command in use is 1.14+. This is the information needed to figure out +// if vendoring should be enabled. +func getMainModuleAnd114(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, bool, error) { + const format = `{{.Path}} +{{.Dir}} +{{.GoMod}} +{{.GoVersion}} +{{range context.ReleaseTags}}{{if eq . "go1.14"}}{{.}}{{end}}{{end}} +` + inv.Verb = "list" + inv.Args = []string{"-m", "-f", format} + stdout, err := r.Run(ctx, inv) + if err != nil { + return nil, false, err + } + + lines := strings.Split(stdout.String(), "\n") + if len(lines) < 5 { + return nil, false, fmt.Errorf("unexpected stdout: %q", stdout.String()) + } + mod := &ModuleJSON{ + Path: lines[0], + Dir: lines[1], + GoMod: lines[2], + GoVersion: lines[3], + Main: true, + } + return mod, lines[4] == "go1.14", nil +} + +// WorkspaceVendorEnabled reports whether workspace vendoring is enabled. It takes a *Runner to execute Go commands +// with the supplied context.Context and Invocation. The Invocation can contain pre-defined fields, +// of which only Verb and Args are modified to run the appropriate Go command. +// Inspired by setDefaultBuildMod in modload/init.go +func WorkspaceVendorEnabled(ctx context.Context, inv Invocation, r *Runner) (bool, []*ModuleJSON, error) { + inv.Verb = "env" + inv.Args = []string{"GOWORK"} + stdout, err := r.Run(ctx, inv) + if err != nil { + return false, nil, err + } + goWork := string(bytes.TrimSpace(stdout.Bytes())) + if fi, err := os.Stat(filepath.Join(filepath.Dir(goWork), "vendor")); err == nil && fi.IsDir() { + mainMods, err := getWorkspaceMainModules(ctx, inv, r) + if err != nil { + return false, nil, err + } + return true, mainMods, nil + } + return false, nil, nil +} + +// getWorkspaceMainModules gets the main modules' information. +// This is the information needed to figure out if vendoring should be enabled. +func getWorkspaceMainModules(ctx context.Context, inv Invocation, r *Runner) ([]*ModuleJSON, error) { + const format = `{{.Path}} +{{.Dir}} +{{.GoMod}} +{{.GoVersion}} +` + inv.Verb = "list" + inv.Args = []string{"-m", "-f", format} + stdout, err := r.Run(ctx, inv) + if err != nil { + return nil, err + } + + lines := strings.Split(strings.TrimSuffix(stdout.String(), "\n"), "\n") + if len(lines) < 4 { + return nil, fmt.Errorf("unexpected stdout: %q", stdout.String()) + } + mods := make([]*ModuleJSON, 0, len(lines)/4) + for i := 0; i < len(lines); i += 4 { + mods = append(mods, &ModuleJSON{ + Path: lines[i], + Dir: lines[i+1], + GoMod: lines[i+2], + GoVersion: lines[i+3], + Main: true, + }) + } + return mods, nil +} diff --git a/vendor/golang.org/x/tools/internal/gocommand/version.go b/vendor/golang.org/x/tools/internal/gocommand/version.go new file mode 100644 index 0000000000..446c5846a6 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/version.go @@ -0,0 +1,71 @@ +// Copyright 2020 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 gocommand + +import ( + "context" + "fmt" + "regexp" + "strings" +) + +// GoVersion reports the minor version number of the highest release +// tag built into the go command on the PATH. +// +// Note that this may be higher than the version of the go tool used +// to build this application, and thus the versions of the standard +// go/{scanner,parser,ast,types} packages that are linked into it. +// In that case, callers should either downgrade to the version of +// go used to build the application, or report an error that the +// application is too old to use the go command on the PATH. +func GoVersion(ctx context.Context, inv Invocation, r *Runner) (int, error) { + inv.Verb = "list" + inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`, `--`, `unsafe`} + inv.BuildFlags = nil // This is not a build command. + inv.ModFlag = "" + inv.ModFile = "" + inv.Env = append(inv.Env[:len(inv.Env):len(inv.Env)], "GO111MODULE=off") + + stdoutBytes, err := r.Run(ctx, inv) + if err != nil { + return 0, err + } + stdout := stdoutBytes.String() + if len(stdout) < 3 { + return 0, fmt.Errorf("bad ReleaseTags output: %q", stdout) + } + // Split up "[go1.1 go1.15]" and return highest go1.X value. + tags := strings.Fields(stdout[1 : len(stdout)-2]) + for i := len(tags) - 1; i >= 0; i-- { + var version int + if _, err := fmt.Sscanf(tags[i], "go1.%d", &version); err != nil { + continue + } + return version, nil + } + return 0, fmt.Errorf("no parseable ReleaseTags in %v", tags) +} + +// GoVersionOutput returns the complete output of the go version command. +func GoVersionOutput(ctx context.Context, inv Invocation, r *Runner) (string, error) { + inv.Verb = "version" + goVersion, err := r.Run(ctx, inv) + if err != nil { + return "", err + } + return goVersion.String(), nil +} + +// ParseGoVersionOutput extracts the Go version string +// from the output of the "go version" command. +// Given an unrecognized form, it returns an empty string. +func ParseGoVersionOutput(data string) string { + re := regexp.MustCompile(`^go version (go\S+|devel \S+)`) + m := re.FindStringSubmatch(data) + if len(m) != 2 { + return "" // unrecognized version + } + return m[1] +} diff --git a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go new file mode 100644 index 0000000000..5252144d04 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go @@ -0,0 +1,336 @@ +// Copyright 2018 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 gopathwalk is like filepath.Walk but specialized for finding Go +// packages, particularly in $GOPATH and $GOROOT. +package gopathwalk + +import ( + "bufio" + "bytes" + "io" + "io/fs" + "os" + "path/filepath" + "runtime" + "slices" + "strings" + "sync" + "time" +) + +// Options controls the behavior of a Walk call. +type Options struct { + // If Logf is non-nil, debug logging is enabled through this function. + Logf func(format string, args ...any) + + // Search module caches. Also disables legacy goimports ignore rules. + ModulesEnabled bool + + // Maximum number of concurrent calls to user-provided callbacks, + // or 0 for GOMAXPROCS. + Concurrency int +} + +// RootType indicates the type of a Root. +type RootType int + +const ( + RootUnknown RootType = iota + RootGOROOT + RootGOPATH + RootCurrentModule + RootModuleCache + RootOther +) + +// A Root is a starting point for a Walk. +type Root struct { + Path string + Type RootType +} + +// Walk concurrently walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. +// +// For each package found, add will be called with the absolute +// paths of the containing source directory and the package directory. +// +// Unlike filepath.WalkDir, Walk follows symbolic links +// (while guarding against cycles). +func Walk(roots []Root, add func(root Root, dir string), opts Options) { + WalkSkip(roots, add, func(Root, string) bool { return false }, opts) +} + +// WalkSkip concurrently walks Go source directories ($GOROOT, $GOPATH, etc) to +// find packages. +// +// For each package found, add will be called with the absolute +// paths of the containing source directory and the package directory. +// For each directory that will be scanned, skip will be called +// with the absolute paths of the containing source directory and the directory. +// If skip returns false on a directory it will be processed. +// +// Unlike filepath.WalkDir, WalkSkip follows symbolic links +// (while guarding against cycles). +func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options) { + for _, root := range roots { + walkDir(root, add, skip, opts) + } +} + +// walkDir creates a walker and starts fastwalk with this walker. +func walkDir(root Root, add func(Root, string), skip func(root Root, dir string) bool, opts Options) { + if opts.Logf == nil { + opts.Logf = func(format string, args ...any) {} + } + if _, err := os.Stat(root.Path); os.IsNotExist(err) { + opts.Logf("skipping nonexistent directory: %v", root.Path) + return + } + start := time.Now() + opts.Logf("scanning %s", root.Path) + + concurrency := opts.Concurrency + if concurrency == 0 { + // The walk be either CPU-bound or I/O-bound, depending on what the + // caller-supplied add function does and the details of the user's platform + // and machine. Rather than trying to fine-tune the concurrency level for a + // specific environment, we default to GOMAXPROCS: it is likely to be a good + // choice for a CPU-bound add function, and if it is instead I/O-bound, then + // dealing with I/O saturation is arguably the job of the kernel and/or + // runtime. (Oversaturating I/O seems unlikely to harm performance as badly + // as failing to saturate would.) + concurrency = runtime.GOMAXPROCS(0) + } + w := &walker{ + root: root, + add: add, + skip: skip, + opts: opts, + sem: make(chan struct{}, concurrency), + } + w.init() + + w.sem <- struct{}{} + path := root.Path + if path == "" { + path = "." + } + if fi, err := os.Lstat(path); err == nil { + w.walk(path, nil, fs.FileInfoToDirEntry(fi)) + } else { + w.opts.Logf("scanning directory %v: %v", root.Path, err) + } + <-w.sem + w.walking.Wait() + + opts.Logf("scanned %s in %v", root.Path, time.Since(start)) +} + +// walker is the callback for fastwalk.Walk. +type walker struct { + root Root // The source directory to scan. + add func(Root, string) // The callback that will be invoked for every possible Go package dir. + skip func(Root, string) bool // The callback that will be invoked for every dir. dir is skipped if it returns true. + opts Options // Options passed to Walk by the user. + + walking sync.WaitGroup + sem chan struct{} // Channel of semaphore tokens; send to acquire, receive to release. + ignoredDirs []string + + added sync.Map // map[string]bool +} + +// A symlinkList is a linked list of os.FileInfos for parent directories +// reached via symlinks. +type symlinkList struct { + info os.FileInfo + prev *symlinkList +} + +// init initializes the walker based on its Options +func (w *walker) init() { + var ignoredPaths []string + if w.root.Type == RootModuleCache { + ignoredPaths = []string{"cache"} + } + if !w.opts.ModulesEnabled && w.root.Type == RootGOPATH { + ignoredPaths = w.getIgnoredDirs(w.root.Path) + ignoredPaths = append(ignoredPaths, "v", "mod") + } + + for _, p := range ignoredPaths { + full := filepath.Join(w.root.Path, p) + w.ignoredDirs = append(w.ignoredDirs, full) + w.opts.Logf("Directory added to ignore list: %s", full) + } +} + +// getIgnoredDirs reads an optional config file at /.goimportsignore +// of relative directories to ignore when scanning for go files. +// The provided path is one of the $GOPATH entries with "src" appended. +func (w *walker) getIgnoredDirs(path string) []string { + file := filepath.Join(path, ".goimportsignore") + slurp, err := os.ReadFile(file) + if err != nil { + w.opts.Logf("%v", err) + } else { + w.opts.Logf("Read %s", file) + } + if err != nil { + return nil + } + + var ignoredDirs []string + bs := bufio.NewScanner(bytes.NewReader(slurp)) + for bs.Scan() { + line := strings.TrimSpace(bs.Text()) + if line == "" || strings.HasPrefix(line, "#") { + continue + } + ignoredDirs = append(ignoredDirs, line) + } + return ignoredDirs +} + +// shouldSkipDir reports whether the file should be skipped or not. +func (w *walker) shouldSkipDir(dir string) bool { + if slices.Contains(w.ignoredDirs, dir) { + return true + } + if w.skip != nil { + // Check with the user specified callback. + return w.skip(w.root, dir) + } + return false +} + +// walk walks through the given path. +// +// Errors are logged if w.opts.Logf is non-nil, but otherwise ignored. +func (w *walker) walk(path string, pathSymlinks *symlinkList, d fs.DirEntry) { + if d.Type()&os.ModeSymlink != 0 { + // Walk the symlink's target rather than the symlink itself. + // + // (Note that os.Stat, unlike the lower-lever os.Readlink, + // follows arbitrarily many layers of symlinks, so it will eventually + // reach either a non-symlink or a nonexistent target.) + // + // TODO(bcmills): 'go list all' itself ignores symlinks within GOROOT/src + // and GOPATH/src. Do we really need to traverse them here? If so, why? + + fi, err := os.Stat(path) + if err != nil { + w.opts.Logf("%v", err) + return + } + + // Avoid walking symlink cycles: if we have already followed a symlink to + // this directory as a parent of itself, don't follow it again. + // + // This doesn't catch the first time through a cycle, but it also minimizes + // the number of extra stat calls we make if we *don't* encounter a cycle. + // Since we don't actually expect to encounter symlink cycles in practice, + // this seems like the right tradeoff. + for parent := pathSymlinks; parent != nil; parent = parent.prev { + if os.SameFile(fi, parent.info) { + return + } + } + + pathSymlinks = &symlinkList{ + info: fi, + prev: pathSymlinks, + } + d = fs.FileInfoToDirEntry(fi) + } + + if d.Type().IsRegular() { + if !strings.HasSuffix(path, ".go") { + return + } + + dir := filepath.Dir(path) + if dir == w.root.Path && (w.root.Type == RootGOROOT || w.root.Type == RootGOPATH) { + // Doesn't make sense to have regular files + // directly in your $GOPATH/src or $GOROOT/src. + // + // TODO(bcmills): there are many levels of directory within + // RootModuleCache where this also wouldn't make sense, + // Can we generalize this to any directory without a corresponding + // import path? + return + } + + if _, dup := w.added.LoadOrStore(dir, true); !dup { + w.add(w.root, dir) + } + } + + if !d.IsDir() { + return + } + + base := filepath.Base(path) + if base == "" || base[0] == '.' || base[0] == '_' || + base == "testdata" || + (w.root.Type == RootGOROOT && w.opts.ModulesEnabled && base == "vendor") || + (!w.opts.ModulesEnabled && base == "node_modules") || + w.shouldSkipDir(path) { + return + } + + // Read the directory and walk its entries. + + f, err := os.Open(path) + if err != nil { + w.opts.Logf("%v", err) + return + } + defer f.Close() + + for { + // We impose an arbitrary limit on the number of ReadDir results per + // directory to limit the amount of memory consumed for stale or upcoming + // directory entries. The limit trades off CPU (number of syscalls to read + // the whole directory) against RAM (reachable directory entries other than + // the one currently being processed). + // + // Since we process the directories recursively, we will end up maintaining + // a slice of entries for each level of the directory tree. + // (Compare https://go.dev/issue/36197.) + ents, err := f.ReadDir(1024) + if err != nil { + if err != io.EOF { + w.opts.Logf("%v", err) + } + break + } + + for _, d := range ents { + nextPath := filepath.Join(path, d.Name()) + if d.IsDir() { + select { + case w.sem <- struct{}{}: + // Got a new semaphore token, so we can traverse the directory concurrently. + d := d + w.walking.Add(1) + go func() { + defer func() { + <-w.sem + w.walking.Done() + }() + w.walk(nextPath, pathSymlinks, d) + }() + continue + + default: + // No tokens available, so traverse serially. + } + } + + w.walk(nextPath, pathSymlinks, d) + } + } +} diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go new file mode 100644 index 0000000000..89b96381cd --- /dev/null +++ b/vendor/golang.org/x/tools/internal/imports/fix.go @@ -0,0 +1,1897 @@ +// 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 imports + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "go/ast" + "go/build" + "go/parser" + "go/token" + "go/types" + "io/fs" + "io/ioutil" + "os" + "path" + "path/filepath" + "reflect" + "sort" + "strconv" + "strings" + "sync" + "unicode" + "unicode/utf8" + + "golang.org/x/tools/go/ast/astutil" + "golang.org/x/tools/internal/event" + "golang.org/x/tools/internal/gocommand" + "golang.org/x/tools/internal/gopathwalk" + "golang.org/x/tools/internal/stdlib" + "maps" +) + +// importToGroup is a list of functions which map from an import path to +// a group number. +var importToGroup = []func(localPrefix, importPath string) (num int, ok bool){ + func(localPrefix, importPath string) (num int, ok bool) { + if localPrefix == "" { + return + } + for _, p := range strings.Split(localPrefix, ",") { + if strings.HasPrefix(importPath, p) || strings.TrimSuffix(p, "/") == importPath { + return 3, true + } + } + return + }, + func(_, importPath string) (num int, ok bool) { + if strings.HasPrefix(importPath, "appengine") { + return 2, true + } + return + }, + func(_, importPath string) (num int, ok bool) { + firstComponent := strings.Split(importPath, "/")[0] + if strings.Contains(firstComponent, ".") { + return 1, true + } + return + }, +} + +func importGroup(localPrefix, importPath string) int { + for _, fn := range importToGroup { + if n, ok := fn(localPrefix, importPath); ok { + return n + } + } + return 0 +} + +type ImportFixType int + +const ( + AddImport ImportFixType = iota + DeleteImport + SetImportName +) + +type ImportFix struct { + // StmtInfo represents the import statement this fix will add, remove, or change. + StmtInfo ImportInfo + // IdentName is the identifier that this fix will add or remove. + IdentName string + // FixType is the type of fix this is (AddImport, DeleteImport, SetImportName). + FixType ImportFixType + Relevance float64 // see pkg +} + +// parseOtherFiles parses all the Go files in srcDir except filename, including +// test files if filename looks like a test. +// +// It returns an error only if ctx is cancelled. Files with parse errors are +// ignored. +func parseOtherFiles(ctx context.Context, fset *token.FileSet, srcDir, filename string) ([]*ast.File, error) { + // This could use go/packages but it doesn't buy much, and it fails + // with https://golang.org/issue/26296 in LoadFiles mode in some cases. + considerTests := strings.HasSuffix(filename, "_test.go") + + fileBase := filepath.Base(filename) + packageFileInfos, err := os.ReadDir(srcDir) + if err != nil { + return nil, ctx.Err() + } + + var files []*ast.File + for _, fi := range packageFileInfos { + if ctx.Err() != nil { + return nil, ctx.Err() + } + if fi.Name() == fileBase || !strings.HasSuffix(fi.Name(), ".go") { + continue + } + if !considerTests && strings.HasSuffix(fi.Name(), "_test.go") { + continue + } + + f, err := parser.ParseFile(fset, filepath.Join(srcDir, fi.Name()), nil, parser.SkipObjectResolution) + if err != nil { + continue + } + + files = append(files, f) + } + + return files, ctx.Err() +} + +// addGlobals puts the names of package vars into the provided map. +func addGlobals(f *ast.File, globals map[string]bool) { + for _, decl := range f.Decls { + genDecl, ok := decl.(*ast.GenDecl) + if !ok { + continue + } + + for _, spec := range genDecl.Specs { + valueSpec, ok := spec.(*ast.ValueSpec) + if !ok { + continue + } + globals[valueSpec.Names[0].Name] = true + } + } +} + +// collectReferences builds a map of selector expressions, from +// left hand side (X) to a set of right hand sides (Sel). +func collectReferences(f *ast.File) References { + refs := References{} + + var visitor visitFn + visitor = func(node ast.Node) ast.Visitor { + if node == nil { + return visitor + } + switch v := node.(type) { + case *ast.SelectorExpr: + xident, ok := v.X.(*ast.Ident) + if !ok { + break + } + if xident.Obj != nil { + // If the parser can resolve it, it's not a package ref. + break + } + if !ast.IsExported(v.Sel.Name) { + // Whatever this is, it's not exported from a package. + break + } + pkgName := xident.Name + r := refs[pkgName] + if r == nil { + r = make(map[string]bool) + refs[pkgName] = r + } + r[v.Sel.Name] = true + } + return visitor + } + ast.Walk(visitor, f) + return refs +} + +// collectImports returns all the imports in f. +// Unnamed imports (., _) and "C" are ignored. +func collectImports(f *ast.File) []*ImportInfo { + var imports []*ImportInfo + for _, imp := range f.Imports { + var name string + if imp.Name != nil { + name = imp.Name.Name + } + if imp.Path.Value == `"C"` || name == "_" || name == "." { + continue + } + path := strings.Trim(imp.Path.Value, `"`) + imports = append(imports, &ImportInfo{ + Name: name, + ImportPath: path, + }) + } + return imports +} + +// findMissingImport searches pass's candidates for an import that provides +// pkg, containing all of syms. +func (p *pass) findMissingImport(pkg string, syms map[string]bool) *ImportInfo { + for _, candidate := range p.candidates { + pkgInfo, ok := p.knownPackages[candidate.ImportPath] + if !ok { + continue + } + if p.importIdentifier(candidate) != pkg { + continue + } + + allFound := true + for right := range syms { + if !pkgInfo.Exports[right] { + allFound = false + break + } + } + + if allFound { + return candidate + } + } + return nil +} + +// A pass contains all the inputs and state necessary to fix a file's imports. +// It can be modified in some ways during use; see comments below. +type pass struct { + // Inputs. These must be set before a call to load, and not modified after. + fset *token.FileSet // fset used to parse f and its siblings. + f *ast.File // the file being fixed. + srcDir string // the directory containing f. + logf func(string, ...any) + source Source // the environment to use for go commands, etc. + loadRealPackageNames bool // if true, load package names from disk rather than guessing them. + otherFiles []*ast.File // sibling files. + goroot string + + // Intermediate state, generated by load. + existingImports map[string][]*ImportInfo + allRefs References + missingRefs References + + // Inputs to fix. These can be augmented between successive fix calls. + lastTry bool // indicates that this is the last call and fix should clean up as best it can. + candidates []*ImportInfo // candidate imports in priority order. + knownPackages map[string]*PackageInfo // information about all known packages. +} + +// loadPackageNames saves the package names for everything referenced by imports. +func (p *pass) loadPackageNames(ctx context.Context, imports []*ImportInfo) error { + if p.logf != nil { + p.logf("loading package names for %v packages", len(imports)) + defer func() { + p.logf("done loading package names for %v packages", len(imports)) + }() + } + var unknown []string + for _, imp := range imports { + if _, ok := p.knownPackages[imp.ImportPath]; ok { + continue + } + unknown = append(unknown, imp.ImportPath) + } + + names, err := p.source.LoadPackageNames(ctx, p.srcDir, unknown) + if err != nil { + return err + } + + // TODO(rfindley): revisit this. Why do we need to store known packages with + // no exports? The inconsistent data is confusing. + for path, name := range names { + p.knownPackages[path] = &PackageInfo{ + Name: name, + Exports: map[string]bool{}, + } + } + return nil +} + +// if there is a trailing major version, remove it +func withoutVersion(nm string) string { + if v := path.Base(nm); len(v) > 0 && v[0] == 'v' { + if _, err := strconv.Atoi(v[1:]); err == nil { + // this is, for instance, called with rand/v2 and returns rand + if len(v) < len(nm) { + xnm := nm[:len(nm)-len(v)-1] + return path.Base(xnm) + } + } + } + return nm +} + +// importIdentifier returns the identifier that imp will introduce. It will +// guess if the package name has not been loaded, e.g. because the source +// is not available. +func (p *pass) importIdentifier(imp *ImportInfo) string { + if imp.Name != "" { + return imp.Name + } + known := p.knownPackages[imp.ImportPath] + if known != nil && known.Name != "" { + return withoutVersion(known.Name) + } + return ImportPathToAssumedName(imp.ImportPath) +} + +// load reads in everything necessary to run a pass, and reports whether the +// file already has all the imports it needs. It fills in p.missingRefs with the +// file's missing symbols, if any, or removes unused imports if not. +func (p *pass) load(ctx context.Context) ([]*ImportFix, bool) { + p.knownPackages = map[string]*PackageInfo{} + p.missingRefs = References{} + p.existingImports = map[string][]*ImportInfo{} + + // Load basic information about the file in question. + p.allRefs = collectReferences(p.f) + + // Load stuff from other files in the same package: + // global variables so we know they don't need resolving, and imports + // that we might want to mimic. + globals := map[string]bool{} + for _, otherFile := range p.otherFiles { + // Don't load globals from files that are in the same directory + // but a different package. Using them to suggest imports is OK. + if p.f.Name.Name == otherFile.Name.Name { + addGlobals(otherFile, globals) + } + p.candidates = append(p.candidates, collectImports(otherFile)...) + } + + // Resolve all the import paths we've seen to package names, and store + // f's imports by the identifier they introduce. + imports := collectImports(p.f) + if p.loadRealPackageNames { + err := p.loadPackageNames(ctx, append(imports, p.candidates...)) + if err != nil { + if p.logf != nil { + p.logf("loading package names: %v", err) + } + return nil, false + } + } + for _, imp := range imports { + p.existingImports[p.importIdentifier(imp)] = append(p.existingImports[p.importIdentifier(imp)], imp) + } + + // Find missing references. + for left, rights := range p.allRefs { + if globals[left] { + continue + } + _, ok := p.existingImports[left] + if !ok { + p.missingRefs[left] = rights + continue + } + } + if len(p.missingRefs) != 0 { + return nil, false + } + + return p.fix() +} + +// fix attempts to satisfy missing imports using p.candidates. If it finds +// everything, or if p.lastTry is true, it updates fixes to add the imports it found, +// delete anything unused, and update import names, and returns true. +func (p *pass) fix() ([]*ImportFix, bool) { + // Find missing imports. + var selected []*ImportInfo + for left, rights := range p.missingRefs { + if imp := p.findMissingImport(left, rights); imp != nil { + selected = append(selected, imp) + } + } + + if !p.lastTry && len(selected) != len(p.missingRefs) { + return nil, false + } + + // Found everything, or giving up. Add the new imports and remove any unused. + var fixes []*ImportFix + for _, identifierImports := range p.existingImports { + for _, imp := range identifierImports { + // We deliberately ignore globals here, because we can't be sure + // they're in the same package. People do things like put multiple + // main packages in the same directory, and we don't want to + // remove imports if they happen to have the same name as a var in + // a different package. + if _, ok := p.allRefs[p.importIdentifier(imp)]; !ok { + fixes = append(fixes, &ImportFix{ + StmtInfo: *imp, + IdentName: p.importIdentifier(imp), + FixType: DeleteImport, + }) + continue + } + + // An existing import may need to update its import name to be correct. + if name := p.importSpecName(imp); name != imp.Name { + fixes = append(fixes, &ImportFix{ + StmtInfo: ImportInfo{ + Name: name, + ImportPath: imp.ImportPath, + }, + IdentName: p.importIdentifier(imp), + FixType: SetImportName, + }) + } + } + } + // Collecting fixes involved map iteration, so sort for stability. See + // golang/go#59976. + sortFixes(fixes) + + // collect selected fixes in a separate slice, so that it can be sorted + // separately. Note that these fixes must occur after fixes to existing + // imports. TODO(rfindley): figure out why. + var selectedFixes []*ImportFix + for _, imp := range selected { + selectedFixes = append(selectedFixes, &ImportFix{ + StmtInfo: ImportInfo{ + Name: p.importSpecName(imp), + ImportPath: imp.ImportPath, + }, + IdentName: p.importIdentifier(imp), + FixType: AddImport, + }) + } + sortFixes(selectedFixes) + + return append(fixes, selectedFixes...), true +} + +func sortFixes(fixes []*ImportFix) { + sort.Slice(fixes, func(i, j int) bool { + fi, fj := fixes[i], fixes[j] + if fi.StmtInfo.ImportPath != fj.StmtInfo.ImportPath { + return fi.StmtInfo.ImportPath < fj.StmtInfo.ImportPath + } + if fi.StmtInfo.Name != fj.StmtInfo.Name { + return fi.StmtInfo.Name < fj.StmtInfo.Name + } + if fi.IdentName != fj.IdentName { + return fi.IdentName < fj.IdentName + } + return fi.FixType < fj.FixType + }) +} + +// importSpecName gets the import name of imp in the import spec. +// +// When the import identifier matches the assumed import name, the import name does +// not appear in the import spec. +func (p *pass) importSpecName(imp *ImportInfo) string { + // If we did not load the real package names, or the name is already set, + // we just return the existing name. + if !p.loadRealPackageNames || imp.Name != "" { + return imp.Name + } + + ident := p.importIdentifier(imp) + if ident == ImportPathToAssumedName(imp.ImportPath) { + return "" // ident not needed since the assumed and real names are the same. + } + return ident +} + +// apply will perform the fixes on f in order. +func apply(fset *token.FileSet, f *ast.File, fixes []*ImportFix) { + for _, fix := range fixes { + switch fix.FixType { + case DeleteImport: + astutil.DeleteNamedImport(fset, f, fix.StmtInfo.Name, fix.StmtInfo.ImportPath) + case AddImport: + astutil.AddNamedImport(fset, f, fix.StmtInfo.Name, fix.StmtInfo.ImportPath) + case SetImportName: + // Find the matching import path and change the name. + for _, spec := range f.Imports { + path := strings.Trim(spec.Path.Value, `"`) + if path == fix.StmtInfo.ImportPath { + spec.Name = &ast.Ident{ + Name: fix.StmtInfo.Name, + NamePos: spec.Pos(), + } + } + } + } + } +} + +// assumeSiblingImportsValid assumes that siblings' use of packages is valid, +// adding the exports they use. +func (p *pass) assumeSiblingImportsValid() { + for _, f := range p.otherFiles { + refs := collectReferences(f) + imports := collectImports(f) + importsByName := map[string]*ImportInfo{} + for _, imp := range imports { + importsByName[p.importIdentifier(imp)] = imp + } + for left, rights := range refs { + if imp, ok := importsByName[left]; ok { + if m, ok := stdlib.PackageSymbols[imp.ImportPath]; ok { + // We have the stdlib in memory; no need to guess. + rights = symbolNameSet(m) + } + // TODO(rfindley): we should set package name here, for consistency. + p.addCandidate(imp, &PackageInfo{ + // no name; we already know it. + Exports: rights, + }) + } + } + } +} + +// addCandidate adds a candidate import to p, and merges in the information +// in pkg. +func (p *pass) addCandidate(imp *ImportInfo, pkg *PackageInfo) { + p.candidates = append(p.candidates, imp) + if existing, ok := p.knownPackages[imp.ImportPath]; ok { + if existing.Name == "" { + existing.Name = pkg.Name + } + for export := range pkg.Exports { + existing.Exports[export] = true + } + } else { + p.knownPackages[imp.ImportPath] = pkg + } +} + +// fixImports adds and removes imports from f so that all its references are +// satisfied and there are no unused imports. +// +// This is declared as a variable rather than a function so goimports can +// easily be extended by adding a file with an init function. +// +// DO NOT REMOVE: used internally at Google. +var fixImports = fixImportsDefault + +func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) error { + fixes, err := getFixes(context.Background(), fset, f, filename, env) + if err != nil { + return err + } + apply(fset, f, fixes) + return nil +} + +// getFixes gets the import fixes that need to be made to f in order to fix the imports. +// It does not modify the ast. +func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) ([]*ImportFix, error) { + source, err := NewProcessEnvSource(env, filename, f.Name.Name) + if err != nil { + return nil, err + } + goEnv, err := env.goEnv() + if err != nil { + return nil, err + } + return getFixesWithSource(ctx, fset, f, filename, goEnv["GOROOT"], env.logf, source) +} + +func getFixesWithSource(ctx context.Context, fset *token.FileSet, f *ast.File, filename string, goroot string, logf func(string, ...any), source Source) ([]*ImportFix, error) { + // This logic is defensively duplicated from getFixes. + abs, err := filepath.Abs(filename) + if err != nil { + return nil, err + } + srcDir := filepath.Dir(abs) + + if logf != nil { + logf("fixImports(filename=%q), srcDir=%q ...", filename, srcDir) + } + + // First pass: looking only at f, and using the naive algorithm to + // derive package names from import paths, see if the file is already + // complete. We can't add any imports yet, because we don't know + // if missing references are actually package vars. + p := &pass{ + fset: fset, + f: f, + srcDir: srcDir, + logf: logf, + goroot: goroot, + source: source, + } + if fixes, done := p.load(ctx); done { + return fixes, nil + } + + otherFiles, err := parseOtherFiles(ctx, fset, srcDir, filename) + if err != nil { + return nil, err + } + + // Second pass: add information from other files in the same package, + // like their package vars and imports. + p.otherFiles = otherFiles + if fixes, done := p.load(ctx); done { + return fixes, nil + } + + // Now we can try adding imports from the stdlib. + p.assumeSiblingImportsValid() + addStdlibCandidates(p, p.missingRefs) + if fixes, done := p.fix(); done { + return fixes, nil + } + + // Third pass: get real package names where we had previously used + // the naive algorithm. + p = &pass{ + fset: fset, + f: f, + srcDir: srcDir, + logf: logf, + goroot: goroot, + source: p.source, // safe to reuse, as it's just a wrapper around env + } + p.loadRealPackageNames = true + p.otherFiles = otherFiles + if fixes, done := p.load(ctx); done { + return fixes, nil + } + + if err := addStdlibCandidates(p, p.missingRefs); err != nil { + return nil, err + } + p.assumeSiblingImportsValid() + if fixes, done := p.fix(); done { + return fixes, nil + } + + // Go look for candidates in $GOPATH, etc. We don't necessarily load + // the real exports of sibling imports, so keep assuming their contents. + if err := addExternalCandidates(ctx, p, p.missingRefs, filename); err != nil { + return nil, err + } + + p.lastTry = true + fixes, _ := p.fix() + return fixes, nil +} + +// MaxRelevance is the highest relevance, used for the standard library. +// Chosen arbitrarily to match pre-existing gopls code. +const MaxRelevance = 7.0 + +// getCandidatePkgs works with the passed callback to find all acceptable packages. +// It deduplicates by import path, and uses a cached stdlib rather than reading +// from disk. +func getCandidatePkgs(ctx context.Context, wrappedCallback *scanCallback, filename, filePkg string, env *ProcessEnv) error { + notSelf := func(p *pkg) bool { + return p.packageName != filePkg || p.dir != filepath.Dir(filename) + } + goenv, err := env.goEnv() + if err != nil { + return err + } + + var mu sync.Mutex // to guard asynchronous access to dupCheck + dupCheck := map[string]struct{}{} + + // Start off with the standard library. + for importPath, symbols := range stdlib.PackageSymbols { + p := &pkg{ + dir: filepath.Join(goenv["GOROOT"], "src", importPath), + importPathShort: importPath, + packageName: path.Base(importPath), + relevance: MaxRelevance, + } + dupCheck[importPath] = struct{}{} + if notSelf(p) && wrappedCallback.dirFound(p) && wrappedCallback.packageNameLoaded(p) { + var exports []stdlib.Symbol + for _, sym := range symbols { + switch sym.Kind { + case stdlib.Func, stdlib.Type, stdlib.Var, stdlib.Const: + exports = append(exports, sym) + } + } + wrappedCallback.exportsLoaded(p, exports) + } + } + + scanFilter := &scanCallback{ + rootFound: func(root gopathwalk.Root) bool { + // Exclude goroot results -- getting them is relatively expensive, not cached, + // and generally redundant with the in-memory version. + return root.Type != gopathwalk.RootGOROOT && wrappedCallback.rootFound(root) + }, + dirFound: wrappedCallback.dirFound, + packageNameLoaded: func(pkg *pkg) bool { + mu.Lock() + defer mu.Unlock() + if _, ok := dupCheck[pkg.importPathShort]; ok { + return false + } + dupCheck[pkg.importPathShort] = struct{}{} + return notSelf(pkg) && wrappedCallback.packageNameLoaded(pkg) + }, + exportsLoaded: func(pkg *pkg, exports []stdlib.Symbol) { + // If we're an x_test, load the package under test's test variant. + if strings.HasSuffix(filePkg, "_test") && pkg.dir == filepath.Dir(filename) { + var err error + _, exports, err = loadExportsFromFiles(ctx, env, pkg.dir, true) + if err != nil { + return + } + } + wrappedCallback.exportsLoaded(pkg, exports) + }, + } + resolver, err := env.GetResolver() + if err != nil { + return err + } + return resolver.scan(ctx, scanFilter) +} + +func ScoreImportPaths(ctx context.Context, env *ProcessEnv, paths []string) (map[string]float64, error) { + result := make(map[string]float64) + resolver, err := env.GetResolver() + if err != nil { + return nil, err + } + for _, path := range paths { + result[path] = resolver.scoreImportPath(ctx, path) + } + return result, nil +} + +func PrimeCache(ctx context.Context, resolver Resolver) error { + // Fully scan the disk for directories, but don't actually read any Go files. + callback := &scanCallback{ + rootFound: func(root gopathwalk.Root) bool { + // See getCandidatePkgs: walking GOROOT is apparently expensive and + // unnecessary. + return root.Type != gopathwalk.RootGOROOT + }, + dirFound: func(pkg *pkg) bool { + return false + }, + // packageNameLoaded and exportsLoaded must never be called. + } + + return resolver.scan(ctx, callback) +} + +func candidateImportName(pkg *pkg) string { + if ImportPathToAssumedName(pkg.importPathShort) != pkg.packageName { + return pkg.packageName + } + return "" +} + +// GetAllCandidates calls wrapped for each package whose name starts with +// searchPrefix, and can be imported from filename with the package name filePkg. +// +// Beware that the wrapped function may be called multiple times concurrently. +// TODO(adonovan): encapsulate the concurrency. +func GetAllCandidates(ctx context.Context, wrapped func(ImportFix), searchPrefix, filename, filePkg string, env *ProcessEnv) error { + callback := &scanCallback{ + rootFound: func(gopathwalk.Root) bool { + return true + }, + dirFound: func(pkg *pkg) bool { + if !CanUse(filename, pkg.dir) { + return false + } + // Try the assumed package name first, then a simpler path match + // in case of packages named vN, which are not uncommon. + return strings.HasPrefix(ImportPathToAssumedName(pkg.importPathShort), searchPrefix) || + strings.HasPrefix(path.Base(pkg.importPathShort), searchPrefix) + }, + packageNameLoaded: func(pkg *pkg) bool { + if !strings.HasPrefix(pkg.packageName, searchPrefix) { + return false + } + wrapped(ImportFix{ + StmtInfo: ImportInfo{ + ImportPath: pkg.importPathShort, + Name: candidateImportName(pkg), + }, + IdentName: pkg.packageName, + FixType: AddImport, + Relevance: pkg.relevance, + }) + return false + }, + } + return getCandidatePkgs(ctx, callback, filename, filePkg, env) +} + +// GetImportPaths calls wrapped for each package whose import path starts with +// searchPrefix, and can be imported from filename with the package name filePkg. +func GetImportPaths(ctx context.Context, wrapped func(ImportFix), searchPrefix, filename, filePkg string, env *ProcessEnv) error { + callback := &scanCallback{ + rootFound: func(gopathwalk.Root) bool { + return true + }, + dirFound: func(pkg *pkg) bool { + if !CanUse(filename, pkg.dir) { + return false + } + return strings.HasPrefix(pkg.importPathShort, searchPrefix) + }, + packageNameLoaded: func(pkg *pkg) bool { + wrapped(ImportFix{ + StmtInfo: ImportInfo{ + ImportPath: pkg.importPathShort, + Name: candidateImportName(pkg), + }, + IdentName: pkg.packageName, + FixType: AddImport, + Relevance: pkg.relevance, + }) + return false + }, + } + return getCandidatePkgs(ctx, callback, filename, filePkg, env) +} + +// A PackageExport is a package and its exports. +type PackageExport struct { + Fix *ImportFix + Exports []stdlib.Symbol +} + +// GetPackageExports returns all known packages with name pkg and their exports. +func GetPackageExports(ctx context.Context, wrapped func(PackageExport), searchPkg, filename, filePkg string, env *ProcessEnv) error { + callback := &scanCallback{ + rootFound: func(gopathwalk.Root) bool { + return true + }, + dirFound: func(pkg *pkg) bool { + return pkgIsCandidate(filename, References{searchPkg: nil}, pkg) + }, + packageNameLoaded: func(pkg *pkg) bool { + return pkg.packageName == searchPkg + }, + exportsLoaded: func(pkg *pkg, exports []stdlib.Symbol) { + sortSymbols(exports) + wrapped(PackageExport{ + Fix: &ImportFix{ + StmtInfo: ImportInfo{ + ImportPath: pkg.importPathShort, + Name: candidateImportName(pkg), + }, + IdentName: pkg.packageName, + FixType: AddImport, + Relevance: pkg.relevance, + }, + Exports: exports, + }) + }, + } + return getCandidatePkgs(ctx, callback, filename, filePkg, env) +} + +// TODO(rfindley): we should depend on GOOS and GOARCH, to provide accurate +// imports when doing cross-platform development. +var requiredGoEnvVars = []string{ + "GO111MODULE", + "GOFLAGS", + "GOINSECURE", + "GOMOD", + "GOMODCACHE", + "GONOPROXY", + "GONOSUMDB", + "GOPATH", + "GOPROXY", + "GOROOT", + "GOSUMDB", + "GOWORK", +} + +// ProcessEnv contains environment variables and settings that affect the use of +// the go command, the go/build package, etc. +// +// ...a ProcessEnv *also* overwrites its Env along with derived state in the +// form of the resolver. And because it is lazily initialized, an env may just +// be broken and unusable, but there is no way for the caller to detect that: +// all queries will just fail. +// +// TODO(rfindley): refactor this package so that this type (perhaps renamed to +// just Env or Config) is an immutable configuration struct, to be exchanged +// for an initialized object via a constructor that returns an error. Perhaps +// the signature should be `func NewResolver(*Env) (*Resolver, error)`, where +// resolver is a concrete type used for resolving imports. Via this +// refactoring, we can avoid the need to call ProcessEnv.init and +// ProcessEnv.GoEnv everywhere, and implicitly fix all the places where this +// these are misused. Also, we'd delegate the caller the decision of how to +// handle a broken environment. +type ProcessEnv struct { + GocmdRunner *gocommand.Runner + + BuildFlags []string + ModFlag string + + // SkipPathInScan returns true if the path should be skipped from scans of + // the RootCurrentModule root type. The function argument is a clean, + // absolute path. + SkipPathInScan func(string) bool + + // Env overrides the OS environment, and can be used to specify + // GOPROXY, GO111MODULE, etc. PATH cannot be set here, because + // exec.Command will not honor it. + // Specifying all of requiredGoEnvVars avoids a call to `go env`. + Env map[string]string + + WorkingDir string + + // If Logf is non-nil, debug logging is enabled through this function. + Logf func(format string, args ...any) + + // If set, ModCache holds a shared cache of directory info to use across + // multiple ProcessEnvs. + ModCache *DirInfoCache + + initialized bool // see TODO above + + // resolver and resolverErr are lazily evaluated (see GetResolver). + // This is unclean, but see the big TODO in the docstring for ProcessEnv + // above: for now, we can't be sure that the ProcessEnv is fully initialized. + resolver Resolver + resolverErr error +} + +func (e *ProcessEnv) goEnv() (map[string]string, error) { + if err := e.init(); err != nil { + return nil, err + } + return e.Env, nil +} + +func (e *ProcessEnv) matchFile(dir, name string) (bool, error) { + bctx, err := e.buildContext() + if err != nil { + return false, err + } + return bctx.MatchFile(dir, name) +} + +// CopyConfig copies the env's configuration into a new env. +func (e *ProcessEnv) CopyConfig() *ProcessEnv { + copy := &ProcessEnv{ + GocmdRunner: e.GocmdRunner, + initialized: e.initialized, + BuildFlags: e.BuildFlags, + Logf: e.Logf, + WorkingDir: e.WorkingDir, + resolver: nil, + Env: map[string]string{}, + } + maps.Copy(copy.Env, e.Env) + return copy +} + +func (e *ProcessEnv) init() error { + if e.initialized { + return nil + } + + foundAllRequired := true + for _, k := range requiredGoEnvVars { + if _, ok := e.Env[k]; !ok { + foundAllRequired = false + break + } + } + if foundAllRequired { + e.initialized = true + return nil + } + + if e.Env == nil { + e.Env = map[string]string{} + } + + goEnv := map[string]string{} + stdout, err := e.invokeGo(context.TODO(), "env", append([]string{"-json"}, requiredGoEnvVars...)...) + if err != nil { + return err + } + if err := json.Unmarshal(stdout.Bytes(), &goEnv); err != nil { + return err + } + maps.Copy(e.Env, goEnv) + e.initialized = true + return nil +} + +func (e *ProcessEnv) env() []string { + var env []string // the gocommand package will prepend os.Environ. + for k, v := range e.Env { + env = append(env, k+"="+v) + } + return env +} + +func (e *ProcessEnv) GetResolver() (Resolver, error) { + if err := e.init(); err != nil { + return nil, err + } + + if e.resolver == nil && e.resolverErr == nil { + // TODO(rfindley): we should only use a gopathResolver here if the working + // directory is actually *in* GOPATH. (I seem to recall an open gopls issue + // for this behavior, but I can't find it). + // + // For gopls, we can optionally explicitly choose a resolver type, since we + // already know the view type. + if e.Env["GOMOD"] == "" && (e.Env["GOWORK"] == "" || e.Env["GOWORK"] == "off") { + e.resolver = newGopathResolver(e) + e.logf("created gopath resolver") + } else if r, err := newModuleResolver(e, e.ModCache); err != nil { + e.resolverErr = err + e.logf("failed to create module resolver: %v", err) + } else { + e.resolver = Resolver(r) + e.logf("created module resolver") + } + } + + return e.resolver, e.resolverErr +} + +// logf logs if e.Logf is non-nil. +func (e *ProcessEnv) logf(format string, args ...any) { + if e.Logf != nil { + e.Logf(format, args...) + } +} + +// buildContext returns the build.Context to use for matching files. +// +// TODO(rfindley): support dynamic GOOS, GOARCH here, when doing cross-platform +// development. +func (e *ProcessEnv) buildContext() (*build.Context, error) { + ctx := build.Default + goenv, err := e.goEnv() + if err != nil { + return nil, err + } + ctx.GOROOT = goenv["GOROOT"] + ctx.GOPATH = goenv["GOPATH"] + + // As of Go 1.14, build.Context has a Dir field + // (see golang.org/issue/34860). + // Populate it only if present. + rc := reflect.ValueOf(&ctx).Elem() + dir := rc.FieldByName("Dir") + if dir.IsValid() && dir.Kind() == reflect.String { + dir.SetString(e.WorkingDir) + } + + // Since Go 1.11, go/build.Context.Import may invoke 'go list' depending on + // the value in GO111MODULE in the process's environment. We always want to + // run in GOPATH mode when calling Import, so we need to prevent this from + // happening. In Go 1.16, GO111MODULE defaults to "on", so this problem comes + // up more frequently. + // + // HACK: setting any of the Context I/O hooks prevents Import from invoking + // 'go list', regardless of GO111MODULE. This is undocumented, but it's + // unlikely to change before GOPATH support is removed. + ctx.ReadDir = ioutil.ReadDir + + return &ctx, nil +} + +func (e *ProcessEnv) invokeGo(ctx context.Context, verb string, args ...string) (*bytes.Buffer, error) { + inv := gocommand.Invocation{ + Verb: verb, + Args: args, + BuildFlags: e.BuildFlags, + Env: e.env(), + Logf: e.Logf, + WorkingDir: e.WorkingDir, + } + return e.GocmdRunner.Run(ctx, inv) +} + +func addStdlibCandidates(pass *pass, refs References) error { + localbase := func(nm string) string { + ans := path.Base(nm) + if ans[0] == 'v' { + // this is called, for instance, with math/rand/v2 and returns rand/v2 + if _, err := strconv.Atoi(ans[1:]); err == nil { + ix := strings.LastIndex(nm, ans) + more := path.Base(nm[:ix]) + ans = path.Join(more, ans) + } + } + return ans + } + add := func(pkg string) { + // Prevent self-imports. + if path.Base(pkg) == pass.f.Name.Name && filepath.Join(pass.goroot, "src", pkg) == pass.srcDir { + return + } + exports := symbolNameSet(stdlib.PackageSymbols[pkg]) + pass.addCandidate( + &ImportInfo{ImportPath: pkg}, + &PackageInfo{Name: localbase(pkg), Exports: exports}) + } + for left := range refs { + if left == "rand" { + // Make sure we try crypto/rand before any version of math/rand as both have Int() + // and our policy is to recommend crypto + add("crypto/rand") + // if the user's no later than go1.21, this should be "math/rand" + // but we have no way of figuring out what the user is using + // TODO: investigate using the toolchain version to disambiguate in the stdlib + add("math/rand/v2") + // math/rand has an overlapping API + // TestIssue66407 fails without this + add("math/rand") + continue + } + for importPath := range stdlib.PackageSymbols { + if path.Base(importPath) == left { + add(importPath) + } + } + } + return nil +} + +// A Resolver does the build-system-specific parts of goimports. +type Resolver interface { + // loadPackageNames loads the package names in importPaths. + loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) + + // scan works with callback to search for packages. See scanCallback for details. + scan(ctx context.Context, callback *scanCallback) error + + // loadExports returns the package name and set of exported symbols in the + // package at dir. loadExports may be called concurrently. + loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []stdlib.Symbol, error) + + // scoreImportPath returns the relevance for an import path. + scoreImportPath(ctx context.Context, path string) float64 + + // ClearForNewScan returns a new Resolver based on the receiver that has + // cleared its internal caches of directory contents. + // + // The new resolver should be primed and then set via + // [ProcessEnv.UpdateResolver]. + ClearForNewScan() Resolver +} + +// A scanCallback controls a call to scan and receives its results. +// In general, minor errors will be silently discarded; a user should not +// expect to receive a full series of calls for everything. +type scanCallback struct { + // rootFound is called before scanning a new root dir. If it returns true, + // the root will be scanned. Returning false will not necessarily prevent + // directories from that root making it to dirFound. + rootFound func(gopathwalk.Root) bool + // dirFound is called when a directory is found that is possibly a Go package. + // pkg will be populated with everything except packageName. + // If it returns true, the package's name will be loaded. + dirFound func(pkg *pkg) bool + // packageNameLoaded is called when a package is found and its name is loaded. + // If it returns true, the package's exports will be loaded. + packageNameLoaded func(pkg *pkg) bool + // exportsLoaded is called when a package's exports have been loaded. + exportsLoaded func(pkg *pkg, exports []stdlib.Symbol) +} + +func addExternalCandidates(ctx context.Context, pass *pass, refs References, filename string) error { + ctx, done := event.Start(ctx, "imports.addExternalCandidates") + defer done() + + results, err := pass.source.ResolveReferences(ctx, filename, refs) + if err != nil { + return err + } + + for _, result := range results { + if result == nil { + continue + } + // Don't offer completions that would shadow predeclared + // names, such as github.com/coreos/etcd/error. + if types.Universe.Lookup(result.Package.Name) != nil { // predeclared + // Ideally we would skip this candidate only + // if the predeclared name is actually + // referenced by the file, but that's a lot + // trickier to compute and would still create + // an import that is likely to surprise the + // user before long. + continue + } + pass.addCandidate(result.Import, result.Package) + } + return nil +} + +// notIdentifier reports whether ch is an invalid identifier character. +func notIdentifier(ch rune) bool { + return !('a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || + '0' <= ch && ch <= '9' || + ch == '_' || + ch >= utf8.RuneSelf && (unicode.IsLetter(ch) || unicode.IsDigit(ch))) +} + +// ImportPathToAssumedName returns the assumed package name of an import path. +// It does this using only string parsing of the import path. +// It picks the last element of the path that does not look like a major +// version, and then picks the valid identifier off the start of that element. +// It is used to determine if a local rename should be added to an import for +// clarity. +// This function could be moved to a standard package and exported if we want +// for use in other tools. +func ImportPathToAssumedName(importPath string) string { + base := path.Base(importPath) + if strings.HasPrefix(base, "v") { + if _, err := strconv.Atoi(base[1:]); err == nil { + dir := path.Dir(importPath) + if dir != "." { + base = path.Base(dir) + } + } + } + base = strings.TrimPrefix(base, "go-") + if i := strings.IndexFunc(base, notIdentifier); i >= 0 { + base = base[:i] + } + return base +} + +// gopathResolver implements resolver for GOPATH workspaces. +type gopathResolver struct { + env *ProcessEnv + walked bool + cache *DirInfoCache + scanSema chan struct{} // scanSema prevents concurrent scans. +} + +func newGopathResolver(env *ProcessEnv) *gopathResolver { + r := &gopathResolver{ + env: env, + cache: NewDirInfoCache(), + scanSema: make(chan struct{}, 1), + } + r.scanSema <- struct{}{} + return r +} + +func (r *gopathResolver) ClearForNewScan() Resolver { + return newGopathResolver(r.env) +} + +func (r *gopathResolver) loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) { + names := map[string]string{} + bctx, err := r.env.buildContext() + if err != nil { + return nil, err + } + for _, path := range importPaths { + names[path] = importPathToName(bctx, path, srcDir) + } + return names, nil +} + +// importPathToName finds out the actual package name, as declared in its .go files. +func importPathToName(bctx *build.Context, importPath, srcDir string) string { + // Fast path for standard library without going to disk. + if stdlib.HasPackage(importPath) { + return path.Base(importPath) // stdlib packages always match their paths. + } + + buildPkg, err := bctx.Import(importPath, srcDir, build.FindOnly) + if err != nil { + return "" + } + pkgName, err := packageDirToName(buildPkg.Dir) + if err != nil { + return "" + } + return pkgName +} + +// packageDirToName is a faster version of build.Import if +// the only thing desired is the package name. Given a directory, +// packageDirToName then only parses one file in the package, +// trusting that the files in the directory are consistent. +func packageDirToName(dir string) (packageName string, err error) { + d, err := os.Open(dir) + if err != nil { + return "", err + } + names, err := d.Readdirnames(-1) + d.Close() + if err != nil { + return "", err + } + sort.Strings(names) // to have predictable behavior + var lastErr error + var nfile int + for _, name := range names { + if !strings.HasSuffix(name, ".go") { + continue + } + if strings.HasSuffix(name, "_test.go") { + continue + } + nfile++ + fullFile := filepath.Join(dir, name) + + fset := token.NewFileSet() + f, err := parser.ParseFile(fset, fullFile, nil, parser.PackageClauseOnly) + if err != nil { + lastErr = err + continue + } + pkgName := f.Name.Name + if pkgName == "documentation" { + // Special case from go/build.ImportDir, not + // handled by ctx.MatchFile. + continue + } + if pkgName == "main" { + // Also skip package main, assuming it's a +build ignore generator or example. + // Since you can't import a package main anyway, there's no harm here. + continue + } + return pkgName, nil + } + if lastErr != nil { + return "", lastErr + } + return "", fmt.Errorf("no importable package found in %d Go files", nfile) +} + +type pkg struct { + dir string // absolute file path to pkg directory ("/usr/lib/go/src/net/http") + importPathShort string // vendorless import path ("net/http", "a/b") + packageName string // package name loaded from source if requested + relevance float64 // a weakly-defined score of how relevant a package is. 0 is most relevant. +} + +type pkgDistance struct { + pkg *pkg + distance int // relative distance to target +} + +// byDistanceOrImportPathShortLength sorts by relative distance breaking ties +// on the short import path length and then the import string itself. +type byDistanceOrImportPathShortLength []pkgDistance + +func (s byDistanceOrImportPathShortLength) Len() int { return len(s) } +func (s byDistanceOrImportPathShortLength) Less(i, j int) bool { + di, dj := s[i].distance, s[j].distance + if di == -1 { + return false + } + if dj == -1 { + return true + } + if di != dj { + return di < dj + } + + vi, vj := s[i].pkg.importPathShort, s[j].pkg.importPathShort + if len(vi) != len(vj) { + return len(vi) < len(vj) + } + return vi < vj +} +func (s byDistanceOrImportPathShortLength) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +func distance(basepath, targetpath string) int { + p, err := filepath.Rel(basepath, targetpath) + if err != nil { + return -1 + } + if p == "." { + return 0 + } + return strings.Count(p, string(filepath.Separator)) + 1 +} + +func (r *gopathResolver) scan(ctx context.Context, callback *scanCallback) error { + add := func(root gopathwalk.Root, dir string) { + // We assume cached directories have not changed. We can skip them and their + // children. + if _, ok := r.cache.Load(dir); ok { + return + } + + importpath := filepath.ToSlash(dir[len(root.Path)+len("/"):]) + info := directoryPackageInfo{ + status: directoryScanned, + dir: dir, + rootType: root.Type, + nonCanonicalImportPath: VendorlessPath(importpath), + } + r.cache.Store(dir, info) + } + processDir := func(info directoryPackageInfo) { + // Skip this directory if we were not able to get the package information successfully. + if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil { + return + } + + p := &pkg{ + importPathShort: info.nonCanonicalImportPath, + dir: info.dir, + relevance: MaxRelevance - 1, + } + if info.rootType == gopathwalk.RootGOROOT { + p.relevance = MaxRelevance + } + + if !callback.dirFound(p) { + return + } + var err error + p.packageName, err = r.cache.CachePackageName(info) + if err != nil { + return + } + + if !callback.packageNameLoaded(p) { + return + } + if _, exports, err := r.loadExports(ctx, p, false); err == nil { + callback.exportsLoaded(p, exports) + } + } + stop := r.cache.ScanAndListen(ctx, processDir) + defer stop() + + goenv, err := r.env.goEnv() + if err != nil { + return err + } + var roots []gopathwalk.Root + roots = append(roots, gopathwalk.Root{Path: filepath.Join(goenv["GOROOT"], "src"), Type: gopathwalk.RootGOROOT}) + for _, p := range filepath.SplitList(goenv["GOPATH"]) { + roots = append(roots, gopathwalk.Root{Path: filepath.Join(p, "src"), Type: gopathwalk.RootGOPATH}) + } + // The callback is not necessarily safe to use in the goroutine below. Process roots eagerly. + roots = filterRoots(roots, callback.rootFound) + // We can't cancel walks, because we need them to finish to have a usable + // cache. Instead, run them in a separate goroutine and detach. + scanDone := make(chan struct{}) + go func() { + select { + case <-ctx.Done(): + return + case <-r.scanSema: + } + defer func() { r.scanSema <- struct{}{} }() + gopathwalk.Walk(roots, add, gopathwalk.Options{Logf: r.env.Logf, ModulesEnabled: false}) + close(scanDone) + }() + select { + case <-ctx.Done(): + case <-scanDone: + } + return nil +} + +func (r *gopathResolver) scoreImportPath(ctx context.Context, path string) float64 { + if stdlib.HasPackage(path) { + return MaxRelevance + } + return MaxRelevance - 1 +} + +func filterRoots(roots []gopathwalk.Root, include func(gopathwalk.Root) bool) []gopathwalk.Root { + var result []gopathwalk.Root + for _, root := range roots { + if !include(root) { + continue + } + result = append(result, root) + } + return result +} + +func (r *gopathResolver) loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []stdlib.Symbol, error) { + if info, ok := r.cache.Load(pkg.dir); ok && !includeTest { + return r.cache.CacheExports(ctx, r.env, info) + } + return loadExportsFromFiles(ctx, r.env, pkg.dir, includeTest) +} + +// VendorlessPath returns the devendorized version of the import path ipath. +// For example, VendorlessPath("foo/bar/vendor/a/b") returns "a/b". +func VendorlessPath(ipath string) string { + // Devendorize for use in import statement. + if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 { + return ipath[i+len("/vendor/"):] + } + if strings.HasPrefix(ipath, "vendor/") { + return ipath[len("vendor/"):] + } + return ipath +} + +func loadExportsFromFiles(ctx context.Context, env *ProcessEnv, dir string, includeTest bool) (string, []stdlib.Symbol, error) { + // Look for non-test, buildable .go files which could provide exports. + all, err := os.ReadDir(dir) + if err != nil { + return "", nil, err + } + var files []fs.DirEntry + for _, fi := range all { + name := fi.Name() + if !strings.HasSuffix(name, ".go") || (!includeTest && strings.HasSuffix(name, "_test.go")) { + continue + } + match, err := env.matchFile(dir, fi.Name()) + if err != nil || !match { + continue + } + files = append(files, fi) + } + + if len(files) == 0 { + return "", nil, fmt.Errorf("dir %v contains no buildable, non-test .go files", dir) + } + + var pkgName string + var exports []stdlib.Symbol + fset := token.NewFileSet() + for _, fi := range files { + select { + case <-ctx.Done(): + return "", nil, ctx.Err() + default: + } + + fullFile := filepath.Join(dir, fi.Name()) + // Legacy ast.Object resolution is needed here. + f, err := parser.ParseFile(fset, fullFile, nil, 0) + if err != nil { + env.logf("error parsing %v: %v", fullFile, err) + continue + } + if f.Name.Name == "documentation" { + // Special case from go/build.ImportDir, not + // handled by MatchFile above. + continue + } + if includeTest && strings.HasSuffix(f.Name.Name, "_test") { + // x_test package. We want internal test files only. + continue + } + pkgName = f.Name.Name + for name, obj := range f.Scope.Objects { + if ast.IsExported(name) { + var kind stdlib.Kind + switch obj.Kind { + case ast.Con: + kind = stdlib.Const + case ast.Typ: + kind = stdlib.Type + case ast.Var: + kind = stdlib.Var + case ast.Fun: + kind = stdlib.Func + } + exports = append(exports, stdlib.Symbol{ + Name: name, + Kind: kind, + Version: 0, // unknown; be permissive + }) + } + } + } + sortSymbols(exports) + + env.logf("loaded exports in dir %v (package %v): %v", dir, pkgName, exports) + return pkgName, exports, nil +} + +func sortSymbols(syms []stdlib.Symbol) { + sort.Slice(syms, func(i, j int) bool { + return syms[i].Name < syms[j].Name + }) +} + +// A symbolSearcher searches for a package with a set of symbols, among a set +// of candidates. See [symbolSearcher.search]. +// +// The search occurs within the scope of a single file, with context captured +// in srcDir and xtest. +type symbolSearcher struct { + logf func(string, ...any) + srcDir string // directory containing the file + xtest bool // if set, the file containing is an x_test file + loadExports func(ctx context.Context, pkg *pkg, includeTest bool) (string, []stdlib.Symbol, error) +} + +// search searches the provided candidates for a package containing all +// exported symbols. +// +// If successful, returns the resulting package. +func (s *symbolSearcher) search(ctx context.Context, candidates []pkgDistance, pkgName string, symbols map[string]bool) (*pkg, error) { + // Sort the candidates by their import package length, + // assuming that shorter package names are better than long + // ones. Note that this sorts by the de-vendored name, so + // there's no "penalty" for vendoring. + sort.Sort(byDistanceOrImportPathShortLength(candidates)) + if s.logf != nil { + for i, c := range candidates { + s.logf("%s candidate %d/%d: %v in %v", pkgName, i+1, len(candidates), c.pkg.importPathShort, c.pkg.dir) + } + } + + // Arrange rescv so that we can we can await results in order of relevance + // and exit as soon as we find the first match. + // + // Search with bounded concurrency, returning as soon as the first result + // among rescv is non-nil. + rescv := make([]chan *pkg, len(candidates)) + for i := range candidates { + rescv[i] = make(chan *pkg, 1) + } + const maxConcurrentPackageImport = 4 + loadExportsSem := make(chan struct{}, maxConcurrentPackageImport) + + // Ensure that all work is completed at exit. + ctx, cancel := context.WithCancel(ctx) + var wg sync.WaitGroup + defer func() { + cancel() + wg.Wait() + }() + + // Start the search. + wg.Add(1) + go func() { + defer wg.Done() + for i, c := range candidates { + select { + case loadExportsSem <- struct{}{}: + case <-ctx.Done(): + return + } + + i := i + c := c + wg.Add(1) + go func() { + defer func() { + <-loadExportsSem + wg.Done() + }() + if s.logf != nil { + s.logf("loading exports in dir %s (seeking package %s)", c.pkg.dir, pkgName) + } + pkg, err := s.searchOne(ctx, c, symbols) + if err != nil { + if s.logf != nil && ctx.Err() == nil { + s.logf("loading exports in dir %s (seeking package %s): %v", c.pkg.dir, pkgName, err) + } + pkg = nil + } + rescv[i] <- pkg // may be nil + }() + } + }() + + // Await the first (best) result. + for _, resc := range rescv { + select { + case r := <-resc: + if r != nil { + return r, nil + } + case <-ctx.Done(): + return nil, ctx.Err() + } + } + return nil, nil +} + +func (s *symbolSearcher) searchOne(ctx context.Context, c pkgDistance, symbols map[string]bool) (*pkg, error) { + if ctx.Err() != nil { + return nil, ctx.Err() + } + // If we're considering the package under test from an x_test, load the + // test variant. + includeTest := s.xtest && c.pkg.dir == s.srcDir + _, exports, err := s.loadExports(ctx, c.pkg, includeTest) + if err != nil { + return nil, err + } + + exportsMap := make(map[string]bool, len(exports)) + for _, sym := range exports { + exportsMap[sym.Name] = true + } + for symbol := range symbols { + if !exportsMap[symbol] { + return nil, nil // no match + } + } + return c.pkg, nil +} + +// pkgIsCandidate reports whether pkg is a candidate for satisfying the +// finding which package pkgIdent in the file named by filename is trying +// to refer to. +// +// This check is purely lexical and is meant to be as fast as possible +// because it's run over all $GOPATH directories to filter out poor +// candidates in order to limit the CPU and I/O later parsing the +// exports in candidate packages. +// +// filename is the file being formatted. +// pkgIdent is the package being searched for, like "client" (if +// searching for "client.New") +func pkgIsCandidate(filename string, refs References, pkg *pkg) bool { + // Check "internal" and "vendor" visibility: + if !CanUse(filename, pkg.dir) { + return false + } + + // Speed optimization to minimize disk I/O: + // + // Use the matchesPath heuristic to filter to package paths that could + // reasonably match a dangling reference. + // + // This permits mismatch naming like directory "go-foo" being package "foo", + // or "pkg.v3" being "pkg", or directory + // "google.golang.org/api/cloudbilling/v1" being package "cloudbilling", but + // doesn't permit a directory "foo" to be package "bar", which is strongly + // discouraged anyway. There's no reason goimports needs to be slow just to + // accommodate that. + for pkgIdent := range refs { + if matchesPath(pkgIdent, pkg.importPathShort) { + return true + } + } + return false +} + +// CanUse reports whether the package in dir is usable from filename, +// respecting the Go "internal" and "vendor" visibility rules. +func CanUse(filename, dir string) bool { + // Fast path check, before any allocations. If it doesn't contain vendor + // or internal, it's not tricky: + // Note that this can false-negative on directories like "notinternal", + // but we check it correctly below. This is just a fast path. + if !strings.Contains(dir, "vendor") && !strings.Contains(dir, "internal") { + return true + } + + dirSlash := filepath.ToSlash(dir) + if !strings.Contains(dirSlash, "/vendor/") && !strings.Contains(dirSlash, "/internal/") && !strings.HasSuffix(dirSlash, "/internal") { + return true + } + // Vendor or internal directory only visible from children of parent. + // That means the path from the current directory to the target directory + // can contain ../vendor or ../internal but not ../foo/vendor or ../foo/internal + // or bar/vendor or bar/internal. + // After stripping all the leading ../, the only okay place to see vendor or internal + // is at the very beginning of the path. + absfile, err := filepath.Abs(filename) + if err != nil { + return false + } + absdir, err := filepath.Abs(dir) + if err != nil { + return false + } + rel, err := filepath.Rel(absfile, absdir) + if err != nil { + return false + } + relSlash := filepath.ToSlash(rel) + if i := strings.LastIndex(relSlash, "../"); i >= 0 { + relSlash = relSlash[i+len("../"):] + } + return !strings.Contains(relSlash, "/vendor/") && !strings.Contains(relSlash, "/internal/") && !strings.HasSuffix(relSlash, "/internal") +} + +// matchesPath reports whether ident may match a potential package name +// referred to by path, using heuristics to filter out unidiomatic package +// names. +// +// Specifically, it checks whether either of the last two '/'- or '\'-delimited +// path segments matches the identifier. The segment-matching heuristic must +// allow for various conventions around segment naming, including go-foo, +// foo-go, and foo.v3. To handle all of these, matching considers both (1) the +// entire segment, ignoring '-' and '.', as well as (2) the last subsegment +// separated by '-' or '.'. So the segment foo-go matches all of the following +// identifiers: foo, go, and foogo. All matches are case insensitive (for ASCII +// identifiers). +// +// See the docstring for [pkgIsCandidate] for an explanation of how this +// heuristic filters potential candidate packages. +func matchesPath(ident, path string) bool { + // Ignore case, for ASCII. + lowerIfASCII := func(b byte) byte { + if 'A' <= b && b <= 'Z' { + return b + ('a' - 'A') + } + return b + } + + // match reports whether path[start:end] matches ident, ignoring [.-]. + match := func(start, end int) bool { + ii := len(ident) - 1 // current byte in ident + pi := end - 1 // current byte in path + for ; pi >= start && ii >= 0; pi-- { + pb := path[pi] + if pb == '-' || pb == '.' { + continue + } + pb = lowerIfASCII(pb) + ib := lowerIfASCII(ident[ii]) + if pb != ib { + return false + } + ii-- + } + return ii < 0 && pi < start // all bytes matched + } + + // segmentEnd and subsegmentEnd hold the end points of the current segment + // and subsegment intervals. + segmentEnd := len(path) + subsegmentEnd := len(path) + + // Count slashes; we only care about the last two segments. + nslash := 0 + + for i := len(path) - 1; i >= 0; i-- { + switch b := path[i]; b { + // TODO(rfindley): we handle backlashes here only because the previous + // heuristic handled backslashes. This is perhaps overly defensive, but is + // the result of many lessons regarding Chesterton's fence and the + // goimports codebase. + // + // However, this function is only ever called with something called an + // 'importPath'. Is it possible that this is a real import path, and + // therefore we need only consider forward slashes? + case '/', '\\': + if match(i+1, segmentEnd) || match(i+1, subsegmentEnd) { + return true + } + nslash++ + if nslash == 2 { + return false // did not match above + } + segmentEnd, subsegmentEnd = i, i // reset + case '-', '.': + if match(i+1, subsegmentEnd) { + return true + } + subsegmentEnd = i + } + } + return match(0, segmentEnd) || match(0, subsegmentEnd) +} + +type visitFn func(node ast.Node) ast.Visitor + +func (fn visitFn) Visit(node ast.Node) ast.Visitor { + return fn(node) +} + +func symbolNameSet(symbols []stdlib.Symbol) map[string]bool { + names := make(map[string]bool) + for _, sym := range symbols { + switch sym.Kind { + case stdlib.Const, stdlib.Var, stdlib.Type, stdlib.Func: + names[sym.Name] = true + } + } + return names +} diff --git a/vendor/golang.org/x/tools/internal/imports/imports.go b/vendor/golang.org/x/tools/internal/imports/imports.go new file mode 100644 index 0000000000..2215a12880 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/imports/imports.go @@ -0,0 +1,359 @@ +// 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 imports implements a Go pretty-printer (like package "go/format") +// that also adds or removes import statements as necessary. +package imports + +import ( + "bufio" + "bytes" + "context" + "fmt" + "go/ast" + "go/format" + "go/parser" + "go/printer" + "go/token" + "io" + "regexp" + "strconv" + "strings" + + "golang.org/x/tools/go/ast/astutil" + "golang.org/x/tools/internal/event" +) + +// Options is golang.org/x/tools/imports.Options with extra internal-only options. +type Options struct { + Env *ProcessEnv // The environment to use. Note: this contains the cached module and filesystem state. + + // LocalPrefix is a comma-separated string of import path prefixes, which, if + // set, instructs Process to sort the import paths with the given prefixes + // into another group after 3rd-party packages. + LocalPrefix string + + Fragment bool // Accept fragment of a source file (no package statement) + AllErrors bool // Report all errors (not just the first 10 on different lines) + + Comments bool // Print comments (true if nil *Options provided) + TabIndent bool // Use tabs for indent (true if nil *Options provided) + TabWidth int // Tab width (8 if nil *Options provided) + + FormatOnly bool // Disable the insertion and deletion of imports +} + +// Process implements golang.org/x/tools/imports.Process with explicit context in opt.Env. +func Process(filename string, src []byte, opt *Options) (formatted []byte, err error) { + fileSet := token.NewFileSet() + var parserMode parser.Mode + if opt.Comments { + parserMode |= parser.ParseComments + } + if opt.AllErrors { + parserMode |= parser.AllErrors + } + file, adjust, err := parse(fileSet, filename, src, parserMode, opt.Fragment) + if err != nil { + return nil, err + } + + if !opt.FormatOnly { + if err := fixImports(fileSet, file, filename, opt.Env); err != nil { + return nil, err + } + } + return formatFile(fileSet, file, src, adjust, opt) +} + +// FixImports returns a list of fixes to the imports that, when applied, +// will leave the imports in the same state as Process. src and opt must +// be specified. +// +// Note that filename's directory influences which imports can be chosen, +// so it is important that filename be accurate. +func FixImports(ctx context.Context, filename string, src []byte, goroot string, logf func(string, ...any), source Source) (fixes []*ImportFix, err error) { + ctx, done := event.Start(ctx, "imports.FixImports") + defer done() + + fileSet := token.NewFileSet() + // TODO(rfindley): these default values for ParseComments and AllErrors were + // extracted from gopls, but are they even needed? + file, _, err := parse(fileSet, filename, src, parser.ParseComments|parser.AllErrors, true) + if err != nil { + return nil, err + } + + return getFixesWithSource(ctx, fileSet, file, filename, goroot, logf, source) +} + +// ApplyFixes applies all of the fixes to the file and formats it. extraMode +// is added in when parsing the file. src and opts must be specified, but no +// env is needed. +func ApplyFixes(fixes []*ImportFix, filename string, src []byte, opt *Options, extraMode parser.Mode) (formatted []byte, err error) { + // Don't use parse() -- we don't care about fragments or statement lists + // here, and we need to work with unparseable files. + fileSet := token.NewFileSet() + parserMode := parser.SkipObjectResolution + if opt.Comments { + parserMode |= parser.ParseComments + } + if opt.AllErrors { + parserMode |= parser.AllErrors + } + parserMode |= extraMode + + file, err := parser.ParseFile(fileSet, filename, src, parserMode) + if file == nil { + return nil, err + } + + // Apply the fixes to the file. + apply(fileSet, file, fixes) + + return formatFile(fileSet, file, src, nil, opt) +} + +// formatFile formats the file syntax tree. +// It may mutate the token.FileSet and the ast.File. +// +// If an adjust function is provided, it is called after formatting +// with the original source (formatFile's src parameter) and the +// formatted file, and returns the postpocessed result. +func formatFile(fset *token.FileSet, file *ast.File, src []byte, adjust func(orig []byte, src []byte) []byte, opt *Options) ([]byte, error) { + mergeImports(file) + sortImports(opt.LocalPrefix, fset.File(file.FileStart), file) + var spacesBefore []string // import paths we need spaces before + for _, impSection := range astutil.Imports(fset, file) { + // Within each block of contiguous imports, see if any + // import lines are in different group numbers. If so, + // we'll need to put a space between them so it's + // compatible with gofmt. + lastGroup := -1 + for _, importSpec := range impSection { + importPath, _ := strconv.Unquote(importSpec.Path.Value) + groupNum := importGroup(opt.LocalPrefix, importPath) + if groupNum != lastGroup && lastGroup != -1 { + spacesBefore = append(spacesBefore, importPath) + } + lastGroup = groupNum + } + + } + + printerMode := printer.UseSpaces + if opt.TabIndent { + printerMode |= printer.TabIndent + } + printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth} + + var buf bytes.Buffer + err := printConfig.Fprint(&buf, fset, file) + if err != nil { + return nil, err + } + out := buf.Bytes() + if adjust != nil { + out = adjust(src, out) + } + if len(spacesBefore) > 0 { + out, err = addImportSpaces(bytes.NewReader(out), spacesBefore) + if err != nil { + return nil, err + } + } + + out, err = format.Source(out) + if err != nil { + return nil, err + } + return out, nil +} + +// parse parses src, which was read from filename, +// as a Go source file or statement list. +func parse(fset *token.FileSet, filename string, src []byte, parserMode parser.Mode, fragment bool) (*ast.File, func(orig, src []byte) []byte, error) { + if parserMode&parser.SkipObjectResolution != 0 { + panic("legacy ast.Object resolution is required") + } + + // Try as whole source file. + file, err := parser.ParseFile(fset, filename, src, parserMode) + if err == nil { + return file, nil, nil + } + // If the error is that the source file didn't begin with a + // package line and we accept fragmented input, fall through to + // try as a source fragment. Stop and return on any other error. + if !fragment || !strings.Contains(err.Error(), "expected 'package'") { + return nil, nil, err + } + + // If this is a declaration list, make it a source file + // by inserting a package clause. + // Insert using a ;, not a newline, so that parse errors are on + // the correct line. + const prefix = "package main;" + psrc := append([]byte(prefix), src...) + file, err = parser.ParseFile(fset, filename, psrc, parserMode) + if err == nil { + // Gofmt will turn the ; into a \n. + // Do that ourselves now and update the file contents, + // so that positions and line numbers are correct going forward. + psrc[len(prefix)-1] = '\n' + fset.File(file.Package).SetLinesForContent(psrc) + + // If a main function exists, we will assume this is a main + // package and leave the file. + if containsMainFunc(file) { + return file, nil, nil + } + + adjust := func(orig, src []byte) []byte { + // Remove the package clause. + src = src[len(prefix):] + return matchSpace(orig, src) + } + return file, adjust, nil + } + // If the error is that the source file didn't begin with a + // declaration, fall through to try as a statement list. + // Stop and return on any other error. + if !strings.Contains(err.Error(), "expected declaration") { + return nil, nil, err + } + + // If this is a statement list, make it a source file + // by inserting a package clause and turning the list + // into a function body. This handles expressions too. + // Insert using a ;, not a newline, so that the line numbers + // in fsrc match the ones in src. + fsrc := append(append([]byte("package p; func _() {"), src...), '}') + file, err = parser.ParseFile(fset, filename, fsrc, parserMode) + if err == nil { + adjust := func(orig, src []byte) []byte { + // Remove the wrapping. + // Gofmt has turned the ; into a \n\n. + src = src[len("package p\n\nfunc _() {"):] + src = src[:len(src)-len("}\n")] + // Gofmt has also indented the function body one level. + // Remove that indent. + src = bytes.ReplaceAll(src, []byte("\n\t"), []byte("\n")) + return matchSpace(orig, src) + } + return file, adjust, nil + } + + // Failed, and out of options. + return nil, nil, err +} + +// containsMainFunc checks if a file contains a function declaration with the +// function signature 'func main()' +func containsMainFunc(file *ast.File) bool { + for _, decl := range file.Decls { + if f, ok := decl.(*ast.FuncDecl); ok { + if f.Name.Name != "main" { + continue + } + + if len(f.Type.Params.List) != 0 { + continue + } + + if f.Type.Results != nil && len(f.Type.Results.List) != 0 { + continue + } + + return true + } + } + + return false +} + +func cutSpace(b []byte) (before, middle, after []byte) { + i := 0 + for i < len(b) && (b[i] == ' ' || b[i] == '\t' || b[i] == '\n') { + i++ + } + j := len(b) + for j > 0 && (b[j-1] == ' ' || b[j-1] == '\t' || b[j-1] == '\n') { + j-- + } + if i <= j { + return b[:i], b[i:j], b[j:] + } + return nil, nil, b[j:] +} + +// matchSpace reformats src to use the same space context as orig. +// 1. If orig begins with blank lines, matchSpace inserts them at the beginning of src. +// 2. matchSpace copies the indentation of the first non-blank line in orig +// to every non-blank line in src. +// 3. matchSpace copies the trailing space from orig and uses it in place +// of src's trailing space. +func matchSpace(orig []byte, src []byte) []byte { + before, _, after := cutSpace(orig) + i := bytes.LastIndex(before, []byte{'\n'}) + before, indent := before[:i+1], before[i+1:] + + _, src, _ = cutSpace(src) + + var b bytes.Buffer + b.Write(before) + for len(src) > 0 { + line := src + if i := bytes.IndexByte(line, '\n'); i >= 0 { + line, src = line[:i+1], line[i+1:] + } else { + src = nil + } + if len(line) > 0 && line[0] != '\n' { // not blank + b.Write(indent) + } + b.Write(line) + } + b.Write(after) + return b.Bytes() +} + +var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+?)"`) + +func addImportSpaces(r io.Reader, breaks []string) ([]byte, error) { + var out bytes.Buffer + in := bufio.NewReader(r) + inImports := false + done := false + for { + s, err := in.ReadString('\n') + if err == io.EOF { + break + } else if err != nil { + return nil, err + } + + if !inImports && !done && strings.HasPrefix(s, "import") { + inImports = true + } + if inImports && (strings.HasPrefix(s, "var") || + strings.HasPrefix(s, "func") || + strings.HasPrefix(s, "const") || + strings.HasPrefix(s, "type")) { + done = true + inImports = false + } + if inImports && len(breaks) > 0 { + if m := impLine.FindStringSubmatch(s); m != nil { + if m[1] == breaks[0] { + out.WriteByte('\n') + breaks = breaks[1:] + } + } + } + + fmt.Fprint(&out, s) + } + return out.Bytes(), nil +} diff --git a/vendor/golang.org/x/tools/internal/imports/mod.go b/vendor/golang.org/x/tools/internal/imports/mod.go new file mode 100644 index 0000000000..df94ec8186 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/imports/mod.go @@ -0,0 +1,841 @@ +// Copyright 2019 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 imports + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "os" + "path" + "path/filepath" + "regexp" + "slices" + "sort" + "strconv" + "strings" + + "golang.org/x/mod/module" + "golang.org/x/tools/internal/event" + "golang.org/x/tools/internal/gocommand" + "golang.org/x/tools/internal/gopathwalk" + "golang.org/x/tools/internal/stdlib" +) + +// Notes(rfindley): ModuleResolver appears to be heavily optimized for scanning +// as fast as possible, which is desirable for a call to goimports from the +// command line, but it doesn't work as well for gopls, where it suffers from +// slow startup (golang/go#44863) and intermittent hanging (golang/go#59216), +// both caused by populating the cache, albeit in slightly different ways. +// +// A high level list of TODOs: +// - Optimize the scan itself, as there is some redundancy statting and +// reading go.mod files. +// - Invert the relationship between ProcessEnv and Resolver (see the +// docstring of ProcessEnv). +// - Make it easier to use an external resolver implementation. +// +// Smaller TODOs are annotated in the code below. + +// ModuleResolver implements the Resolver interface for a workspace using +// modules. +// +// A goal of the ModuleResolver is to invoke the Go command as little as +// possible. To this end, it runs the Go command only for listing module +// information (i.e. `go list -m -e -json ...`). Package scanning, the process +// of loading package information for the modules, is implemented internally +// via the scan method. +// +// It has two types of state: the state derived from the go command, which +// is populated by init, and the state derived from scans, which is populated +// via scan. A root is considered scanned if it has been walked to discover +// directories. However, if the scan did not require additional information +// from the directory (such as package name or exports), the directory +// information itself may be partially populated. It will be lazily filled in +// as needed by scans, using the scanCallback. +type ModuleResolver struct { + env *ProcessEnv + + // Module state, populated during construction + dummyVendorMod *gocommand.ModuleJSON // if vendoring is enabled, a pseudo-module to represent the /vendor directory + moduleCacheDir string // GOMODCACHE, inferred from GOPATH if unset + roots []gopathwalk.Root // roots to scan, in approximate order of importance + mains []*gocommand.ModuleJSON // main modules + mainByDir map[string]*gocommand.ModuleJSON // module information by dir, to join with roots + modsByModPath []*gocommand.ModuleJSON // all modules, ordered by # of path components in their module path + modsByDir []*gocommand.ModuleJSON // ...or by the number of path components in their Dir. + + // Scanning state, populated by scan + + // scanSema prevents concurrent scans, and guards scannedRoots and the cache + // fields below (though the caches themselves are concurrency safe). + // Receive to acquire, send to release. + scanSema chan struct{} + scannedRoots map[gopathwalk.Root]bool // if true, root has been walked + + // Caches of directory info, populated by scans and scan callbacks + // + // moduleCacheCache stores cached information about roots in the module + // cache, which are immutable and therefore do not need to be invalidated. + // + // otherCache stores information about all other roots (even GOROOT), which + // may change. + moduleCacheCache *DirInfoCache + otherCache *DirInfoCache +} + +// newModuleResolver returns a new module-aware goimports resolver. +// +// Note: use caution when modifying this constructor: changes must also be +// reflected in ModuleResolver.ClearForNewScan. +func newModuleResolver(e *ProcessEnv, moduleCacheCache *DirInfoCache) (*ModuleResolver, error) { + r := &ModuleResolver{ + env: e, + scanSema: make(chan struct{}, 1), + } + r.scanSema <- struct{}{} // release + + goenv, err := r.env.goEnv() + if err != nil { + return nil, err + } + + // TODO(rfindley): can we refactor to share logic with r.env.invokeGo? + inv := gocommand.Invocation{ + BuildFlags: r.env.BuildFlags, + ModFlag: r.env.ModFlag, + Env: r.env.env(), + Logf: r.env.Logf, + WorkingDir: r.env.WorkingDir, + } + + vendorEnabled := false + var mainModVendor *gocommand.ModuleJSON // for module vendoring + var mainModsVendor []*gocommand.ModuleJSON // for workspace vendoring + + goWork := r.env.Env["GOWORK"] + if len(goWork) == 0 { + // TODO(rfindley): VendorEnabled runs the go command to get GOFLAGS, but + // they should be available from the ProcessEnv. Can we avoid the redundant + // invocation? + vendorEnabled, mainModVendor, err = gocommand.VendorEnabled(context.TODO(), inv, r.env.GocmdRunner) + if err != nil { + return nil, err + } + } else { + vendorEnabled, mainModsVendor, err = gocommand.WorkspaceVendorEnabled(context.Background(), inv, r.env.GocmdRunner) + if err != nil { + return nil, err + } + } + + if vendorEnabled { + if mainModVendor != nil { + // Module vendor mode is on, so all the non-Main modules are irrelevant, + // and we need to search /vendor for everything. + r.mains = []*gocommand.ModuleJSON{mainModVendor} + r.dummyVendorMod = &gocommand.ModuleJSON{ + Path: "", + Dir: filepath.Join(mainModVendor.Dir, "vendor"), + } + r.modsByModPath = []*gocommand.ModuleJSON{mainModVendor, r.dummyVendorMod} + r.modsByDir = []*gocommand.ModuleJSON{mainModVendor, r.dummyVendorMod} + } else { + // Workspace vendor mode is on, so all the non-Main modules are irrelevant, + // and we need to search /vendor for everything. + r.mains = mainModsVendor + r.dummyVendorMod = &gocommand.ModuleJSON{ + Path: "", + Dir: filepath.Join(filepath.Dir(goWork), "vendor"), + } + r.modsByModPath = append(slices.Clone(mainModsVendor), r.dummyVendorMod) + r.modsByDir = append(slices.Clone(mainModsVendor), r.dummyVendorMod) + } + } else { + // Vendor mode is off, so run go list -m ... to find everything. + err := r.initAllMods() + // We expect an error when running outside of a module with + // GO111MODULE=on. Other errors are fatal. + if err != nil { + if errMsg := err.Error(); !strings.Contains(errMsg, "working directory is not part of a module") && !strings.Contains(errMsg, "go.mod file not found") { + return nil, err + } + } + } + + r.moduleCacheDir = gomodcacheForEnv(goenv) + if r.moduleCacheDir == "" { + return nil, fmt.Errorf("cannot resolve GOMODCACHE") + } + + sort.Slice(r.modsByModPath, func(i, j int) bool { + count := func(x int) int { + return strings.Count(r.modsByModPath[x].Path, "/") + } + return count(j) < count(i) // descending order + }) + sort.Slice(r.modsByDir, func(i, j int) bool { + count := func(x int) int { + return strings.Count(r.modsByDir[x].Dir, string(filepath.Separator)) + } + return count(j) < count(i) // descending order + }) + + r.roots = []gopathwalk.Root{} + if goenv["GOROOT"] != "" { // "" happens in tests + r.roots = append(r.roots, gopathwalk.Root{Path: filepath.Join(goenv["GOROOT"], "/src"), Type: gopathwalk.RootGOROOT}) + } + r.mainByDir = make(map[string]*gocommand.ModuleJSON) + for _, main := range r.mains { + r.roots = append(r.roots, gopathwalk.Root{Path: main.Dir, Type: gopathwalk.RootCurrentModule}) + r.mainByDir[main.Dir] = main + } + if vendorEnabled { + r.roots = append(r.roots, gopathwalk.Root{Path: r.dummyVendorMod.Dir, Type: gopathwalk.RootOther}) + } else { + addDep := func(mod *gocommand.ModuleJSON) { + if mod.Replace == nil { + // This is redundant with the cache, but we'll skip it cheaply enough + // when we encounter it in the module cache scan. + // + // Including it at a lower index in r.roots than the module cache dir + // helps prioritize matches from within existing dependencies. + r.roots = append(r.roots, gopathwalk.Root{Path: mod.Dir, Type: gopathwalk.RootModuleCache}) + } else { + r.roots = append(r.roots, gopathwalk.Root{Path: mod.Dir, Type: gopathwalk.RootOther}) + } + } + // Walk dependent modules before scanning the full mod cache, direct deps first. + for _, mod := range r.modsByModPath { + if !mod.Indirect && !mod.Main { + addDep(mod) + } + } + for _, mod := range r.modsByModPath { + if mod.Indirect && !mod.Main { + addDep(mod) + } + } + // If provided, share the moduleCacheCache. + // + // TODO(rfindley): The module cache is immutable. However, the loaded + // exports do depend on GOOS and GOARCH. Fortunately, the + // ProcessEnv.buildContext does not adjust these from build.DefaultContext + // (even though it should). So for now, this is OK to share, but we need to + // add logic for handling GOOS/GOARCH. + r.moduleCacheCache = moduleCacheCache + r.roots = append(r.roots, gopathwalk.Root{Path: r.moduleCacheDir, Type: gopathwalk.RootModuleCache}) + } + + r.scannedRoots = map[gopathwalk.Root]bool{} + if r.moduleCacheCache == nil { + r.moduleCacheCache = NewDirInfoCache() + } + r.otherCache = NewDirInfoCache() + return r, nil +} + +// gomodcacheForEnv returns the GOMODCACHE value to use based on the given env +// map, which must have GOMODCACHE and GOPATH populated. +// +// TODO(rfindley): this is defensive refactoring. +// 1. Is this even relevant anymore? Can't we just read GOMODCACHE. +// 2. Use this to separate module cache scanning from other scanning. +func gomodcacheForEnv(goenv map[string]string) string { + if gmc := goenv["GOMODCACHE"]; gmc != "" { + // golang/go#67156: ensure that the module cache is clean, since it is + // assumed as a prefix to directories scanned by gopathwalk, which are + // themselves clean. + return filepath.Clean(gmc) + } + gopaths := filepath.SplitList(goenv["GOPATH"]) + if len(gopaths) == 0 { + return "" + } + return filepath.Join(gopaths[0], "/pkg/mod") +} + +func (r *ModuleResolver) initAllMods() error { + stdout, err := r.env.invokeGo(context.TODO(), "list", "-m", "-e", "-json", "...") + if err != nil { + return err + } + for dec := json.NewDecoder(stdout); dec.More(); { + mod := &gocommand.ModuleJSON{} + if err := dec.Decode(mod); err != nil { + return err + } + if mod.Dir == "" { + r.env.logf("module %v has not been downloaded and will be ignored", mod.Path) + // Can't do anything with a module that's not downloaded. + continue + } + // golang/go#36193: the go command doesn't always clean paths. + mod.Dir = filepath.Clean(mod.Dir) + r.modsByModPath = append(r.modsByModPath, mod) + r.modsByDir = append(r.modsByDir, mod) + if mod.Main { + r.mains = append(r.mains, mod) + } + } + return nil +} + +// ClearForNewScan invalidates the last scan. +// +// It preserves the set of roots, but forgets about the set of directories. +// Though it forgets the set of module cache directories, it remembers their +// contents, since they are assumed to be immutable. +func (r *ModuleResolver) ClearForNewScan() Resolver { + <-r.scanSema // acquire r, to guard scannedRoots + r2 := &ModuleResolver{ + env: r.env, + dummyVendorMod: r.dummyVendorMod, + moduleCacheDir: r.moduleCacheDir, + roots: r.roots, + mains: r.mains, + mainByDir: r.mainByDir, + modsByModPath: r.modsByModPath, + + scanSema: make(chan struct{}, 1), + scannedRoots: make(map[gopathwalk.Root]bool), + otherCache: NewDirInfoCache(), + moduleCacheCache: r.moduleCacheCache, + } + r2.scanSema <- struct{}{} // r2 must start released + // Invalidate root scans. We don't need to invalidate module cache roots, + // because they are immutable. + // (We don't support a use case where GOMODCACHE is cleaned in the middle of + // e.g. a gopls session: the user must restart gopls to get accurate + // imports.) + // + // Scanning for new directories in GOMODCACHE should be handled elsewhere, + // via a call to ScanModuleCache. + for _, root := range r.roots { + if root.Type == gopathwalk.RootModuleCache && r.scannedRoots[root] { + r2.scannedRoots[root] = true + } + } + r.scanSema <- struct{}{} // release r + return r2 +} + +// ClearModuleInfo invalidates resolver state that depends on go.mod file +// contents (essentially, the output of go list -m -json ...). +// +// Notably, it does not forget directory contents, which are reset +// asynchronously via ClearForNewScan. +// +// If the ProcessEnv is a GOPATH environment, ClearModuleInfo is a no op. +// +// TODO(rfindley): move this to a new env.go, consolidating ProcessEnv methods. +func (e *ProcessEnv) ClearModuleInfo() { + if r, ok := e.resolver.(*ModuleResolver); ok { + resolver, err := newModuleResolver(e, e.ModCache) + if err != nil { + e.resolver = nil + e.resolverErr = err + return + } + + <-r.scanSema // acquire (guards caches) + resolver.moduleCacheCache = r.moduleCacheCache + resolver.otherCache = r.otherCache + r.scanSema <- struct{}{} // release + + e.UpdateResolver(resolver) + } +} + +// UpdateResolver sets the resolver for the ProcessEnv to use in imports +// operations. Only for use with the result of [Resolver.ClearForNewScan]. +// +// TODO(rfindley): this awkward API is a result of the (arguably) inverted +// relationship between configuration and state described in the doc comment +// for [ProcessEnv]. +func (e *ProcessEnv) UpdateResolver(r Resolver) { + e.resolver = r + e.resolverErr = nil +} + +// findPackage returns the module and directory from within the main modules +// and their dependencies that contains the package at the given import path, +// or returns nil, "" if no module is in scope. +func (r *ModuleResolver) findPackage(importPath string) (*gocommand.ModuleJSON, string) { + // This can't find packages in the stdlib, but that's harmless for all + // the existing code paths. + for _, m := range r.modsByModPath { + if !strings.HasPrefix(importPath, m.Path) { + continue + } + pathInModule := importPath[len(m.Path):] + pkgDir := filepath.Join(m.Dir, pathInModule) + if r.dirIsNestedModule(pkgDir, m) { + continue + } + + if info, ok := r.cacheLoad(pkgDir); ok { + if loaded, err := info.reachedStatus(nameLoaded); loaded { + if err != nil { + continue // No package in this dir. + } + return m, pkgDir + } + if scanned, err := info.reachedStatus(directoryScanned); scanned && err != nil { + continue // Dir is unreadable, etc. + } + // This is slightly wrong: a directory doesn't have to have an + // importable package to count as a package for package-to-module + // resolution. package main or _test files should count but + // don't. + // TODO(heschi): fix this. + if _, err := r.cachePackageName(info); err == nil { + return m, pkgDir + } + } + + // Not cached. Read the filesystem. + pkgFiles, err := os.ReadDir(pkgDir) + if err != nil { + continue + } + // A module only contains a package if it has buildable go + // files in that directory. If not, it could be provided by an + // outer module. See #29736. + for _, fi := range pkgFiles { + if ok, _ := r.env.matchFile(pkgDir, fi.Name()); ok { + return m, pkgDir + } + } + } + return nil, "" +} + +func (r *ModuleResolver) cacheLoad(dir string) (directoryPackageInfo, bool) { + if info, ok := r.moduleCacheCache.Load(dir); ok { + return info, ok + } + return r.otherCache.Load(dir) +} + +func (r *ModuleResolver) cacheStore(info directoryPackageInfo) { + if info.rootType == gopathwalk.RootModuleCache { + r.moduleCacheCache.Store(info.dir, info) + } else { + r.otherCache.Store(info.dir, info) + } +} + +// cachePackageName caches the package name for a dir already in the cache. +func (r *ModuleResolver) cachePackageName(info directoryPackageInfo) (string, error) { + if info.rootType == gopathwalk.RootModuleCache { + return r.moduleCacheCache.CachePackageName(info) + } + return r.otherCache.CachePackageName(info) +} + +func (r *ModuleResolver) cacheExports(ctx context.Context, env *ProcessEnv, info directoryPackageInfo) (string, []stdlib.Symbol, error) { + if info.rootType == gopathwalk.RootModuleCache { + return r.moduleCacheCache.CacheExports(ctx, env, info) + } + return r.otherCache.CacheExports(ctx, env, info) +} + +// findModuleByDir returns the module that contains dir, or nil if no such +// module is in scope. +func (r *ModuleResolver) findModuleByDir(dir string) *gocommand.ModuleJSON { + // This is quite tricky and may not be correct. dir could be: + // - a package in the main module. + // - a replace target underneath the main module's directory. + // - a nested module in the above. + // - a replace target somewhere totally random. + // - a nested module in the above. + // - in the mod cache. + // - in /vendor/ in -mod=vendor mode. + // - nested module? Dunno. + // Rumor has it that replace targets cannot contain other replace targets. + // + // Note that it is critical here that modsByDir is sorted to have deeper dirs + // first. This ensures that findModuleByDir finds the innermost module. + // See also golang/go#56291. + for _, m := range r.modsByDir { + if !strings.HasPrefix(dir, m.Dir) { + continue + } + + if r.dirIsNestedModule(dir, m) { + continue + } + + return m + } + return nil +} + +// dirIsNestedModule reports if dir is contained in a nested module underneath +// mod, not actually in mod. +func (r *ModuleResolver) dirIsNestedModule(dir string, mod *gocommand.ModuleJSON) bool { + if !strings.HasPrefix(dir, mod.Dir) { + return false + } + if r.dirInModuleCache(dir) { + // Nested modules in the module cache are pruned, + // so it cannot be a nested module. + return false + } + if mod != nil && mod == r.dummyVendorMod { + // The /vendor pseudomodule is flattened and doesn't actually count. + return false + } + modDir, _ := r.modInfo(dir) + if modDir == "" { + return false + } + return modDir != mod.Dir +} + +func readModName(modFile string) string { + modBytes, err := os.ReadFile(modFile) + if err != nil { + return "" + } + return modulePath(modBytes) +} + +func (r *ModuleResolver) modInfo(dir string) (modDir, modName string) { + if r.dirInModuleCache(dir) { + if matches := modCacheRegexp.FindStringSubmatch(dir); len(matches) == 3 { + index := strings.Index(dir, matches[1]+"@"+matches[2]) + modDir := filepath.Join(dir[:index], matches[1]+"@"+matches[2]) + return modDir, readModName(filepath.Join(modDir, "go.mod")) + } + } + for { + if info, ok := r.cacheLoad(dir); ok { + return info.moduleDir, info.moduleName + } + f := filepath.Join(dir, "go.mod") + info, err := os.Stat(f) + if err == nil && !info.IsDir() { + return dir, readModName(f) + } + + d := filepath.Dir(dir) + if len(d) >= len(dir) { + return "", "" // reached top of file system, no go.mod + } + dir = d + } +} + +func (r *ModuleResolver) dirInModuleCache(dir string) bool { + if r.moduleCacheDir == "" { + return false + } + return strings.HasPrefix(dir, r.moduleCacheDir) +} + +func (r *ModuleResolver) loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) { + names := map[string]string{} + for _, path := range importPaths { + // TODO(rfindley): shouldn't this use the dirInfoCache? + _, packageDir := r.findPackage(path) + if packageDir == "" { + continue + } + name, err := packageDirToName(packageDir) + if err != nil { + continue + } + names[path] = name + } + return names, nil +} + +func (r *ModuleResolver) scan(ctx context.Context, callback *scanCallback) error { + ctx, done := event.Start(ctx, "imports.ModuleResolver.scan") + defer done() + + processDir := func(info directoryPackageInfo) { + // Skip this directory if we were not able to get the package information successfully. + if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil { + return + } + pkg, err := r.canonicalize(info) + if err != nil { + return + } + if !callback.dirFound(pkg) { + return + } + + pkg.packageName, err = r.cachePackageName(info) + if err != nil { + return + } + if !callback.packageNameLoaded(pkg) { + return + } + + _, exports, err := r.loadExports(ctx, pkg, false) + if err != nil { + return + } + callback.exportsLoaded(pkg, exports) + } + + // Start processing everything in the cache, and listen for the new stuff + // we discover in the walk below. + stop1 := r.moduleCacheCache.ScanAndListen(ctx, processDir) + defer stop1() + stop2 := r.otherCache.ScanAndListen(ctx, processDir) + defer stop2() + + // We assume cached directories are fully cached, including all their + // children, and have not changed. We can skip them. + skip := func(root gopathwalk.Root, dir string) bool { + if r.env.SkipPathInScan != nil && root.Type == gopathwalk.RootCurrentModule { + if root.Path == dir { + return false + } + + if r.env.SkipPathInScan(filepath.Clean(dir)) { + return true + } + } + + info, ok := r.cacheLoad(dir) + if !ok { + return false + } + // This directory can be skipped as long as we have already scanned it. + // Packages with errors will continue to have errors, so there is no need + // to rescan them. + packageScanned, _ := info.reachedStatus(directoryScanned) + return packageScanned + } + + add := func(root gopathwalk.Root, dir string) { + r.cacheStore(r.scanDirForPackage(root, dir)) + } + + // r.roots and the callback are not necessarily safe to use in the + // goroutine below. Process them eagerly. + roots := filterRoots(r.roots, callback.rootFound) + // We can't cancel walks, because we need them to finish to have a usable + // cache. Instead, run them in a separate goroutine and detach. + scanDone := make(chan struct{}) + go func() { + select { + case <-ctx.Done(): + return + case <-r.scanSema: // acquire + } + defer func() { r.scanSema <- struct{}{} }() // release + // We have the lock on r.scannedRoots, and no other scans can run. + for _, root := range roots { + if ctx.Err() != nil { + return + } + + if r.scannedRoots[root] { + continue + } + gopathwalk.WalkSkip([]gopathwalk.Root{root}, add, skip, gopathwalk.Options{Logf: r.env.Logf, ModulesEnabled: true}) + r.scannedRoots[root] = true + } + close(scanDone) + }() + select { + case <-ctx.Done(): + case <-scanDone: + } + return nil +} + +func (r *ModuleResolver) scoreImportPath(ctx context.Context, path string) float64 { + if stdlib.HasPackage(path) { + return MaxRelevance + } + mod, _ := r.findPackage(path) + return modRelevance(mod) +} + +func modRelevance(mod *gocommand.ModuleJSON) float64 { + var relevance float64 + switch { + case mod == nil: // out of scope + return MaxRelevance - 4 + case mod.Indirect: + relevance = MaxRelevance - 3 + case !mod.Main: + relevance = MaxRelevance - 2 + default: + relevance = MaxRelevance - 1 // main module ties with stdlib + } + + _, versionString, ok := module.SplitPathVersion(mod.Path) + if ok { + index := strings.Index(versionString, "v") + if index == -1 { + return relevance + } + if versionNumber, err := strconv.ParseFloat(versionString[index+1:], 64); err == nil { + relevance += versionNumber / 1000 + } + } + + return relevance +} + +// canonicalize gets the result of canonicalizing the packages using the results +// of initializing the resolver from 'go list -m'. +func (r *ModuleResolver) canonicalize(info directoryPackageInfo) (*pkg, error) { + // Packages in GOROOT are already canonical, regardless of the std/cmd modules. + if info.rootType == gopathwalk.RootGOROOT { + return &pkg{ + importPathShort: info.nonCanonicalImportPath, + dir: info.dir, + packageName: path.Base(info.nonCanonicalImportPath), + relevance: MaxRelevance, + }, nil + } + + importPath := info.nonCanonicalImportPath + mod := r.findModuleByDir(info.dir) + // Check if the directory is underneath a module that's in scope. + if mod != nil { + // It is. If dir is the target of a replace directive, + // our guessed import path is wrong. Use the real one. + if mod.Dir == info.dir { + importPath = mod.Path + } else { + dirInMod := info.dir[len(mod.Dir)+len("/"):] + importPath = path.Join(mod.Path, filepath.ToSlash(dirInMod)) + } + } else if !strings.HasPrefix(importPath, info.moduleName) { + // The module's name doesn't match the package's import path. It + // probably needs a replace directive we don't have. + return nil, fmt.Errorf("package in %q is not valid without a replace statement", info.dir) + } + + res := &pkg{ + importPathShort: importPath, + dir: info.dir, + relevance: modRelevance(mod), + } + // We may have discovered a package that has a different version + // in scope already. Canonicalize to that one if possible. + if _, canonicalDir := r.findPackage(importPath); canonicalDir != "" { + res.dir = canonicalDir + } + return res, nil +} + +func (r *ModuleResolver) loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []stdlib.Symbol, error) { + if info, ok := r.cacheLoad(pkg.dir); ok && !includeTest { + return r.cacheExports(ctx, r.env, info) + } + return loadExportsFromFiles(ctx, r.env, pkg.dir, includeTest) +} + +func (r *ModuleResolver) scanDirForPackage(root gopathwalk.Root, dir string) directoryPackageInfo { + subdir := "" + if prefix := root.Path + string(filepath.Separator); strings.HasPrefix(dir, prefix) { + subdir = dir[len(prefix):] + } + importPath := filepath.ToSlash(subdir) + if strings.HasPrefix(importPath, "vendor/") { + // Only enter vendor directories if they're explicitly requested as a root. + return directoryPackageInfo{ + status: directoryScanned, + err: fmt.Errorf("unwanted vendor directory"), + } + } + switch root.Type { + case gopathwalk.RootCurrentModule: + importPath = path.Join(r.mainByDir[root.Path].Path, filepath.ToSlash(subdir)) + case gopathwalk.RootModuleCache: + matches := modCacheRegexp.FindStringSubmatch(subdir) + if len(matches) == 0 { + return directoryPackageInfo{ + status: directoryScanned, + err: fmt.Errorf("invalid module cache path: %v", subdir), + } + } + modPath, err := module.UnescapePath(filepath.ToSlash(matches[1])) + if err != nil { + r.env.logf("decoding module cache path %q: %v", subdir, err) + return directoryPackageInfo{ + status: directoryScanned, + err: fmt.Errorf("decoding module cache path %q: %v", subdir, err), + } + } + importPath = path.Join(modPath, filepath.ToSlash(matches[3])) + } + + modDir, modName := r.modInfo(dir) + result := directoryPackageInfo{ + status: directoryScanned, + dir: dir, + rootType: root.Type, + nonCanonicalImportPath: importPath, + moduleDir: modDir, + moduleName: modName, + } + if root.Type == gopathwalk.RootGOROOT { + // stdlib packages are always in scope, despite the confusing go.mod + return result + } + return result +} + +// modCacheRegexp splits a path in a module cache into module, module version, and package. +var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`) + +var ( + slashSlash = []byte("//") + moduleStr = []byte("module") +) + +// modulePath returns the module path from the gomod file text. +// If it cannot find a module path, it returns an empty string. +// It is tolerant of unrelated problems in the go.mod file. +// +// Copied from cmd/go/internal/modfile. +func modulePath(mod []byte) string { + for len(mod) > 0 { + line := mod + mod = nil + if i := bytes.IndexByte(line, '\n'); i >= 0 { + line, mod = line[:i], line[i+1:] + } + if i := bytes.Index(line, slashSlash); i >= 0 { + line = line[:i] + } + line = bytes.TrimSpace(line) + if !bytes.HasPrefix(line, moduleStr) { + continue + } + line = line[len(moduleStr):] + n := len(line) + line = bytes.TrimSpace(line) + if len(line) == n || len(line) == 0 { + continue + } + + if line[0] == '"' || line[0] == '`' { + p, err := strconv.Unquote(string(line)) + if err != nil { + return "" // malformed quoted string or multiline module path + } + return p + } + + return string(line) + } + return "" // missing module path +} diff --git a/vendor/golang.org/x/tools/internal/imports/mod_cache.go b/vendor/golang.org/x/tools/internal/imports/mod_cache.go new file mode 100644 index 0000000000..b96c9d4bf7 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/imports/mod_cache.go @@ -0,0 +1,331 @@ +// Copyright 2019 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 imports + +import ( + "context" + "fmt" + "path" + "path/filepath" + "strings" + "sync" + + "golang.org/x/mod/module" + "golang.org/x/tools/internal/gopathwalk" + "golang.org/x/tools/internal/stdlib" +) + +// To find packages to import, the resolver needs to know about all of +// the packages that could be imported. This includes packages that are +// already in modules that are in (1) the current module, (2) replace targets, +// and (3) packages in the module cache. Packages in (1) and (2) may change over +// time, as the client may edit the current module and locally replaced modules. +// The module cache (which includes all of the packages in (3)) can only +// ever be added to. +// +// The resolver can thus save state about packages in the module cache +// and guarantee that this will not change over time. To obtain information +// about new modules added to the module cache, the module cache should be +// rescanned. +// +// It is OK to serve information about modules that have been deleted, +// as they do still exist. +// TODO(suzmue): can we share information with the caller about +// what module needs to be downloaded to import this package? + +type directoryPackageStatus int + +const ( + _ directoryPackageStatus = iota + directoryScanned + nameLoaded + exportsLoaded +) + +// directoryPackageInfo holds (possibly incomplete) information about packages +// contained in a given directory. +type directoryPackageInfo struct { + // status indicates the extent to which this struct has been filled in. + status directoryPackageStatus + // err is non-nil when there was an error trying to reach status. + err error + + // Set when status >= directoryScanned. + + // dir is the absolute directory of this package. + dir string + rootType gopathwalk.RootType + // nonCanonicalImportPath is the package's expected import path. It may + // not actually be importable at that path. + nonCanonicalImportPath string + + // Module-related information. + moduleDir string // The directory that is the module root of this dir. + moduleName string // The module name that contains this dir. + + // Set when status >= nameLoaded. + + packageName string // the package name, as declared in the source. + + // Set when status >= exportsLoaded. + // TODO(rfindley): it's hard to see this, but exports depend implicitly on + // the default build context GOOS and GOARCH. + // + // We can make this explicit, and key exports by GOOS, GOARCH. + exports []stdlib.Symbol +} + +// reachedStatus returns true when info has a status at least target and any error associated with +// an attempt to reach target. +func (info *directoryPackageInfo) reachedStatus(target directoryPackageStatus) (bool, error) { + if info.err == nil { + return info.status >= target, nil + } + if info.status == target { + return true, info.err + } + return true, nil +} + +// DirInfoCache is a concurrency-safe map for storing information about +// directories that may contain packages. +// +// The information in this cache is built incrementally. Entries are initialized in scan. +// No new keys should be added in any other functions, as all directories containing +// packages are identified in scan. +// +// Other functions, including loadExports and findPackage, may update entries in this cache +// as they discover new things about the directory. +// +// The information in the cache is not expected to change for the cache's +// lifetime, so there is no protection against competing writes. Users should +// take care not to hold the cache across changes to the underlying files. +type DirInfoCache struct { + mu sync.Mutex + // dirs stores information about packages in directories, keyed by absolute path. + dirs map[string]*directoryPackageInfo + listeners map[*int]cacheListener +} + +func NewDirInfoCache() *DirInfoCache { + return &DirInfoCache{ + dirs: make(map[string]*directoryPackageInfo), + listeners: make(map[*int]cacheListener), + } +} + +type cacheListener func(directoryPackageInfo) + +// ScanAndListen calls listener on all the items in the cache, and on anything +// newly added. The returned stop function waits for all in-flight callbacks to +// finish and blocks new ones. +func (d *DirInfoCache) ScanAndListen(ctx context.Context, listener cacheListener) func() { + ctx, cancel := context.WithCancel(ctx) + + // Flushing out all the callbacks is tricky without knowing how many there + // are going to be. Setting an arbitrary limit makes it much easier. + const maxInFlight = 10 + sema := make(chan struct{}, maxInFlight) + for range maxInFlight { + sema <- struct{}{} + } + + cookie := new(int) // A unique ID we can use for the listener. + + // We can't hold mu while calling the listener. + d.mu.Lock() + var keys []string + for key := range d.dirs { + keys = append(keys, key) + } + d.listeners[cookie] = func(info directoryPackageInfo) { + select { + case <-ctx.Done(): + return + case <-sema: + } + listener(info) + sema <- struct{}{} + } + d.mu.Unlock() + + stop := func() { + cancel() + d.mu.Lock() + delete(d.listeners, cookie) + d.mu.Unlock() + for range maxInFlight { + <-sema + } + } + + // Process the pre-existing keys. + for _, k := range keys { + select { + case <-ctx.Done(): + return stop + default: + } + if v, ok := d.Load(k); ok { + listener(v) + } + } + + return stop +} + +// Store stores the package info for dir. +func (d *DirInfoCache) Store(dir string, info directoryPackageInfo) { + d.mu.Lock() + // TODO(rfindley, golang/go#59216): should we overwrite an existing entry? + // That seems incorrect as the cache should be idempotent. + _, old := d.dirs[dir] + d.dirs[dir] = &info + var listeners []cacheListener + for _, l := range d.listeners { + listeners = append(listeners, l) + } + d.mu.Unlock() + + if !old { + for _, l := range listeners { + l(info) + } + } +} + +// Load returns a copy of the directoryPackageInfo for absolute directory dir. +func (d *DirInfoCache) Load(dir string) (directoryPackageInfo, bool) { + d.mu.Lock() + defer d.mu.Unlock() + info, ok := d.dirs[dir] + if !ok { + return directoryPackageInfo{}, false + } + return *info, true +} + +// Keys returns the keys currently present in d. +func (d *DirInfoCache) Keys() (keys []string) { + d.mu.Lock() + defer d.mu.Unlock() + for key := range d.dirs { + keys = append(keys, key) + } + return keys +} + +func (d *DirInfoCache) CachePackageName(info directoryPackageInfo) (string, error) { + if loaded, err := info.reachedStatus(nameLoaded); loaded { + return info.packageName, err + } + if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil { + return "", fmt.Errorf("cannot read package name, scan error: %v", err) + } + info.packageName, info.err = packageDirToName(info.dir) + info.status = nameLoaded + d.Store(info.dir, info) + return info.packageName, info.err +} + +func (d *DirInfoCache) CacheExports(ctx context.Context, env *ProcessEnv, info directoryPackageInfo) (string, []stdlib.Symbol, error) { + if reached, _ := info.reachedStatus(exportsLoaded); reached { + return info.packageName, info.exports, info.err + } + if reached, err := info.reachedStatus(nameLoaded); reached && err != nil { + return "", nil, err + } + info.packageName, info.exports, info.err = loadExportsFromFiles(ctx, env, info.dir, false) + if info.err == context.Canceled || info.err == context.DeadlineExceeded { + return info.packageName, info.exports, info.err + } + // The cache structure wants things to proceed linearly. We can skip a + // step here, but only if we succeed. + if info.status == nameLoaded || info.err == nil { + info.status = exportsLoaded + } else { + info.status = nameLoaded + } + d.Store(info.dir, info) + return info.packageName, info.exports, info.err +} + +// ScanModuleCache walks the given directory, which must be a GOMODCACHE value, +// for directory package information, storing the results in cache. +func ScanModuleCache(dir string, cache *DirInfoCache, logf func(string, ...any)) { + // Note(rfindley): it's hard to see, but this function attempts to implement + // just the side effects on cache of calling PrimeCache with a ProcessEnv + // that has the given dir as its GOMODCACHE. + // + // Teasing out the control flow, we see that we can avoid any handling of + // vendor/ and can infer module info entirely from the path, simplifying the + // logic here. + + root := gopathwalk.Root{ + Path: filepath.Clean(dir), + Type: gopathwalk.RootModuleCache, + } + + directoryInfo := func(root gopathwalk.Root, dir string) directoryPackageInfo { + // This is a copy of ModuleResolver.scanDirForPackage, trimmed down to + // logic that applies to a module cache directory. + + subdir := "" + if dir != root.Path { + subdir = dir[len(root.Path)+len("/"):] + } + + matches := modCacheRegexp.FindStringSubmatch(subdir) + if len(matches) == 0 { + return directoryPackageInfo{ + status: directoryScanned, + err: fmt.Errorf("invalid module cache path: %v", subdir), + } + } + modPath, err := module.UnescapePath(filepath.ToSlash(matches[1])) + if err != nil { + if logf != nil { + logf("decoding module cache path %q: %v", subdir, err) + } + return directoryPackageInfo{ + status: directoryScanned, + err: fmt.Errorf("decoding module cache path %q: %v", subdir, err), + } + } + importPath := path.Join(modPath, filepath.ToSlash(matches[3])) + index := strings.Index(dir, matches[1]+"@"+matches[2]) + modDir := filepath.Join(dir[:index], matches[1]+"@"+matches[2]) + modName := readModName(filepath.Join(modDir, "go.mod")) + return directoryPackageInfo{ + status: directoryScanned, + dir: dir, + rootType: root.Type, + nonCanonicalImportPath: importPath, + moduleDir: modDir, + moduleName: modName, + } + } + + add := func(root gopathwalk.Root, dir string) { + info := directoryInfo(root, dir) + cache.Store(info.dir, info) + } + + skip := func(_ gopathwalk.Root, dir string) bool { + // Skip directories that have already been scanned. + // + // Note that gopathwalk only adds "package" directories, which must contain + // a .go file, and all such package directories in the module cache are + // immutable. So if we can load a dir, it can be skipped. + info, ok := cache.Load(dir) + if !ok { + return false + } + packageScanned, _ := info.reachedStatus(directoryScanned) + return packageScanned + } + + gopathwalk.WalkSkip([]gopathwalk.Root{root}, add, skip, gopathwalk.Options{Logf: logf, ModulesEnabled: true}) +} diff --git a/vendor/golang.org/x/tools/internal/imports/sortimports.go b/vendor/golang.org/x/tools/internal/imports/sortimports.go new file mode 100644 index 0000000000..67c17bc431 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/imports/sortimports.go @@ -0,0 +1,298 @@ +// 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. + +// Hacked up copy of go/ast/import.go +// Modified to use a single token.File in preference to a FileSet. + +package imports + +import ( + "go/ast" + "go/token" + "log" + "slices" + "sort" + "strconv" +) + +// sortImports sorts runs of consecutive import lines in import blocks in f. +// It also removes duplicate imports when it is possible to do so without data loss. +// +// It may mutate the token.File and the ast.File. +func sortImports(localPrefix string, tokFile *token.File, f *ast.File) { + for i, d := range f.Decls { + d, ok := d.(*ast.GenDecl) + if !ok || d.Tok != token.IMPORT { + // Not an import declaration, so we're done. + // Imports are always first. + break + } + + if len(d.Specs) == 0 { + // Empty import block, remove it. + f.Decls = slices.Delete(f.Decls, i, i+1) + } + + if !d.Lparen.IsValid() { + // Not a block: sorted by default. + continue + } + + // Identify and sort runs of specs on successive lines. + i := 0 + specs := d.Specs[:0] + for j, s := range d.Specs { + if j > i && tokFile.Line(s.Pos()) > 1+tokFile.Line(d.Specs[j-1].End()) { + // j begins a new run. End this one. + specs = append(specs, sortSpecs(localPrefix, tokFile, f, d.Specs[i:j])...) + i = j + } + } + specs = append(specs, sortSpecs(localPrefix, tokFile, f, d.Specs[i:])...) + d.Specs = specs + + // Deduping can leave a blank line before the rparen; clean that up. + // Ignore line directives. + if len(d.Specs) > 0 { + lastSpec := d.Specs[len(d.Specs)-1] + lastLine := tokFile.PositionFor(lastSpec.Pos(), false).Line + if rParenLine := tokFile.PositionFor(d.Rparen, false).Line; rParenLine > lastLine+1 { + tokFile.MergeLine(rParenLine - 1) // has side effects! + } + } + } +} + +// mergeImports merges all the import declarations into the first one. +// Taken from golang.org/x/tools/ast/astutil. +// This does not adjust line numbers properly +func mergeImports(f *ast.File) { + if len(f.Decls) <= 1 { + return + } + + // Merge all the import declarations into the first one. + var first *ast.GenDecl + for i := 0; i < len(f.Decls); i++ { + decl := f.Decls[i] + gen, ok := decl.(*ast.GenDecl) + if !ok || gen.Tok != token.IMPORT || declImports(gen, "C") { + continue + } + if first == nil { + first = gen + continue // Don't touch the first one. + } + // We now know there is more than one package in this import + // declaration. Ensure that it ends up parenthesized. + first.Lparen = first.Pos() + // Move the imports of the other import declaration to the first one. + for _, spec := range gen.Specs { + spec.(*ast.ImportSpec).Path.ValuePos = first.Pos() + first.Specs = append(first.Specs, spec) + } + f.Decls = slices.Delete(f.Decls, i, i+1) + i-- + } +} + +// declImports reports whether gen contains an import of path. +// Taken from golang.org/x/tools/ast/astutil. +func declImports(gen *ast.GenDecl, path string) bool { + if gen.Tok != token.IMPORT { + return false + } + for _, spec := range gen.Specs { + impspec := spec.(*ast.ImportSpec) + if importPath(impspec) == path { + return true + } + } + return false +} + +func importPath(s ast.Spec) string { + t, err := strconv.Unquote(s.(*ast.ImportSpec).Path.Value) + if err == nil { + return t + } + return "" +} + +func importName(s ast.Spec) string { + n := s.(*ast.ImportSpec).Name + if n == nil { + return "" + } + return n.Name +} + +func importComment(s ast.Spec) string { + c := s.(*ast.ImportSpec).Comment + if c == nil { + return "" + } + return c.Text() +} + +// collapse indicates whether prev may be removed, leaving only next. +func collapse(prev, next ast.Spec) bool { + if importPath(next) != importPath(prev) || importName(next) != importName(prev) { + return false + } + return prev.(*ast.ImportSpec).Comment == nil +} + +type posSpan struct { + Start token.Pos + End token.Pos +} + +// sortSpecs sorts the import specs within each import decl. +// It may mutate the token.File. +func sortSpecs(localPrefix string, tokFile *token.File, f *ast.File, specs []ast.Spec) []ast.Spec { + // Can't short-circuit here even if specs are already sorted, + // since they might yet need deduplication. + // A lone import, however, may be safely ignored. + if len(specs) <= 1 { + return specs + } + + // Record positions for specs. + pos := make([]posSpan, len(specs)) + for i, s := range specs { + pos[i] = posSpan{s.Pos(), s.End()} + } + + // Identify comments in this range. + // Any comment from pos[0].Start to the final line counts. + lastLine := tokFile.Line(pos[len(pos)-1].End) + cstart := len(f.Comments) + cend := len(f.Comments) + for i, g := range f.Comments { + if g.Pos() < pos[0].Start { + continue + } + if i < cstart { + cstart = i + } + if tokFile.Line(g.End()) > lastLine { + cend = i + break + } + } + comments := f.Comments[cstart:cend] + + // Assign each comment to the import spec preceding it. + importComment := map[*ast.ImportSpec][]*ast.CommentGroup{} + specIndex := 0 + for _, g := range comments { + for specIndex+1 < len(specs) && pos[specIndex+1].Start <= g.Pos() { + specIndex++ + } + s := specs[specIndex].(*ast.ImportSpec) + importComment[s] = append(importComment[s], g) + } + + // Sort the import specs by import path. + // Remove duplicates, when possible without data loss. + // Reassign the import paths to have the same position sequence. + // Reassign each comment to abut the end of its spec. + // Sort the comments by new position. + sort.Sort(byImportSpec{localPrefix, specs}) + + // Dedup. Thanks to our sorting, we can just consider + // adjacent pairs of imports. + deduped := specs[:0] + for i, s := range specs { + if i == len(specs)-1 || !collapse(s, specs[i+1]) { + deduped = append(deduped, s) + } else { + p := s.Pos() + tokFile.MergeLine(tokFile.Line(p)) // has side effects! + } + } + specs = deduped + + // Fix up comment positions + for i, s := range specs { + s := s.(*ast.ImportSpec) + if s.Name != nil { + s.Name.NamePos = pos[i].Start + } + s.Path.ValuePos = pos[i].Start + s.EndPos = pos[i].End + nextSpecPos := pos[i].End + + for _, g := range importComment[s] { + for _, c := range g.List { + c.Slash = pos[i].End + nextSpecPos = c.End() + } + } + if i < len(specs)-1 { + pos[i+1].Start = nextSpecPos + pos[i+1].End = nextSpecPos + } + } + + sort.Sort(byCommentPos(comments)) + + // Fixup comments can insert blank lines, because import specs are on different lines. + // We remove those blank lines here by merging import spec to the first import spec line. + firstSpecLine := tokFile.Line(specs[0].Pos()) + for _, s := range specs[1:] { + p := s.Pos() + line := tokFile.Line(p) + for previousLine := line - 1; previousLine >= firstSpecLine; { + // MergeLine can panic. Avoid the panic at the cost of not removing the blank line + // golang/go#50329 + if previousLine > 0 && previousLine < tokFile.LineCount() { + tokFile.MergeLine(previousLine) // has side effects! + previousLine-- + } else { + // try to gather some data to diagnose how this could happen + req := "Please report what the imports section of your go file looked like." + log.Printf("panic avoided: first:%d line:%d previous:%d max:%d. %s", + firstSpecLine, line, previousLine, tokFile.LineCount(), req) + } + } + } + return specs +} + +type byImportSpec struct { + localPrefix string + specs []ast.Spec // slice of *ast.ImportSpec +} + +func (x byImportSpec) Len() int { return len(x.specs) } +func (x byImportSpec) Swap(i, j int) { x.specs[i], x.specs[j] = x.specs[j], x.specs[i] } +func (x byImportSpec) Less(i, j int) bool { + ipath := importPath(x.specs[i]) + jpath := importPath(x.specs[j]) + + igroup := importGroup(x.localPrefix, ipath) + jgroup := importGroup(x.localPrefix, jpath) + if igroup != jgroup { + return igroup < jgroup + } + + if ipath != jpath { + return ipath < jpath + } + iname := importName(x.specs[i]) + jname := importName(x.specs[j]) + + if iname != jname { + return iname < jname + } + return importComment(x.specs[i]) < importComment(x.specs[j]) +} + +type byCommentPos []*ast.CommentGroup + +func (x byCommentPos) Len() int { return len(x) } +func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] } +func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() } diff --git a/vendor/golang.org/x/tools/internal/imports/source.go b/vendor/golang.org/x/tools/internal/imports/source.go new file mode 100644 index 0000000000..cbe4f3c5ba --- /dev/null +++ b/vendor/golang.org/x/tools/internal/imports/source.go @@ -0,0 +1,63 @@ +// Copyright 2024 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 imports + +import "context" + +// These types document the APIs below. +// +// TODO(rfindley): consider making these defined types rather than aliases. +type ( + ImportPath = string + PackageName = string + Symbol = string + + // References is set of References found in a Go file. The first map key is the + // left hand side of a selector expression, the second key is the right hand + // side, and the value should always be true. + References = map[PackageName]map[Symbol]bool +) + +// A Result satisfies a missing import. +// +// The Import field describes the missing import spec, and the Package field +// summarizes the package exports. +type Result struct { + Import *ImportInfo + Package *PackageInfo +} + +// An ImportInfo represents a single import statement. +type ImportInfo struct { + ImportPath string // import path, e.g. "crypto/rand". + Name string // import name, e.g. "crand", or "" if none. +} + +// A PackageInfo represents what's known about a package. +type PackageInfo struct { + Name string // package name in the package declaration, if known + Exports map[string]bool // set of names of known package level sortSymbols +} + +// A Source provides imports to satisfy unresolved references in the file being +// fixed. +type Source interface { + // LoadPackageNames queries PackageName information for the requested import + // paths, when operating from the provided srcDir. + // + // TODO(rfindley): try to refactor to remove this operation. + LoadPackageNames(ctx context.Context, srcDir string, paths []ImportPath) (map[ImportPath]PackageName, error) + + // ResolveReferences asks the Source for the best package name to satisfy + // each of the missing references, in the context of fixing the given + // filename. + // + // Returns a map from package name to a [Result] for that package name that + // provides the required symbols. Keys may be omitted in the map if no + // candidates satisfy all missing references for that package name. It is up + // to each data source to select the best result for each entry in the + // missing map. + ResolveReferences(ctx context.Context, filename string, missing References) ([]*Result, error) +} diff --git a/vendor/golang.org/x/tools/internal/imports/source_env.go b/vendor/golang.org/x/tools/internal/imports/source_env.go new file mode 100644 index 0000000000..ec996c3ccf --- /dev/null +++ b/vendor/golang.org/x/tools/internal/imports/source_env.go @@ -0,0 +1,129 @@ +// Copyright 2024 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 imports + +import ( + "context" + "path/filepath" + "strings" + "sync" + + "golang.org/x/sync/errgroup" + "golang.org/x/tools/internal/gopathwalk" +) + +// ProcessEnvSource implements the [Source] interface using the legacy +// [ProcessEnv] abstraction. +type ProcessEnvSource struct { + env *ProcessEnv + srcDir string + filename string + pkgName string +} + +// NewProcessEnvSource returns a [ProcessEnvSource] wrapping the given +// env, to be used for fixing imports in the file with name filename in package +// named pkgName. +func NewProcessEnvSource(env *ProcessEnv, filename, pkgName string) (*ProcessEnvSource, error) { + abs, err := filepath.Abs(filename) + if err != nil { + return nil, err + } + srcDir := filepath.Dir(abs) + return &ProcessEnvSource{ + env: env, + srcDir: srcDir, + filename: filename, + pkgName: pkgName, + }, nil +} + +func (s *ProcessEnvSource) LoadPackageNames(ctx context.Context, srcDir string, unknown []string) (map[string]string, error) { + r, err := s.env.GetResolver() + if err != nil { + return nil, err + } + return r.loadPackageNames(unknown, srcDir) +} + +func (s *ProcessEnvSource) ResolveReferences(ctx context.Context, filename string, refs map[string]map[string]bool) ([]*Result, error) { + var mu sync.Mutex + found := make(map[string][]pkgDistance) + callback := &scanCallback{ + rootFound: func(gopathwalk.Root) bool { + return true // We want everything. + }, + dirFound: func(pkg *pkg) bool { + return pkgIsCandidate(filename, refs, pkg) + }, + packageNameLoaded: func(pkg *pkg) bool { + if _, want := refs[pkg.packageName]; !want { + return false + } + if pkg.dir == s.srcDir && s.pkgName == pkg.packageName { + // The candidate is in the same directory and has the + // same package name. Don't try to import ourselves. + return false + } + if !CanUse(filename, pkg.dir) { + return false + } + mu.Lock() + defer mu.Unlock() + found[pkg.packageName] = append(found[pkg.packageName], pkgDistance{pkg, distance(s.srcDir, pkg.dir)}) + return false // We'll do our own loading after we sort. + }, + } + resolver, err := s.env.GetResolver() + if err != nil { + return nil, err + } + if err := resolver.scan(ctx, callback); err != nil { + return nil, err + } + + g, ctx := errgroup.WithContext(ctx) + + searcher := symbolSearcher{ + logf: s.env.logf, + srcDir: s.srcDir, + xtest: strings.HasSuffix(s.pkgName, "_test"), + loadExports: resolver.loadExports, + } + + var resultMu sync.Mutex + results := make(map[string]*Result, len(refs)) + for pkgName, symbols := range refs { + g.Go(func() error { + found, err := searcher.search(ctx, found[pkgName], pkgName, symbols) + if err != nil { + return err + } + if found == nil { + return nil // No matching package. + } + + imp := &ImportInfo{ + ImportPath: found.importPathShort, + } + pkg := &PackageInfo{ + Name: pkgName, + Exports: symbols, + } + resultMu.Lock() + results[pkgName] = &Result{Import: imp, Package: pkg} + resultMu.Unlock() + return nil + }) + } + if err := g.Wait(); err != nil { + return nil, err + } + var ans []*Result + for _, x := range results { + ans = append(ans, x) + } + return ans, nil +} diff --git a/vendor/golang.org/x/tools/internal/imports/source_modindex.go b/vendor/golang.org/x/tools/internal/imports/source_modindex.go new file mode 100644 index 0000000000..05229f06ce --- /dev/null +++ b/vendor/golang.org/x/tools/internal/imports/source_modindex.go @@ -0,0 +1,103 @@ +// Copyright 2024 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 imports + +import ( + "context" + "sync" + "time" + + "golang.org/x/tools/internal/modindex" +) + +// This code is here rather than in the modindex package +// to avoid import loops + +// implements Source using modindex, so only for module cache. +// +// this is perhaps over-engineered. A new Index is read at first use. +// And then Update is called after every 15 minutes, and a new Index +// is read if the index changed. It is not clear the Mutex is needed. +type IndexSource struct { + modcachedir string + mutex sync.Mutex + ix *modindex.Index + expires time.Time +} + +// create a new Source. Called from NewView in cache/session.go. +func NewIndexSource(cachedir string) *IndexSource { + return &IndexSource{modcachedir: cachedir} +} + +func (s *IndexSource) LoadPackageNames(ctx context.Context, srcDir string, paths []ImportPath) (map[ImportPath]PackageName, error) { + /// This is used by goimports to resolve the package names of imports of the + // current package, which is irrelevant for the module cache. + return nil, nil +} + +func (s *IndexSource) ResolveReferences(ctx context.Context, filename string, missing References) ([]*Result, error) { + if err := s.maybeReadIndex(); err != nil { + return nil, err + } + var cs []modindex.Candidate + for pkg, nms := range missing { + for nm := range nms { + x := s.ix.Lookup(pkg, nm, false) + cs = append(cs, x...) + } + } + found := make(map[string]*Result) + for _, c := range cs { + var x *Result + if x = found[c.ImportPath]; x == nil { + x = &Result{ + Import: &ImportInfo{ + ImportPath: c.ImportPath, + Name: "", + }, + Package: &PackageInfo{ + Name: c.PkgName, + Exports: make(map[string]bool), + }, + } + found[c.ImportPath] = x + } + x.Package.Exports[c.Name] = true + } + var ans []*Result + for _, x := range found { + ans = append(ans, x) + } + return ans, nil +} + +func (s *IndexSource) maybeReadIndex() error { + s.mutex.Lock() + defer s.mutex.Unlock() + + var readIndex bool + if time.Now().After(s.expires) { + ok, err := modindex.Update(s.modcachedir) + if err != nil { + return err + } + if ok { + readIndex = true + } + } + + if readIndex || s.ix == nil { + ix, err := modindex.ReadIndex(s.modcachedir) + if err != nil { + return err + } + s.ix = ix + // for now refresh every 15 minutes + s.expires = time.Now().Add(time.Minute * 15) + } + + return nil +} diff --git a/vendor/golang.org/x/tools/internal/modindex/directories.go b/vendor/golang.org/x/tools/internal/modindex/directories.go new file mode 100644 index 0000000000..1e1a02f239 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/modindex/directories.go @@ -0,0 +1,135 @@ +// Copyright 2024 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 modindex + +import ( + "fmt" + "log" + "os" + "path/filepath" + "regexp" + "slices" + "strings" + "sync" + "time" + + "golang.org/x/mod/semver" + "golang.org/x/tools/internal/gopathwalk" +) + +type directory struct { + path Relpath + importPath string + version string // semantic version + syms []symbol +} + +// filterDirs groups the directories by import path, +// sorting the ones with the same import path by semantic version, +// most recent first. +func byImportPath(dirs []Relpath) (map[string][]*directory, error) { + ans := make(map[string][]*directory) // key is import path + for _, d := range dirs { + ip, sv, err := DirToImportPathVersion(d) + if err != nil { + return nil, err + } + ans[ip] = append(ans[ip], &directory{ + path: d, + importPath: ip, + version: sv, + }) + } + for k, v := range ans { + semanticSort(v) + ans[k] = v + } + return ans, nil +} + +// sort the directories by semantic version, latest first +func semanticSort(v []*directory) { + slices.SortFunc(v, func(l, r *directory) int { + if n := semver.Compare(l.version, r.version); n != 0 { + return -n // latest first + } + return strings.Compare(string(l.path), string(r.path)) + }) +} + +// modCacheRegexp splits a relpathpath into module, module version, and package. +var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`) + +// DirToImportPathVersion computes import path and semantic version +func DirToImportPathVersion(dir Relpath) (string, string, error) { + m := modCacheRegexp.FindStringSubmatch(string(dir)) + // m[1] is the module path + // m[2] is the version major.minor.patch(-
 1 && flds[1][1] == 'D',
+			}
+			if px.Type == Func {
+				n, err := strconv.Atoi(flds[2])
+				if err != nil {
+					continue // should never happen
+				}
+				px.Results = int16(n)
+				if len(flds) >= 4 {
+					sig := strings.Split(flds[3], " ")
+					for i := range sig {
+						// $ cannot otherwise occur. removing the spaces
+						// almost works, but for chan struct{}, e.g.
+						sig[i] = strings.Replace(sig[i], "$", " ", -1)
+					}
+					px.Sig = toFields(sig)
+				}
+			}
+			ans = append(ans, px)
+		}
+	}
+	return ans
+}
+
+func toFields(sig []string) []Field {
+	ans := make([]Field, len(sig)/2)
+	for i := range ans {
+		ans[i] = Field{Arg: sig[2*i], Type: sig[2*i+1]}
+	}
+	return ans
+}
+
+// benchmarks show this is measurably better than strings.Split
+// split into first 4 fields separated by single space
+func fastSplit(x string) []string {
+	ans := make([]string, 0, 4)
+	nxt := 0
+	start := 0
+	for i := 0; i < len(x); i++ {
+		if x[i] != ' ' {
+			continue
+		}
+		ans = append(ans, x[start:i])
+		nxt++
+		start = i + 1
+		if nxt >= 3 {
+			break
+		}
+	}
+	ans = append(ans, x[start:])
+	return ans
+}
+
+func asLexType(c byte) LexType {
+	switch c {
+	case 'C':
+		return Const
+	case 'V':
+		return Var
+	case 'T':
+		return Type
+	case 'F':
+		return Func
+	}
+	return -1
+}
diff --git a/vendor/golang.org/x/tools/internal/modindex/modindex.go b/vendor/golang.org/x/tools/internal/modindex/modindex.go
new file mode 100644
index 0000000000..355a53e71a
--- /dev/null
+++ b/vendor/golang.org/x/tools/internal/modindex/modindex.go
@@ -0,0 +1,164 @@
+// Copyright 2024 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 modindex contains code for building and searching an index to
+// the Go module cache. The directory containing the index, returned by
+// IndexDir(), contains a file index-name- that contains the name
+// of the current index. We believe writing that short file is atomic.
+// ReadIndex reads that file to get the file name of the index.
+// WriteIndex writes an index with a unique name and then
+// writes that name into a new version of index-name-.
+// ( stands for the CurrentVersion of the index format.)
+package modindex
+
+import (
+	"path/filepath"
+	"slices"
+	"strings"
+	"time"
+
+	"golang.org/x/mod/semver"
+)
+
+// Create always creates a new index for the go module cache that is in cachedir.
+func Create(cachedir string) error {
+	_, err := indexModCache(cachedir, true)
+	return err
+}
+
+// Update the index for the go module cache that is in cachedir,
+// If there is no existing index it will build one.
+// If there are changed directories since the last index, it will
+// write a new one and return true. Otherwise it returns false.
+func Update(cachedir string) (bool, error) {
+	return indexModCache(cachedir, false)
+}
+
+// indexModCache writes an index current as of when it is called.
+// If clear is true the index is constructed from all of GOMODCACHE
+// otherwise the index is constructed from the last previous index
+// and the updates to the cache. It returns true if it wrote an index,
+// false otherwise.
+func indexModCache(cachedir string, clear bool) (bool, error) {
+	cachedir, err := filepath.Abs(cachedir)
+	if err != nil {
+		return false, err
+	}
+	cd := Abspath(cachedir)
+	future := time.Now().Add(24 * time.Hour) // safely in the future
+	ok, err := modindexTimed(future, cd, clear)
+	if err != nil {
+		return false, err
+	}
+	return ok, nil
+}
+
+// modindexTimed writes an index current as of onlyBefore.
+// If clear is true the index is constructed from all of GOMODCACHE
+// otherwise the index is constructed from the last previous index
+// and all the updates to the cache before onlyBefore.
+// It returns true if it wrote a new index, false if it wrote nothing.
+func modindexTimed(onlyBefore time.Time, cachedir Abspath, clear bool) (bool, error) {
+	var curIndex *Index
+	if !clear {
+		var err error
+		curIndex, err = ReadIndex(string(cachedir))
+		if clear && err != nil {
+			return false, err
+		}
+		// TODO(pjw): check that most of those directories still exist
+	}
+	cfg := &work{
+		onlyBefore: onlyBefore,
+		oldIndex:   curIndex,
+		cacheDir:   cachedir,
+	}
+	if curIndex != nil {
+		cfg.onlyAfter = curIndex.Changed
+	}
+	if err := cfg.buildIndex(); err != nil {
+		return false, err
+	}
+	if len(cfg.newIndex.Entries) == 0 && curIndex != nil {
+		// no changes from existing curIndex, don't write a new index
+		return false, nil
+	}
+	if err := cfg.writeIndex(); err != nil {
+		return false, err
+	}
+	return true, nil
+}
+
+type work struct {
+	onlyBefore time.Time // do not use directories later than this
+	onlyAfter  time.Time // only interested in directories after this
+	// directories from before onlyAfter come from oldIndex
+	oldIndex *Index
+	newIndex *Index
+	cacheDir Abspath
+}
+
+func (w *work) buildIndex() error {
+	// The effective date of the new index should be at least
+	// slightly earlier than when the directories are scanned
+	// so set it now.
+	w.newIndex = &Index{Changed: time.Now(), Cachedir: w.cacheDir}
+	dirs := findDirs(string(w.cacheDir), w.onlyAfter, w.onlyBefore)
+	if len(dirs) == 0 {
+		return nil
+	}
+	newdirs, err := byImportPath(dirs)
+	if err != nil {
+		return err
+	}
+	// for each import path it might occur only in newdirs,
+	// only in w.oldIndex, or in both.
+	// If it occurs in both, use the semantically later one
+	if w.oldIndex != nil {
+		for _, e := range w.oldIndex.Entries {
+			found, ok := newdirs[e.ImportPath]
+			if !ok {
+				w.newIndex.Entries = append(w.newIndex.Entries, e)
+				continue // use this one, there is no new one
+			}
+			if semver.Compare(found[0].version, e.Version) > 0 {
+				// use the new one
+			} else {
+				// use the old one, forget the new one
+				w.newIndex.Entries = append(w.newIndex.Entries, e)
+				delete(newdirs, e.ImportPath)
+			}
+		}
+	}
+	// get symbol information for all the new diredtories
+	getSymbols(w.cacheDir, newdirs)
+	// assemble the new index entries
+	for k, v := range newdirs {
+		d := v[0]
+		pkg, names := processSyms(d.syms)
+		if pkg == "" {
+			continue // PJW: does this ever happen?
+		}
+		entry := Entry{
+			PkgName:    pkg,
+			Dir:        d.path,
+			ImportPath: k,
+			Version:    d.version,
+			Names:      names,
+		}
+		w.newIndex.Entries = append(w.newIndex.Entries, entry)
+	}
+	// sort the entries in the new index
+	slices.SortFunc(w.newIndex.Entries, func(l, r Entry) int {
+		if n := strings.Compare(l.PkgName, r.PkgName); n != 0 {
+			return n
+		}
+		return strings.Compare(l.ImportPath, r.ImportPath)
+	})
+	return nil
+}
+
+func (w *work) writeIndex() error {
+	return writeIndex(w.cacheDir, w.newIndex)
+}
diff --git a/vendor/golang.org/x/tools/internal/modindex/symbols.go b/vendor/golang.org/x/tools/internal/modindex/symbols.go
new file mode 100644
index 0000000000..b918529d43
--- /dev/null
+++ b/vendor/golang.org/x/tools/internal/modindex/symbols.go
@@ -0,0 +1,218 @@
+// Copyright 2024 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 modindex
+
+import (
+	"fmt"
+	"go/ast"
+	"go/parser"
+	"go/token"
+	"go/types"
+	"os"
+	"path/filepath"
+	"runtime"
+	"slices"
+	"strings"
+
+	"golang.org/x/sync/errgroup"
+)
+
+// The name of a symbol contains information about the symbol:
+//  T for types, TD if the type is deprecated
+//  C for consts, CD if the const is deprecated
+//  V for vars, VD if the var is deprecated
+// and for funcs:  F  ( )*
+// any spaces in  are replaced by $s so that the fields
+// of the name are space separated. F is replaced by FD if the func
+// is deprecated.
+type symbol struct {
+	pkg  string // name of the symbols's package
+	name string // declared name
+	kind string // T, C, V, or F, follwed by D if deprecated
+	sig  string // signature information, for F
+}
+
+// find the symbols for the best directories
+func getSymbols(cd Abspath, dirs map[string][]*directory) {
+	var g errgroup.Group
+	g.SetLimit(max(2, runtime.GOMAXPROCS(0)/2))
+	for _, vv := range dirs {
+		// throttling some day?
+		d := vv[0]
+		g.Go(func() error {
+			thedir := filepath.Join(string(cd), string(d.path))
+			mode := parser.SkipObjectResolution | parser.ParseComments
+
+			fi, err := os.ReadDir(thedir)
+			if err != nil {
+				return nil // log this someday?
+			}
+			for _, fx := range fi {
+				if !strings.HasSuffix(fx.Name(), ".go") || strings.HasSuffix(fx.Name(), "_test.go") {
+					continue
+				}
+				fname := filepath.Join(thedir, fx.Name())
+				tr, err := parser.ParseFile(token.NewFileSet(), fname, nil, mode)
+				if err != nil {
+					continue // ignore errors, someday log them?
+				}
+				d.syms = append(d.syms, getFileExports(tr)...)
+			}
+			return nil
+		})
+	}
+	g.Wait()
+}
+
+func getFileExports(f *ast.File) []symbol {
+	pkg := f.Name.Name
+	if pkg == "main" {
+		return nil
+	}
+	var ans []symbol
+	// should we look for //go:build ignore?
+	for _, decl := range f.Decls {
+		switch decl := decl.(type) {
+		case *ast.FuncDecl:
+			if decl.Recv != nil {
+				// ignore methods, as we are completing package selections
+				continue
+			}
+			name := decl.Name.Name
+			dtype := decl.Type
+			// not looking at dtype.TypeParams. That is, treating
+			// generic functions just like non-generic ones.
+			sig := dtype.Params
+			kind := "F"
+			if isDeprecated(decl.Doc) {
+				kind += "D"
+			}
+			result := []string{fmt.Sprintf("%d", dtype.Results.NumFields())}
+			for _, x := range sig.List {
+				// This code creates a string representing the type.
+				// TODO(pjw): it may be fragile:
+				// 1. x.Type could be nil, perhaps in ill-formed code
+				// 2. ExprString might someday change incompatibly to
+				//    include struct tags, which can be arbitrary strings
+				if x.Type == nil {
+					// Can this happen without a parse error? (Files with parse
+					// errors are ignored in getSymbols)
+					continue // maybe report this someday
+				}
+				tp := types.ExprString(x.Type)
+				if len(tp) == 0 {
+					// Can this happen?
+					continue // maybe report this someday
+				}
+				// This is only safe if ExprString never returns anything with a $
+				// The only place a $ can occur seems to be in a struct tag, which
+				// can be an arbitrary string literal, and ExprString does not presently
+				// print struct tags. So for this to happen the type of a formal parameter
+				// has to be a explict struct, e.g. foo(x struct{a int "$"}) and ExprString
+				// would have to show the struct tag. Even testing for this case seems
+				// a waste of effort, but let's remember the possibility
+				if strings.Contains(tp, "$") {
+					continue
+				}
+				tp = strings.Replace(tp, " ", "$", -1)
+				if len(x.Names) == 0 {
+					result = append(result, "_")
+					result = append(result, tp)
+				} else {
+					for _, y := range x.Names {
+						result = append(result, y.Name)
+						result = append(result, tp)
+					}
+				}
+			}
+			sigs := strings.Join(result, " ")
+			if s := newsym(pkg, name, kind, sigs); s != nil {
+				ans = append(ans, *s)
+			}
+		case *ast.GenDecl:
+			depr := isDeprecated(decl.Doc)
+			switch decl.Tok {
+			case token.CONST, token.VAR:
+				tp := "V"
+				if decl.Tok == token.CONST {
+					tp = "C"
+				}
+				if depr {
+					tp += "D"
+				}
+				for _, sp := range decl.Specs {
+					for _, x := range sp.(*ast.ValueSpec).Names {
+						if s := newsym(pkg, x.Name, tp, ""); s != nil {
+							ans = append(ans, *s)
+						}
+					}
+				}
+			case token.TYPE:
+				tp := "T"
+				if depr {
+					tp += "D"
+				}
+				for _, sp := range decl.Specs {
+					if s := newsym(pkg, sp.(*ast.TypeSpec).Name.Name, tp, ""); s != nil {
+						ans = append(ans, *s)
+					}
+				}
+			}
+		}
+	}
+	return ans
+}
+
+func newsym(pkg, name, kind, sig string) *symbol {
+	if len(name) == 0 || !ast.IsExported(name) {
+		return nil
+	}
+	sym := symbol{pkg: pkg, name: name, kind: kind, sig: sig}
+	return &sym
+}
+
+func isDeprecated(doc *ast.CommentGroup) bool {
+	if doc == nil {
+		return false
+	}
+	// go.dev/wiki/Deprecated Paragraph starting 'Deprecated:'
+	// This code fails for /* Deprecated: */, but it's the code from
+	// gopls/internal/analysis/deprecated
+	lines := strings.Split(doc.Text(), "\n\n")
+	for _, line := range lines {
+		if strings.HasPrefix(line, "Deprecated:") {
+			return true
+		}
+	}
+	return false
+}
+
+// return the package name and the value for the symbols.
+// if there are multiple packages, choose one arbitrarily
+// the returned slice is sorted lexicographically
+func processSyms(syms []symbol) (string, []string) {
+	if len(syms) == 0 {
+		return "", nil
+	}
+	slices.SortFunc(syms, func(l, r symbol) int {
+		return strings.Compare(l.name, r.name)
+	})
+	pkg := syms[0].pkg
+	var names []string
+	for _, s := range syms {
+		var nx string
+		if s.pkg == pkg {
+			if s.sig != "" {
+				nx = fmt.Sprintf("%s %s %s", s.name, s.kind, s.sig)
+			} else {
+				nx = fmt.Sprintf("%s %s", s.name, s.kind)
+			}
+			names = append(names, nx)
+		} else {
+			continue // PJW: do we want to keep track of these?
+		}
+	}
+	return pkg, names
+}
diff --git a/vendor/golang.org/x/tools/internal/modindex/types.go b/vendor/golang.org/x/tools/internal/modindex/types.go
new file mode 100644
index 0000000000..ece4488630
--- /dev/null
+++ b/vendor/golang.org/x/tools/internal/modindex/types.go
@@ -0,0 +1,25 @@
+// Copyright 2024 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 modindex
+
+import (
+	"strings"
+)
+
+// some special types to avoid confusions
+
+// distinguish various types of directory names. It's easy to get confused.
+type Abspath string // absolute paths
+type Relpath string // paths with GOMODCACHE prefix removed
+
+func toRelpath(cachedir Abspath, s string) Relpath {
+	if strings.HasPrefix(s, string(cachedir)) {
+		if s == string(cachedir) {
+			return Relpath("")
+		}
+		return Relpath(s[len(cachedir)+1:])
+	}
+	return Relpath(s)
+}
diff --git a/vendor/golang.org/x/tools/internal/stdlib/deps.go b/vendor/golang.org/x/tools/internal/stdlib/deps.go
new file mode 100644
index 0000000000..77cf8d2181
--- /dev/null
+++ b/vendor/golang.org/x/tools/internal/stdlib/deps.go
@@ -0,0 +1,359 @@
+// Copyright 2025 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.
+
+// Code generated by generate.go. DO NOT EDIT.
+
+package stdlib
+
+type pkginfo struct {
+	name string
+	deps string // list of indices of dependencies, as varint-encoded deltas
+}
+
+var deps = [...]pkginfo{
+	{"archive/tar", "\x03j\x03E5\x01\v\x01#\x01\x01\x02\x05\n\x02\x01\x02\x02\v"},
+	{"archive/zip", "\x02\x04`\a\x16\x0205\x01+\x05\x01\x11\x03\x02\r\x04"},
+	{"bufio", "\x03j}F\x13"},
+	{"bytes", "m+R\x03\fH\x02\x02"},
+	{"cmp", ""},
+	{"compress/bzip2", "\x02\x02\xe6\x01C"},
+	{"compress/flate", "\x02k\x03z\r\x025\x01\x03"},
+	{"compress/gzip", "\x02\x04`\a\x03\x15eU"},
+	{"compress/lzw", "\x02k\x03z"},
+	{"compress/zlib", "\x02\x04`\a\x03\x13\x01f"},
+	{"container/heap", "\xae\x02"},
+	{"container/list", ""},
+	{"container/ring", ""},
+	{"context", "m\\i\x01\f"},
+	{"crypto", "\x83\x01gE"},
+	{"crypto/aes", "\x10\n\a\x8e\x02"},
+	{"crypto/cipher", "\x03\x1e\x01\x01\x1d\x11\x1c,Q"},
+	{"crypto/des", "\x10\x13\x1d-,\x96\x01\x03"},
+	{"crypto/dsa", "@\x04)}\x0e"},
+	{"crypto/ecdh", "\x03\v\f\x0e\x04\x14\x04\r\x1c}"},
+	{"crypto/ecdsa", "\x0e\x05\x03\x04\x01\x0e\x16\x01\x04\f\x01\x1c}\x0e\x04L\x01"},
+	{"crypto/ed25519", "\x0e\x1c\x16\n\a\x1c}E"},
+	{"crypto/elliptic", "0=}\x0e:"},
+	{"crypto/fips140", " \x05\x90\x01"},
+	{"crypto/hkdf", "-\x12\x01-\x16"},
+	{"crypto/hmac", "\x1a\x14\x11\x01\x112"},
+	{"crypto/internal/boring", "\x0e\x02\rf"},
+	{"crypto/internal/boring/bbig", "\x1a\xde\x01M"},
+	{"crypto/internal/boring/bcache", "\xb3\x02\x12"},
+	{"crypto/internal/boring/sig", ""},
+	{"crypto/internal/cryptotest", "\x03\r\n)\x0e\x19\x06\x13\x12#\a\t\x11\x11\x11\x1b\x01\f\r\x05\n"},
+	{"crypto/internal/entropy", "E"},
+	{"crypto/internal/fips140", ">/}9\r\x15"},
+	{"crypto/internal/fips140/aes", "\x03\x1d\x03\x02\x13\x04\x01\x01\x05*\x8c\x016"},
+	{"crypto/internal/fips140/aes/gcm", " \x01\x02\x02\x02\x11\x04\x01\x06*\x8a\x01"},
+	{"crypto/internal/fips140/alias", "\xc5\x02"},
+	{"crypto/internal/fips140/bigmod", "%\x17\x01\x06*\x8c\x01"},
+	{"crypto/internal/fips140/check", " \x0e\x06\b\x02\xac\x01["},
+	{"crypto/internal/fips140/check/checktest", "%\xfe\x01\""},
+	{"crypto/internal/fips140/drbg", "\x03\x1c\x01\x01\x04\x13\x04\b\x01(}\x0f9"},
+	{"crypto/internal/fips140/ecdh", "\x03\x1d\x05\x02\t\f1}\x0f9"},
+	{"crypto/internal/fips140/ecdsa", "\x03\x1d\x04\x01\x02\a\x02\x067}H"},
+	{"crypto/internal/fips140/ed25519", "\x03\x1d\x05\x02\x04\v7\xc2\x01\x03"},
+	{"crypto/internal/fips140/edwards25519", "%\a\f\x041\x8c\x019"},
+	{"crypto/internal/fips140/edwards25519/field", "%\x13\x041\x8c\x01"},
+	{"crypto/internal/fips140/hkdf", "\x03\x1d\x05\t\x069"},
+	{"crypto/internal/fips140/hmac", "\x03\x1d\x14\x01\x017"},
+	{"crypto/internal/fips140/mlkem", "\x03\x1d\x05\x02\x0e\x03\x041"},
+	{"crypto/internal/fips140/nistec", "%\f\a\x041\x8c\x01*\x0f\x13"},
+	{"crypto/internal/fips140/nistec/fiat", "%\x135\x8c\x01"},
+	{"crypto/internal/fips140/pbkdf2", "\x03\x1d\x05\t\x069"},
+	{"crypto/internal/fips140/rsa", "\x03\x1d\x04\x01\x02\r\x01\x01\x025}H"},
+	{"crypto/internal/fips140/sha256", "\x03\x1d\x1c\x01\x06*\x8c\x01"},
+	{"crypto/internal/fips140/sha3", "\x03\x1d\x18\x04\x010\x8c\x01L"},
+	{"crypto/internal/fips140/sha512", "\x03\x1d\x1c\x01\x06*\x8c\x01"},
+	{"crypto/internal/fips140/ssh", " \x05"},
+	{"crypto/internal/fips140/subtle", "#"},
+	{"crypto/internal/fips140/tls12", "\x03\x1d\x05\t\x06\x027"},
+	{"crypto/internal/fips140/tls13", "\x03\x1d\x05\b\a\b1"},
+	{"crypto/internal/fips140deps", ""},
+	{"crypto/internal/fips140deps/byteorder", "\x99\x01"},
+	{"crypto/internal/fips140deps/cpu", "\xad\x01\a"},
+	{"crypto/internal/fips140deps/godebug", "\xb5\x01"},
+	{"crypto/internal/fips140hash", "5\x1a4\xc2\x01"},
+	{"crypto/internal/fips140only", "'\r\x01\x01M25"},
+	{"crypto/internal/fips140test", ""},
+	{"crypto/internal/hpke", "\x0e\x01\x01\x03\x1a\x1d#,`N"},
+	{"crypto/internal/impl", "\xb0\x02"},
+	{"crypto/internal/randutil", "\xea\x01\x12"},
+	{"crypto/internal/sysrand", "mi!\x1f\r\x0f\x01\x01\v\x06"},
+	{"crypto/internal/sysrand/internal/seccomp", "m"},
+	{"crypto/md5", "\x0e2-\x16\x16`"},
+	{"crypto/mlkem", "/"},
+	{"crypto/pbkdf2", "2\r\x01-\x16"},
+	{"crypto/rand", "\x1a\x06\a\x19\x04\x01(}\x0eM"},
+	{"crypto/rc4", "#\x1d-\xc2\x01"},
+	{"crypto/rsa", "\x0e\f\x01\t\x0f\f\x01\x04\x06\a\x1c\x03\x1325\r\x01"},
+	{"crypto/sha1", "\x0e\f&-\x16\x16\x14L"},
+	{"crypto/sha256", "\x0e\f\x1aO"},
+	{"crypto/sha3", "\x0e'N\xc2\x01"},
+	{"crypto/sha512", "\x0e\f\x1cM"},
+	{"crypto/subtle", "8\x96\x01U"},
+	{"crypto/tls", "\x03\b\x02\x01\x01\x01\x01\x02\x01\x01\x01\x03\x01\a\x01\v\x02\n\x01\b\x05\x03\x01\x01\x01\x01\x02\x01\x02\x01\x17\x02\x03\x13\x16\x14\b5\x16\x16\r\n\x01\x01\x01\x02\x01\f\x06\x02\x01"},
+	{"crypto/tls/internal/fips140tls", " \x93\x02"},
+	{"crypto/x509", "\x03\v\x01\x01\x01\x01\x01\x01\x01\x011\x03\x02\x01\x01\x02\x05\x0e\x06\x02\x02\x03E\x032\x01\x02\t\x01\x01\x01\a\x10\x05\x01\x06\x02\x05\f\x01\x02\r\x02\x01\x01\x02\x03\x01"},
+	{"crypto/x509/pkix", "c\x06\a\x88\x01G"},
+	{"database/sql", "\x03\nJ\x16\x03z\f\x06\"\x05\n\x02\x03\x01\f\x02\x02\x02"},
+	{"database/sql/driver", "\r`\x03\xae\x01\x11\x10"},
+	{"debug/buildinfo", "\x03W\x02\x01\x01\b\a\x03`\x18\x02\x01+\x0f "},
+	{"debug/dwarf", "\x03c\a\x03z1\x13\x01\x01"},
+	{"debug/elf", "\x03\x06P\r\a\x03`\x19\x01,\x19\x01\x15"},
+	{"debug/gosym", "\x03c\n\xbe\x01\x01\x01\x02"},
+	{"debug/macho", "\x03\x06P\r\n`\x1a,\x19\x01"},
+	{"debug/pe", "\x03\x06P\r\a\x03`\x1a,\x19\x01\x15"},
+	{"debug/plan9obj", "f\a\x03`\x1a,"},
+	{"embed", "m+:\x18\x01T"},
+	{"embed/internal/embedtest", ""},
+	{"encoding", ""},
+	{"encoding/ascii85", "\xea\x01E"},
+	{"encoding/asn1", "\x03j\x03\x87\x01\x01&\x0f\x02\x01\x0f\x03\x01"},
+	{"encoding/base32", "\xea\x01C\x02"},
+	{"encoding/base64", "\x99\x01QC\x02"},
+	{"encoding/binary", "m}\r'\x0f\x05"},
+	{"encoding/csv", "\x02\x01j\x03zF\x11\x02"},
+	{"encoding/gob", "\x02_\x05\a\x03`\x1a\f\x01\x02\x1d\b\x14\x01\x0e\x02"},
+	{"encoding/hex", "m\x03zC\x03"},
+	{"encoding/json", "\x03\x01]\x04\b\x03z\r'\x0f\x02\x01\x02\x0f\x01\x01\x02"},
+	{"encoding/pem", "\x03b\b}C\x03"},
+	{"encoding/xml", "\x02\x01^\f\x03z4\x05\f\x01\x02\x0f\x02"},
+	{"errors", "\xc9\x01|"},
+	{"expvar", "jK9\t\n\x15\r\n\x02\x03\x01\x10"},
+	{"flag", "a\f\x03z,\b\x05\n\x02\x01\x0f"},
+	{"fmt", "mE8\r\x1f\b\x0f\x02\x03\x11"},
+	{"go/ast", "\x03\x01l\x0f\x01j\x03)\b\x0f\x02\x01"},
+	{"go/ast/internal/tests", ""},
+	{"go/build", "\x02\x01j\x03\x01\x03\x02\a\x02\x01\x17\x1e\x04\x02\t\x14\x12\x01+\x01\x04\x01\a\n\x02\x01\x11\x02\x02"},
+	{"go/build/constraint", "m\xc2\x01\x01\x11\x02"},
+	{"go/constant", "p\x10w\x01\x016\x01\x02\x11"},
+	{"go/doc", "\x04l\x01\x06\t=-1\x12\x02\x01\x11\x02"},
+	{"go/doc/comment", "\x03m\xbd\x01\x01\x01\x01\x11\x02"},
+	{"go/format", "\x03m\x01\f\x01\x02jF"},
+	{"go/importer", "s\a\x01\x01\x04\x01i9"},
+	{"go/internal/gccgoimporter", "\x02\x01W\x13\x03\x05\v\x01g\x02,\x01\x05\x13\x01\v\b"},
+	{"go/internal/gcimporter", "\x02n\x10\x01/\x05\x0e',\x17\x03\x02"},
+	{"go/internal/srcimporter", "p\x01\x02\n\x03\x01i,\x01\x05\x14\x02\x13"},
+	{"go/parser", "\x03j\x03\x01\x03\v\x01j\x01+\x06\x14"},
+	{"go/printer", "p\x01\x03\x03\tj\r\x1f\x17\x02\x01\x02\n\x05\x02"},
+	{"go/scanner", "\x03m\x10j2\x12\x01\x12\x02"},
+	{"go/token", "\x04l\xbd\x01\x02\x03\x01\x0e\x02"},
+	{"go/types", "\x03\x01\x06c\x03\x01\x04\b\x03\x02\x15\x1e\x06+\x04\x03\n%\a\n\x01\x01\x01\x02\x01\x0e\x02\x02"},
+	{"go/version", "\xba\x01v"},
+	{"hash", "\xea\x01"},
+	{"hash/adler32", "m\x16\x16"},
+	{"hash/crc32", "m\x16\x16\x14\x85\x01\x01\x12"},
+	{"hash/crc64", "m\x16\x16\x99\x01"},
+	{"hash/fnv", "m\x16\x16`"},
+	{"hash/maphash", "\x94\x01\x05\x1b\x03@N"},
+	{"html", "\xb0\x02\x02\x11"},
+	{"html/template", "\x03g\x06\x19,5\x01\v \x05\x01\x02\x03\x0e\x01\x02\v\x01\x03\x02"},
+	{"image", "\x02k\x1f^\x0f6\x03\x01"},
+	{"image/color", ""},
+	{"image/color/palette", "\x8c\x01"},
+	{"image/draw", "\x8b\x01\x01\x04"},
+	{"image/gif", "\x02\x01\x05e\x03\x1b\x01\x01\x01\vQ"},
+	{"image/internal/imageutil", "\x8b\x01"},
+	{"image/jpeg", "\x02k\x1e\x01\x04Z"},
+	{"image/png", "\x02\a]\n\x13\x02\x06\x01^E"},
+	{"index/suffixarray", "\x03c\a}\r*\f\x01"},
+	{"internal/abi", "\xb4\x01\x91\x01"},
+	{"internal/asan", "\xc5\x02"},
+	{"internal/bisect", "\xa3\x02\x0f\x01"},
+	{"internal/buildcfg", "pG_\x06\x02\x05\f\x01"},
+	{"internal/bytealg", "\xad\x01\x98\x01"},
+	{"internal/byteorder", ""},
+	{"internal/cfg", ""},
+	{"internal/chacha8rand", "\x99\x01\x1b\x91\x01"},
+	{"internal/copyright", ""},
+	{"internal/coverage", ""},
+	{"internal/coverage/calloc", ""},
+	{"internal/coverage/cfile", "j\x06\x17\x16\x01\x02\x01\x01\x01\x01\x01\x01\x01#\x01\x1f,\x06\a\f\x01\x03\f\x06"},
+	{"internal/coverage/cformat", "\x04l-\x04I\f7\x01\x02\f"},
+	{"internal/coverage/cmerge", "p-Z"},
+	{"internal/coverage/decodecounter", "f\n-\v\x02@,\x19\x16"},
+	{"internal/coverage/decodemeta", "\x02d\n\x17\x16\v\x02@,"},
+	{"internal/coverage/encodecounter", "\x02d\n-\f\x01\x02>\f \x17"},
+	{"internal/coverage/encodemeta", "\x02\x01c\n\x13\x04\x16\r\x02>,/"},
+	{"internal/coverage/pods", "\x04l-y\x06\x05\f\x02\x01"},
+	{"internal/coverage/rtcov", "\xc5\x02"},
+	{"internal/coverage/slicereader", "f\nz["},
+	{"internal/coverage/slicewriter", "pz"},
+	{"internal/coverage/stringtab", "p8\x04>"},
+	{"internal/coverage/test", ""},
+	{"internal/coverage/uleb128", ""},
+	{"internal/cpu", "\xc5\x02"},
+	{"internal/dag", "\x04l\xbd\x01\x03"},
+	{"internal/diff", "\x03m\xbe\x01\x02"},
+	{"internal/exportdata", "\x02\x01j\x03\x03]\x1a,\x01\x05\x13\x01\x02"},
+	{"internal/filepathlite", "m+:\x19B"},
+	{"internal/fmtsort", "\x04\x9a\x02\x0f"},
+	{"internal/fuzz", "\x03\nA\x18\x04\x03\x03\x01\f\x0355\r\x02\x1d\x01\x05\x02\x05\f\x01\x02\x01\x01\v\x04\x02"},
+	{"internal/goarch", ""},
+	{"internal/godebug", "\x96\x01 |\x01\x12"},
+	{"internal/godebugs", ""},
+	{"internal/goexperiment", ""},
+	{"internal/goos", ""},
+	{"internal/goroot", "\x96\x02\x01\x05\x14\x02"},
+	{"internal/gover", "\x04"},
+	{"internal/goversion", ""},
+	{"internal/itoa", ""},
+	{"internal/lazyregexp", "\x96\x02\v\x0f\x02"},
+	{"internal/lazytemplate", "\xea\x01,\x1a\x02\v"},
+	{"internal/msan", "\xc5\x02"},
+	{"internal/nettrace", ""},
+	{"internal/obscuretestdata", "e\x85\x01,"},
+	{"internal/oserror", "m"},
+	{"internal/pkgbits", "\x03K\x18\a\x03\x05\vj\x0e\x1e\r\f\x01"},
+	{"internal/platform", ""},
+	{"internal/poll", "mO\x1a\x149\x0f\x01\x01\v\x06"},
+	{"internal/profile", "\x03\x04f\x03z7\r\x01\x01\x0f"},
+	{"internal/profilerecord", ""},
+	{"internal/race", "\x94\x01\xb1\x01"},
+	{"internal/reflectlite", "\x94\x01 3<\""},
+	{"internal/runtime/atomic", "\xc5\x02"},
+	{"internal/runtime/exithook", "\xca\x01{"},
+	{"internal/runtime/maps", "\x94\x01\x01\x1f\v\t\x05\x01w"},
+	{"internal/runtime/math", "\xb4\x01"},
+	{"internal/runtime/sys", "\xb4\x01\x04"},
+	{"internal/runtime/syscall", "\xc5\x02"},
+	{"internal/saferio", "\xea\x01["},
+	{"internal/singleflight", "\xb2\x02"},
+	{"internal/stringslite", "\x98\x01\xad\x01"},
+	{"internal/sync", "\x94\x01 \x14k\x12"},
+	{"internal/synctest", "\xc5\x02"},
+	{"internal/syscall/execenv", "\xb4\x02"},
+	{"internal/syscall/unix", "\xa3\x02\x10\x01\x11"},
+	{"internal/sysinfo", "\x02\x01\xaa\x01=,\x1a\x02"},
+	{"internal/syslist", ""},
+	{"internal/testenv", "\x03\n`\x02\x01*\x1a\x10'+\x01\x05\a\f\x01\x02\x02\x01\n"},
+	{"internal/testlog", "\xb2\x02\x01\x12"},
+	{"internal/testpty", "m\x03\xa6\x01"},
+	{"internal/trace", "\x02\x01\x01\x06\\\a\x03n\x03\x03\x06\x03\n6\x01\x02\x0f\x06"},
+	{"internal/trace/internal/testgen", "\x03c\nl\x03\x02\x03\x011\v\x0f"},
+	{"internal/trace/internal/tracev1", "\x03\x01b\a\x03t\x06\r6\x01"},
+	{"internal/trace/raw", "\x02d\nq\x03\x06E\x01\x11"},
+	{"internal/trace/testtrace", "\x02\x01j\x03l\x03\x06\x057\f\x02\x01"},
+	{"internal/trace/tracev2", ""},
+	{"internal/trace/traceviewer", "\x02]\v\x06\x1a<\x16\a\a\x04\t\n\x15\x01\x05\a\f\x01\x02\r"},
+	{"internal/trace/traceviewer/format", ""},
+	{"internal/trace/version", "pq\t"},
+	{"internal/txtar", "\x03m\xa6\x01\x1a"},
+	{"internal/types/errors", "\xaf\x02"},
+	{"internal/unsafeheader", "\xc5\x02"},
+	{"internal/xcoff", "Y\r\a\x03`\x1a,\x19\x01"},
+	{"internal/zstd", "f\a\x03z\x0f"},
+	{"io", "m\xc5\x01"},
+	{"io/fs", "m+*(1\x12\x12\x04"},
+	{"io/ioutil", "\xea\x01\x01+\x17\x03"},
+	{"iter", "\xc8\x01[\""},
+	{"log", "pz\x05'\r\x0f\x01\f"},
+	{"log/internal", ""},
+	{"log/slog", "\x03\nT\t\x03\x03z\x04\x01\x02\x02\x04'\x05\n\x02\x01\x02\x01\f\x02\x02\x02"},
+	{"log/slog/internal", ""},
+	{"log/slog/internal/benchmarks", "\r`\x03z\x06\x03<\x10"},
+	{"log/slog/internal/buffer", "\xb2\x02"},
+	{"log/slog/internal/slogtest", "\xf0\x01"},
+	{"log/syslog", "m\x03~\x12\x16\x1a\x02\r"},
+	{"maps", "\xed\x01X"},
+	{"math", "\xad\x01LL"},
+	{"math/big", "\x03j\x03)\x14=\r\x02\x024\x01\x02\x13"},
+	{"math/bits", "\xc5\x02"},
+	{"math/cmplx", "\xf7\x01\x02"},
+	{"math/rand", "\xb5\x01B;\x01\x12"},
+	{"math/rand/v2", "m,\x02\\\x02L"},
+	{"mime", "\x02\x01b\b\x03z\f \x17\x03\x02\x0f\x02"},
+	{"mime/multipart", "\x02\x01G#\x03E5\f\x01\x06\x02\x15\x02\x06\x11\x02\x01\x15"},
+	{"mime/quotedprintable", "\x02\x01mz"},
+	{"net", "\x04\t`+\x1d\a\x04\x05\f\x01\x04\x14\x01%\x06\r\n\x05\x01\x01\v\x06\a"},
+	{"net/http", "\x02\x01\x04\x04\x02=\b\x13\x01\a\x03E5\x01\x03\b\x01\x02\x02\x02\x01\x02\x06\x02\x01\x01\n\x01\x01\x05\x01\x02\x05\n\x01\x01\x01\x02\x01\x01\v\x02\x02\x02\b\x01\x01\x01"},
+	{"net/http/cgi", "\x02P\x1b\x03z\x04\b\n\x01\x13\x01\x01\x01\x04\x01\x05\x02\n\x02\x01\x0f\x0e"},
+	{"net/http/cookiejar", "\x04i\x03\x90\x01\x01\b\f\x18\x03\x02\r\x04"},
+	{"net/http/fcgi", "\x02\x01\nY\a\x03z\x16\x01\x01\x14\x1a\x02\r"},
+	{"net/http/httptest", "\x02\x01\nE\x02\x1b\x01z\x04\x12\x01\n\t\x02\x19\x01\x02\r\x0e"},
+	{"net/http/httptrace", "\rEn@\x14\n!"},
+	{"net/http/httputil", "\x02\x01\n`\x03z\x04\x0f\x03\x01\x05\x02\x01\v\x01\x1b\x02\r\x0e"},
+	{"net/http/internal", "\x02\x01j\x03z"},
+	{"net/http/internal/ascii", "\xb0\x02\x11"},
+	{"net/http/internal/httpcommon", "\r`\x03\x96\x01\x0e\x01\x19\x01\x01\x02\x1b\x02"},
+	{"net/http/internal/testcert", "\xb0\x02"},
+	{"net/http/pprof", "\x02\x01\nc\x19,\x11$\x04\x13\x14\x01\r\x06\x03\x01\x02\x01\x0f"},
+	{"net/internal/cgotest", ""},
+	{"net/internal/socktest", "p\xc2\x01\x02"},
+	{"net/mail", "\x02k\x03z\x04\x0f\x03\x14\x1c\x02\r\x04"},
+	{"net/netip", "\x04i+\x01#;\x026\x15"},
+	{"net/rpc", "\x02f\x05\x03\x10\n`\x04\x12\x01\x1d\x0f\x03\x02"},
+	{"net/rpc/jsonrpc", "j\x03\x03z\x16\x11!"},
+	{"net/smtp", "\x19.\v\x13\b\x03z\x16\x14\x1c"},
+	{"net/textproto", "\x02\x01j\x03z\r\t/\x01\x02\x13"},
+	{"net/url", "m\x03\x86\x01%\x12\x02\x01\x15"},
+	{"os", "m+\x01\x18\x03\b\t\r\x03\x01\x04\x10\x018\n\x05\x01\x01\v\x06"},
+	{"os/exec", "\x03\n`H \x01\x14\x01+\x06\a\f\x01\x04\v"},
+	{"os/exec/internal/fdtest", "\xb4\x02"},
+	{"os/signal", "\r\x89\x02\x17\x05\x02"},
+	{"os/user", "\x02\x01j\x03z,\r\f\x01\x02"},
+	{"path", "m+\xab\x01"},
+	{"path/filepath", "m+\x19:+\r\n\x03\x04\x0f"},
+	{"plugin", "m"},
+	{"reflect", "m'\x04\x1c\b\f\x04\x02\x19\x10,\f\x03\x0f\x02\x02"},
+	{"reflect/internal/example1", ""},
+	{"reflect/internal/example2", ""},
+	{"regexp", "\x03\xe7\x018\v\x02\x01\x02\x0f\x02"},
+	{"regexp/syntax", "\xad\x02\x01\x01\x01\x11\x02"},
+	{"runtime", "\x94\x01\x04\x01\x02\f\x06\a\x02\x01\x01\x0f\x03\x01\x01\x01\x01\x01\x03\x0fd"},
+	{"runtime/coverage", "\x9f\x01K"},
+	{"runtime/debug", "pUQ\r\n\x02\x01\x0f\x06"},
+	{"runtime/internal/startlinetest", ""},
+	{"runtime/internal/wasitest", ""},
+	{"runtime/metrics", "\xb6\x01A,\""},
+	{"runtime/pprof", "\x02\x01\x01\x03\x06Y\a\x03$3#\r\x1f\r\n\x01\x01\x01\x02\x02\b\x03\x06"},
+	{"runtime/race", "\xab\x02"},
+	{"runtime/race/internal/amd64v1", ""},
+	{"runtime/trace", "\rcz9\x0f\x01\x12"},
+	{"slices", "\x04\xe9\x01\fL"},
+	{"sort", "\xc9\x0104"},
+	{"strconv", "m+:%\x02J"},
+	{"strings", "m'\x04:\x18\x03\f9\x0f\x02\x02"},
+	{"structs", ""},
+	{"sync", "\xc8\x01\vP\x10\x12"},
+	{"sync/atomic", "\xc5\x02"},
+	{"syscall", "m(\x03\x01\x1b\b\x03\x03\x06\aT\n\x05\x01\x12"},
+	{"testing", "\x03\n`\x02\x01X\x0f\x13\r\x04\x1b\x06\x02\x05\x02\a\x01\x02\x01\x02\x01\f\x02\x02\x02"},
+	{"testing/fstest", "m\x03z\x01\v%\x12\x03\b\a"},
+	{"testing/internal/testdeps", "\x02\v\xa6\x01'\x10,\x03\x05\x03\b\a\x02\r"},
+	{"testing/iotest", "\x03j\x03z\x04"},
+	{"testing/quick", "o\x01\x87\x01\x04#\x12\x0f"},
+	{"testing/slogtest", "\r`\x03\x80\x01.\x05\x12\n"},
+	{"text/scanner", "\x03mz,+\x02"},
+	{"text/tabwriter", "pzY"},
+	{"text/template", "m\x03B8\x01\v\x1f\x01\x05\x01\x02\x05\r\x02\f\x03\x02"},
+	{"text/template/parse", "\x03m\xb3\x01\f\x01\x11\x02"},
+	{"time", "m+\x1d\x1d'*\x0f\x02\x11"},
+	{"time/tzdata", "m\xc7\x01\x11"},
+	{"unicode", ""},
+	{"unicode/utf16", ""},
+	{"unicode/utf8", ""},
+	{"unique", "\x94\x01>\x01P\x0f\x13\x12"},
+	{"unsafe", ""},
+	{"vendor/golang.org/x/crypto/chacha20", "\x10V\a\x8c\x01*'"},
+	{"vendor/golang.org/x/crypto/chacha20poly1305", "\x10V\a\xd9\x01\x04\x01\a"},
+	{"vendor/golang.org/x/crypto/cryptobyte", "c\n\x03\x88\x01&!\n"},
+	{"vendor/golang.org/x/crypto/cryptobyte/asn1", ""},
+	{"vendor/golang.org/x/crypto/internal/alias", "\xc5\x02"},
+	{"vendor/golang.org/x/crypto/internal/poly1305", "Q\x15\x93\x01"},
+	{"vendor/golang.org/x/net/dns/dnsmessage", "m"},
+	{"vendor/golang.org/x/net/http/httpguts", "\x80\x02\x14\x1c\x13\r"},
+	{"vendor/golang.org/x/net/http/httpproxy", "m\x03\x90\x01\x15\x01\x1a\x13\r"},
+	{"vendor/golang.org/x/net/http2/hpack", "\x03j\x03zH"},
+	{"vendor/golang.org/x/net/idna", "p\x87\x019\x13\x10\x02\x01"},
+	{"vendor/golang.org/x/net/nettest", "\x03c\a\x03z\x11\x05\x16\x01\f\f\x01\x02\x02\x01\n"},
+	{"vendor/golang.org/x/sys/cpu", "\x96\x02\r\f\x01\x15"},
+	{"vendor/golang.org/x/text/secure/bidirule", "m\xd6\x01\x11\x01"},
+	{"vendor/golang.org/x/text/transform", "\x03j}Y"},
+	{"vendor/golang.org/x/text/unicode/bidi", "\x03\be~@\x15"},
+	{"vendor/golang.org/x/text/unicode/norm", "f\nzH\x11\x11"},
+	{"weak", "\x94\x01\x8f\x01\""},
+}
diff --git a/vendor/golang.org/x/tools/internal/stdlib/import.go b/vendor/golang.org/x/tools/internal/stdlib/import.go
new file mode 100644
index 0000000000..f6909878a8
--- /dev/null
+++ b/vendor/golang.org/x/tools/internal/stdlib/import.go
@@ -0,0 +1,89 @@
+// Copyright 2025 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 stdlib
+
+// This file provides the API for the import graph of the standard library.
+//
+// Be aware that the compiler-generated code for every package
+// implicitly depends on package "runtime" and a handful of others
+// (see runtimePkgs in GOROOT/src/cmd/internal/objabi/pkgspecial.go).
+
+import (
+	"encoding/binary"
+	"iter"
+	"slices"
+	"strings"
+)
+
+// Imports returns the sequence of packages directly imported by the
+// named standard packages, in name order.
+// The imports of an unknown package are the empty set.
+//
+// The graph is built into the application and may differ from the
+// graph in the Go source tree being analyzed by the application.
+func Imports(pkgs ...string) iter.Seq[string] {
+	return func(yield func(string) bool) {
+		for _, pkg := range pkgs {
+			if i, ok := find(pkg); ok {
+				var depIndex uint64
+				for data := []byte(deps[i].deps); len(data) > 0; {
+					delta, n := binary.Uvarint(data)
+					depIndex += delta
+					if !yield(deps[depIndex].name) {
+						return
+					}
+					data = data[n:]
+				}
+			}
+		}
+	}
+}
+
+// Dependencies returns the set of all dependencies of the named
+// standard packages, including the initial package,
+// in a deterministic topological order.
+// The dependencies of an unknown package are the empty set.
+//
+// The graph is built into the application and may differ from the
+// graph in the Go source tree being analyzed by the application.
+func Dependencies(pkgs ...string) iter.Seq[string] {
+	return func(yield func(string) bool) {
+		for _, pkg := range pkgs {
+			if i, ok := find(pkg); ok {
+				var seen [1 + len(deps)/8]byte // bit set of seen packages
+				var visit func(i int) bool
+				visit = func(i int) bool {
+					bit := byte(1) << (i % 8)
+					if seen[i/8]&bit == 0 {
+						seen[i/8] |= bit
+						var depIndex uint64
+						for data := []byte(deps[i].deps); len(data) > 0; {
+							delta, n := binary.Uvarint(data)
+							depIndex += delta
+							if !visit(int(depIndex)) {
+								return false
+							}
+							data = data[n:]
+						}
+						if !yield(deps[i].name) {
+							return false
+						}
+					}
+					return true
+				}
+				if !visit(i) {
+					return
+				}
+			}
+		}
+	}
+}
+
+// find returns the index of pkg in the deps table.
+func find(pkg string) (int, bool) {
+	return slices.BinarySearchFunc(deps[:], pkg, func(p pkginfo, n string) int {
+		return strings.Compare(p.name, n)
+	})
+}
diff --git a/vendor/golang.org/x/tools/internal/stdlib/manifest.go b/vendor/golang.org/x/tools/internal/stdlib/manifest.go
new file mode 100644
index 0000000000..64f0326b64
--- /dev/null
+++ b/vendor/golang.org/x/tools/internal/stdlib/manifest.go
@@ -0,0 +1,17676 @@
+// Copyright 2025 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.
+
+// Code generated by generate.go. DO NOT EDIT.
+
+package stdlib
+
+var PackageSymbols = map[string][]Symbol{
+	"archive/tar": {
+		{"(*Header).FileInfo", Method, 1, ""},
+		{"(*Reader).Next", Method, 0, ""},
+		{"(*Reader).Read", Method, 0, ""},
+		{"(*Writer).AddFS", Method, 22, ""},
+		{"(*Writer).Close", Method, 0, ""},
+		{"(*Writer).Flush", Method, 0, ""},
+		{"(*Writer).Write", Method, 0, ""},
+		{"(*Writer).WriteHeader", Method, 0, ""},
+		{"(Format).String", Method, 10, ""},
+		{"ErrFieldTooLong", Var, 0, ""},
+		{"ErrHeader", Var, 0, ""},
+		{"ErrInsecurePath", Var, 20, ""},
+		{"ErrWriteAfterClose", Var, 0, ""},
+		{"ErrWriteTooLong", Var, 0, ""},
+		{"FileInfoHeader", Func, 1, "func(fi fs.FileInfo, link string) (*Header, error)"},
+		{"FileInfoNames", Type, 23, ""},
+		{"Format", Type, 10, ""},
+		{"FormatGNU", Const, 10, ""},
+		{"FormatPAX", Const, 10, ""},
+		{"FormatUSTAR", Const, 10, ""},
+		{"FormatUnknown", Const, 10, ""},
+		{"Header", Type, 0, ""},
+		{"Header.AccessTime", Field, 0, ""},
+		{"Header.ChangeTime", Field, 0, ""},
+		{"Header.Devmajor", Field, 0, ""},
+		{"Header.Devminor", Field, 0, ""},
+		{"Header.Format", Field, 10, ""},
+		{"Header.Gid", Field, 0, ""},
+		{"Header.Gname", Field, 0, ""},
+		{"Header.Linkname", Field, 0, ""},
+		{"Header.ModTime", Field, 0, ""},
+		{"Header.Mode", Field, 0, ""},
+		{"Header.Name", Field, 0, ""},
+		{"Header.PAXRecords", Field, 10, ""},
+		{"Header.Size", Field, 0, ""},
+		{"Header.Typeflag", Field, 0, ""},
+		{"Header.Uid", Field, 0, ""},
+		{"Header.Uname", Field, 0, ""},
+		{"Header.Xattrs", Field, 3, ""},
+		{"NewReader", Func, 0, "func(r io.Reader) *Reader"},
+		{"NewWriter", Func, 0, "func(w io.Writer) *Writer"},
+		{"Reader", Type, 0, ""},
+		{"TypeBlock", Const, 0, ""},
+		{"TypeChar", Const, 0, ""},
+		{"TypeCont", Const, 0, ""},
+		{"TypeDir", Const, 0, ""},
+		{"TypeFifo", Const, 0, ""},
+		{"TypeGNULongLink", Const, 1, ""},
+		{"TypeGNULongName", Const, 1, ""},
+		{"TypeGNUSparse", Const, 3, ""},
+		{"TypeLink", Const, 0, ""},
+		{"TypeReg", Const, 0, ""},
+		{"TypeRegA", Const, 0, ""},
+		{"TypeSymlink", Const, 0, ""},
+		{"TypeXGlobalHeader", Const, 0, ""},
+		{"TypeXHeader", Const, 0, ""},
+		{"Writer", Type, 0, ""},
+	},
+	"archive/zip": {
+		{"(*File).DataOffset", Method, 2, ""},
+		{"(*File).FileInfo", Method, 0, ""},
+		{"(*File).ModTime", Method, 0, ""},
+		{"(*File).Mode", Method, 0, ""},
+		{"(*File).Open", Method, 0, ""},
+		{"(*File).OpenRaw", Method, 17, ""},
+		{"(*File).SetModTime", Method, 0, ""},
+		{"(*File).SetMode", Method, 0, ""},
+		{"(*FileHeader).FileInfo", Method, 0, ""},
+		{"(*FileHeader).ModTime", Method, 0, ""},
+		{"(*FileHeader).Mode", Method, 0, ""},
+		{"(*FileHeader).SetModTime", Method, 0, ""},
+		{"(*FileHeader).SetMode", Method, 0, ""},
+		{"(*ReadCloser).Close", Method, 0, ""},
+		{"(*ReadCloser).Open", Method, 16, ""},
+		{"(*ReadCloser).RegisterDecompressor", Method, 6, ""},
+		{"(*Reader).Open", Method, 16, ""},
+		{"(*Reader).RegisterDecompressor", Method, 6, ""},
+		{"(*Writer).AddFS", Method, 22, ""},
+		{"(*Writer).Close", Method, 0, ""},
+		{"(*Writer).Copy", Method, 17, ""},
+		{"(*Writer).Create", Method, 0, ""},
+		{"(*Writer).CreateHeader", Method, 0, ""},
+		{"(*Writer).CreateRaw", Method, 17, ""},
+		{"(*Writer).Flush", Method, 4, ""},
+		{"(*Writer).RegisterCompressor", Method, 6, ""},
+		{"(*Writer).SetComment", Method, 10, ""},
+		{"(*Writer).SetOffset", Method, 5, ""},
+		{"Compressor", Type, 2, ""},
+		{"Decompressor", Type, 2, ""},
+		{"Deflate", Const, 0, ""},
+		{"ErrAlgorithm", Var, 0, ""},
+		{"ErrChecksum", Var, 0, ""},
+		{"ErrFormat", Var, 0, ""},
+		{"ErrInsecurePath", Var, 20, ""},
+		{"File", Type, 0, ""},
+		{"File.FileHeader", Field, 0, ""},
+		{"FileHeader", Type, 0, ""},
+		{"FileHeader.CRC32", Field, 0, ""},
+		{"FileHeader.Comment", Field, 0, ""},
+		{"FileHeader.CompressedSize", Field, 0, ""},
+		{"FileHeader.CompressedSize64", Field, 1, ""},
+		{"FileHeader.CreatorVersion", Field, 0, ""},
+		{"FileHeader.ExternalAttrs", Field, 0, ""},
+		{"FileHeader.Extra", Field, 0, ""},
+		{"FileHeader.Flags", Field, 0, ""},
+		{"FileHeader.Method", Field, 0, ""},
+		{"FileHeader.Modified", Field, 10, ""},
+		{"FileHeader.ModifiedDate", Field, 0, ""},
+		{"FileHeader.ModifiedTime", Field, 0, ""},
+		{"FileHeader.Name", Field, 0, ""},
+		{"FileHeader.NonUTF8", Field, 10, ""},
+		{"FileHeader.ReaderVersion", Field, 0, ""},
+		{"FileHeader.UncompressedSize", Field, 0, ""},
+		{"FileHeader.UncompressedSize64", Field, 1, ""},
+		{"FileInfoHeader", Func, 0, "func(fi fs.FileInfo) (*FileHeader, error)"},
+		{"NewReader", Func, 0, "func(r io.ReaderAt, size int64) (*Reader, error)"},
+		{"NewWriter", Func, 0, "func(w io.Writer) *Writer"},
+		{"OpenReader", Func, 0, "func(name string) (*ReadCloser, error)"},
+		{"ReadCloser", Type, 0, ""},
+		{"ReadCloser.Reader", Field, 0, ""},
+		{"Reader", Type, 0, ""},
+		{"Reader.Comment", Field, 0, ""},
+		{"Reader.File", Field, 0, ""},
+		{"RegisterCompressor", Func, 2, "func(method uint16, comp Compressor)"},
+		{"RegisterDecompressor", Func, 2, "func(method uint16, dcomp Decompressor)"},
+		{"Store", Const, 0, ""},
+		{"Writer", Type, 0, ""},
+	},
+	"bufio": {
+		{"(*Reader).Buffered", Method, 0, ""},
+		{"(*Reader).Discard", Method, 5, ""},
+		{"(*Reader).Peek", Method, 0, ""},
+		{"(*Reader).Read", Method, 0, ""},
+		{"(*Reader).ReadByte", Method, 0, ""},
+		{"(*Reader).ReadBytes", Method, 0, ""},
+		{"(*Reader).ReadLine", Method, 0, ""},
+		{"(*Reader).ReadRune", Method, 0, ""},
+		{"(*Reader).ReadSlice", Method, 0, ""},
+		{"(*Reader).ReadString", Method, 0, ""},
+		{"(*Reader).Reset", Method, 2, ""},
+		{"(*Reader).Size", Method, 10, ""},
+		{"(*Reader).UnreadByte", Method, 0, ""},
+		{"(*Reader).UnreadRune", Method, 0, ""},
+		{"(*Reader).WriteTo", Method, 1, ""},
+		{"(*Scanner).Buffer", Method, 6, ""},
+		{"(*Scanner).Bytes", Method, 1, ""},
+		{"(*Scanner).Err", Method, 1, ""},
+		{"(*Scanner).Scan", Method, 1, ""},
+		{"(*Scanner).Split", Method, 1, ""},
+		{"(*Scanner).Text", Method, 1, ""},
+		{"(*Writer).Available", Method, 0, ""},
+		{"(*Writer).AvailableBuffer", Method, 18, ""},
+		{"(*Writer).Buffered", Method, 0, ""},
+		{"(*Writer).Flush", Method, 0, ""},
+		{"(*Writer).ReadFrom", Method, 1, ""},
+		{"(*Writer).Reset", Method, 2, ""},
+		{"(*Writer).Size", Method, 10, ""},
+		{"(*Writer).Write", Method, 0, ""},
+		{"(*Writer).WriteByte", Method, 0, ""},
+		{"(*Writer).WriteRune", Method, 0, ""},
+		{"(*Writer).WriteString", Method, 0, ""},
+		{"(ReadWriter).Available", Method, 0, ""},
+		{"(ReadWriter).AvailableBuffer", Method, 18, ""},
+		{"(ReadWriter).Discard", Method, 5, ""},
+		{"(ReadWriter).Flush", Method, 0, ""},
+		{"(ReadWriter).Peek", Method, 0, ""},
+		{"(ReadWriter).Read", Method, 0, ""},
+		{"(ReadWriter).ReadByte", Method, 0, ""},
+		{"(ReadWriter).ReadBytes", Method, 0, ""},
+		{"(ReadWriter).ReadFrom", Method, 1, ""},
+		{"(ReadWriter).ReadLine", Method, 0, ""},
+		{"(ReadWriter).ReadRune", Method, 0, ""},
+		{"(ReadWriter).ReadSlice", Method, 0, ""},
+		{"(ReadWriter).ReadString", Method, 0, ""},
+		{"(ReadWriter).UnreadByte", Method, 0, ""},
+		{"(ReadWriter).UnreadRune", Method, 0, ""},
+		{"(ReadWriter).Write", Method, 0, ""},
+		{"(ReadWriter).WriteByte", Method, 0, ""},
+		{"(ReadWriter).WriteRune", Method, 0, ""},
+		{"(ReadWriter).WriteString", Method, 0, ""},
+		{"(ReadWriter).WriteTo", Method, 1, ""},
+		{"ErrAdvanceTooFar", Var, 1, ""},
+		{"ErrBadReadCount", Var, 15, ""},
+		{"ErrBufferFull", Var, 0, ""},
+		{"ErrFinalToken", Var, 6, ""},
+		{"ErrInvalidUnreadByte", Var, 0, ""},
+		{"ErrInvalidUnreadRune", Var, 0, ""},
+		{"ErrNegativeAdvance", Var, 1, ""},
+		{"ErrNegativeCount", Var, 0, ""},
+		{"ErrTooLong", Var, 1, ""},
+		{"MaxScanTokenSize", Const, 1, ""},
+		{"NewReadWriter", Func, 0, "func(r *Reader, w *Writer) *ReadWriter"},
+		{"NewReader", Func, 0, "func(rd io.Reader) *Reader"},
+		{"NewReaderSize", Func, 0, "func(rd io.Reader, size int) *Reader"},
+		{"NewScanner", Func, 1, "func(r io.Reader) *Scanner"},
+		{"NewWriter", Func, 0, "func(w io.Writer) *Writer"},
+		{"NewWriterSize", Func, 0, "func(w io.Writer, size int) *Writer"},
+		{"ReadWriter", Type, 0, ""},
+		{"ReadWriter.Reader", Field, 0, ""},
+		{"ReadWriter.Writer", Field, 0, ""},
+		{"Reader", Type, 0, ""},
+		{"ScanBytes", Func, 1, "func(data []byte, atEOF bool) (advance int, token []byte, err error)"},
+		{"ScanLines", Func, 1, "func(data []byte, atEOF bool) (advance int, token []byte, err error)"},
+		{"ScanRunes", Func, 1, "func(data []byte, atEOF bool) (advance int, token []byte, err error)"},
+		{"ScanWords", Func, 1, "func(data []byte, atEOF bool) (advance int, token []byte, err error)"},
+		{"Scanner", Type, 1, ""},
+		{"SplitFunc", Type, 1, ""},
+		{"Writer", Type, 0, ""},
+	},
+	"bytes": {
+		{"(*Buffer).Available", Method, 21, ""},
+		{"(*Buffer).AvailableBuffer", Method, 21, ""},
+		{"(*Buffer).Bytes", Method, 0, ""},
+		{"(*Buffer).Cap", Method, 5, ""},
+		{"(*Buffer).Grow", Method, 1, ""},
+		{"(*Buffer).Len", Method, 0, ""},
+		{"(*Buffer).Next", Method, 0, ""},
+		{"(*Buffer).Read", Method, 0, ""},
+		{"(*Buffer).ReadByte", Method, 0, ""},
+		{"(*Buffer).ReadBytes", Method, 0, ""},
+		{"(*Buffer).ReadFrom", Method, 0, ""},
+		{"(*Buffer).ReadRune", Method, 0, ""},
+		{"(*Buffer).ReadString", Method, 0, ""},
+		{"(*Buffer).Reset", Method, 0, ""},
+		{"(*Buffer).String", Method, 0, ""},
+		{"(*Buffer).Truncate", Method, 0, ""},
+		{"(*Buffer).UnreadByte", Method, 0, ""},
+		{"(*Buffer).UnreadRune", Method, 0, ""},
+		{"(*Buffer).Write", Method, 0, ""},
+		{"(*Buffer).WriteByte", Method, 0, ""},
+		{"(*Buffer).WriteRune", Method, 0, ""},
+		{"(*Buffer).WriteString", Method, 0, ""},
+		{"(*Buffer).WriteTo", Method, 0, ""},
+		{"(*Reader).Len", Method, 0, ""},
+		{"(*Reader).Read", Method, 0, ""},
+		{"(*Reader).ReadAt", Method, 0, ""},
+		{"(*Reader).ReadByte", Method, 0, ""},
+		{"(*Reader).ReadRune", Method, 0, ""},
+		{"(*Reader).Reset", Method, 7, ""},
+		{"(*Reader).Seek", Method, 0, ""},
+		{"(*Reader).Size", Method, 5, ""},
+		{"(*Reader).UnreadByte", Method, 0, ""},
+		{"(*Reader).UnreadRune", Method, 0, ""},
+		{"(*Reader).WriteTo", Method, 1, ""},
+		{"Buffer", Type, 0, ""},
+		{"Clone", Func, 20, "func(b []byte) []byte"},
+		{"Compare", Func, 0, "func(a []byte, b []byte) int"},
+		{"Contains", Func, 0, "func(b []byte, subslice []byte) bool"},
+		{"ContainsAny", Func, 7, "func(b []byte, chars string) bool"},
+		{"ContainsFunc", Func, 21, "func(b []byte, f func(rune) bool) bool"},
+		{"ContainsRune", Func, 7, "func(b []byte, r rune) bool"},
+		{"Count", Func, 0, "func(s []byte, sep []byte) int"},
+		{"Cut", Func, 18, "func(s []byte, sep []byte) (before []byte, after []byte, found bool)"},
+		{"CutPrefix", Func, 20, "func(s []byte, prefix []byte) (after []byte, found bool)"},
+		{"CutSuffix", Func, 20, "func(s []byte, suffix []byte) (before []byte, found bool)"},
+		{"Equal", Func, 0, "func(a []byte, b []byte) bool"},
+		{"EqualFold", Func, 0, "func(s []byte, t []byte) bool"},
+		{"ErrTooLarge", Var, 0, ""},
+		{"Fields", Func, 0, "func(s []byte) [][]byte"},
+		{"FieldsFunc", Func, 0, "func(s []byte, f func(rune) bool) [][]byte"},
+		{"FieldsFuncSeq", Func, 24, "func(s []byte, f func(rune) bool) iter.Seq[[]byte]"},
+		{"FieldsSeq", Func, 24, "func(s []byte) iter.Seq[[]byte]"},
+		{"HasPrefix", Func, 0, "func(s []byte, prefix []byte) bool"},
+		{"HasSuffix", Func, 0, "func(s []byte, suffix []byte) bool"},
+		{"Index", Func, 0, "func(s []byte, sep []byte) int"},
+		{"IndexAny", Func, 0, "func(s []byte, chars string) int"},
+		{"IndexByte", Func, 0, "func(b []byte, c byte) int"},
+		{"IndexFunc", Func, 0, "func(s []byte, f func(r rune) bool) int"},
+		{"IndexRune", Func, 0, "func(s []byte, r rune) int"},
+		{"Join", Func, 0, "func(s [][]byte, sep []byte) []byte"},
+		{"LastIndex", Func, 0, "func(s []byte, sep []byte) int"},
+		{"LastIndexAny", Func, 0, "func(s []byte, chars string) int"},
+		{"LastIndexByte", Func, 5, "func(s []byte, c byte) int"},
+		{"LastIndexFunc", Func, 0, "func(s []byte, f func(r rune) bool) int"},
+		{"Lines", Func, 24, "func(s []byte) iter.Seq[[]byte]"},
+		{"Map", Func, 0, "func(mapping func(r rune) rune, s []byte) []byte"},
+		{"MinRead", Const, 0, ""},
+		{"NewBuffer", Func, 0, "func(buf []byte) *Buffer"},
+		{"NewBufferString", Func, 0, "func(s string) *Buffer"},
+		{"NewReader", Func, 0, "func(b []byte) *Reader"},
+		{"Reader", Type, 0, ""},
+		{"Repeat", Func, 0, "func(b []byte, count int) []byte"},
+		{"Replace", Func, 0, "func(s []byte, old []byte, new []byte, n int) []byte"},
+		{"ReplaceAll", Func, 12, "func(s []byte, old []byte, new []byte) []byte"},
+		{"Runes", Func, 0, "func(s []byte) []rune"},
+		{"Split", Func, 0, "func(s []byte, sep []byte) [][]byte"},
+		{"SplitAfter", Func, 0, "func(s []byte, sep []byte) [][]byte"},
+		{"SplitAfterN", Func, 0, "func(s []byte, sep []byte, n int) [][]byte"},
+		{"SplitAfterSeq", Func, 24, "func(s []byte, sep []byte) iter.Seq[[]byte]"},
+		{"SplitN", Func, 0, "func(s []byte, sep []byte, n int) [][]byte"},
+		{"SplitSeq", Func, 24, "func(s []byte, sep []byte) iter.Seq[[]byte]"},
+		{"Title", Func, 0, "func(s []byte) []byte"},
+		{"ToLower", Func, 0, "func(s []byte) []byte"},
+		{"ToLowerSpecial", Func, 0, "func(c unicode.SpecialCase, s []byte) []byte"},
+		{"ToTitle", Func, 0, "func(s []byte) []byte"},
+		{"ToTitleSpecial", Func, 0, "func(c unicode.SpecialCase, s []byte) []byte"},
+		{"ToUpper", Func, 0, "func(s []byte) []byte"},
+		{"ToUpperSpecial", Func, 0, "func(c unicode.SpecialCase, s []byte) []byte"},
+		{"ToValidUTF8", Func, 13, "func(s []byte, replacement []byte) []byte"},
+		{"Trim", Func, 0, "func(s []byte, cutset string) []byte"},
+		{"TrimFunc", Func, 0, "func(s []byte, f func(r rune) bool) []byte"},
+		{"TrimLeft", Func, 0, "func(s []byte, cutset string) []byte"},
+		{"TrimLeftFunc", Func, 0, "func(s []byte, f func(r rune) bool) []byte"},
+		{"TrimPrefix", Func, 1, "func(s []byte, prefix []byte) []byte"},
+		{"TrimRight", Func, 0, "func(s []byte, cutset string) []byte"},
+		{"TrimRightFunc", Func, 0, "func(s []byte, f func(r rune) bool) []byte"},
+		{"TrimSpace", Func, 0, "func(s []byte) []byte"},
+		{"TrimSuffix", Func, 1, "func(s []byte, suffix []byte) []byte"},
+	},
+	"cmp": {
+		{"Compare", Func, 21, "func[T Ordered](x T, y T) int"},
+		{"Less", Func, 21, "func[T Ordered](x T, y T) bool"},
+		{"Or", Func, 22, "func[T comparable](vals ...T) T"},
+		{"Ordered", Type, 21, ""},
+	},
+	"compress/bzip2": {
+		{"(StructuralError).Error", Method, 0, ""},
+		{"NewReader", Func, 0, "func(r io.Reader) io.Reader"},
+		{"StructuralError", Type, 0, ""},
+	},
+	"compress/flate": {
+		{"(*ReadError).Error", Method, 0, ""},
+		{"(*WriteError).Error", Method, 0, ""},
+		{"(*Writer).Close", Method, 0, ""},
+		{"(*Writer).Flush", Method, 0, ""},
+		{"(*Writer).Reset", Method, 2, ""},
+		{"(*Writer).Write", Method, 0, ""},
+		{"(CorruptInputError).Error", Method, 0, ""},
+		{"(InternalError).Error", Method, 0, ""},
+		{"BestCompression", Const, 0, ""},
+		{"BestSpeed", Const, 0, ""},
+		{"CorruptInputError", Type, 0, ""},
+		{"DefaultCompression", Const, 0, ""},
+		{"HuffmanOnly", Const, 7, ""},
+		{"InternalError", Type, 0, ""},
+		{"NewReader", Func, 0, "func(r io.Reader) io.ReadCloser"},
+		{"NewReaderDict", Func, 0, "func(r io.Reader, dict []byte) io.ReadCloser"},
+		{"NewWriter", Func, 0, "func(w io.Writer, level int) (*Writer, error)"},
+		{"NewWriterDict", Func, 0, "func(w io.Writer, level int, dict []byte) (*Writer, error)"},
+		{"NoCompression", Const, 0, ""},
+		{"ReadError", Type, 0, ""},
+		{"ReadError.Err", Field, 0, ""},
+		{"ReadError.Offset", Field, 0, ""},
+		{"Reader", Type, 0, ""},
+		{"Resetter", Type, 4, ""},
+		{"WriteError", Type, 0, ""},
+		{"WriteError.Err", Field, 0, ""},
+		{"WriteError.Offset", Field, 0, ""},
+		{"Writer", Type, 0, ""},
+	},
+	"compress/gzip": {
+		{"(*Reader).Close", Method, 0, ""},
+		{"(*Reader).Multistream", Method, 4, ""},
+		{"(*Reader).Read", Method, 0, ""},
+		{"(*Reader).Reset", Method, 3, ""},
+		{"(*Writer).Close", Method, 0, ""},
+		{"(*Writer).Flush", Method, 1, ""},
+		{"(*Writer).Reset", Method, 2, ""},
+		{"(*Writer).Write", Method, 0, ""},
+		{"BestCompression", Const, 0, ""},
+		{"BestSpeed", Const, 0, ""},
+		{"DefaultCompression", Const, 0, ""},
+		{"ErrChecksum", Var, 0, ""},
+		{"ErrHeader", Var, 0, ""},
+		{"Header", Type, 0, ""},
+		{"Header.Comment", Field, 0, ""},
+		{"Header.Extra", Field, 0, ""},
+		{"Header.ModTime", Field, 0, ""},
+		{"Header.Name", Field, 0, ""},
+		{"Header.OS", Field, 0, ""},
+		{"HuffmanOnly", Const, 8, ""},
+		{"NewReader", Func, 0, "func(r io.Reader) (*Reader, error)"},
+		{"NewWriter", Func, 0, "func(w io.Writer) *Writer"},
+		{"NewWriterLevel", Func, 0, "func(w io.Writer, level int) (*Writer, error)"},
+		{"NoCompression", Const, 0, ""},
+		{"Reader", Type, 0, ""},
+		{"Reader.Header", Field, 0, ""},
+		{"Writer", Type, 0, ""},
+		{"Writer.Header", Field, 0, ""},
+	},
+	"compress/lzw": {
+		{"(*Reader).Close", Method, 17, ""},
+		{"(*Reader).Read", Method, 17, ""},
+		{"(*Reader).Reset", Method, 17, ""},
+		{"(*Writer).Close", Method, 17, ""},
+		{"(*Writer).Reset", Method, 17, ""},
+		{"(*Writer).Write", Method, 17, ""},
+		{"LSB", Const, 0, ""},
+		{"MSB", Const, 0, ""},
+		{"NewReader", Func, 0, "func(r io.Reader, order Order, litWidth int) io.ReadCloser"},
+		{"NewWriter", Func, 0, "func(w io.Writer, order Order, litWidth int) io.WriteCloser"},
+		{"Order", Type, 0, ""},
+		{"Reader", Type, 17, ""},
+		{"Writer", Type, 17, ""},
+	},
+	"compress/zlib": {
+		{"(*Writer).Close", Method, 0, ""},
+		{"(*Writer).Flush", Method, 0, ""},
+		{"(*Writer).Reset", Method, 2, ""},
+		{"(*Writer).Write", Method, 0, ""},
+		{"BestCompression", Const, 0, ""},
+		{"BestSpeed", Const, 0, ""},
+		{"DefaultCompression", Const, 0, ""},
+		{"ErrChecksum", Var, 0, ""},
+		{"ErrDictionary", Var, 0, ""},
+		{"ErrHeader", Var, 0, ""},
+		{"HuffmanOnly", Const, 8, ""},
+		{"NewReader", Func, 0, "func(r io.Reader) (io.ReadCloser, error)"},
+		{"NewReaderDict", Func, 0, "func(r io.Reader, dict []byte) (io.ReadCloser, error)"},
+		{"NewWriter", Func, 0, "func(w io.Writer) *Writer"},
+		{"NewWriterLevel", Func, 0, "func(w io.Writer, level int) (*Writer, error)"},
+		{"NewWriterLevelDict", Func, 0, "func(w io.Writer, level int, dict []byte) (*Writer, error)"},
+		{"NoCompression", Const, 0, ""},
+		{"Resetter", Type, 4, ""},
+		{"Writer", Type, 0, ""},
+	},
+	"container/heap": {
+		{"Fix", Func, 2, "func(h Interface, i int)"},
+		{"Init", Func, 0, "func(h Interface)"},
+		{"Interface", Type, 0, ""},
+		{"Pop", Func, 0, "func(h Interface) any"},
+		{"Push", Func, 0, "func(h Interface, x any)"},
+		{"Remove", Func, 0, "func(h Interface, i int) any"},
+	},
+	"container/list": {
+		{"(*Element).Next", Method, 0, ""},
+		{"(*Element).Prev", Method, 0, ""},
+		{"(*List).Back", Method, 0, ""},
+		{"(*List).Front", Method, 0, ""},
+		{"(*List).Init", Method, 0, ""},
+		{"(*List).InsertAfter", Method, 0, ""},
+		{"(*List).InsertBefore", Method, 0, ""},
+		{"(*List).Len", Method, 0, ""},
+		{"(*List).MoveAfter", Method, 2, ""},
+		{"(*List).MoveBefore", Method, 2, ""},
+		{"(*List).MoveToBack", Method, 0, ""},
+		{"(*List).MoveToFront", Method, 0, ""},
+		{"(*List).PushBack", Method, 0, ""},
+		{"(*List).PushBackList", Method, 0, ""},
+		{"(*List).PushFront", Method, 0, ""},
+		{"(*List).PushFrontList", Method, 0, ""},
+		{"(*List).Remove", Method, 0, ""},
+		{"Element", Type, 0, ""},
+		{"Element.Value", Field, 0, ""},
+		{"List", Type, 0, ""},
+		{"New", Func, 0, "func() *List"},
+	},
+	"container/ring": {
+		{"(*Ring).Do", Method, 0, ""},
+		{"(*Ring).Len", Method, 0, ""},
+		{"(*Ring).Link", Method, 0, ""},
+		{"(*Ring).Move", Method, 0, ""},
+		{"(*Ring).Next", Method, 0, ""},
+		{"(*Ring).Prev", Method, 0, ""},
+		{"(*Ring).Unlink", Method, 0, ""},
+		{"New", Func, 0, "func(n int) *Ring"},
+		{"Ring", Type, 0, ""},
+		{"Ring.Value", Field, 0, ""},
+	},
+	"context": {
+		{"AfterFunc", Func, 21, "func(ctx Context, f func()) (stop func() bool)"},
+		{"Background", Func, 7, "func() Context"},
+		{"CancelCauseFunc", Type, 20, ""},
+		{"CancelFunc", Type, 7, ""},
+		{"Canceled", Var, 7, ""},
+		{"Cause", Func, 20, "func(c Context) error"},
+		{"Context", Type, 7, ""},
+		{"DeadlineExceeded", Var, 7, ""},
+		{"TODO", Func, 7, "func() Context"},
+		{"WithCancel", Func, 7, "func(parent Context) (ctx Context, cancel CancelFunc)"},
+		{"WithCancelCause", Func, 20, "func(parent Context) (ctx Context, cancel CancelCauseFunc)"},
+		{"WithDeadline", Func, 7, "func(parent Context, d time.Time) (Context, CancelFunc)"},
+		{"WithDeadlineCause", Func, 21, "func(parent Context, d time.Time, cause error) (Context, CancelFunc)"},
+		{"WithTimeout", Func, 7, "func(parent Context, timeout time.Duration) (Context, CancelFunc)"},
+		{"WithTimeoutCause", Func, 21, "func(parent Context, timeout time.Duration, cause error) (Context, CancelFunc)"},
+		{"WithValue", Func, 7, "func(parent Context, key any, val any) Context"},
+		{"WithoutCancel", Func, 21, "func(parent Context) Context"},
+	},
+	"crypto": {
+		{"(Hash).Available", Method, 0, ""},
+		{"(Hash).HashFunc", Method, 4, ""},
+		{"(Hash).New", Method, 0, ""},
+		{"(Hash).Size", Method, 0, ""},
+		{"(Hash).String", Method, 15, ""},
+		{"BLAKE2b_256", Const, 9, ""},
+		{"BLAKE2b_384", Const, 9, ""},
+		{"BLAKE2b_512", Const, 9, ""},
+		{"BLAKE2s_256", Const, 9, ""},
+		{"Decrypter", Type, 5, ""},
+		{"DecrypterOpts", Type, 5, ""},
+		{"Hash", Type, 0, ""},
+		{"MD4", Const, 0, ""},
+		{"MD5", Const, 0, ""},
+		{"MD5SHA1", Const, 0, ""},
+		{"PrivateKey", Type, 0, ""},
+		{"PublicKey", Type, 2, ""},
+		{"RIPEMD160", Const, 0, ""},
+		{"RegisterHash", Func, 0, "func(h Hash, f func() hash.Hash)"},
+		{"SHA1", Const, 0, ""},
+		{"SHA224", Const, 0, ""},
+		{"SHA256", Const, 0, ""},
+		{"SHA384", Const, 0, ""},
+		{"SHA3_224", Const, 4, ""},
+		{"SHA3_256", Const, 4, ""},
+		{"SHA3_384", Const, 4, ""},
+		{"SHA3_512", Const, 4, ""},
+		{"SHA512", Const, 0, ""},
+		{"SHA512_224", Const, 5, ""},
+		{"SHA512_256", Const, 5, ""},
+		{"Signer", Type, 4, ""},
+		{"SignerOpts", Type, 4, ""},
+	},
+	"crypto/aes": {
+		{"(KeySizeError).Error", Method, 0, ""},
+		{"BlockSize", Const, 0, ""},
+		{"KeySizeError", Type, 0, ""},
+		{"NewCipher", Func, 0, "func(key []byte) (cipher.Block, error)"},
+	},
+	"crypto/cipher": {
+		{"(StreamReader).Read", Method, 0, ""},
+		{"(StreamWriter).Close", Method, 0, ""},
+		{"(StreamWriter).Write", Method, 0, ""},
+		{"AEAD", Type, 2, ""},
+		{"Block", Type, 0, ""},
+		{"BlockMode", Type, 0, ""},
+		{"NewCBCDecrypter", Func, 0, "func(b Block, iv []byte) BlockMode"},
+		{"NewCBCEncrypter", Func, 0, "func(b Block, iv []byte) BlockMode"},
+		{"NewCFBDecrypter", Func, 0, "func(block Block, iv []byte) Stream"},
+		{"NewCFBEncrypter", Func, 0, "func(block Block, iv []byte) Stream"},
+		{"NewCTR", Func, 0, "func(block Block, iv []byte) Stream"},
+		{"NewGCM", Func, 2, "func(cipher Block) (AEAD, error)"},
+		{"NewGCMWithNonceSize", Func, 5, "func(cipher Block, size int) (AEAD, error)"},
+		{"NewGCMWithRandomNonce", Func, 24, "func(cipher Block) (AEAD, error)"},
+		{"NewGCMWithTagSize", Func, 11, "func(cipher Block, tagSize int) (AEAD, error)"},
+		{"NewOFB", Func, 0, "func(b Block, iv []byte) Stream"},
+		{"Stream", Type, 0, ""},
+		{"StreamReader", Type, 0, ""},
+		{"StreamReader.R", Field, 0, ""},
+		{"StreamReader.S", Field, 0, ""},
+		{"StreamWriter", Type, 0, ""},
+		{"StreamWriter.Err", Field, 0, ""},
+		{"StreamWriter.S", Field, 0, ""},
+		{"StreamWriter.W", Field, 0, ""},
+	},
+	"crypto/des": {
+		{"(KeySizeError).Error", Method, 0, ""},
+		{"BlockSize", Const, 0, ""},
+		{"KeySizeError", Type, 0, ""},
+		{"NewCipher", Func, 0, "func(key []byte) (cipher.Block, error)"},
+		{"NewTripleDESCipher", Func, 0, "func(key []byte) (cipher.Block, error)"},
+	},
+	"crypto/dsa": {
+		{"ErrInvalidPublicKey", Var, 0, ""},
+		{"GenerateKey", Func, 0, "func(priv *PrivateKey, rand io.Reader) error"},
+		{"GenerateParameters", Func, 0, "func(params *Parameters, rand io.Reader, sizes ParameterSizes) error"},
+		{"L1024N160", Const, 0, ""},
+		{"L2048N224", Const, 0, ""},
+		{"L2048N256", Const, 0, ""},
+		{"L3072N256", Const, 0, ""},
+		{"ParameterSizes", Type, 0, ""},
+		{"Parameters", Type, 0, ""},
+		{"Parameters.G", Field, 0, ""},
+		{"Parameters.P", Field, 0, ""},
+		{"Parameters.Q", Field, 0, ""},
+		{"PrivateKey", Type, 0, ""},
+		{"PrivateKey.PublicKey", Field, 0, ""},
+		{"PrivateKey.X", Field, 0, ""},
+		{"PublicKey", Type, 0, ""},
+		{"PublicKey.Parameters", Field, 0, ""},
+		{"PublicKey.Y", Field, 0, ""},
+		{"Sign", Func, 0, "func(rand io.Reader, priv *PrivateKey, hash []byte) (r *big.Int, s *big.Int, err error)"},
+		{"Verify", Func, 0, "func(pub *PublicKey, hash []byte, r *big.Int, s *big.Int) bool"},
+	},
+	"crypto/ecdh": {
+		{"(*PrivateKey).Bytes", Method, 20, ""},
+		{"(*PrivateKey).Curve", Method, 20, ""},
+		{"(*PrivateKey).ECDH", Method, 20, ""},
+		{"(*PrivateKey).Equal", Method, 20, ""},
+		{"(*PrivateKey).Public", Method, 20, ""},
+		{"(*PrivateKey).PublicKey", Method, 20, ""},
+		{"(*PublicKey).Bytes", Method, 20, ""},
+		{"(*PublicKey).Curve", Method, 20, ""},
+		{"(*PublicKey).Equal", Method, 20, ""},
+		{"Curve", Type, 20, ""},
+		{"P256", Func, 20, "func() Curve"},
+		{"P384", Func, 20, "func() Curve"},
+		{"P521", Func, 20, "func() Curve"},
+		{"PrivateKey", Type, 20, ""},
+		{"PublicKey", Type, 20, ""},
+		{"X25519", Func, 20, "func() Curve"},
+	},
+	"crypto/ecdsa": {
+		{"(*PrivateKey).ECDH", Method, 20, ""},
+		{"(*PrivateKey).Equal", Method, 15, ""},
+		{"(*PrivateKey).Public", Method, 4, ""},
+		{"(*PrivateKey).Sign", Method, 4, ""},
+		{"(*PublicKey).ECDH", Method, 20, ""},
+		{"(*PublicKey).Equal", Method, 15, ""},
+		{"(PrivateKey).Add", Method, 0, ""},
+		{"(PrivateKey).Double", Method, 0, ""},
+		{"(PrivateKey).IsOnCurve", Method, 0, ""},
+		{"(PrivateKey).Params", Method, 0, ""},
+		{"(PrivateKey).ScalarBaseMult", Method, 0, ""},
+		{"(PrivateKey).ScalarMult", Method, 0, ""},
+		{"(PublicKey).Add", Method, 0, ""},
+		{"(PublicKey).Double", Method, 0, ""},
+		{"(PublicKey).IsOnCurve", Method, 0, ""},
+		{"(PublicKey).Params", Method, 0, ""},
+		{"(PublicKey).ScalarBaseMult", Method, 0, ""},
+		{"(PublicKey).ScalarMult", Method, 0, ""},
+		{"GenerateKey", Func, 0, "func(c elliptic.Curve, rand io.Reader) (*PrivateKey, error)"},
+		{"PrivateKey", Type, 0, ""},
+		{"PrivateKey.D", Field, 0, ""},
+		{"PrivateKey.PublicKey", Field, 0, ""},
+		{"PublicKey", Type, 0, ""},
+		{"PublicKey.Curve", Field, 0, ""},
+		{"PublicKey.X", Field, 0, ""},
+		{"PublicKey.Y", Field, 0, ""},
+		{"Sign", Func, 0, "func(rand io.Reader, priv *PrivateKey, hash []byte) (r *big.Int, s *big.Int, err error)"},
+		{"SignASN1", Func, 15, "func(rand io.Reader, priv *PrivateKey, hash []byte) ([]byte, error)"},
+		{"Verify", Func, 0, "func(pub *PublicKey, hash []byte, r *big.Int, s *big.Int) bool"},
+		{"VerifyASN1", Func, 15, "func(pub *PublicKey, hash []byte, sig []byte) bool"},
+	},
+	"crypto/ed25519": {
+		{"(*Options).HashFunc", Method, 20, ""},
+		{"(PrivateKey).Equal", Method, 15, ""},
+		{"(PrivateKey).Public", Method, 13, ""},
+		{"(PrivateKey).Seed", Method, 13, ""},
+		{"(PrivateKey).Sign", Method, 13, ""},
+		{"(PublicKey).Equal", Method, 15, ""},
+		{"GenerateKey", Func, 13, "func(rand io.Reader) (PublicKey, PrivateKey, error)"},
+		{"NewKeyFromSeed", Func, 13, "func(seed []byte) PrivateKey"},
+		{"Options", Type, 20, ""},
+		{"Options.Context", Field, 20, ""},
+		{"Options.Hash", Field, 20, ""},
+		{"PrivateKey", Type, 13, ""},
+		{"PrivateKeySize", Const, 13, ""},
+		{"PublicKey", Type, 13, ""},
+		{"PublicKeySize", Const, 13, ""},
+		{"SeedSize", Const, 13, ""},
+		{"Sign", Func, 13, "func(privateKey PrivateKey, message []byte) []byte"},
+		{"SignatureSize", Const, 13, ""},
+		{"Verify", Func, 13, "func(publicKey PublicKey, message []byte, sig []byte) bool"},
+		{"VerifyWithOptions", Func, 20, "func(publicKey PublicKey, message []byte, sig []byte, opts *Options) error"},
+	},
+	"crypto/elliptic": {
+		{"(*CurveParams).Add", Method, 0, ""},
+		{"(*CurveParams).Double", Method, 0, ""},
+		{"(*CurveParams).IsOnCurve", Method, 0, ""},
+		{"(*CurveParams).Params", Method, 0, ""},
+		{"(*CurveParams).ScalarBaseMult", Method, 0, ""},
+		{"(*CurveParams).ScalarMult", Method, 0, ""},
+		{"Curve", Type, 0, ""},
+		{"CurveParams", Type, 0, ""},
+		{"CurveParams.B", Field, 0, ""},
+		{"CurveParams.BitSize", Field, 0, ""},
+		{"CurveParams.Gx", Field, 0, ""},
+		{"CurveParams.Gy", Field, 0, ""},
+		{"CurveParams.N", Field, 0, ""},
+		{"CurveParams.Name", Field, 5, ""},
+		{"CurveParams.P", Field, 0, ""},
+		{"GenerateKey", Func, 0, "func(curve Curve, rand io.Reader) (priv []byte, x *big.Int, y *big.Int, err error)"},
+		{"Marshal", Func, 0, "func(curve Curve, x *big.Int, y *big.Int) []byte"},
+		{"MarshalCompressed", Func, 15, "func(curve Curve, x *big.Int, y *big.Int) []byte"},
+		{"P224", Func, 0, "func() Curve"},
+		{"P256", Func, 0, "func() Curve"},
+		{"P384", Func, 0, "func() Curve"},
+		{"P521", Func, 0, "func() Curve"},
+		{"Unmarshal", Func, 0, "func(curve Curve, data []byte) (x *big.Int, y *big.Int)"},
+		{"UnmarshalCompressed", Func, 15, "func(curve Curve, data []byte) (x *big.Int, y *big.Int)"},
+	},
+	"crypto/fips140": {
+		{"Enabled", Func, 24, "func() bool"},
+	},
+	"crypto/hkdf": {
+		{"Expand", Func, 24, "func[H hash.Hash](h func() H, pseudorandomKey []byte, info string, keyLength int) ([]byte, error)"},
+		{"Extract", Func, 24, "func[H hash.Hash](h func() H, secret []byte, salt []byte) ([]byte, error)"},
+		{"Key", Func, 24, "func[Hash hash.Hash](h func() Hash, secret []byte, salt []byte, info string, keyLength int) ([]byte, error)"},
+	},
+	"crypto/hmac": {
+		{"Equal", Func, 1, "func(mac1 []byte, mac2 []byte) bool"},
+		{"New", Func, 0, "func(h func() hash.Hash, key []byte) hash.Hash"},
+	},
+	"crypto/md5": {
+		{"BlockSize", Const, 0, ""},
+		{"New", Func, 0, "func() hash.Hash"},
+		{"Size", Const, 0, ""},
+		{"Sum", Func, 2, "func(data []byte) [16]byte"},
+	},
+	"crypto/mlkem": {
+		{"(*DecapsulationKey1024).Bytes", Method, 24, ""},
+		{"(*DecapsulationKey1024).Decapsulate", Method, 24, ""},
+		{"(*DecapsulationKey1024).EncapsulationKey", Method, 24, ""},
+		{"(*DecapsulationKey768).Bytes", Method, 24, ""},
+		{"(*DecapsulationKey768).Decapsulate", Method, 24, ""},
+		{"(*DecapsulationKey768).EncapsulationKey", Method, 24, ""},
+		{"(*EncapsulationKey1024).Bytes", Method, 24, ""},
+		{"(*EncapsulationKey1024).Encapsulate", Method, 24, ""},
+		{"(*EncapsulationKey768).Bytes", Method, 24, ""},
+		{"(*EncapsulationKey768).Encapsulate", Method, 24, ""},
+		{"CiphertextSize1024", Const, 24, ""},
+		{"CiphertextSize768", Const, 24, ""},
+		{"DecapsulationKey1024", Type, 24, ""},
+		{"DecapsulationKey768", Type, 24, ""},
+		{"EncapsulationKey1024", Type, 24, ""},
+		{"EncapsulationKey768", Type, 24, ""},
+		{"EncapsulationKeySize1024", Const, 24, ""},
+		{"EncapsulationKeySize768", Const, 24, ""},
+		{"GenerateKey1024", Func, 24, "func() (*DecapsulationKey1024, error)"},
+		{"GenerateKey768", Func, 24, "func() (*DecapsulationKey768, error)"},
+		{"NewDecapsulationKey1024", Func, 24, "func(seed []byte) (*DecapsulationKey1024, error)"},
+		{"NewDecapsulationKey768", Func, 24, "func(seed []byte) (*DecapsulationKey768, error)"},
+		{"NewEncapsulationKey1024", Func, 24, "func(encapsulationKey []byte) (*EncapsulationKey1024, error)"},
+		{"NewEncapsulationKey768", Func, 24, "func(encapsulationKey []byte) (*EncapsulationKey768, error)"},
+		{"SeedSize", Const, 24, ""},
+		{"SharedKeySize", Const, 24, ""},
+	},
+	"crypto/pbkdf2": {
+		{"Key", Func, 24, "func[Hash hash.Hash](h func() Hash, password string, salt []byte, iter int, keyLength int) ([]byte, error)"},
+	},
+	"crypto/rand": {
+		{"Int", Func, 0, "func(rand io.Reader, max *big.Int) (n *big.Int, err error)"},
+		{"Prime", Func, 0, "func(rand io.Reader, bits int) (*big.Int, error)"},
+		{"Read", Func, 0, "func(b []byte) (n int, err error)"},
+		{"Reader", Var, 0, ""},
+		{"Text", Func, 24, "func() string"},
+	},
+	"crypto/rc4": {
+		{"(*Cipher).Reset", Method, 0, ""},
+		{"(*Cipher).XORKeyStream", Method, 0, ""},
+		{"(KeySizeError).Error", Method, 0, ""},
+		{"Cipher", Type, 0, ""},
+		{"KeySizeError", Type, 0, ""},
+		{"NewCipher", Func, 0, "func(key []byte) (*Cipher, error)"},
+	},
+	"crypto/rsa": {
+		{"(*PSSOptions).HashFunc", Method, 4, ""},
+		{"(*PrivateKey).Decrypt", Method, 5, ""},
+		{"(*PrivateKey).Equal", Method, 15, ""},
+		{"(*PrivateKey).Precompute", Method, 0, ""},
+		{"(*PrivateKey).Public", Method, 4, ""},
+		{"(*PrivateKey).Sign", Method, 4, ""},
+		{"(*PrivateKey).Size", Method, 11, ""},
+		{"(*PrivateKey).Validate", Method, 0, ""},
+		{"(*PublicKey).Equal", Method, 15, ""},
+		{"(*PublicKey).Size", Method, 11, ""},
+		{"CRTValue", Type, 0, ""},
+		{"CRTValue.Coeff", Field, 0, ""},
+		{"CRTValue.Exp", Field, 0, ""},
+		{"CRTValue.R", Field, 0, ""},
+		{"DecryptOAEP", Func, 0, "func(hash hash.Hash, random io.Reader, priv *PrivateKey, ciphertext []byte, label []byte) ([]byte, error)"},
+		{"DecryptPKCS1v15", Func, 0, "func(random io.Reader, priv *PrivateKey, ciphertext []byte) ([]byte, error)"},
+		{"DecryptPKCS1v15SessionKey", Func, 0, "func(random io.Reader, priv *PrivateKey, ciphertext []byte, key []byte) error"},
+		{"EncryptOAEP", Func, 0, "func(hash hash.Hash, random io.Reader, pub *PublicKey, msg []byte, label []byte) ([]byte, error)"},
+		{"EncryptPKCS1v15", Func, 0, "func(random io.Reader, pub *PublicKey, msg []byte) ([]byte, error)"},
+		{"ErrDecryption", Var, 0, ""},
+		{"ErrMessageTooLong", Var, 0, ""},
+		{"ErrVerification", Var, 0, ""},
+		{"GenerateKey", Func, 0, "func(random io.Reader, bits int) (*PrivateKey, error)"},
+		{"GenerateMultiPrimeKey", Func, 0, "func(random io.Reader, nprimes int, bits int) (*PrivateKey, error)"},
+		{"OAEPOptions", Type, 5, ""},
+		{"OAEPOptions.Hash", Field, 5, ""},
+		{"OAEPOptions.Label", Field, 5, ""},
+		{"OAEPOptions.MGFHash", Field, 20, ""},
+		{"PKCS1v15DecryptOptions", Type, 5, ""},
+		{"PKCS1v15DecryptOptions.SessionKeyLen", Field, 5, ""},
+		{"PSSOptions", Type, 2, ""},
+		{"PSSOptions.Hash", Field, 4, ""},
+		{"PSSOptions.SaltLength", Field, 2, ""},
+		{"PSSSaltLengthAuto", Const, 2, ""},
+		{"PSSSaltLengthEqualsHash", Const, 2, ""},
+		{"PrecomputedValues", Type, 0, ""},
+		{"PrecomputedValues.CRTValues", Field, 0, ""},
+		{"PrecomputedValues.Dp", Field, 0, ""},
+		{"PrecomputedValues.Dq", Field, 0, ""},
+		{"PrecomputedValues.Qinv", Field, 0, ""},
+		{"PrivateKey", Type, 0, ""},
+		{"PrivateKey.D", Field, 0, ""},
+		{"PrivateKey.Precomputed", Field, 0, ""},
+		{"PrivateKey.Primes", Field, 0, ""},
+		{"PrivateKey.PublicKey", Field, 0, ""},
+		{"PublicKey", Type, 0, ""},
+		{"PublicKey.E", Field, 0, ""},
+		{"PublicKey.N", Field, 0, ""},
+		{"SignPKCS1v15", Func, 0, "func(random io.Reader, priv *PrivateKey, hash crypto.Hash, hashed []byte) ([]byte, error)"},
+		{"SignPSS", Func, 2, "func(rand io.Reader, priv *PrivateKey, hash crypto.Hash, digest []byte, opts *PSSOptions) ([]byte, error)"},
+		{"VerifyPKCS1v15", Func, 0, "func(pub *PublicKey, hash crypto.Hash, hashed []byte, sig []byte) error"},
+		{"VerifyPSS", Func, 2, "func(pub *PublicKey, hash crypto.Hash, digest []byte, sig []byte, opts *PSSOptions) error"},
+	},
+	"crypto/sha1": {
+		{"BlockSize", Const, 0, ""},
+		{"New", Func, 0, "func() hash.Hash"},
+		{"Size", Const, 0, ""},
+		{"Sum", Func, 2, "func(data []byte) [20]byte"},
+	},
+	"crypto/sha256": {
+		{"BlockSize", Const, 0, ""},
+		{"New", Func, 0, "func() hash.Hash"},
+		{"New224", Func, 0, "func() hash.Hash"},
+		{"Size", Const, 0, ""},
+		{"Size224", Const, 0, ""},
+		{"Sum224", Func, 2, "func(data []byte) [28]byte"},
+		{"Sum256", Func, 2, "func(data []byte) [32]byte"},
+	},
+	"crypto/sha3": {
+		{"(*SHA3).AppendBinary", Method, 24, ""},
+		{"(*SHA3).BlockSize", Method, 24, ""},
+		{"(*SHA3).MarshalBinary", Method, 24, ""},
+		{"(*SHA3).Reset", Method, 24, ""},
+		{"(*SHA3).Size", Method, 24, ""},
+		{"(*SHA3).Sum", Method, 24, ""},
+		{"(*SHA3).UnmarshalBinary", Method, 24, ""},
+		{"(*SHA3).Write", Method, 24, ""},
+		{"(*SHAKE).AppendBinary", Method, 24, ""},
+		{"(*SHAKE).BlockSize", Method, 24, ""},
+		{"(*SHAKE).MarshalBinary", Method, 24, ""},
+		{"(*SHAKE).Read", Method, 24, ""},
+		{"(*SHAKE).Reset", Method, 24, ""},
+		{"(*SHAKE).UnmarshalBinary", Method, 24, ""},
+		{"(*SHAKE).Write", Method, 24, ""},
+		{"New224", Func, 24, "func() *SHA3"},
+		{"New256", Func, 24, "func() *SHA3"},
+		{"New384", Func, 24, "func() *SHA3"},
+		{"New512", Func, 24, "func() *SHA3"},
+		{"NewCSHAKE128", Func, 24, "func(N []byte, S []byte) *SHAKE"},
+		{"NewCSHAKE256", Func, 24, "func(N []byte, S []byte) *SHAKE"},
+		{"NewSHAKE128", Func, 24, "func() *SHAKE"},
+		{"NewSHAKE256", Func, 24, "func() *SHAKE"},
+		{"SHA3", Type, 24, ""},
+		{"SHAKE", Type, 24, ""},
+		{"Sum224", Func, 24, "func(data []byte) [28]byte"},
+		{"Sum256", Func, 24, "func(data []byte) [32]byte"},
+		{"Sum384", Func, 24, "func(data []byte) [48]byte"},
+		{"Sum512", Func, 24, "func(data []byte) [64]byte"},
+		{"SumSHAKE128", Func, 24, "func(data []byte, length int) []byte"},
+		{"SumSHAKE256", Func, 24, "func(data []byte, length int) []byte"},
+	},
+	"crypto/sha512": {
+		{"BlockSize", Const, 0, ""},
+		{"New", Func, 0, "func() hash.Hash"},
+		{"New384", Func, 0, "func() hash.Hash"},
+		{"New512_224", Func, 5, "func() hash.Hash"},
+		{"New512_256", Func, 5, "func() hash.Hash"},
+		{"Size", Const, 0, ""},
+		{"Size224", Const, 5, ""},
+		{"Size256", Const, 5, ""},
+		{"Size384", Const, 0, ""},
+		{"Sum384", Func, 2, "func(data []byte) [48]byte"},
+		{"Sum512", Func, 2, "func(data []byte) [64]byte"},
+		{"Sum512_224", Func, 5, "func(data []byte) [28]byte"},
+		{"Sum512_256", Func, 5, "func(data []byte) [32]byte"},
+	},
+	"crypto/subtle": {
+		{"ConstantTimeByteEq", Func, 0, "func(x uint8, y uint8) int"},
+		{"ConstantTimeCompare", Func, 0, "func(x []byte, y []byte) int"},
+		{"ConstantTimeCopy", Func, 0, "func(v int, x []byte, y []byte)"},
+		{"ConstantTimeEq", Func, 0, "func(x int32, y int32) int"},
+		{"ConstantTimeLessOrEq", Func, 2, "func(x int, y int) int"},
+		{"ConstantTimeSelect", Func, 0, "func(v int, x int, y int) int"},
+		{"WithDataIndependentTiming", Func, 24, "func(f func())"},
+		{"XORBytes", Func, 20, "func(dst []byte, x []byte, y []byte) int"},
+	},
+	"crypto/tls": {
+		{"(*CertificateRequestInfo).Context", Method, 17, ""},
+		{"(*CertificateRequestInfo).SupportsCertificate", Method, 14, ""},
+		{"(*CertificateVerificationError).Error", Method, 20, ""},
+		{"(*CertificateVerificationError).Unwrap", Method, 20, ""},
+		{"(*ClientHelloInfo).Context", Method, 17, ""},
+		{"(*ClientHelloInfo).SupportsCertificate", Method, 14, ""},
+		{"(*ClientSessionState).ResumptionState", Method, 21, ""},
+		{"(*Config).BuildNameToCertificate", Method, 0, ""},
+		{"(*Config).Clone", Method, 8, ""},
+		{"(*Config).DecryptTicket", Method, 21, ""},
+		{"(*Config).EncryptTicket", Method, 21, ""},
+		{"(*Config).SetSessionTicketKeys", Method, 5, ""},
+		{"(*Conn).Close", Method, 0, ""},
+		{"(*Conn).CloseWrite", Method, 8, ""},
+		{"(*Conn).ConnectionState", Method, 0, ""},
+		{"(*Conn).Handshake", Method, 0, ""},
+		{"(*Conn).HandshakeContext", Method, 17, ""},
+		{"(*Conn).LocalAddr", Method, 0, ""},
+		{"(*Conn).NetConn", Method, 18, ""},
+		{"(*Conn).OCSPResponse", Method, 0, ""},
+		{"(*Conn).Read", Method, 0, ""},
+		{"(*Conn).RemoteAddr", Method, 0, ""},
+		{"(*Conn).SetDeadline", Method, 0, ""},
+		{"(*Conn).SetReadDeadline", Method, 0, ""},
+		{"(*Conn).SetWriteDeadline", Method, 0, ""},
+		{"(*Conn).VerifyHostname", Method, 0, ""},
+		{"(*Conn).Write", Method, 0, ""},
+		{"(*ConnectionState).ExportKeyingMaterial", Method, 11, ""},
+		{"(*Dialer).Dial", Method, 15, ""},
+		{"(*Dialer).DialContext", Method, 15, ""},
+		{"(*ECHRejectionError).Error", Method, 23, ""},
+		{"(*QUICConn).Close", Method, 21, ""},
+		{"(*QUICConn).ConnectionState", Method, 21, ""},
+		{"(*QUICConn).HandleData", Method, 21, ""},
+		{"(*QUICConn).NextEvent", Method, 21, ""},
+		{"(*QUICConn).SendSessionTicket", Method, 21, ""},
+		{"(*QUICConn).SetTransportParameters", Method, 21, ""},
+		{"(*QUICConn).Start", Method, 21, ""},
+		{"(*QUICConn).StoreSession", Method, 23, ""},
+		{"(*SessionState).Bytes", Method, 21, ""},
+		{"(AlertError).Error", Method, 21, ""},
+		{"(ClientAuthType).String", Method, 15, ""},
+		{"(CurveID).String", Method, 15, ""},
+		{"(QUICEncryptionLevel).String", Method, 21, ""},
+		{"(RecordHeaderError).Error", Method, 6, ""},
+		{"(SignatureScheme).String", Method, 15, ""},
+		{"AlertError", Type, 21, ""},
+		{"Certificate", Type, 0, ""},
+		{"Certificate.Certificate", Field, 0, ""},
+		{"Certificate.Leaf", Field, 0, ""},
+		{"Certificate.OCSPStaple", Field, 0, ""},
+		{"Certificate.PrivateKey", Field, 0, ""},
+		{"Certificate.SignedCertificateTimestamps", Field, 5, ""},
+		{"Certificate.SupportedSignatureAlgorithms", Field, 14, ""},
+		{"CertificateRequestInfo", Type, 8, ""},
+		{"CertificateRequestInfo.AcceptableCAs", Field, 8, ""},
+		{"CertificateRequestInfo.SignatureSchemes", Field, 8, ""},
+		{"CertificateRequestInfo.Version", Field, 14, ""},
+		{"CertificateVerificationError", Type, 20, ""},
+		{"CertificateVerificationError.Err", Field, 20, ""},
+		{"CertificateVerificationError.UnverifiedCertificates", Field, 20, ""},
+		{"CipherSuite", Type, 14, ""},
+		{"CipherSuite.ID", Field, 14, ""},
+		{"CipherSuite.Insecure", Field, 14, ""},
+		{"CipherSuite.Name", Field, 14, ""},
+		{"CipherSuite.SupportedVersions", Field, 14, ""},
+		{"CipherSuiteName", Func, 14, "func(id uint16) string"},
+		{"CipherSuites", Func, 14, "func() []*CipherSuite"},
+		{"Client", Func, 0, "func(conn net.Conn, config *Config) *Conn"},
+		{"ClientAuthType", Type, 0, ""},
+		{"ClientHelloInfo", Type, 4, ""},
+		{"ClientHelloInfo.CipherSuites", Field, 4, ""},
+		{"ClientHelloInfo.Conn", Field, 8, ""},
+		{"ClientHelloInfo.Extensions", Field, 24, ""},
+		{"ClientHelloInfo.ServerName", Field, 4, ""},
+		{"ClientHelloInfo.SignatureSchemes", Field, 8, ""},
+		{"ClientHelloInfo.SupportedCurves", Field, 4, ""},
+		{"ClientHelloInfo.SupportedPoints", Field, 4, ""},
+		{"ClientHelloInfo.SupportedProtos", Field, 8, ""},
+		{"ClientHelloInfo.SupportedVersions", Field, 8, ""},
+		{"ClientSessionCache", Type, 3, ""},
+		{"ClientSessionState", Type, 3, ""},
+		{"Config", Type, 0, ""},
+		{"Config.Certificates", Field, 0, ""},
+		{"Config.CipherSuites", Field, 0, ""},
+		{"Config.ClientAuth", Field, 0, ""},
+		{"Config.ClientCAs", Field, 0, ""},
+		{"Config.ClientSessionCache", Field, 3, ""},
+		{"Config.CurvePreferences", Field, 3, ""},
+		{"Config.DynamicRecordSizingDisabled", Field, 7, ""},
+		{"Config.EncryptedClientHelloConfigList", Field, 23, ""},
+		{"Config.EncryptedClientHelloKeys", Field, 24, ""},
+		{"Config.EncryptedClientHelloRejectionVerify", Field, 23, ""},
+		{"Config.GetCertificate", Field, 4, ""},
+		{"Config.GetClientCertificate", Field, 8, ""},
+		{"Config.GetConfigForClient", Field, 8, ""},
+		{"Config.InsecureSkipVerify", Field, 0, ""},
+		{"Config.KeyLogWriter", Field, 8, ""},
+		{"Config.MaxVersion", Field, 2, ""},
+		{"Config.MinVersion", Field, 2, ""},
+		{"Config.NameToCertificate", Field, 0, ""},
+		{"Config.NextProtos", Field, 0, ""},
+		{"Config.PreferServerCipherSuites", Field, 1, ""},
+		{"Config.Rand", Field, 0, ""},
+		{"Config.Renegotiation", Field, 7, ""},
+		{"Config.RootCAs", Field, 0, ""},
+		{"Config.ServerName", Field, 0, ""},
+		{"Config.SessionTicketKey", Field, 1, ""},
+		{"Config.SessionTicketsDisabled", Field, 1, ""},
+		{"Config.Time", Field, 0, ""},
+		{"Config.UnwrapSession", Field, 21, ""},
+		{"Config.VerifyConnection", Field, 15, ""},
+		{"Config.VerifyPeerCertificate", Field, 8, ""},
+		{"Config.WrapSession", Field, 21, ""},
+		{"Conn", Type, 0, ""},
+		{"ConnectionState", Type, 0, ""},
+		{"ConnectionState.CipherSuite", Field, 0, ""},
+		{"ConnectionState.CurveID", Field, 25, ""},
+		{"ConnectionState.DidResume", Field, 1, ""},
+		{"ConnectionState.ECHAccepted", Field, 23, ""},
+		{"ConnectionState.HandshakeComplete", Field, 0, ""},
+		{"ConnectionState.NegotiatedProtocol", Field, 0, ""},
+		{"ConnectionState.NegotiatedProtocolIsMutual", Field, 0, ""},
+		{"ConnectionState.OCSPResponse", Field, 5, ""},
+		{"ConnectionState.PeerCertificates", Field, 0, ""},
+		{"ConnectionState.ServerName", Field, 0, ""},
+		{"ConnectionState.SignedCertificateTimestamps", Field, 5, ""},
+		{"ConnectionState.TLSUnique", Field, 4, ""},
+		{"ConnectionState.VerifiedChains", Field, 0, ""},
+		{"ConnectionState.Version", Field, 3, ""},
+		{"CurveID", Type, 3, ""},
+		{"CurveP256", Const, 3, ""},
+		{"CurveP384", Const, 3, ""},
+		{"CurveP521", Const, 3, ""},
+		{"Dial", Func, 0, "func(network string, addr string, config *Config) (*Conn, error)"},
+		{"DialWithDialer", Func, 3, "func(dialer *net.Dialer, network string, addr string, config *Config) (*Conn, error)"},
+		{"Dialer", Type, 15, ""},
+		{"Dialer.Config", Field, 15, ""},
+		{"Dialer.NetDialer", Field, 15, ""},
+		{"ECDSAWithP256AndSHA256", Const, 8, ""},
+		{"ECDSAWithP384AndSHA384", Const, 8, ""},
+		{"ECDSAWithP521AndSHA512", Const, 8, ""},
+		{"ECDSAWithSHA1", Const, 10, ""},
+		{"ECHRejectionError", Type, 23, ""},
+		{"ECHRejectionError.RetryConfigList", Field, 23, ""},
+		{"Ed25519", Const, 13, ""},
+		{"EncryptedClientHelloKey", Type, 24, ""},
+		{"EncryptedClientHelloKey.Config", Field, 24, ""},
+		{"EncryptedClientHelloKey.PrivateKey", Field, 24, ""},
+		{"EncryptedClientHelloKey.SendAsRetry", Field, 24, ""},
+		{"InsecureCipherSuites", Func, 14, "func() []*CipherSuite"},
+		{"Listen", Func, 0, "func(network string, laddr string, config *Config) (net.Listener, error)"},
+		{"LoadX509KeyPair", Func, 0, "func(certFile string, keyFile string) (Certificate, error)"},
+		{"NewLRUClientSessionCache", Func, 3, "func(capacity int) ClientSessionCache"},
+		{"NewListener", Func, 0, "func(inner net.Listener, config *Config) net.Listener"},
+		{"NewResumptionState", Func, 21, "func(ticket []byte, state *SessionState) (*ClientSessionState, error)"},
+		{"NoClientCert", Const, 0, ""},
+		{"PKCS1WithSHA1", Const, 8, ""},
+		{"PKCS1WithSHA256", Const, 8, ""},
+		{"PKCS1WithSHA384", Const, 8, ""},
+		{"PKCS1WithSHA512", Const, 8, ""},
+		{"PSSWithSHA256", Const, 8, ""},
+		{"PSSWithSHA384", Const, 8, ""},
+		{"PSSWithSHA512", Const, 8, ""},
+		{"ParseSessionState", Func, 21, "func(data []byte) (*SessionState, error)"},
+		{"QUICClient", Func, 21, "func(config *QUICConfig) *QUICConn"},
+		{"QUICConfig", Type, 21, ""},
+		{"QUICConfig.EnableSessionEvents", Field, 23, ""},
+		{"QUICConfig.TLSConfig", Field, 21, ""},
+		{"QUICConn", Type, 21, ""},
+		{"QUICEncryptionLevel", Type, 21, ""},
+		{"QUICEncryptionLevelApplication", Const, 21, ""},
+		{"QUICEncryptionLevelEarly", Const, 21, ""},
+		{"QUICEncryptionLevelHandshake", Const, 21, ""},
+		{"QUICEncryptionLevelInitial", Const, 21, ""},
+		{"QUICEvent", Type, 21, ""},
+		{"QUICEvent.Data", Field, 21, ""},
+		{"QUICEvent.Kind", Field, 21, ""},
+		{"QUICEvent.Level", Field, 21, ""},
+		{"QUICEvent.SessionState", Field, 23, ""},
+		{"QUICEvent.Suite", Field, 21, ""},
+		{"QUICEventKind", Type, 21, ""},
+		{"QUICHandshakeDone", Const, 21, ""},
+		{"QUICNoEvent", Const, 21, ""},
+		{"QUICRejectedEarlyData", Const, 21, ""},
+		{"QUICResumeSession", Const, 23, ""},
+		{"QUICServer", Func, 21, "func(config *QUICConfig) *QUICConn"},
+		{"QUICSessionTicketOptions", Type, 21, ""},
+		{"QUICSessionTicketOptions.EarlyData", Field, 21, ""},
+		{"QUICSessionTicketOptions.Extra", Field, 23, ""},
+		{"QUICSetReadSecret", Const, 21, ""},
+		{"QUICSetWriteSecret", Const, 21, ""},
+		{"QUICStoreSession", Const, 23, ""},
+		{"QUICTransportParameters", Const, 21, ""},
+		{"QUICTransportParametersRequired", Const, 21, ""},
+		{"QUICWriteData", Const, 21, ""},
+		{"RecordHeaderError", Type, 6, ""},
+		{"RecordHeaderError.Conn", Field, 12, ""},
+		{"RecordHeaderError.Msg", Field, 6, ""},
+		{"RecordHeaderError.RecordHeader", Field, 6, ""},
+		{"RenegotiateFreelyAsClient", Const, 7, ""},
+		{"RenegotiateNever", Const, 7, ""},
+		{"RenegotiateOnceAsClient", Const, 7, ""},
+		{"RenegotiationSupport", Type, 7, ""},
+		{"RequestClientCert", Const, 0, ""},
+		{"RequireAndVerifyClientCert", Const, 0, ""},
+		{"RequireAnyClientCert", Const, 0, ""},
+		{"Server", Func, 0, "func(conn net.Conn, config *Config) *Conn"},
+		{"SessionState", Type, 21, ""},
+		{"SessionState.EarlyData", Field, 21, ""},
+		{"SessionState.Extra", Field, 21, ""},
+		{"SignatureScheme", Type, 8, ""},
+		{"TLS_AES_128_GCM_SHA256", Const, 12, ""},
+		{"TLS_AES_256_GCM_SHA384", Const, 12, ""},
+		{"TLS_CHACHA20_POLY1305_SHA256", Const, 12, ""},
+		{"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", Const, 2, ""},
+		{"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", Const, 8, ""},
+		{"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", Const, 2, ""},
+		{"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", Const, 2, ""},
+		{"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", Const, 5, ""},
+		{"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", Const, 8, ""},
+		{"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256", Const, 14, ""},
+		{"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", Const, 2, ""},
+		{"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", Const, 0, ""},
+		{"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", Const, 0, ""},
+		{"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", Const, 8, ""},
+		{"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", Const, 2, ""},
+		{"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", Const, 1, ""},
+		{"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", Const, 5, ""},
+		{"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", Const, 8, ""},
+		{"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", Const, 14, ""},
+		{"TLS_ECDHE_RSA_WITH_RC4_128_SHA", Const, 0, ""},
+		{"TLS_FALLBACK_SCSV", Const, 4, ""},
+		{"TLS_RSA_WITH_3DES_EDE_CBC_SHA", Const, 0, ""},
+		{"TLS_RSA_WITH_AES_128_CBC_SHA", Const, 0, ""},
+		{"TLS_RSA_WITH_AES_128_CBC_SHA256", Const, 8, ""},
+		{"TLS_RSA_WITH_AES_128_GCM_SHA256", Const, 6, ""},
+		{"TLS_RSA_WITH_AES_256_CBC_SHA", Const, 1, ""},
+		{"TLS_RSA_WITH_AES_256_GCM_SHA384", Const, 6, ""},
+		{"TLS_RSA_WITH_RC4_128_SHA", Const, 0, ""},
+		{"VerifyClientCertIfGiven", Const, 0, ""},
+		{"VersionName", Func, 21, "func(version uint16) string"},
+		{"VersionSSL30", Const, 2, ""},
+		{"VersionTLS10", Const, 2, ""},
+		{"VersionTLS11", Const, 2, ""},
+		{"VersionTLS12", Const, 2, ""},
+		{"VersionTLS13", Const, 12, ""},
+		{"X25519", Const, 8, ""},
+		{"X25519MLKEM768", Const, 24, ""},
+		{"X509KeyPair", Func, 0, "func(certPEMBlock []byte, keyPEMBlock []byte) (Certificate, error)"},
+	},
+	"crypto/x509": {
+		{"(*CertPool).AddCert", Method, 0, ""},
+		{"(*CertPool).AddCertWithConstraint", Method, 22, ""},
+		{"(*CertPool).AppendCertsFromPEM", Method, 0, ""},
+		{"(*CertPool).Clone", Method, 19, ""},
+		{"(*CertPool).Equal", Method, 19, ""},
+		{"(*CertPool).Subjects", Method, 0, ""},
+		{"(*Certificate).CheckCRLSignature", Method, 0, ""},
+		{"(*Certificate).CheckSignature", Method, 0, ""},
+		{"(*Certificate).CheckSignatureFrom", Method, 0, ""},
+		{"(*Certificate).CreateCRL", Method, 0, ""},
+		{"(*Certificate).Equal", Method, 0, ""},
+		{"(*Certificate).Verify", Method, 0, ""},
+		{"(*Certificate).VerifyHostname", Method, 0, ""},
+		{"(*CertificateRequest).CheckSignature", Method, 5, ""},
+		{"(*OID).UnmarshalBinary", Method, 23, ""},
+		{"(*OID).UnmarshalText", Method, 23, ""},
+		{"(*RevocationList).CheckSignatureFrom", Method, 19, ""},
+		{"(CertificateInvalidError).Error", Method, 0, ""},
+		{"(ConstraintViolationError).Error", Method, 0, ""},
+		{"(HostnameError).Error", Method, 0, ""},
+		{"(InsecureAlgorithmError).Error", Method, 6, ""},
+		{"(OID).AppendBinary", Method, 24, ""},
+		{"(OID).AppendText", Method, 24, ""},
+		{"(OID).Equal", Method, 22, ""},
+		{"(OID).EqualASN1OID", Method, 22, ""},
+		{"(OID).MarshalBinary", Method, 23, ""},
+		{"(OID).MarshalText", Method, 23, ""},
+		{"(OID).String", Method, 22, ""},
+		{"(PublicKeyAlgorithm).String", Method, 10, ""},
+		{"(SignatureAlgorithm).String", Method, 6, ""},
+		{"(SystemRootsError).Error", Method, 1, ""},
+		{"(SystemRootsError).Unwrap", Method, 16, ""},
+		{"(UnhandledCriticalExtension).Error", Method, 0, ""},
+		{"(UnknownAuthorityError).Error", Method, 0, ""},
+		{"CANotAuthorizedForExtKeyUsage", Const, 10, ""},
+		{"CANotAuthorizedForThisName", Const, 0, ""},
+		{"CertPool", Type, 0, ""},
+		{"Certificate", Type, 0, ""},
+		{"Certificate.AuthorityKeyId", Field, 0, ""},
+		{"Certificate.BasicConstraintsValid", Field, 0, ""},
+		{"Certificate.CRLDistributionPoints", Field, 2, ""},
+		{"Certificate.DNSNames", Field, 0, ""},
+		{"Certificate.EmailAddresses", Field, 0, ""},
+		{"Certificate.ExcludedDNSDomains", Field, 9, ""},
+		{"Certificate.ExcludedEmailAddresses", Field, 10, ""},
+		{"Certificate.ExcludedIPRanges", Field, 10, ""},
+		{"Certificate.ExcludedURIDomains", Field, 10, ""},
+		{"Certificate.ExtKeyUsage", Field, 0, ""},
+		{"Certificate.Extensions", Field, 2, ""},
+		{"Certificate.ExtraExtensions", Field, 2, ""},
+		{"Certificate.IPAddresses", Field, 1, ""},
+		{"Certificate.InhibitAnyPolicy", Field, 24, ""},
+		{"Certificate.InhibitAnyPolicyZero", Field, 24, ""},
+		{"Certificate.InhibitPolicyMapping", Field, 24, ""},
+		{"Certificate.InhibitPolicyMappingZero", Field, 24, ""},
+		{"Certificate.IsCA", Field, 0, ""},
+		{"Certificate.Issuer", Field, 0, ""},
+		{"Certificate.IssuingCertificateURL", Field, 2, ""},
+		{"Certificate.KeyUsage", Field, 0, ""},
+		{"Certificate.MaxPathLen", Field, 0, ""},
+		{"Certificate.MaxPathLenZero", Field, 4, ""},
+		{"Certificate.NotAfter", Field, 0, ""},
+		{"Certificate.NotBefore", Field, 0, ""},
+		{"Certificate.OCSPServer", Field, 2, ""},
+		{"Certificate.PermittedDNSDomains", Field, 0, ""},
+		{"Certificate.PermittedDNSDomainsCritical", Field, 0, ""},
+		{"Certificate.PermittedEmailAddresses", Field, 10, ""},
+		{"Certificate.PermittedIPRanges", Field, 10, ""},
+		{"Certificate.PermittedURIDomains", Field, 10, ""},
+		{"Certificate.Policies", Field, 22, ""},
+		{"Certificate.PolicyIdentifiers", Field, 0, ""},
+		{"Certificate.PolicyMappings", Field, 24, ""},
+		{"Certificate.PublicKey", Field, 0, ""},
+		{"Certificate.PublicKeyAlgorithm", Field, 0, ""},
+		{"Certificate.Raw", Field, 0, ""},
+		{"Certificate.RawIssuer", Field, 0, ""},
+		{"Certificate.RawSubject", Field, 0, ""},
+		{"Certificate.RawSubjectPublicKeyInfo", Field, 0, ""},
+		{"Certificate.RawTBSCertificate", Field, 0, ""},
+		{"Certificate.RequireExplicitPolicy", Field, 24, ""},
+		{"Certificate.RequireExplicitPolicyZero", Field, 24, ""},
+		{"Certificate.SerialNumber", Field, 0, ""},
+		{"Certificate.Signature", Field, 0, ""},
+		{"Certificate.SignatureAlgorithm", Field, 0, ""},
+		{"Certificate.Subject", Field, 0, ""},
+		{"Certificate.SubjectKeyId", Field, 0, ""},
+		{"Certificate.URIs", Field, 10, ""},
+		{"Certificate.UnhandledCriticalExtensions", Field, 5, ""},
+		{"Certificate.UnknownExtKeyUsage", Field, 0, ""},
+		{"Certificate.Version", Field, 0, ""},
+		{"CertificateInvalidError", Type, 0, ""},
+		{"CertificateInvalidError.Cert", Field, 0, ""},
+		{"CertificateInvalidError.Detail", Field, 10, ""},
+		{"CertificateInvalidError.Reason", Field, 0, ""},
+		{"CertificateRequest", Type, 3, ""},
+		{"CertificateRequest.Attributes", Field, 3, ""},
+		{"CertificateRequest.DNSNames", Field, 3, ""},
+		{"CertificateRequest.EmailAddresses", Field, 3, ""},
+		{"CertificateRequest.Extensions", Field, 3, ""},
+		{"CertificateRequest.ExtraExtensions", Field, 3, ""},
+		{"CertificateRequest.IPAddresses", Field, 3, ""},
+		{"CertificateRequest.PublicKey", Field, 3, ""},
+		{"CertificateRequest.PublicKeyAlgorithm", Field, 3, ""},
+		{"CertificateRequest.Raw", Field, 3, ""},
+		{"CertificateRequest.RawSubject", Field, 3, ""},
+		{"CertificateRequest.RawSubjectPublicKeyInfo", Field, 3, ""},
+		{"CertificateRequest.RawTBSCertificateRequest", Field, 3, ""},
+		{"CertificateRequest.Signature", Field, 3, ""},
+		{"CertificateRequest.SignatureAlgorithm", Field, 3, ""},
+		{"CertificateRequest.Subject", Field, 3, ""},
+		{"CertificateRequest.URIs", Field, 10, ""},
+		{"CertificateRequest.Version", Field, 3, ""},
+		{"ConstraintViolationError", Type, 0, ""},
+		{"CreateCertificate", Func, 0, "func(rand io.Reader, template *Certificate, parent *Certificate, pub any, priv any) ([]byte, error)"},
+		{"CreateCertificateRequest", Func, 3, "func(rand io.Reader, template *CertificateRequest, priv any) (csr []byte, err error)"},
+		{"CreateRevocationList", Func, 15, "func(rand io.Reader, template *RevocationList, issuer *Certificate, priv crypto.Signer) ([]byte, error)"},
+		{"DSA", Const, 0, ""},
+		{"DSAWithSHA1", Const, 0, ""},
+		{"DSAWithSHA256", Const, 0, ""},
+		{"DecryptPEMBlock", Func, 1, "func(b *pem.Block, password []byte) ([]byte, error)"},
+		{"ECDSA", Const, 1, ""},
+		{"ECDSAWithSHA1", Const, 1, ""},
+		{"ECDSAWithSHA256", Const, 1, ""},
+		{"ECDSAWithSHA384", Const, 1, ""},
+		{"ECDSAWithSHA512", Const, 1, ""},
+		{"Ed25519", Const, 13, ""},
+		{"EncryptPEMBlock", Func, 1, "func(rand io.Reader, blockType string, data []byte, password []byte, alg PEMCipher) (*pem.Block, error)"},
+		{"ErrUnsupportedAlgorithm", Var, 0, ""},
+		{"Expired", Const, 0, ""},
+		{"ExtKeyUsage", Type, 0, ""},
+		{"ExtKeyUsageAny", Const, 0, ""},
+		{"ExtKeyUsageClientAuth", Const, 0, ""},
+		{"ExtKeyUsageCodeSigning", Const, 0, ""},
+		{"ExtKeyUsageEmailProtection", Const, 0, ""},
+		{"ExtKeyUsageIPSECEndSystem", Const, 1, ""},
+		{"ExtKeyUsageIPSECTunnel", Const, 1, ""},
+		{"ExtKeyUsageIPSECUser", Const, 1, ""},
+		{"ExtKeyUsageMicrosoftCommercialCodeSigning", Const, 10, ""},
+		{"ExtKeyUsageMicrosoftKernelCodeSigning", Const, 10, ""},
+		{"ExtKeyUsageMicrosoftServerGatedCrypto", Const, 1, ""},
+		{"ExtKeyUsageNetscapeServerGatedCrypto", Const, 1, ""},
+		{"ExtKeyUsageOCSPSigning", Const, 0, ""},
+		{"ExtKeyUsageServerAuth", Const, 0, ""},
+		{"ExtKeyUsageTimeStamping", Const, 0, ""},
+		{"HostnameError", Type, 0, ""},
+		{"HostnameError.Certificate", Field, 0, ""},
+		{"HostnameError.Host", Field, 0, ""},
+		{"IncompatibleUsage", Const, 1, ""},
+		{"IncorrectPasswordError", Var, 1, ""},
+		{"InsecureAlgorithmError", Type, 6, ""},
+		{"InvalidReason", Type, 0, ""},
+		{"IsEncryptedPEMBlock", Func, 1, "func(b *pem.Block) bool"},
+		{"KeyUsage", Type, 0, ""},
+		{"KeyUsageCRLSign", Const, 0, ""},
+		{"KeyUsageCertSign", Const, 0, ""},
+		{"KeyUsageContentCommitment", Const, 0, ""},
+		{"KeyUsageDataEncipherment", Const, 0, ""},
+		{"KeyUsageDecipherOnly", Const, 0, ""},
+		{"KeyUsageDigitalSignature", Const, 0, ""},
+		{"KeyUsageEncipherOnly", Const, 0, ""},
+		{"KeyUsageKeyAgreement", Const, 0, ""},
+		{"KeyUsageKeyEncipherment", Const, 0, ""},
+		{"MD2WithRSA", Const, 0, ""},
+		{"MD5WithRSA", Const, 0, ""},
+		{"MarshalECPrivateKey", Func, 2, "func(key *ecdsa.PrivateKey) ([]byte, error)"},
+		{"MarshalPKCS1PrivateKey", Func, 0, "func(key *rsa.PrivateKey) []byte"},
+		{"MarshalPKCS1PublicKey", Func, 10, "func(key *rsa.PublicKey) []byte"},
+		{"MarshalPKCS8PrivateKey", Func, 10, "func(key any) ([]byte, error)"},
+		{"MarshalPKIXPublicKey", Func, 0, "func(pub any) ([]byte, error)"},
+		{"NameConstraintsWithoutSANs", Const, 10, ""},
+		{"NameMismatch", Const, 8, ""},
+		{"NewCertPool", Func, 0, "func() *CertPool"},
+		{"NoValidChains", Const, 24, ""},
+		{"NotAuthorizedToSign", Const, 0, ""},
+		{"OID", Type, 22, ""},
+		{"OIDFromInts", Func, 22, "func(oid []uint64) (OID, error)"},
+		{"PEMCipher", Type, 1, ""},
+		{"PEMCipher3DES", Const, 1, ""},
+		{"PEMCipherAES128", Const, 1, ""},
+		{"PEMCipherAES192", Const, 1, ""},
+		{"PEMCipherAES256", Const, 1, ""},
+		{"PEMCipherDES", Const, 1, ""},
+		{"ParseCRL", Func, 0, "func(crlBytes []byte) (*pkix.CertificateList, error)"},
+		{"ParseCertificate", Func, 0, "func(der []byte) (*Certificate, error)"},
+		{"ParseCertificateRequest", Func, 3, "func(asn1Data []byte) (*CertificateRequest, error)"},
+		{"ParseCertificates", Func, 0, "func(der []byte) ([]*Certificate, error)"},
+		{"ParseDERCRL", Func, 0, "func(derBytes []byte) (*pkix.CertificateList, error)"},
+		{"ParseECPrivateKey", Func, 1, "func(der []byte) (*ecdsa.PrivateKey, error)"},
+		{"ParseOID", Func, 23, "func(oid string) (OID, error)"},
+		{"ParsePKCS1PrivateKey", Func, 0, "func(der []byte) (*rsa.PrivateKey, error)"},
+		{"ParsePKCS1PublicKey", Func, 10, "func(der []byte) (*rsa.PublicKey, error)"},
+		{"ParsePKCS8PrivateKey", Func, 0, "func(der []byte) (key any, err error)"},
+		{"ParsePKIXPublicKey", Func, 0, "func(derBytes []byte) (pub any, err error)"},
+		{"ParseRevocationList", Func, 19, "func(der []byte) (*RevocationList, error)"},
+		{"PolicyMapping", Type, 24, ""},
+		{"PolicyMapping.IssuerDomainPolicy", Field, 24, ""},
+		{"PolicyMapping.SubjectDomainPolicy", Field, 24, ""},
+		{"PublicKeyAlgorithm", Type, 0, ""},
+		{"PureEd25519", Const, 13, ""},
+		{"RSA", Const, 0, ""},
+		{"RevocationList", Type, 15, ""},
+		{"RevocationList.AuthorityKeyId", Field, 19, ""},
+		{"RevocationList.Extensions", Field, 19, ""},
+		{"RevocationList.ExtraExtensions", Field, 15, ""},
+		{"RevocationList.Issuer", Field, 19, ""},
+		{"RevocationList.NextUpdate", Field, 15, ""},
+		{"RevocationList.Number", Field, 15, ""},
+		{"RevocationList.Raw", Field, 19, ""},
+		{"RevocationList.RawIssuer", Field, 19, ""},
+		{"RevocationList.RawTBSRevocationList", Field, 19, ""},
+		{"RevocationList.RevokedCertificateEntries", Field, 21, ""},
+		{"RevocationList.RevokedCertificates", Field, 15, ""},
+		{"RevocationList.Signature", Field, 19, ""},
+		{"RevocationList.SignatureAlgorithm", Field, 15, ""},
+		{"RevocationList.ThisUpdate", Field, 15, ""},
+		{"RevocationListEntry", Type, 21, ""},
+		{"RevocationListEntry.Extensions", Field, 21, ""},
+		{"RevocationListEntry.ExtraExtensions", Field, 21, ""},
+		{"RevocationListEntry.Raw", Field, 21, ""},
+		{"RevocationListEntry.ReasonCode", Field, 21, ""},
+		{"RevocationListEntry.RevocationTime", Field, 21, ""},
+		{"RevocationListEntry.SerialNumber", Field, 21, ""},
+		{"SHA1WithRSA", Const, 0, ""},
+		{"SHA256WithRSA", Const, 0, ""},
+		{"SHA256WithRSAPSS", Const, 8, ""},
+		{"SHA384WithRSA", Const, 0, ""},
+		{"SHA384WithRSAPSS", Const, 8, ""},
+		{"SHA512WithRSA", Const, 0, ""},
+		{"SHA512WithRSAPSS", Const, 8, ""},
+		{"SetFallbackRoots", Func, 20, "func(roots *CertPool)"},
+		{"SignatureAlgorithm", Type, 0, ""},
+		{"SystemCertPool", Func, 7, "func() (*CertPool, error)"},
+		{"SystemRootsError", Type, 1, ""},
+		{"SystemRootsError.Err", Field, 7, ""},
+		{"TooManyConstraints", Const, 10, ""},
+		{"TooManyIntermediates", Const, 0, ""},
+		{"UnconstrainedName", Const, 10, ""},
+		{"UnhandledCriticalExtension", Type, 0, ""},
+		{"UnknownAuthorityError", Type, 0, ""},
+		{"UnknownAuthorityError.Cert", Field, 8, ""},
+		{"UnknownPublicKeyAlgorithm", Const, 0, ""},
+		{"UnknownSignatureAlgorithm", Const, 0, ""},
+		{"VerifyOptions", Type, 0, ""},
+		{"VerifyOptions.CertificatePolicies", Field, 24, ""},
+		{"VerifyOptions.CurrentTime", Field, 0, ""},
+		{"VerifyOptions.DNSName", Field, 0, ""},
+		{"VerifyOptions.Intermediates", Field, 0, ""},
+		{"VerifyOptions.KeyUsages", Field, 1, ""},
+		{"VerifyOptions.MaxConstraintComparisions", Field, 10, ""},
+		{"VerifyOptions.Roots", Field, 0, ""},
+	},
+	"crypto/x509/pkix": {
+		{"(*CertificateList).HasExpired", Method, 0, ""},
+		{"(*Name).FillFromRDNSequence", Method, 0, ""},
+		{"(Name).String", Method, 10, ""},
+		{"(Name).ToRDNSequence", Method, 0, ""},
+		{"(RDNSequence).String", Method, 10, ""},
+		{"AlgorithmIdentifier", Type, 0, ""},
+		{"AlgorithmIdentifier.Algorithm", Field, 0, ""},
+		{"AlgorithmIdentifier.Parameters", Field, 0, ""},
+		{"AttributeTypeAndValue", Type, 0, ""},
+		{"AttributeTypeAndValue.Type", Field, 0, ""},
+		{"AttributeTypeAndValue.Value", Field, 0, ""},
+		{"AttributeTypeAndValueSET", Type, 3, ""},
+		{"AttributeTypeAndValueSET.Type", Field, 3, ""},
+		{"AttributeTypeAndValueSET.Value", Field, 3, ""},
+		{"CertificateList", Type, 0, ""},
+		{"CertificateList.SignatureAlgorithm", Field, 0, ""},
+		{"CertificateList.SignatureValue", Field, 0, ""},
+		{"CertificateList.TBSCertList", Field, 0, ""},
+		{"Extension", Type, 0, ""},
+		{"Extension.Critical", Field, 0, ""},
+		{"Extension.Id", Field, 0, ""},
+		{"Extension.Value", Field, 0, ""},
+		{"Name", Type, 0, ""},
+		{"Name.CommonName", Field, 0, ""},
+		{"Name.Country", Field, 0, ""},
+		{"Name.ExtraNames", Field, 5, ""},
+		{"Name.Locality", Field, 0, ""},
+		{"Name.Names", Field, 0, ""},
+		{"Name.Organization", Field, 0, ""},
+		{"Name.OrganizationalUnit", Field, 0, ""},
+		{"Name.PostalCode", Field, 0, ""},
+		{"Name.Province", Field, 0, ""},
+		{"Name.SerialNumber", Field, 0, ""},
+		{"Name.StreetAddress", Field, 0, ""},
+		{"RDNSequence", Type, 0, ""},
+		{"RelativeDistinguishedNameSET", Type, 0, ""},
+		{"RevokedCertificate", Type, 0, ""},
+		{"RevokedCertificate.Extensions", Field, 0, ""},
+		{"RevokedCertificate.RevocationTime", Field, 0, ""},
+		{"RevokedCertificate.SerialNumber", Field, 0, ""},
+		{"TBSCertificateList", Type, 0, ""},
+		{"TBSCertificateList.Extensions", Field, 0, ""},
+		{"TBSCertificateList.Issuer", Field, 0, ""},
+		{"TBSCertificateList.NextUpdate", Field, 0, ""},
+		{"TBSCertificateList.Raw", Field, 0, ""},
+		{"TBSCertificateList.RevokedCertificates", Field, 0, ""},
+		{"TBSCertificateList.Signature", Field, 0, ""},
+		{"TBSCertificateList.ThisUpdate", Field, 0, ""},
+		{"TBSCertificateList.Version", Field, 0, ""},
+	},
+	"database/sql": {
+		{"(*ColumnType).DatabaseTypeName", Method, 8, ""},
+		{"(*ColumnType).DecimalSize", Method, 8, ""},
+		{"(*ColumnType).Length", Method, 8, ""},
+		{"(*ColumnType).Name", Method, 8, ""},
+		{"(*ColumnType).Nullable", Method, 8, ""},
+		{"(*ColumnType).ScanType", Method, 8, ""},
+		{"(*Conn).BeginTx", Method, 9, ""},
+		{"(*Conn).Close", Method, 9, ""},
+		{"(*Conn).ExecContext", Method, 9, ""},
+		{"(*Conn).PingContext", Method, 9, ""},
+		{"(*Conn).PrepareContext", Method, 9, ""},
+		{"(*Conn).QueryContext", Method, 9, ""},
+		{"(*Conn).QueryRowContext", Method, 9, ""},
+		{"(*Conn).Raw", Method, 13, ""},
+		{"(*DB).Begin", Method, 0, ""},
+		{"(*DB).BeginTx", Method, 8, ""},
+		{"(*DB).Close", Method, 0, ""},
+		{"(*DB).Conn", Method, 9, ""},
+		{"(*DB).Driver", Method, 0, ""},
+		{"(*DB).Exec", Method, 0, ""},
+		{"(*DB).ExecContext", Method, 8, ""},
+		{"(*DB).Ping", Method, 1, ""},
+		{"(*DB).PingContext", Method, 8, ""},
+		{"(*DB).Prepare", Method, 0, ""},
+		{"(*DB).PrepareContext", Method, 8, ""},
+		{"(*DB).Query", Method, 0, ""},
+		{"(*DB).QueryContext", Method, 8, ""},
+		{"(*DB).QueryRow", Method, 0, ""},
+		{"(*DB).QueryRowContext", Method, 8, ""},
+		{"(*DB).SetConnMaxIdleTime", Method, 15, ""},
+		{"(*DB).SetConnMaxLifetime", Method, 6, ""},
+		{"(*DB).SetMaxIdleConns", Method, 1, ""},
+		{"(*DB).SetMaxOpenConns", Method, 2, ""},
+		{"(*DB).Stats", Method, 5, ""},
+		{"(*Null).Scan", Method, 22, ""},
+		{"(*NullBool).Scan", Method, 0, ""},
+		{"(*NullByte).Scan", Method, 17, ""},
+		{"(*NullFloat64).Scan", Method, 0, ""},
+		{"(*NullInt16).Scan", Method, 17, ""},
+		{"(*NullInt32).Scan", Method, 13, ""},
+		{"(*NullInt64).Scan", Method, 0, ""},
+		{"(*NullString).Scan", Method, 0, ""},
+		{"(*NullTime).Scan", Method, 13, ""},
+		{"(*Row).Err", Method, 15, ""},
+		{"(*Row).Scan", Method, 0, ""},
+		{"(*Rows).Close", Method, 0, ""},
+		{"(*Rows).ColumnTypes", Method, 8, ""},
+		{"(*Rows).Columns", Method, 0, ""},
+		{"(*Rows).Err", Method, 0, ""},
+		{"(*Rows).Next", Method, 0, ""},
+		{"(*Rows).NextResultSet", Method, 8, ""},
+		{"(*Rows).Scan", Method, 0, ""},
+		{"(*Stmt).Close", Method, 0, ""},
+		{"(*Stmt).Exec", Method, 0, ""},
+		{"(*Stmt).ExecContext", Method, 8, ""},
+		{"(*Stmt).Query", Method, 0, ""},
+		{"(*Stmt).QueryContext", Method, 8, ""},
+		{"(*Stmt).QueryRow", Method, 0, ""},
+		{"(*Stmt).QueryRowContext", Method, 8, ""},
+		{"(*Tx).Commit", Method, 0, ""},
+		{"(*Tx).Exec", Method, 0, ""},
+		{"(*Tx).ExecContext", Method, 8, ""},
+		{"(*Tx).Prepare", Method, 0, ""},
+		{"(*Tx).PrepareContext", Method, 8, ""},
+		{"(*Tx).Query", Method, 0, ""},
+		{"(*Tx).QueryContext", Method, 8, ""},
+		{"(*Tx).QueryRow", Method, 0, ""},
+		{"(*Tx).QueryRowContext", Method, 8, ""},
+		{"(*Tx).Rollback", Method, 0, ""},
+		{"(*Tx).Stmt", Method, 0, ""},
+		{"(*Tx).StmtContext", Method, 8, ""},
+		{"(IsolationLevel).String", Method, 11, ""},
+		{"(Null).Value", Method, 22, ""},
+		{"(NullBool).Value", Method, 0, ""},
+		{"(NullByte).Value", Method, 17, ""},
+		{"(NullFloat64).Value", Method, 0, ""},
+		{"(NullInt16).Value", Method, 17, ""},
+		{"(NullInt32).Value", Method, 13, ""},
+		{"(NullInt64).Value", Method, 0, ""},
+		{"(NullString).Value", Method, 0, ""},
+		{"(NullTime).Value", Method, 13, ""},
+		{"ColumnType", Type, 8, ""},
+		{"Conn", Type, 9, ""},
+		{"DB", Type, 0, ""},
+		{"DBStats", Type, 5, ""},
+		{"DBStats.Idle", Field, 11, ""},
+		{"DBStats.InUse", Field, 11, ""},
+		{"DBStats.MaxIdleClosed", Field, 11, ""},
+		{"DBStats.MaxIdleTimeClosed", Field, 15, ""},
+		{"DBStats.MaxLifetimeClosed", Field, 11, ""},
+		{"DBStats.MaxOpenConnections", Field, 11, ""},
+		{"DBStats.OpenConnections", Field, 5, ""},
+		{"DBStats.WaitCount", Field, 11, ""},
+		{"DBStats.WaitDuration", Field, 11, ""},
+		{"Drivers", Func, 4, "func() []string"},
+		{"ErrConnDone", Var, 9, ""},
+		{"ErrNoRows", Var, 0, ""},
+		{"ErrTxDone", Var, 0, ""},
+		{"IsolationLevel", Type, 8, ""},
+		{"LevelDefault", Const, 8, ""},
+		{"LevelLinearizable", Const, 8, ""},
+		{"LevelReadCommitted", Const, 8, ""},
+		{"LevelReadUncommitted", Const, 8, ""},
+		{"LevelRepeatableRead", Const, 8, ""},
+		{"LevelSerializable", Const, 8, ""},
+		{"LevelSnapshot", Const, 8, ""},
+		{"LevelWriteCommitted", Const, 8, ""},
+		{"Named", Func, 8, "func(name string, value any) NamedArg"},
+		{"NamedArg", Type, 8, ""},
+		{"NamedArg.Name", Field, 8, ""},
+		{"NamedArg.Value", Field, 8, ""},
+		{"Null", Type, 22, ""},
+		{"Null.V", Field, 22, ""},
+		{"Null.Valid", Field, 22, ""},
+		{"NullBool", Type, 0, ""},
+		{"NullBool.Bool", Field, 0, ""},
+		{"NullBool.Valid", Field, 0, ""},
+		{"NullByte", Type, 17, ""},
+		{"NullByte.Byte", Field, 17, ""},
+		{"NullByte.Valid", Field, 17, ""},
+		{"NullFloat64", Type, 0, ""},
+		{"NullFloat64.Float64", Field, 0, ""},
+		{"NullFloat64.Valid", Field, 0, ""},
+		{"NullInt16", Type, 17, ""},
+		{"NullInt16.Int16", Field, 17, ""},
+		{"NullInt16.Valid", Field, 17, ""},
+		{"NullInt32", Type, 13, ""},
+		{"NullInt32.Int32", Field, 13, ""},
+		{"NullInt32.Valid", Field, 13, ""},
+		{"NullInt64", Type, 0, ""},
+		{"NullInt64.Int64", Field, 0, ""},
+		{"NullInt64.Valid", Field, 0, ""},
+		{"NullString", Type, 0, ""},
+		{"NullString.String", Field, 0, ""},
+		{"NullString.Valid", Field, 0, ""},
+		{"NullTime", Type, 13, ""},
+		{"NullTime.Time", Field, 13, ""},
+		{"NullTime.Valid", Field, 13, ""},
+		{"Open", Func, 0, "func(driverName string, dataSourceName string) (*DB, error)"},
+		{"OpenDB", Func, 10, "func(c driver.Connector) *DB"},
+		{"Out", Type, 9, ""},
+		{"Out.Dest", Field, 9, ""},
+		{"Out.In", Field, 9, ""},
+		{"RawBytes", Type, 0, ""},
+		{"Register", Func, 0, "func(name string, driver driver.Driver)"},
+		{"Result", Type, 0, ""},
+		{"Row", Type, 0, ""},
+		{"Rows", Type, 0, ""},
+		{"Scanner", Type, 0, ""},
+		{"Stmt", Type, 0, ""},
+		{"Tx", Type, 0, ""},
+		{"TxOptions", Type, 8, ""},
+		{"TxOptions.Isolation", Field, 8, ""},
+		{"TxOptions.ReadOnly", Field, 8, ""},
+	},
+	"database/sql/driver": {
+		{"(NotNull).ConvertValue", Method, 0, ""},
+		{"(Null).ConvertValue", Method, 0, ""},
+		{"(RowsAffected).LastInsertId", Method, 0, ""},
+		{"(RowsAffected).RowsAffected", Method, 0, ""},
+		{"Bool", Var, 0, ""},
+		{"ColumnConverter", Type, 0, ""},
+		{"Conn", Type, 0, ""},
+		{"ConnBeginTx", Type, 8, ""},
+		{"ConnPrepareContext", Type, 8, ""},
+		{"Connector", Type, 10, ""},
+		{"DefaultParameterConverter", Var, 0, ""},
+		{"Driver", Type, 0, ""},
+		{"DriverContext", Type, 10, ""},
+		{"ErrBadConn", Var, 0, ""},
+		{"ErrRemoveArgument", Var, 9, ""},
+		{"ErrSkip", Var, 0, ""},
+		{"Execer", Type, 0, ""},
+		{"ExecerContext", Type, 8, ""},
+		{"Int32", Var, 0, ""},
+		{"IsScanValue", Func, 0, "func(v any) bool"},
+		{"IsValue", Func, 0, "func(v any) bool"},
+		{"IsolationLevel", Type, 8, ""},
+		{"NamedValue", Type, 8, ""},
+		{"NamedValue.Name", Field, 8, ""},
+		{"NamedValue.Ordinal", Field, 8, ""},
+		{"NamedValue.Value", Field, 8, ""},
+		{"NamedValueChecker", Type, 9, ""},
+		{"NotNull", Type, 0, ""},
+		{"NotNull.Converter", Field, 0, ""},
+		{"Null", Type, 0, ""},
+		{"Null.Converter", Field, 0, ""},
+		{"Pinger", Type, 8, ""},
+		{"Queryer", Type, 1, ""},
+		{"QueryerContext", Type, 8, ""},
+		{"Result", Type, 0, ""},
+		{"ResultNoRows", Var, 0, ""},
+		{"Rows", Type, 0, ""},
+		{"RowsAffected", Type, 0, ""},
+		{"RowsColumnTypeDatabaseTypeName", Type, 8, ""},
+		{"RowsColumnTypeLength", Type, 8, ""},
+		{"RowsColumnTypeNullable", Type, 8, ""},
+		{"RowsColumnTypePrecisionScale", Type, 8, ""},
+		{"RowsColumnTypeScanType", Type, 8, ""},
+		{"RowsNextResultSet", Type, 8, ""},
+		{"SessionResetter", Type, 10, ""},
+		{"Stmt", Type, 0, ""},
+		{"StmtExecContext", Type, 8, ""},
+		{"StmtQueryContext", Type, 8, ""},
+		{"String", Var, 0, ""},
+		{"Tx", Type, 0, ""},
+		{"TxOptions", Type, 8, ""},
+		{"TxOptions.Isolation", Field, 8, ""},
+		{"TxOptions.ReadOnly", Field, 8, ""},
+		{"Validator", Type, 15, ""},
+		{"Value", Type, 0, ""},
+		{"ValueConverter", Type, 0, ""},
+		{"Valuer", Type, 0, ""},
+	},
+	"debug/buildinfo": {
+		{"BuildInfo", Type, 18, ""},
+		{"Read", Func, 18, "func(r io.ReaderAt) (*BuildInfo, error)"},
+		{"ReadFile", Func, 18, "func(name string) (info *BuildInfo, err error)"},
+	},
+	"debug/dwarf": {
+		{"(*AddrType).Basic", Method, 0, ""},
+		{"(*AddrType).Common", Method, 0, ""},
+		{"(*AddrType).Size", Method, 0, ""},
+		{"(*AddrType).String", Method, 0, ""},
+		{"(*ArrayType).Common", Method, 0, ""},
+		{"(*ArrayType).Size", Method, 0, ""},
+		{"(*ArrayType).String", Method, 0, ""},
+		{"(*BasicType).Basic", Method, 0, ""},
+		{"(*BasicType).Common", Method, 0, ""},
+		{"(*BasicType).Size", Method, 0, ""},
+		{"(*BasicType).String", Method, 0, ""},
+		{"(*BoolType).Basic", Method, 0, ""},
+		{"(*BoolType).Common", Method, 0, ""},
+		{"(*BoolType).Size", Method, 0, ""},
+		{"(*BoolType).String", Method, 0, ""},
+		{"(*CharType).Basic", Method, 0, ""},
+		{"(*CharType).Common", Method, 0, ""},
+		{"(*CharType).Size", Method, 0, ""},
+		{"(*CharType).String", Method, 0, ""},
+		{"(*CommonType).Common", Method, 0, ""},
+		{"(*CommonType).Size", Method, 0, ""},
+		{"(*ComplexType).Basic", Method, 0, ""},
+		{"(*ComplexType).Common", Method, 0, ""},
+		{"(*ComplexType).Size", Method, 0, ""},
+		{"(*ComplexType).String", Method, 0, ""},
+		{"(*Data).AddSection", Method, 14, ""},
+		{"(*Data).AddTypes", Method, 3, ""},
+		{"(*Data).LineReader", Method, 5, ""},
+		{"(*Data).Ranges", Method, 7, ""},
+		{"(*Data).Reader", Method, 0, ""},
+		{"(*Data).Type", Method, 0, ""},
+		{"(*DotDotDotType).Common", Method, 0, ""},
+		{"(*DotDotDotType).Size", Method, 0, ""},
+		{"(*DotDotDotType).String", Method, 0, ""},
+		{"(*Entry).AttrField", Method, 5, ""},
+		{"(*Entry).Val", Method, 0, ""},
+		{"(*EnumType).Common", Method, 0, ""},
+		{"(*EnumType).Size", Method, 0, ""},
+		{"(*EnumType).String", Method, 0, ""},
+		{"(*FloatType).Basic", Method, 0, ""},
+		{"(*FloatType).Common", Method, 0, ""},
+		{"(*FloatType).Size", Method, 0, ""},
+		{"(*FloatType).String", Method, 0, ""},
+		{"(*FuncType).Common", Method, 0, ""},
+		{"(*FuncType).Size", Method, 0, ""},
+		{"(*FuncType).String", Method, 0, ""},
+		{"(*IntType).Basic", Method, 0, ""},
+		{"(*IntType).Common", Method, 0, ""},
+		{"(*IntType).Size", Method, 0, ""},
+		{"(*IntType).String", Method, 0, ""},
+		{"(*LineReader).Files", Method, 14, ""},
+		{"(*LineReader).Next", Method, 5, ""},
+		{"(*LineReader).Reset", Method, 5, ""},
+		{"(*LineReader).Seek", Method, 5, ""},
+		{"(*LineReader).SeekPC", Method, 5, ""},
+		{"(*LineReader).Tell", Method, 5, ""},
+		{"(*PtrType).Common", Method, 0, ""},
+		{"(*PtrType).Size", Method, 0, ""},
+		{"(*PtrType).String", Method, 0, ""},
+		{"(*QualType).Common", Method, 0, ""},
+		{"(*QualType).Size", Method, 0, ""},
+		{"(*QualType).String", Method, 0, ""},
+		{"(*Reader).AddressSize", Method, 5, ""},
+		{"(*Reader).ByteOrder", Method, 14, ""},
+		{"(*Reader).Next", Method, 0, ""},
+		{"(*Reader).Seek", Method, 0, ""},
+		{"(*Reader).SeekPC", Method, 7, ""},
+		{"(*Reader).SkipChildren", Method, 0, ""},
+		{"(*StructType).Common", Method, 0, ""},
+		{"(*StructType).Defn", Method, 0, ""},
+		{"(*StructType).Size", Method, 0, ""},
+		{"(*StructType).String", Method, 0, ""},
+		{"(*TypedefType).Common", Method, 0, ""},
+		{"(*TypedefType).Size", Method, 0, ""},
+		{"(*TypedefType).String", Method, 0, ""},
+		{"(*UcharType).Basic", Method, 0, ""},
+		{"(*UcharType).Common", Method, 0, ""},
+		{"(*UcharType).Size", Method, 0, ""},
+		{"(*UcharType).String", Method, 0, ""},
+		{"(*UintType).Basic", Method, 0, ""},
+		{"(*UintType).Common", Method, 0, ""},
+		{"(*UintType).Size", Method, 0, ""},
+		{"(*UintType).String", Method, 0, ""},
+		{"(*UnspecifiedType).Basic", Method, 4, ""},
+		{"(*UnspecifiedType).Common", Method, 4, ""},
+		{"(*UnspecifiedType).Size", Method, 4, ""},
+		{"(*UnspecifiedType).String", Method, 4, ""},
+		{"(*UnsupportedType).Common", Method, 13, ""},
+		{"(*UnsupportedType).Size", Method, 13, ""},
+		{"(*UnsupportedType).String", Method, 13, ""},
+		{"(*VoidType).Common", Method, 0, ""},
+		{"(*VoidType).Size", Method, 0, ""},
+		{"(*VoidType).String", Method, 0, ""},
+		{"(Attr).GoString", Method, 0, ""},
+		{"(Attr).String", Method, 0, ""},
+		{"(Class).GoString", Method, 5, ""},
+		{"(Class).String", Method, 5, ""},
+		{"(DecodeError).Error", Method, 0, ""},
+		{"(Tag).GoString", Method, 0, ""},
+		{"(Tag).String", Method, 0, ""},
+		{"AddrType", Type, 0, ""},
+		{"AddrType.BasicType", Field, 0, ""},
+		{"ArrayType", Type, 0, ""},
+		{"ArrayType.CommonType", Field, 0, ""},
+		{"ArrayType.Count", Field, 0, ""},
+		{"ArrayType.StrideBitSize", Field, 0, ""},
+		{"ArrayType.Type", Field, 0, ""},
+		{"Attr", Type, 0, ""},
+		{"AttrAbstractOrigin", Const, 0, ""},
+		{"AttrAccessibility", Const, 0, ""},
+		{"AttrAddrBase", Const, 14, ""},
+		{"AttrAddrClass", Const, 0, ""},
+		{"AttrAlignment", Const, 14, ""},
+		{"AttrAllocated", Const, 0, ""},
+		{"AttrArtificial", Const, 0, ""},
+		{"AttrAssociated", Const, 0, ""},
+		{"AttrBaseTypes", Const, 0, ""},
+		{"AttrBinaryScale", Const, 14, ""},
+		{"AttrBitOffset", Const, 0, ""},
+		{"AttrBitSize", Const, 0, ""},
+		{"AttrByteSize", Const, 0, ""},
+		{"AttrCallAllCalls", Const, 14, ""},
+		{"AttrCallAllSourceCalls", Const, 14, ""},
+		{"AttrCallAllTailCalls", Const, 14, ""},
+		{"AttrCallColumn", Const, 0, ""},
+		{"AttrCallDataLocation", Const, 14, ""},
+		{"AttrCallDataValue", Const, 14, ""},
+		{"AttrCallFile", Const, 0, ""},
+		{"AttrCallLine", Const, 0, ""},
+		{"AttrCallOrigin", Const, 14, ""},
+		{"AttrCallPC", Const, 14, ""},
+		{"AttrCallParameter", Const, 14, ""},
+		{"AttrCallReturnPC", Const, 14, ""},
+		{"AttrCallTailCall", Const, 14, ""},
+		{"AttrCallTarget", Const, 14, ""},
+		{"AttrCallTargetClobbered", Const, 14, ""},
+		{"AttrCallValue", Const, 14, ""},
+		{"AttrCalling", Const, 0, ""},
+		{"AttrCommonRef", Const, 0, ""},
+		{"AttrCompDir", Const, 0, ""},
+		{"AttrConstExpr", Const, 14, ""},
+		{"AttrConstValue", Const, 0, ""},
+		{"AttrContainingType", Const, 0, ""},
+		{"AttrCount", Const, 0, ""},
+		{"AttrDataBitOffset", Const, 14, ""},
+		{"AttrDataLocation", Const, 0, ""},
+		{"AttrDataMemberLoc", Const, 0, ""},
+		{"AttrDecimalScale", Const, 14, ""},
+		{"AttrDecimalSign", Const, 14, ""},
+		{"AttrDeclColumn", Const, 0, ""},
+		{"AttrDeclFile", Const, 0, ""},
+		{"AttrDeclLine", Const, 0, ""},
+		{"AttrDeclaration", Const, 0, ""},
+		{"AttrDefaultValue", Const, 0, ""},
+		{"AttrDefaulted", Const, 14, ""},
+		{"AttrDeleted", Const, 14, ""},
+		{"AttrDescription", Const, 0, ""},
+		{"AttrDigitCount", Const, 14, ""},
+		{"AttrDiscr", Const, 0, ""},
+		{"AttrDiscrList", Const, 0, ""},
+		{"AttrDiscrValue", Const, 0, ""},
+		{"AttrDwoName", Const, 14, ""},
+		{"AttrElemental", Const, 14, ""},
+		{"AttrEncoding", Const, 0, ""},
+		{"AttrEndianity", Const, 14, ""},
+		{"AttrEntrypc", Const, 0, ""},
+		{"AttrEnumClass", Const, 14, ""},
+		{"AttrExplicit", Const, 14, ""},
+		{"AttrExportSymbols", Const, 14, ""},
+		{"AttrExtension", Const, 0, ""},
+		{"AttrExternal", Const, 0, ""},
+		{"AttrFrameBase", Const, 0, ""},
+		{"AttrFriend", Const, 0, ""},
+		{"AttrHighpc", Const, 0, ""},
+		{"AttrIdentifierCase", Const, 0, ""},
+		{"AttrImport", Const, 0, ""},
+		{"AttrInline", Const, 0, ""},
+		{"AttrIsOptional", Const, 0, ""},
+		{"AttrLanguage", Const, 0, ""},
+		{"AttrLinkageName", Const, 14, ""},
+		{"AttrLocation", Const, 0, ""},
+		{"AttrLoclistsBase", Const, 14, ""},
+		{"AttrLowerBound", Const, 0, ""},
+		{"AttrLowpc", Const, 0, ""},
+		{"AttrMacroInfo", Const, 0, ""},
+		{"AttrMacros", Const, 14, ""},
+		{"AttrMainSubprogram", Const, 14, ""},
+		{"AttrMutable", Const, 14, ""},
+		{"AttrName", Const, 0, ""},
+		{"AttrNamelistItem", Const, 0, ""},
+		{"AttrNoreturn", Const, 14, ""},
+		{"AttrObjectPointer", Const, 14, ""},
+		{"AttrOrdering", Const, 0, ""},
+		{"AttrPictureString", Const, 14, ""},
+		{"AttrPriority", Const, 0, ""},
+		{"AttrProducer", Const, 0, ""},
+		{"AttrPrototyped", Const, 0, ""},
+		{"AttrPure", Const, 14, ""},
+		{"AttrRanges", Const, 0, ""},
+		{"AttrRank", Const, 14, ""},
+		{"AttrRecursive", Const, 14, ""},
+		{"AttrReference", Const, 14, ""},
+		{"AttrReturnAddr", Const, 0, ""},
+		{"AttrRnglistsBase", Const, 14, ""},
+		{"AttrRvalueReference", Const, 14, ""},
+		{"AttrSegment", Const, 0, ""},
+		{"AttrSibling", Const, 0, ""},
+		{"AttrSignature", Const, 14, ""},
+		{"AttrSmall", Const, 14, ""},
+		{"AttrSpecification", Const, 0, ""},
+		{"AttrStartScope", Const, 0, ""},
+		{"AttrStaticLink", Const, 0, ""},
+		{"AttrStmtList", Const, 0, ""},
+		{"AttrStrOffsetsBase", Const, 14, ""},
+		{"AttrStride", Const, 0, ""},
+		{"AttrStrideSize", Const, 0, ""},
+		{"AttrStringLength", Const, 0, ""},
+		{"AttrStringLengthBitSize", Const, 14, ""},
+		{"AttrStringLengthByteSize", Const, 14, ""},
+		{"AttrThreadsScaled", Const, 14, ""},
+		{"AttrTrampoline", Const, 0, ""},
+		{"AttrType", Const, 0, ""},
+		{"AttrUpperBound", Const, 0, ""},
+		{"AttrUseLocation", Const, 0, ""},
+		{"AttrUseUTF8", Const, 0, ""},
+		{"AttrVarParam", Const, 0, ""},
+		{"AttrVirtuality", Const, 0, ""},
+		{"AttrVisibility", Const, 0, ""},
+		{"AttrVtableElemLoc", Const, 0, ""},
+		{"BasicType", Type, 0, ""},
+		{"BasicType.BitOffset", Field, 0, ""},
+		{"BasicType.BitSize", Field, 0, ""},
+		{"BasicType.CommonType", Field, 0, ""},
+		{"BasicType.DataBitOffset", Field, 18, ""},
+		{"BoolType", Type, 0, ""},
+		{"BoolType.BasicType", Field, 0, ""},
+		{"CharType", Type, 0, ""},
+		{"CharType.BasicType", Field, 0, ""},
+		{"Class", Type, 5, ""},
+		{"ClassAddrPtr", Const, 14, ""},
+		{"ClassAddress", Const, 5, ""},
+		{"ClassBlock", Const, 5, ""},
+		{"ClassConstant", Const, 5, ""},
+		{"ClassExprLoc", Const, 5, ""},
+		{"ClassFlag", Const, 5, ""},
+		{"ClassLinePtr", Const, 5, ""},
+		{"ClassLocList", Const, 14, ""},
+		{"ClassLocListPtr", Const, 5, ""},
+		{"ClassMacPtr", Const, 5, ""},
+		{"ClassRangeListPtr", Const, 5, ""},
+		{"ClassReference", Const, 5, ""},
+		{"ClassReferenceAlt", Const, 5, ""},
+		{"ClassReferenceSig", Const, 5, ""},
+		{"ClassRngList", Const, 14, ""},
+		{"ClassRngListsPtr", Const, 14, ""},
+		{"ClassStrOffsetsPtr", Const, 14, ""},
+		{"ClassString", Const, 5, ""},
+		{"ClassStringAlt", Const, 5, ""},
+		{"ClassUnknown", Const, 6, ""},
+		{"CommonType", Type, 0, ""},
+		{"CommonType.ByteSize", Field, 0, ""},
+		{"CommonType.Name", Field, 0, ""},
+		{"ComplexType", Type, 0, ""},
+		{"ComplexType.BasicType", Field, 0, ""},
+		{"Data", Type, 0, ""},
+		{"DecodeError", Type, 0, ""},
+		{"DecodeError.Err", Field, 0, ""},
+		{"DecodeError.Name", Field, 0, ""},
+		{"DecodeError.Offset", Field, 0, ""},
+		{"DotDotDotType", Type, 0, ""},
+		{"DotDotDotType.CommonType", Field, 0, ""},
+		{"Entry", Type, 0, ""},
+		{"Entry.Children", Field, 0, ""},
+		{"Entry.Field", Field, 0, ""},
+		{"Entry.Offset", Field, 0, ""},
+		{"Entry.Tag", Field, 0, ""},
+		{"EnumType", Type, 0, ""},
+		{"EnumType.CommonType", Field, 0, ""},
+		{"EnumType.EnumName", Field, 0, ""},
+		{"EnumType.Val", Field, 0, ""},
+		{"EnumValue", Type, 0, ""},
+		{"EnumValue.Name", Field, 0, ""},
+		{"EnumValue.Val", Field, 0, ""},
+		{"ErrUnknownPC", Var, 5, ""},
+		{"Field", Type, 0, ""},
+		{"Field.Attr", Field, 0, ""},
+		{"Field.Class", Field, 5, ""},
+		{"Field.Val", Field, 0, ""},
+		{"FloatType", Type, 0, ""},
+		{"FloatType.BasicType", Field, 0, ""},
+		{"FuncType", Type, 0, ""},
+		{"FuncType.CommonType", Field, 0, ""},
+		{"FuncType.ParamType", Field, 0, ""},
+		{"FuncType.ReturnType", Field, 0, ""},
+		{"IntType", Type, 0, ""},
+		{"IntType.BasicType", Field, 0, ""},
+		{"LineEntry", Type, 5, ""},
+		{"LineEntry.Address", Field, 5, ""},
+		{"LineEntry.BasicBlock", Field, 5, ""},
+		{"LineEntry.Column", Field, 5, ""},
+		{"LineEntry.Discriminator", Field, 5, ""},
+		{"LineEntry.EndSequence", Field, 5, ""},
+		{"LineEntry.EpilogueBegin", Field, 5, ""},
+		{"LineEntry.File", Field, 5, ""},
+		{"LineEntry.ISA", Field, 5, ""},
+		{"LineEntry.IsStmt", Field, 5, ""},
+		{"LineEntry.Line", Field, 5, ""},
+		{"LineEntry.OpIndex", Field, 5, ""},
+		{"LineEntry.PrologueEnd", Field, 5, ""},
+		{"LineFile", Type, 5, ""},
+		{"LineFile.Length", Field, 5, ""},
+		{"LineFile.Mtime", Field, 5, ""},
+		{"LineFile.Name", Field, 5, ""},
+		{"LineReader", Type, 5, ""},
+		{"LineReaderPos", Type, 5, ""},
+		{"New", Func, 0, "func(abbrev []byte, aranges []byte, frame []byte, info []byte, line []byte, pubnames []byte, ranges []byte, str []byte) (*Data, error)"},
+		{"Offset", Type, 0, ""},
+		{"PtrType", Type, 0, ""},
+		{"PtrType.CommonType", Field, 0, ""},
+		{"PtrType.Type", Field, 0, ""},
+		{"QualType", Type, 0, ""},
+		{"QualType.CommonType", Field, 0, ""},
+		{"QualType.Qual", Field, 0, ""},
+		{"QualType.Type", Field, 0, ""},
+		{"Reader", Type, 0, ""},
+		{"StructField", Type, 0, ""},
+		{"StructField.BitOffset", Field, 0, ""},
+		{"StructField.BitSize", Field, 0, ""},
+		{"StructField.ByteOffset", Field, 0, ""},
+		{"StructField.ByteSize", Field, 0, ""},
+		{"StructField.DataBitOffset", Field, 18, ""},
+		{"StructField.Name", Field, 0, ""},
+		{"StructField.Type", Field, 0, ""},
+		{"StructType", Type, 0, ""},
+		{"StructType.CommonType", Field, 0, ""},
+		{"StructType.Field", Field, 0, ""},
+		{"StructType.Incomplete", Field, 0, ""},
+		{"StructType.Kind", Field, 0, ""},
+		{"StructType.StructName", Field, 0, ""},
+		{"Tag", Type, 0, ""},
+		{"TagAccessDeclaration", Const, 0, ""},
+		{"TagArrayType", Const, 0, ""},
+		{"TagAtomicType", Const, 14, ""},
+		{"TagBaseType", Const, 0, ""},
+		{"TagCallSite", Const, 14, ""},
+		{"TagCallSiteParameter", Const, 14, ""},
+		{"TagCatchDwarfBlock", Const, 0, ""},
+		{"TagClassType", Const, 0, ""},
+		{"TagCoarrayType", Const, 14, ""},
+		{"TagCommonDwarfBlock", Const, 0, ""},
+		{"TagCommonInclusion", Const, 0, ""},
+		{"TagCompileUnit", Const, 0, ""},
+		{"TagCondition", Const, 3, ""},
+		{"TagConstType", Const, 0, ""},
+		{"TagConstant", Const, 0, ""},
+		{"TagDwarfProcedure", Const, 0, ""},
+		{"TagDynamicType", Const, 14, ""},
+		{"TagEntryPoint", Const, 0, ""},
+		{"TagEnumerationType", Const, 0, ""},
+		{"TagEnumerator", Const, 0, ""},
+		{"TagFileType", Const, 0, ""},
+		{"TagFormalParameter", Const, 0, ""},
+		{"TagFriend", Const, 0, ""},
+		{"TagGenericSubrange", Const, 14, ""},
+		{"TagImmutableType", Const, 14, ""},
+		{"TagImportedDeclaration", Const, 0, ""},
+		{"TagImportedModule", Const, 0, ""},
+		{"TagImportedUnit", Const, 0, ""},
+		{"TagInheritance", Const, 0, ""},
+		{"TagInlinedSubroutine", Const, 0, ""},
+		{"TagInterfaceType", Const, 0, ""},
+		{"TagLabel", Const, 0, ""},
+		{"TagLexDwarfBlock", Const, 0, ""},
+		{"TagMember", Const, 0, ""},
+		{"TagModule", Const, 0, ""},
+		{"TagMutableType", Const, 0, ""},
+		{"TagNamelist", Const, 0, ""},
+		{"TagNamelistItem", Const, 0, ""},
+		{"TagNamespace", Const, 0, ""},
+		{"TagPackedType", Const, 0, ""},
+		{"TagPartialUnit", Const, 0, ""},
+		{"TagPointerType", Const, 0, ""},
+		{"TagPtrToMemberType", Const, 0, ""},
+		{"TagReferenceType", Const, 0, ""},
+		{"TagRestrictType", Const, 0, ""},
+		{"TagRvalueReferenceType", Const, 3, ""},
+		{"TagSetType", Const, 0, ""},
+		{"TagSharedType", Const, 3, ""},
+		{"TagSkeletonUnit", Const, 14, ""},
+		{"TagStringType", Const, 0, ""},
+		{"TagStructType", Const, 0, ""},
+		{"TagSubprogram", Const, 0, ""},
+		{"TagSubrangeType", Const, 0, ""},
+		{"TagSubroutineType", Const, 0, ""},
+		{"TagTemplateAlias", Const, 3, ""},
+		{"TagTemplateTypeParameter", Const, 0, ""},
+		{"TagTemplateValueParameter", Const, 0, ""},
+		{"TagThrownType", Const, 0, ""},
+		{"TagTryDwarfBlock", Const, 0, ""},
+		{"TagTypeUnit", Const, 3, ""},
+		{"TagTypedef", Const, 0, ""},
+		{"TagUnionType", Const, 0, ""},
+		{"TagUnspecifiedParameters", Const, 0, ""},
+		{"TagUnspecifiedType", Const, 0, ""},
+		{"TagVariable", Const, 0, ""},
+		{"TagVariant", Const, 0, ""},
+		{"TagVariantPart", Const, 0, ""},
+		{"TagVolatileType", Const, 0, ""},
+		{"TagWithStmt", Const, 0, ""},
+		{"Type", Type, 0, ""},
+		{"TypedefType", Type, 0, ""},
+		{"TypedefType.CommonType", Field, 0, ""},
+		{"TypedefType.Type", Field, 0, ""},
+		{"UcharType", Type, 0, ""},
+		{"UcharType.BasicType", Field, 0, ""},
+		{"UintType", Type, 0, ""},
+		{"UintType.BasicType", Field, 0, ""},
+		{"UnspecifiedType", Type, 4, ""},
+		{"UnspecifiedType.BasicType", Field, 4, ""},
+		{"UnsupportedType", Type, 13, ""},
+		{"UnsupportedType.CommonType", Field, 13, ""},
+		{"UnsupportedType.Tag", Field, 13, ""},
+		{"VoidType", Type, 0, ""},
+		{"VoidType.CommonType", Field, 0, ""},
+	},
+	"debug/elf": {
+		{"(*File).Close", Method, 0, ""},
+		{"(*File).DWARF", Method, 0, ""},
+		{"(*File).DynString", Method, 1, ""},
+		{"(*File).DynValue", Method, 21, ""},
+		{"(*File).DynamicSymbols", Method, 4, ""},
+		{"(*File).DynamicVersionNeeds", Method, 24, ""},
+		{"(*File).DynamicVersions", Method, 24, ""},
+		{"(*File).ImportedLibraries", Method, 0, ""},
+		{"(*File).ImportedSymbols", Method, 0, ""},
+		{"(*File).Section", Method, 0, ""},
+		{"(*File).SectionByType", Method, 0, ""},
+		{"(*File).Symbols", Method, 0, ""},
+		{"(*FormatError).Error", Method, 0, ""},
+		{"(*Prog).Open", Method, 0, ""},
+		{"(*Section).Data", Method, 0, ""},
+		{"(*Section).Open", Method, 0, ""},
+		{"(Class).GoString", Method, 0, ""},
+		{"(Class).String", Method, 0, ""},
+		{"(CompressionType).GoString", Method, 6, ""},
+		{"(CompressionType).String", Method, 6, ""},
+		{"(Data).GoString", Method, 0, ""},
+		{"(Data).String", Method, 0, ""},
+		{"(DynFlag).GoString", Method, 0, ""},
+		{"(DynFlag).String", Method, 0, ""},
+		{"(DynFlag1).GoString", Method, 21, ""},
+		{"(DynFlag1).String", Method, 21, ""},
+		{"(DynTag).GoString", Method, 0, ""},
+		{"(DynTag).String", Method, 0, ""},
+		{"(Machine).GoString", Method, 0, ""},
+		{"(Machine).String", Method, 0, ""},
+		{"(NType).GoString", Method, 0, ""},
+		{"(NType).String", Method, 0, ""},
+		{"(OSABI).GoString", Method, 0, ""},
+		{"(OSABI).String", Method, 0, ""},
+		{"(Prog).ReadAt", Method, 0, ""},
+		{"(ProgFlag).GoString", Method, 0, ""},
+		{"(ProgFlag).String", Method, 0, ""},
+		{"(ProgType).GoString", Method, 0, ""},
+		{"(ProgType).String", Method, 0, ""},
+		{"(R_386).GoString", Method, 0, ""},
+		{"(R_386).String", Method, 0, ""},
+		{"(R_390).GoString", Method, 7, ""},
+		{"(R_390).String", Method, 7, ""},
+		{"(R_AARCH64).GoString", Method, 4, ""},
+		{"(R_AARCH64).String", Method, 4, ""},
+		{"(R_ALPHA).GoString", Method, 0, ""},
+		{"(R_ALPHA).String", Method, 0, ""},
+		{"(R_ARM).GoString", Method, 0, ""},
+		{"(R_ARM).String", Method, 0, ""},
+		{"(R_LARCH).GoString", Method, 19, ""},
+		{"(R_LARCH).String", Method, 19, ""},
+		{"(R_MIPS).GoString", Method, 6, ""},
+		{"(R_MIPS).String", Method, 6, ""},
+		{"(R_PPC).GoString", Method, 0, ""},
+		{"(R_PPC).String", Method, 0, ""},
+		{"(R_PPC64).GoString", Method, 5, ""},
+		{"(R_PPC64).String", Method, 5, ""},
+		{"(R_RISCV).GoString", Method, 11, ""},
+		{"(R_RISCV).String", Method, 11, ""},
+		{"(R_SPARC).GoString", Method, 0, ""},
+		{"(R_SPARC).String", Method, 0, ""},
+		{"(R_X86_64).GoString", Method, 0, ""},
+		{"(R_X86_64).String", Method, 0, ""},
+		{"(Section).ReadAt", Method, 0, ""},
+		{"(SectionFlag).GoString", Method, 0, ""},
+		{"(SectionFlag).String", Method, 0, ""},
+		{"(SectionIndex).GoString", Method, 0, ""},
+		{"(SectionIndex).String", Method, 0, ""},
+		{"(SectionType).GoString", Method, 0, ""},
+		{"(SectionType).String", Method, 0, ""},
+		{"(SymBind).GoString", Method, 0, ""},
+		{"(SymBind).String", Method, 0, ""},
+		{"(SymType).GoString", Method, 0, ""},
+		{"(SymType).String", Method, 0, ""},
+		{"(SymVis).GoString", Method, 0, ""},
+		{"(SymVis).String", Method, 0, ""},
+		{"(Type).GoString", Method, 0, ""},
+		{"(Type).String", Method, 0, ""},
+		{"(Version).GoString", Method, 0, ""},
+		{"(Version).String", Method, 0, ""},
+		{"(VersionIndex).Index", Method, 24, ""},
+		{"(VersionIndex).IsHidden", Method, 24, ""},
+		{"ARM_MAGIC_TRAMP_NUMBER", Const, 0, ""},
+		{"COMPRESS_HIOS", Const, 6, ""},
+		{"COMPRESS_HIPROC", Const, 6, ""},
+		{"COMPRESS_LOOS", Const, 6, ""},
+		{"COMPRESS_LOPROC", Const, 6, ""},
+		{"COMPRESS_ZLIB", Const, 6, ""},
+		{"COMPRESS_ZSTD", Const, 21, ""},
+		{"Chdr32", Type, 6, ""},
+		{"Chdr32.Addralign", Field, 6, ""},
+		{"Chdr32.Size", Field, 6, ""},
+		{"Chdr32.Type", Field, 6, ""},
+		{"Chdr64", Type, 6, ""},
+		{"Chdr64.Addralign", Field, 6, ""},
+		{"Chdr64.Size", Field, 6, ""},
+		{"Chdr64.Type", Field, 6, ""},
+		{"Class", Type, 0, ""},
+		{"CompressionType", Type, 6, ""},
+		{"DF_1_CONFALT", Const, 21, ""},
+		{"DF_1_DIRECT", Const, 21, ""},
+		{"DF_1_DISPRELDNE", Const, 21, ""},
+		{"DF_1_DISPRELPND", Const, 21, ""},
+		{"DF_1_EDITED", Const, 21, ""},
+		{"DF_1_ENDFILTEE", Const, 21, ""},
+		{"DF_1_GLOBAL", Const, 21, ""},
+		{"DF_1_GLOBAUDIT", Const, 21, ""},
+		{"DF_1_GROUP", Const, 21, ""},
+		{"DF_1_IGNMULDEF", Const, 21, ""},
+		{"DF_1_INITFIRST", Const, 21, ""},
+		{"DF_1_INTERPOSE", Const, 21, ""},
+		{"DF_1_KMOD", Const, 21, ""},
+		{"DF_1_LOADFLTR", Const, 21, ""},
+		{"DF_1_NOCOMMON", Const, 21, ""},
+		{"DF_1_NODEFLIB", Const, 21, ""},
+		{"DF_1_NODELETE", Const, 21, ""},
+		{"DF_1_NODIRECT", Const, 21, ""},
+		{"DF_1_NODUMP", Const, 21, ""},
+		{"DF_1_NOHDR", Const, 21, ""},
+		{"DF_1_NOKSYMS", Const, 21, ""},
+		{"DF_1_NOOPEN", Const, 21, ""},
+		{"DF_1_NORELOC", Const, 21, ""},
+		{"DF_1_NOW", Const, 21, ""},
+		{"DF_1_ORIGIN", Const, 21, ""},
+		{"DF_1_PIE", Const, 21, ""},
+		{"DF_1_SINGLETON", Const, 21, ""},
+		{"DF_1_STUB", Const, 21, ""},
+		{"DF_1_SYMINTPOSE", Const, 21, ""},
+		{"DF_1_TRANS", Const, 21, ""},
+		{"DF_1_WEAKFILTER", Const, 21, ""},
+		{"DF_BIND_NOW", Const, 0, ""},
+		{"DF_ORIGIN", Const, 0, ""},
+		{"DF_STATIC_TLS", Const, 0, ""},
+		{"DF_SYMBOLIC", Const, 0, ""},
+		{"DF_TEXTREL", Const, 0, ""},
+		{"DT_ADDRRNGHI", Const, 16, ""},
+		{"DT_ADDRRNGLO", Const, 16, ""},
+		{"DT_AUDIT", Const, 16, ""},
+		{"DT_AUXILIARY", Const, 16, ""},
+		{"DT_BIND_NOW", Const, 0, ""},
+		{"DT_CHECKSUM", Const, 16, ""},
+		{"DT_CONFIG", Const, 16, ""},
+		{"DT_DEBUG", Const, 0, ""},
+		{"DT_DEPAUDIT", Const, 16, ""},
+		{"DT_ENCODING", Const, 0, ""},
+		{"DT_FEATURE", Const, 16, ""},
+		{"DT_FILTER", Const, 16, ""},
+		{"DT_FINI", Const, 0, ""},
+		{"DT_FINI_ARRAY", Const, 0, ""},
+		{"DT_FINI_ARRAYSZ", Const, 0, ""},
+		{"DT_FLAGS", Const, 0, ""},
+		{"DT_FLAGS_1", Const, 16, ""},
+		{"DT_GNU_CONFLICT", Const, 16, ""},
+		{"DT_GNU_CONFLICTSZ", Const, 16, ""},
+		{"DT_GNU_HASH", Const, 16, ""},
+		{"DT_GNU_LIBLIST", Const, 16, ""},
+		{"DT_GNU_LIBLISTSZ", Const, 16, ""},
+		{"DT_GNU_PRELINKED", Const, 16, ""},
+		{"DT_HASH", Const, 0, ""},
+		{"DT_HIOS", Const, 0, ""},
+		{"DT_HIPROC", Const, 0, ""},
+		{"DT_INIT", Const, 0, ""},
+		{"DT_INIT_ARRAY", Const, 0, ""},
+		{"DT_INIT_ARRAYSZ", Const, 0, ""},
+		{"DT_JMPREL", Const, 0, ""},
+		{"DT_LOOS", Const, 0, ""},
+		{"DT_LOPROC", Const, 0, ""},
+		{"DT_MIPS_AUX_DYNAMIC", Const, 16, ""},
+		{"DT_MIPS_BASE_ADDRESS", Const, 16, ""},
+		{"DT_MIPS_COMPACT_SIZE", Const, 16, ""},
+		{"DT_MIPS_CONFLICT", Const, 16, ""},
+		{"DT_MIPS_CONFLICTNO", Const, 16, ""},
+		{"DT_MIPS_CXX_FLAGS", Const, 16, ""},
+		{"DT_MIPS_DELTA_CLASS", Const, 16, ""},
+		{"DT_MIPS_DELTA_CLASSSYM", Const, 16, ""},
+		{"DT_MIPS_DELTA_CLASSSYM_NO", Const, 16, ""},
+		{"DT_MIPS_DELTA_CLASS_NO", Const, 16, ""},
+		{"DT_MIPS_DELTA_INSTANCE", Const, 16, ""},
+		{"DT_MIPS_DELTA_INSTANCE_NO", Const, 16, ""},
+		{"DT_MIPS_DELTA_RELOC", Const, 16, ""},
+		{"DT_MIPS_DELTA_RELOC_NO", Const, 16, ""},
+		{"DT_MIPS_DELTA_SYM", Const, 16, ""},
+		{"DT_MIPS_DELTA_SYM_NO", Const, 16, ""},
+		{"DT_MIPS_DYNSTR_ALIGN", Const, 16, ""},
+		{"DT_MIPS_FLAGS", Const, 16, ""},
+		{"DT_MIPS_GOTSYM", Const, 16, ""},
+		{"DT_MIPS_GP_VALUE", Const, 16, ""},
+		{"DT_MIPS_HIDDEN_GOTIDX", Const, 16, ""},
+		{"DT_MIPS_HIPAGENO", Const, 16, ""},
+		{"DT_MIPS_ICHECKSUM", Const, 16, ""},
+		{"DT_MIPS_INTERFACE", Const, 16, ""},
+		{"DT_MIPS_INTERFACE_SIZE", Const, 16, ""},
+		{"DT_MIPS_IVERSION", Const, 16, ""},
+		{"DT_MIPS_LIBLIST", Const, 16, ""},
+		{"DT_MIPS_LIBLISTNO", Const, 16, ""},
+		{"DT_MIPS_LOCALPAGE_GOTIDX", Const, 16, ""},
+		{"DT_MIPS_LOCAL_GOTIDX", Const, 16, ""},
+		{"DT_MIPS_LOCAL_GOTNO", Const, 16, ""},
+		{"DT_MIPS_MSYM", Const, 16, ""},
+		{"DT_MIPS_OPTIONS", Const, 16, ""},
+		{"DT_MIPS_PERF_SUFFIX", Const, 16, ""},
+		{"DT_MIPS_PIXIE_INIT", Const, 16, ""},
+		{"DT_MIPS_PLTGOT", Const, 16, ""},
+		{"DT_MIPS_PROTECTED_GOTIDX", Const, 16, ""},
+		{"DT_MIPS_RLD_MAP", Const, 16, ""},
+		{"DT_MIPS_RLD_MAP_REL", Const, 16, ""},
+		{"DT_MIPS_RLD_TEXT_RESOLVE_ADDR", Const, 16, ""},
+		{"DT_MIPS_RLD_VERSION", Const, 16, ""},
+		{"DT_MIPS_RWPLT", Const, 16, ""},
+		{"DT_MIPS_SYMBOL_LIB", Const, 16, ""},
+		{"DT_MIPS_SYMTABNO", Const, 16, ""},
+		{"DT_MIPS_TIME_STAMP", Const, 16, ""},
+		{"DT_MIPS_UNREFEXTNO", Const, 16, ""},
+		{"DT_MOVEENT", Const, 16, ""},
+		{"DT_MOVESZ", Const, 16, ""},
+		{"DT_MOVETAB", Const, 16, ""},
+		{"DT_NEEDED", Const, 0, ""},
+		{"DT_NULL", Const, 0, ""},
+		{"DT_PLTGOT", Const, 0, ""},
+		{"DT_PLTPAD", Const, 16, ""},
+		{"DT_PLTPADSZ", Const, 16, ""},
+		{"DT_PLTREL", Const, 0, ""},
+		{"DT_PLTRELSZ", Const, 0, ""},
+		{"DT_POSFLAG_1", Const, 16, ""},
+		{"DT_PPC64_GLINK", Const, 16, ""},
+		{"DT_PPC64_OPD", Const, 16, ""},
+		{"DT_PPC64_OPDSZ", Const, 16, ""},
+		{"DT_PPC64_OPT", Const, 16, ""},
+		{"DT_PPC_GOT", Const, 16, ""},
+		{"DT_PPC_OPT", Const, 16, ""},
+		{"DT_PREINIT_ARRAY", Const, 0, ""},
+		{"DT_PREINIT_ARRAYSZ", Const, 0, ""},
+		{"DT_REL", Const, 0, ""},
+		{"DT_RELA", Const, 0, ""},
+		{"DT_RELACOUNT", Const, 16, ""},
+		{"DT_RELAENT", Const, 0, ""},
+		{"DT_RELASZ", Const, 0, ""},
+		{"DT_RELCOUNT", Const, 16, ""},
+		{"DT_RELENT", Const, 0, ""},
+		{"DT_RELSZ", Const, 0, ""},
+		{"DT_RPATH", Const, 0, ""},
+		{"DT_RUNPATH", Const, 0, ""},
+		{"DT_SONAME", Const, 0, ""},
+		{"DT_SPARC_REGISTER", Const, 16, ""},
+		{"DT_STRSZ", Const, 0, ""},
+		{"DT_STRTAB", Const, 0, ""},
+		{"DT_SYMBOLIC", Const, 0, ""},
+		{"DT_SYMENT", Const, 0, ""},
+		{"DT_SYMINENT", Const, 16, ""},
+		{"DT_SYMINFO", Const, 16, ""},
+		{"DT_SYMINSZ", Const, 16, ""},
+		{"DT_SYMTAB", Const, 0, ""},
+		{"DT_SYMTAB_SHNDX", Const, 16, ""},
+		{"DT_TEXTREL", Const, 0, ""},
+		{"DT_TLSDESC_GOT", Const, 16, ""},
+		{"DT_TLSDESC_PLT", Const, 16, ""},
+		{"DT_USED", Const, 16, ""},
+		{"DT_VALRNGHI", Const, 16, ""},
+		{"DT_VALRNGLO", Const, 16, ""},
+		{"DT_VERDEF", Const, 16, ""},
+		{"DT_VERDEFNUM", Const, 16, ""},
+		{"DT_VERNEED", Const, 0, ""},
+		{"DT_VERNEEDNUM", Const, 0, ""},
+		{"DT_VERSYM", Const, 0, ""},
+		{"Data", Type, 0, ""},
+		{"Dyn32", Type, 0, ""},
+		{"Dyn32.Tag", Field, 0, ""},
+		{"Dyn32.Val", Field, 0, ""},
+		{"Dyn64", Type, 0, ""},
+		{"Dyn64.Tag", Field, 0, ""},
+		{"Dyn64.Val", Field, 0, ""},
+		{"DynFlag", Type, 0, ""},
+		{"DynFlag1", Type, 21, ""},
+		{"DynTag", Type, 0, ""},
+		{"DynamicVersion", Type, 24, ""},
+		{"DynamicVersion.Deps", Field, 24, ""},
+		{"DynamicVersion.Flags", Field, 24, ""},
+		{"DynamicVersion.Index", Field, 24, ""},
+		{"DynamicVersion.Name", Field, 24, ""},
+		{"DynamicVersionDep", Type, 24, ""},
+		{"DynamicVersionDep.Dep", Field, 24, ""},
+		{"DynamicVersionDep.Flags", Field, 24, ""},
+		{"DynamicVersionDep.Index", Field, 24, ""},
+		{"DynamicVersionFlag", Type, 24, ""},
+		{"DynamicVersionNeed", Type, 24, ""},
+		{"DynamicVersionNeed.Name", Field, 24, ""},
+		{"DynamicVersionNeed.Needs", Field, 24, ""},
+		{"EI_ABIVERSION", Const, 0, ""},
+		{"EI_CLASS", Const, 0, ""},
+		{"EI_DATA", Const, 0, ""},
+		{"EI_NIDENT", Const, 0, ""},
+		{"EI_OSABI", Const, 0, ""},
+		{"EI_PAD", Const, 0, ""},
+		{"EI_VERSION", Const, 0, ""},
+		{"ELFCLASS32", Const, 0, ""},
+		{"ELFCLASS64", Const, 0, ""},
+		{"ELFCLASSNONE", Const, 0, ""},
+		{"ELFDATA2LSB", Const, 0, ""},
+		{"ELFDATA2MSB", Const, 0, ""},
+		{"ELFDATANONE", Const, 0, ""},
+		{"ELFMAG", Const, 0, ""},
+		{"ELFOSABI_86OPEN", Const, 0, ""},
+		{"ELFOSABI_AIX", Const, 0, ""},
+		{"ELFOSABI_ARM", Const, 0, ""},
+		{"ELFOSABI_AROS", Const, 11, ""},
+		{"ELFOSABI_CLOUDABI", Const, 11, ""},
+		{"ELFOSABI_FENIXOS", Const, 11, ""},
+		{"ELFOSABI_FREEBSD", Const, 0, ""},
+		{"ELFOSABI_HPUX", Const, 0, ""},
+		{"ELFOSABI_HURD", Const, 0, ""},
+		{"ELFOSABI_IRIX", Const, 0, ""},
+		{"ELFOSABI_LINUX", Const, 0, ""},
+		{"ELFOSABI_MODESTO", Const, 0, ""},
+		{"ELFOSABI_NETBSD", Const, 0, ""},
+		{"ELFOSABI_NONE", Const, 0, ""},
+		{"ELFOSABI_NSK", Const, 0, ""},
+		{"ELFOSABI_OPENBSD", Const, 0, ""},
+		{"ELFOSABI_OPENVMS", Const, 0, ""},
+		{"ELFOSABI_SOLARIS", Const, 0, ""},
+		{"ELFOSABI_STANDALONE", Const, 0, ""},
+		{"ELFOSABI_TRU64", Const, 0, ""},
+		{"EM_386", Const, 0, ""},
+		{"EM_486", Const, 0, ""},
+		{"EM_56800EX", Const, 11, ""},
+		{"EM_68HC05", Const, 11, ""},
+		{"EM_68HC08", Const, 11, ""},
+		{"EM_68HC11", Const, 11, ""},
+		{"EM_68HC12", Const, 0, ""},
+		{"EM_68HC16", Const, 11, ""},
+		{"EM_68K", Const, 0, ""},
+		{"EM_78KOR", Const, 11, ""},
+		{"EM_8051", Const, 11, ""},
+		{"EM_860", Const, 0, ""},
+		{"EM_88K", Const, 0, ""},
+		{"EM_960", Const, 0, ""},
+		{"EM_AARCH64", Const, 4, ""},
+		{"EM_ALPHA", Const, 0, ""},
+		{"EM_ALPHA_STD", Const, 0, ""},
+		{"EM_ALTERA_NIOS2", Const, 11, ""},
+		{"EM_AMDGPU", Const, 11, ""},
+		{"EM_ARC", Const, 0, ""},
+		{"EM_ARCA", Const, 11, ""},
+		{"EM_ARC_COMPACT", Const, 11, ""},
+		{"EM_ARC_COMPACT2", Const, 11, ""},
+		{"EM_ARM", Const, 0, ""},
+		{"EM_AVR", Const, 11, ""},
+		{"EM_AVR32", Const, 11, ""},
+		{"EM_BA1", Const, 11, ""},
+		{"EM_BA2", Const, 11, ""},
+		{"EM_BLACKFIN", Const, 11, ""},
+		{"EM_BPF", Const, 11, ""},
+		{"EM_C166", Const, 11, ""},
+		{"EM_CDP", Const, 11, ""},
+		{"EM_CE", Const, 11, ""},
+		{"EM_CLOUDSHIELD", Const, 11, ""},
+		{"EM_COGE", Const, 11, ""},
+		{"EM_COLDFIRE", Const, 0, ""},
+		{"EM_COOL", Const, 11, ""},
+		{"EM_COREA_1ST", Const, 11, ""},
+		{"EM_COREA_2ND", Const, 11, ""},
+		{"EM_CR", Const, 11, ""},
+		{"EM_CR16", Const, 11, ""},
+		{"EM_CRAYNV2", Const, 11, ""},
+		{"EM_CRIS", Const, 11, ""},
+		{"EM_CRX", Const, 11, ""},
+		{"EM_CSR_KALIMBA", Const, 11, ""},
+		{"EM_CUDA", Const, 11, ""},
+		{"EM_CYPRESS_M8C", Const, 11, ""},
+		{"EM_D10V", Const, 11, ""},
+		{"EM_D30V", Const, 11, ""},
+		{"EM_DSP24", Const, 11, ""},
+		{"EM_DSPIC30F", Const, 11, ""},
+		{"EM_DXP", Const, 11, ""},
+		{"EM_ECOG1", Const, 11, ""},
+		{"EM_ECOG16", Const, 11, ""},
+		{"EM_ECOG1X", Const, 11, ""},
+		{"EM_ECOG2", Const, 11, ""},
+		{"EM_ETPU", Const, 11, ""},
+		{"EM_EXCESS", Const, 11, ""},
+		{"EM_F2MC16", Const, 11, ""},
+		{"EM_FIREPATH", Const, 11, ""},
+		{"EM_FR20", Const, 0, ""},
+		{"EM_FR30", Const, 11, ""},
+		{"EM_FT32", Const, 11, ""},
+		{"EM_FX66", Const, 11, ""},
+		{"EM_H8S", Const, 0, ""},
+		{"EM_H8_300", Const, 0, ""},
+		{"EM_H8_300H", Const, 0, ""},
+		{"EM_H8_500", Const, 0, ""},
+		{"EM_HUANY", Const, 11, ""},
+		{"EM_IA_64", Const, 0, ""},
+		{"EM_INTEL205", Const, 11, ""},
+		{"EM_INTEL206", Const, 11, ""},
+		{"EM_INTEL207", Const, 11, ""},
+		{"EM_INTEL208", Const, 11, ""},
+		{"EM_INTEL209", Const, 11, ""},
+		{"EM_IP2K", Const, 11, ""},
+		{"EM_JAVELIN", Const, 11, ""},
+		{"EM_K10M", Const, 11, ""},
+		{"EM_KM32", Const, 11, ""},
+		{"EM_KMX16", Const, 11, ""},
+		{"EM_KMX32", Const, 11, ""},
+		{"EM_KMX8", Const, 11, ""},
+		{"EM_KVARC", Const, 11, ""},
+		{"EM_L10M", Const, 11, ""},
+		{"EM_LANAI", Const, 11, ""},
+		{"EM_LATTICEMICO32", Const, 11, ""},
+		{"EM_LOONGARCH", Const, 19, ""},
+		{"EM_M16C", Const, 11, ""},
+		{"EM_M32", Const, 0, ""},
+		{"EM_M32C", Const, 11, ""},
+		{"EM_M32R", Const, 11, ""},
+		{"EM_MANIK", Const, 11, ""},
+		{"EM_MAX", Const, 11, ""},
+		{"EM_MAXQ30", Const, 11, ""},
+		{"EM_MCHP_PIC", Const, 11, ""},
+		{"EM_MCST_ELBRUS", Const, 11, ""},
+		{"EM_ME16", Const, 0, ""},
+		{"EM_METAG", Const, 11, ""},
+		{"EM_MICROBLAZE", Const, 11, ""},
+		{"EM_MIPS", Const, 0, ""},
+		{"EM_MIPS_RS3_LE", Const, 0, ""},
+		{"EM_MIPS_RS4_BE", Const, 0, ""},
+		{"EM_MIPS_X", Const, 0, ""},
+		{"EM_MMA", Const, 0, ""},
+		{"EM_MMDSP_PLUS", Const, 11, ""},
+		{"EM_MMIX", Const, 11, ""},
+		{"EM_MN10200", Const, 11, ""},
+		{"EM_MN10300", Const, 11, ""},
+		{"EM_MOXIE", Const, 11, ""},
+		{"EM_MSP430", Const, 11, ""},
+		{"EM_NCPU", Const, 0, ""},
+		{"EM_NDR1", Const, 0, ""},
+		{"EM_NDS32", Const, 11, ""},
+		{"EM_NONE", Const, 0, ""},
+		{"EM_NORC", Const, 11, ""},
+		{"EM_NS32K", Const, 11, ""},
+		{"EM_OPEN8", Const, 11, ""},
+		{"EM_OPENRISC", Const, 11, ""},
+		{"EM_PARISC", Const, 0, ""},
+		{"EM_PCP", Const, 0, ""},
+		{"EM_PDP10", Const, 11, ""},
+		{"EM_PDP11", Const, 11, ""},
+		{"EM_PDSP", Const, 11, ""},
+		{"EM_PJ", Const, 11, ""},
+		{"EM_PPC", Const, 0, ""},
+		{"EM_PPC64", Const, 0, ""},
+		{"EM_PRISM", Const, 11, ""},
+		{"EM_QDSP6", Const, 11, ""},
+		{"EM_R32C", Const, 11, ""},
+		{"EM_RCE", Const, 0, ""},
+		{"EM_RH32", Const, 0, ""},
+		{"EM_RISCV", Const, 11, ""},
+		{"EM_RL78", Const, 11, ""},
+		{"EM_RS08", Const, 11, ""},
+		{"EM_RX", Const, 11, ""},
+		{"EM_S370", Const, 0, ""},
+		{"EM_S390", Const, 0, ""},
+		{"EM_SCORE7", Const, 11, ""},
+		{"EM_SEP", Const, 11, ""},
+		{"EM_SE_C17", Const, 11, ""},
+		{"EM_SE_C33", Const, 11, ""},
+		{"EM_SH", Const, 0, ""},
+		{"EM_SHARC", Const, 11, ""},
+		{"EM_SLE9X", Const, 11, ""},
+		{"EM_SNP1K", Const, 11, ""},
+		{"EM_SPARC", Const, 0, ""},
+		{"EM_SPARC32PLUS", Const, 0, ""},
+		{"EM_SPARCV9", Const, 0, ""},
+		{"EM_ST100", Const, 0, ""},
+		{"EM_ST19", Const, 11, ""},
+		{"EM_ST200", Const, 11, ""},
+		{"EM_ST7", Const, 11, ""},
+		{"EM_ST9PLUS", Const, 11, ""},
+		{"EM_STARCORE", Const, 0, ""},
+		{"EM_STM8", Const, 11, ""},
+		{"EM_STXP7X", Const, 11, ""},
+		{"EM_SVX", Const, 11, ""},
+		{"EM_TILE64", Const, 11, ""},
+		{"EM_TILEGX", Const, 11, ""},
+		{"EM_TILEPRO", Const, 11, ""},
+		{"EM_TINYJ", Const, 0, ""},
+		{"EM_TI_ARP32", Const, 11, ""},
+		{"EM_TI_C2000", Const, 11, ""},
+		{"EM_TI_C5500", Const, 11, ""},
+		{"EM_TI_C6000", Const, 11, ""},
+		{"EM_TI_PRU", Const, 11, ""},
+		{"EM_TMM_GPP", Const, 11, ""},
+		{"EM_TPC", Const, 11, ""},
+		{"EM_TRICORE", Const, 0, ""},
+		{"EM_TRIMEDIA", Const, 11, ""},
+		{"EM_TSK3000", Const, 11, ""},
+		{"EM_UNICORE", Const, 11, ""},
+		{"EM_V800", Const, 0, ""},
+		{"EM_V850", Const, 11, ""},
+		{"EM_VAX", Const, 11, ""},
+		{"EM_VIDEOCORE", Const, 11, ""},
+		{"EM_VIDEOCORE3", Const, 11, ""},
+		{"EM_VIDEOCORE5", Const, 11, ""},
+		{"EM_VISIUM", Const, 11, ""},
+		{"EM_VPP500", Const, 0, ""},
+		{"EM_X86_64", Const, 0, ""},
+		{"EM_XCORE", Const, 11, ""},
+		{"EM_XGATE", Const, 11, ""},
+		{"EM_XIMO16", Const, 11, ""},
+		{"EM_XTENSA", Const, 11, ""},
+		{"EM_Z80", Const, 11, ""},
+		{"EM_ZSP", Const, 11, ""},
+		{"ET_CORE", Const, 0, ""},
+		{"ET_DYN", Const, 0, ""},
+		{"ET_EXEC", Const, 0, ""},
+		{"ET_HIOS", Const, 0, ""},
+		{"ET_HIPROC", Const, 0, ""},
+		{"ET_LOOS", Const, 0, ""},
+		{"ET_LOPROC", Const, 0, ""},
+		{"ET_NONE", Const, 0, ""},
+		{"ET_REL", Const, 0, ""},
+		{"EV_CURRENT", Const, 0, ""},
+		{"EV_NONE", Const, 0, ""},
+		{"ErrNoSymbols", Var, 4, ""},
+		{"File", Type, 0, ""},
+		{"File.FileHeader", Field, 0, ""},
+		{"File.Progs", Field, 0, ""},
+		{"File.Sections", Field, 0, ""},
+		{"FileHeader", Type, 0, ""},
+		{"FileHeader.ABIVersion", Field, 0, ""},
+		{"FileHeader.ByteOrder", Field, 0, ""},
+		{"FileHeader.Class", Field, 0, ""},
+		{"FileHeader.Data", Field, 0, ""},
+		{"FileHeader.Entry", Field, 1, ""},
+		{"FileHeader.Machine", Field, 0, ""},
+		{"FileHeader.OSABI", Field, 0, ""},
+		{"FileHeader.Type", Field, 0, ""},
+		{"FileHeader.Version", Field, 0, ""},
+		{"FormatError", Type, 0, ""},
+		{"Header32", Type, 0, ""},
+		{"Header32.Ehsize", Field, 0, ""},
+		{"Header32.Entry", Field, 0, ""},
+		{"Header32.Flags", Field, 0, ""},
+		{"Header32.Ident", Field, 0, ""},
+		{"Header32.Machine", Field, 0, ""},
+		{"Header32.Phentsize", Field, 0, ""},
+		{"Header32.Phnum", Field, 0, ""},
+		{"Header32.Phoff", Field, 0, ""},
+		{"Header32.Shentsize", Field, 0, ""},
+		{"Header32.Shnum", Field, 0, ""},
+		{"Header32.Shoff", Field, 0, ""},
+		{"Header32.Shstrndx", Field, 0, ""},
+		{"Header32.Type", Field, 0, ""},
+		{"Header32.Version", Field, 0, ""},
+		{"Header64", Type, 0, ""},
+		{"Header64.Ehsize", Field, 0, ""},
+		{"Header64.Entry", Field, 0, ""},
+		{"Header64.Flags", Field, 0, ""},
+		{"Header64.Ident", Field, 0, ""},
+		{"Header64.Machine", Field, 0, ""},
+		{"Header64.Phentsize", Field, 0, ""},
+		{"Header64.Phnum", Field, 0, ""},
+		{"Header64.Phoff", Field, 0, ""},
+		{"Header64.Shentsize", Field, 0, ""},
+		{"Header64.Shnum", Field, 0, ""},
+		{"Header64.Shoff", Field, 0, ""},
+		{"Header64.Shstrndx", Field, 0, ""},
+		{"Header64.Type", Field, 0, ""},
+		{"Header64.Version", Field, 0, ""},
+		{"ImportedSymbol", Type, 0, ""},
+		{"ImportedSymbol.Library", Field, 0, ""},
+		{"ImportedSymbol.Name", Field, 0, ""},
+		{"ImportedSymbol.Version", Field, 0, ""},
+		{"Machine", Type, 0, ""},
+		{"NT_FPREGSET", Const, 0, ""},
+		{"NT_PRPSINFO", Const, 0, ""},
+		{"NT_PRSTATUS", Const, 0, ""},
+		{"NType", Type, 0, ""},
+		{"NewFile", Func, 0, "func(r io.ReaderAt) (*File, error)"},
+		{"OSABI", Type, 0, ""},
+		{"Open", Func, 0, "func(name string) (*File, error)"},
+		{"PF_MASKOS", Const, 0, ""},
+		{"PF_MASKPROC", Const, 0, ""},
+		{"PF_R", Const, 0, ""},
+		{"PF_W", Const, 0, ""},
+		{"PF_X", Const, 0, ""},
+		{"PT_AARCH64_ARCHEXT", Const, 16, ""},
+		{"PT_AARCH64_UNWIND", Const, 16, ""},
+		{"PT_ARM_ARCHEXT", Const, 16, ""},
+		{"PT_ARM_EXIDX", Const, 16, ""},
+		{"PT_DYNAMIC", Const, 0, ""},
+		{"PT_GNU_EH_FRAME", Const, 16, ""},
+		{"PT_GNU_MBIND_HI", Const, 16, ""},
+		{"PT_GNU_MBIND_LO", Const, 16, ""},
+		{"PT_GNU_PROPERTY", Const, 16, ""},
+		{"PT_GNU_RELRO", Const, 16, ""},
+		{"PT_GNU_STACK", Const, 16, ""},
+		{"PT_HIOS", Const, 0, ""},
+		{"PT_HIPROC", Const, 0, ""},
+		{"PT_INTERP", Const, 0, ""},
+		{"PT_LOAD", Const, 0, ""},
+		{"PT_LOOS", Const, 0, ""},
+		{"PT_LOPROC", Const, 0, ""},
+		{"PT_MIPS_ABIFLAGS", Const, 16, ""},
+		{"PT_MIPS_OPTIONS", Const, 16, ""},
+		{"PT_MIPS_REGINFO", Const, 16, ""},
+		{"PT_MIPS_RTPROC", Const, 16, ""},
+		{"PT_NOTE", Const, 0, ""},
+		{"PT_NULL", Const, 0, ""},
+		{"PT_OPENBSD_BOOTDATA", Const, 16, ""},
+		{"PT_OPENBSD_NOBTCFI", Const, 23, ""},
+		{"PT_OPENBSD_RANDOMIZE", Const, 16, ""},
+		{"PT_OPENBSD_WXNEEDED", Const, 16, ""},
+		{"PT_PAX_FLAGS", Const, 16, ""},
+		{"PT_PHDR", Const, 0, ""},
+		{"PT_RISCV_ATTRIBUTES", Const, 25, ""},
+		{"PT_S390_PGSTE", Const, 16, ""},
+		{"PT_SHLIB", Const, 0, ""},
+		{"PT_SUNWSTACK", Const, 16, ""},
+		{"PT_SUNW_EH_FRAME", Const, 16, ""},
+		{"PT_TLS", Const, 0, ""},
+		{"Prog", Type, 0, ""},
+		{"Prog.ProgHeader", Field, 0, ""},
+		{"Prog.ReaderAt", Field, 0, ""},
+		{"Prog32", Type, 0, ""},
+		{"Prog32.Align", Field, 0, ""},
+		{"Prog32.Filesz", Field, 0, ""},
+		{"Prog32.Flags", Field, 0, ""},
+		{"Prog32.Memsz", Field, 0, ""},
+		{"Prog32.Off", Field, 0, ""},
+		{"Prog32.Paddr", Field, 0, ""},
+		{"Prog32.Type", Field, 0, ""},
+		{"Prog32.Vaddr", Field, 0, ""},
+		{"Prog64", Type, 0, ""},
+		{"Prog64.Align", Field, 0, ""},
+		{"Prog64.Filesz", Field, 0, ""},
+		{"Prog64.Flags", Field, 0, ""},
+		{"Prog64.Memsz", Field, 0, ""},
+		{"Prog64.Off", Field, 0, ""},
+		{"Prog64.Paddr", Field, 0, ""},
+		{"Prog64.Type", Field, 0, ""},
+		{"Prog64.Vaddr", Field, 0, ""},
+		{"ProgFlag", Type, 0, ""},
+		{"ProgHeader", Type, 0, ""},
+		{"ProgHeader.Align", Field, 0, ""},
+		{"ProgHeader.Filesz", Field, 0, ""},
+		{"ProgHeader.Flags", Field, 0, ""},
+		{"ProgHeader.Memsz", Field, 0, ""},
+		{"ProgHeader.Off", Field, 0, ""},
+		{"ProgHeader.Paddr", Field, 0, ""},
+		{"ProgHeader.Type", Field, 0, ""},
+		{"ProgHeader.Vaddr", Field, 0, ""},
+		{"ProgType", Type, 0, ""},
+		{"R_386", Type, 0, ""},
+		{"R_386_16", Const, 10, ""},
+		{"R_386_32", Const, 0, ""},
+		{"R_386_32PLT", Const, 10, ""},
+		{"R_386_8", Const, 10, ""},
+		{"R_386_COPY", Const, 0, ""},
+		{"R_386_GLOB_DAT", Const, 0, ""},
+		{"R_386_GOT32", Const, 0, ""},
+		{"R_386_GOT32X", Const, 10, ""},
+		{"R_386_GOTOFF", Const, 0, ""},
+		{"R_386_GOTPC", Const, 0, ""},
+		{"R_386_IRELATIVE", Const, 10, ""},
+		{"R_386_JMP_SLOT", Const, 0, ""},
+		{"R_386_NONE", Const, 0, ""},
+		{"R_386_PC16", Const, 10, ""},
+		{"R_386_PC32", Const, 0, ""},
+		{"R_386_PC8", Const, 10, ""},
+		{"R_386_PLT32", Const, 0, ""},
+		{"R_386_RELATIVE", Const, 0, ""},
+		{"R_386_SIZE32", Const, 10, ""},
+		{"R_386_TLS_DESC", Const, 10, ""},
+		{"R_386_TLS_DESC_CALL", Const, 10, ""},
+		{"R_386_TLS_DTPMOD32", Const, 0, ""},
+		{"R_386_TLS_DTPOFF32", Const, 0, ""},
+		{"R_386_TLS_GD", Const, 0, ""},
+		{"R_386_TLS_GD_32", Const, 0, ""},
+		{"R_386_TLS_GD_CALL", Const, 0, ""},
+		{"R_386_TLS_GD_POP", Const, 0, ""},
+		{"R_386_TLS_GD_PUSH", Const, 0, ""},
+		{"R_386_TLS_GOTDESC", Const, 10, ""},
+		{"R_386_TLS_GOTIE", Const, 0, ""},
+		{"R_386_TLS_IE", Const, 0, ""},
+		{"R_386_TLS_IE_32", Const, 0, ""},
+		{"R_386_TLS_LDM", Const, 0, ""},
+		{"R_386_TLS_LDM_32", Const, 0, ""},
+		{"R_386_TLS_LDM_CALL", Const, 0, ""},
+		{"R_386_TLS_LDM_POP", Const, 0, ""},
+		{"R_386_TLS_LDM_PUSH", Const, 0, ""},
+		{"R_386_TLS_LDO_32", Const, 0, ""},
+		{"R_386_TLS_LE", Const, 0, ""},
+		{"R_386_TLS_LE_32", Const, 0, ""},
+		{"R_386_TLS_TPOFF", Const, 0, ""},
+		{"R_386_TLS_TPOFF32", Const, 0, ""},
+		{"R_390", Type, 7, ""},
+		{"R_390_12", Const, 7, ""},
+		{"R_390_16", Const, 7, ""},
+		{"R_390_20", Const, 7, ""},
+		{"R_390_32", Const, 7, ""},
+		{"R_390_64", Const, 7, ""},
+		{"R_390_8", Const, 7, ""},
+		{"R_390_COPY", Const, 7, ""},
+		{"R_390_GLOB_DAT", Const, 7, ""},
+		{"R_390_GOT12", Const, 7, ""},
+		{"R_390_GOT16", Const, 7, ""},
+		{"R_390_GOT20", Const, 7, ""},
+		{"R_390_GOT32", Const, 7, ""},
+		{"R_390_GOT64", Const, 7, ""},
+		{"R_390_GOTENT", Const, 7, ""},
+		{"R_390_GOTOFF", Const, 7, ""},
+		{"R_390_GOTOFF16", Const, 7, ""},
+		{"R_390_GOTOFF64", Const, 7, ""},
+		{"R_390_GOTPC", Const, 7, ""},
+		{"R_390_GOTPCDBL", Const, 7, ""},
+		{"R_390_GOTPLT12", Const, 7, ""},
+		{"R_390_GOTPLT16", Const, 7, ""},
+		{"R_390_GOTPLT20", Const, 7, ""},
+		{"R_390_GOTPLT32", Const, 7, ""},
+		{"R_390_GOTPLT64", Const, 7, ""},
+		{"R_390_GOTPLTENT", Const, 7, ""},
+		{"R_390_GOTPLTOFF16", Const, 7, ""},
+		{"R_390_GOTPLTOFF32", Const, 7, ""},
+		{"R_390_GOTPLTOFF64", Const, 7, ""},
+		{"R_390_JMP_SLOT", Const, 7, ""},
+		{"R_390_NONE", Const, 7, ""},
+		{"R_390_PC16", Const, 7, ""},
+		{"R_390_PC16DBL", Const, 7, ""},
+		{"R_390_PC32", Const, 7, ""},
+		{"R_390_PC32DBL", Const, 7, ""},
+		{"R_390_PC64", Const, 7, ""},
+		{"R_390_PLT16DBL", Const, 7, ""},
+		{"R_390_PLT32", Const, 7, ""},
+		{"R_390_PLT32DBL", Const, 7, ""},
+		{"R_390_PLT64", Const, 7, ""},
+		{"R_390_RELATIVE", Const, 7, ""},
+		{"R_390_TLS_DTPMOD", Const, 7, ""},
+		{"R_390_TLS_DTPOFF", Const, 7, ""},
+		{"R_390_TLS_GD32", Const, 7, ""},
+		{"R_390_TLS_GD64", Const, 7, ""},
+		{"R_390_TLS_GDCALL", Const, 7, ""},
+		{"R_390_TLS_GOTIE12", Const, 7, ""},
+		{"R_390_TLS_GOTIE20", Const, 7, ""},
+		{"R_390_TLS_GOTIE32", Const, 7, ""},
+		{"R_390_TLS_GOTIE64", Const, 7, ""},
+		{"R_390_TLS_IE32", Const, 7, ""},
+		{"R_390_TLS_IE64", Const, 7, ""},
+		{"R_390_TLS_IEENT", Const, 7, ""},
+		{"R_390_TLS_LDCALL", Const, 7, ""},
+		{"R_390_TLS_LDM32", Const, 7, ""},
+		{"R_390_TLS_LDM64", Const, 7, ""},
+		{"R_390_TLS_LDO32", Const, 7, ""},
+		{"R_390_TLS_LDO64", Const, 7, ""},
+		{"R_390_TLS_LE32", Const, 7, ""},
+		{"R_390_TLS_LE64", Const, 7, ""},
+		{"R_390_TLS_LOAD", Const, 7, ""},
+		{"R_390_TLS_TPOFF", Const, 7, ""},
+		{"R_AARCH64", Type, 4, ""},
+		{"R_AARCH64_ABS16", Const, 4, ""},
+		{"R_AARCH64_ABS32", Const, 4, ""},
+		{"R_AARCH64_ABS64", Const, 4, ""},
+		{"R_AARCH64_ADD_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_ADR_GOT_PAGE", Const, 4, ""},
+		{"R_AARCH64_ADR_PREL_LO21", Const, 4, ""},
+		{"R_AARCH64_ADR_PREL_PG_HI21", Const, 4, ""},
+		{"R_AARCH64_ADR_PREL_PG_HI21_NC", Const, 4, ""},
+		{"R_AARCH64_CALL26", Const, 4, ""},
+		{"R_AARCH64_CONDBR19", Const, 4, ""},
+		{"R_AARCH64_COPY", Const, 4, ""},
+		{"R_AARCH64_GLOB_DAT", Const, 4, ""},
+		{"R_AARCH64_GOT_LD_PREL19", Const, 4, ""},
+		{"R_AARCH64_IRELATIVE", Const, 4, ""},
+		{"R_AARCH64_JUMP26", Const, 4, ""},
+		{"R_AARCH64_JUMP_SLOT", Const, 4, ""},
+		{"R_AARCH64_LD64_GOTOFF_LO15", Const, 10, ""},
+		{"R_AARCH64_LD64_GOTPAGE_LO15", Const, 10, ""},
+		{"R_AARCH64_LD64_GOT_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_LDST128_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_LDST16_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_LDST32_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_LDST64_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_LDST8_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_LD_PREL_LO19", Const, 4, ""},
+		{"R_AARCH64_MOVW_SABS_G0", Const, 4, ""},
+		{"R_AARCH64_MOVW_SABS_G1", Const, 4, ""},
+		{"R_AARCH64_MOVW_SABS_G2", Const, 4, ""},
+		{"R_AARCH64_MOVW_UABS_G0", Const, 4, ""},
+		{"R_AARCH64_MOVW_UABS_G0_NC", Const, 4, ""},
+		{"R_AARCH64_MOVW_UABS_G1", Const, 4, ""},
+		{"R_AARCH64_MOVW_UABS_G1_NC", Const, 4, ""},
+		{"R_AARCH64_MOVW_UABS_G2", Const, 4, ""},
+		{"R_AARCH64_MOVW_UABS_G2_NC", Const, 4, ""},
+		{"R_AARCH64_MOVW_UABS_G3", Const, 4, ""},
+		{"R_AARCH64_NONE", Const, 4, ""},
+		{"R_AARCH64_NULL", Const, 4, ""},
+		{"R_AARCH64_P32_ABS16", Const, 4, ""},
+		{"R_AARCH64_P32_ABS32", Const, 4, ""},
+		{"R_AARCH64_P32_ADD_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_ADR_GOT_PAGE", Const, 4, ""},
+		{"R_AARCH64_P32_ADR_PREL_LO21", Const, 4, ""},
+		{"R_AARCH64_P32_ADR_PREL_PG_HI21", Const, 4, ""},
+		{"R_AARCH64_P32_CALL26", Const, 4, ""},
+		{"R_AARCH64_P32_CONDBR19", Const, 4, ""},
+		{"R_AARCH64_P32_COPY", Const, 4, ""},
+		{"R_AARCH64_P32_GLOB_DAT", Const, 4, ""},
+		{"R_AARCH64_P32_GOT_LD_PREL19", Const, 4, ""},
+		{"R_AARCH64_P32_IRELATIVE", Const, 4, ""},
+		{"R_AARCH64_P32_JUMP26", Const, 4, ""},
+		{"R_AARCH64_P32_JUMP_SLOT", Const, 4, ""},
+		{"R_AARCH64_P32_LD32_GOT_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_LDST128_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_LDST16_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_LDST32_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_LDST64_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_LDST8_ABS_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_LD_PREL_LO19", Const, 4, ""},
+		{"R_AARCH64_P32_MOVW_SABS_G0", Const, 4, ""},
+		{"R_AARCH64_P32_MOVW_UABS_G0", Const, 4, ""},
+		{"R_AARCH64_P32_MOVW_UABS_G0_NC", Const, 4, ""},
+		{"R_AARCH64_P32_MOVW_UABS_G1", Const, 4, ""},
+		{"R_AARCH64_P32_PREL16", Const, 4, ""},
+		{"R_AARCH64_P32_PREL32", Const, 4, ""},
+		{"R_AARCH64_P32_RELATIVE", Const, 4, ""},
+		{"R_AARCH64_P32_TLSDESC", Const, 4, ""},
+		{"R_AARCH64_P32_TLSDESC_ADD_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_TLSDESC_ADR_PAGE21", Const, 4, ""},
+		{"R_AARCH64_P32_TLSDESC_ADR_PREL21", Const, 4, ""},
+		{"R_AARCH64_P32_TLSDESC_CALL", Const, 4, ""},
+		{"R_AARCH64_P32_TLSDESC_LD32_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_TLSDESC_LD_PREL19", Const, 4, ""},
+		{"R_AARCH64_P32_TLSGD_ADD_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_TLSGD_ADR_PAGE21", Const, 4, ""},
+		{"R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21", Const, 4, ""},
+		{"R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19", Const, 4, ""},
+		{"R_AARCH64_P32_TLSLE_ADD_TPREL_HI12", Const, 4, ""},
+		{"R_AARCH64_P32_TLSLE_ADD_TPREL_LO12", Const, 4, ""},
+		{"R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_P32_TLSLE_MOVW_TPREL_G0", Const, 4, ""},
+		{"R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC", Const, 4, ""},
+		{"R_AARCH64_P32_TLSLE_MOVW_TPREL_G1", Const, 4, ""},
+		{"R_AARCH64_P32_TLS_DTPMOD", Const, 4, ""},
+		{"R_AARCH64_P32_TLS_DTPREL", Const, 4, ""},
+		{"R_AARCH64_P32_TLS_TPREL", Const, 4, ""},
+		{"R_AARCH64_P32_TSTBR14", Const, 4, ""},
+		{"R_AARCH64_PREL16", Const, 4, ""},
+		{"R_AARCH64_PREL32", Const, 4, ""},
+		{"R_AARCH64_PREL64", Const, 4, ""},
+		{"R_AARCH64_RELATIVE", Const, 4, ""},
+		{"R_AARCH64_TLSDESC", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_ADD", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_ADD_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_ADR_PAGE21", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_ADR_PREL21", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_CALL", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_LD64_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_LDR", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_LD_PREL19", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_OFF_G0_NC", Const, 4, ""},
+		{"R_AARCH64_TLSDESC_OFF_G1", Const, 4, ""},
+		{"R_AARCH64_TLSGD_ADD_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_TLSGD_ADR_PAGE21", Const, 4, ""},
+		{"R_AARCH64_TLSGD_ADR_PREL21", Const, 10, ""},
+		{"R_AARCH64_TLSGD_MOVW_G0_NC", Const, 10, ""},
+		{"R_AARCH64_TLSGD_MOVW_G1", Const, 10, ""},
+		{"R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21", Const, 4, ""},
+		{"R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_TLSIE_LD_GOTTPREL_PREL19", Const, 4, ""},
+		{"R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC", Const, 4, ""},
+		{"R_AARCH64_TLSIE_MOVW_GOTTPREL_G1", Const, 4, ""},
+		{"R_AARCH64_TLSLD_ADR_PAGE21", Const, 10, ""},
+		{"R_AARCH64_TLSLD_ADR_PREL21", Const, 10, ""},
+		{"R_AARCH64_TLSLD_LDST128_DTPREL_LO12", Const, 10, ""},
+		{"R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC", Const, 10, ""},
+		{"R_AARCH64_TLSLE_ADD_TPREL_HI12", Const, 4, ""},
+		{"R_AARCH64_TLSLE_ADD_TPREL_LO12", Const, 4, ""},
+		{"R_AARCH64_TLSLE_ADD_TPREL_LO12_NC", Const, 4, ""},
+		{"R_AARCH64_TLSLE_LDST128_TPREL_LO12", Const, 10, ""},
+		{"R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC", Const, 10, ""},
+		{"R_AARCH64_TLSLE_MOVW_TPREL_G0", Const, 4, ""},
+		{"R_AARCH64_TLSLE_MOVW_TPREL_G0_NC", Const, 4, ""},
+		{"R_AARCH64_TLSLE_MOVW_TPREL_G1", Const, 4, ""},
+		{"R_AARCH64_TLSLE_MOVW_TPREL_G1_NC", Const, 4, ""},
+		{"R_AARCH64_TLSLE_MOVW_TPREL_G2", Const, 4, ""},
+		{"R_AARCH64_TLS_DTPMOD64", Const, 4, ""},
+		{"R_AARCH64_TLS_DTPREL64", Const, 4, ""},
+		{"R_AARCH64_TLS_TPREL64", Const, 4, ""},
+		{"R_AARCH64_TSTBR14", Const, 4, ""},
+		{"R_ALPHA", Type, 0, ""},
+		{"R_ALPHA_BRADDR", Const, 0, ""},
+		{"R_ALPHA_COPY", Const, 0, ""},
+		{"R_ALPHA_GLOB_DAT", Const, 0, ""},
+		{"R_ALPHA_GPDISP", Const, 0, ""},
+		{"R_ALPHA_GPREL32", Const, 0, ""},
+		{"R_ALPHA_GPRELHIGH", Const, 0, ""},
+		{"R_ALPHA_GPRELLOW", Const, 0, ""},
+		{"R_ALPHA_GPVALUE", Const, 0, ""},
+		{"R_ALPHA_HINT", Const, 0, ""},
+		{"R_ALPHA_IMMED_BR_HI32", Const, 0, ""},
+		{"R_ALPHA_IMMED_GP_16", Const, 0, ""},
+		{"R_ALPHA_IMMED_GP_HI32", Const, 0, ""},
+		{"R_ALPHA_IMMED_LO32", Const, 0, ""},
+		{"R_ALPHA_IMMED_SCN_HI32", Const, 0, ""},
+		{"R_ALPHA_JMP_SLOT", Const, 0, ""},
+		{"R_ALPHA_LITERAL", Const, 0, ""},
+		{"R_ALPHA_LITUSE", Const, 0, ""},
+		{"R_ALPHA_NONE", Const, 0, ""},
+		{"R_ALPHA_OP_PRSHIFT", Const, 0, ""},
+		{"R_ALPHA_OP_PSUB", Const, 0, ""},
+		{"R_ALPHA_OP_PUSH", Const, 0, ""},
+		{"R_ALPHA_OP_STORE", Const, 0, ""},
+		{"R_ALPHA_REFLONG", Const, 0, ""},
+		{"R_ALPHA_REFQUAD", Const, 0, ""},
+		{"R_ALPHA_RELATIVE", Const, 0, ""},
+		{"R_ALPHA_SREL16", Const, 0, ""},
+		{"R_ALPHA_SREL32", Const, 0, ""},
+		{"R_ALPHA_SREL64", Const, 0, ""},
+		{"R_ARM", Type, 0, ""},
+		{"R_ARM_ABS12", Const, 0, ""},
+		{"R_ARM_ABS16", Const, 0, ""},
+		{"R_ARM_ABS32", Const, 0, ""},
+		{"R_ARM_ABS32_NOI", Const, 10, ""},
+		{"R_ARM_ABS8", Const, 0, ""},
+		{"R_ARM_ALU_PCREL_15_8", Const, 10, ""},
+		{"R_ARM_ALU_PCREL_23_15", Const, 10, ""},
+		{"R_ARM_ALU_PCREL_7_0", Const, 10, ""},
+		{"R_ARM_ALU_PC_G0", Const, 10, ""},
+		{"R_ARM_ALU_PC_G0_NC", Const, 10, ""},
+		{"R_ARM_ALU_PC_G1", Const, 10, ""},
+		{"R_ARM_ALU_PC_G1_NC", Const, 10, ""},
+		{"R_ARM_ALU_PC_G2", Const, 10, ""},
+		{"R_ARM_ALU_SBREL_19_12_NC", Const, 10, ""},
+		{"R_ARM_ALU_SBREL_27_20_CK", Const, 10, ""},
+		{"R_ARM_ALU_SB_G0", Const, 10, ""},
+		{"R_ARM_ALU_SB_G0_NC", Const, 10, ""},
+		{"R_ARM_ALU_SB_G1", Const, 10, ""},
+		{"R_ARM_ALU_SB_G1_NC", Const, 10, ""},
+		{"R_ARM_ALU_SB_G2", Const, 10, ""},
+		{"R_ARM_AMP_VCALL9", Const, 0, ""},
+		{"R_ARM_BASE_ABS", Const, 10, ""},
+		{"R_ARM_CALL", Const, 10, ""},
+		{"R_ARM_COPY", Const, 0, ""},
+		{"R_ARM_GLOB_DAT", Const, 0, ""},
+		{"R_ARM_GNU_VTENTRY", Const, 0, ""},
+		{"R_ARM_GNU_VTINHERIT", Const, 0, ""},
+		{"R_ARM_GOT32", Const, 0, ""},
+		{"R_ARM_GOTOFF", Const, 0, ""},
+		{"R_ARM_GOTOFF12", Const, 10, ""},
+		{"R_ARM_GOTPC", Const, 0, ""},
+		{"R_ARM_GOTRELAX", Const, 10, ""},
+		{"R_ARM_GOT_ABS", Const, 10, ""},
+		{"R_ARM_GOT_BREL12", Const, 10, ""},
+		{"R_ARM_GOT_PREL", Const, 10, ""},
+		{"R_ARM_IRELATIVE", Const, 10, ""},
+		{"R_ARM_JUMP24", Const, 10, ""},
+		{"R_ARM_JUMP_SLOT", Const, 0, ""},
+		{"R_ARM_LDC_PC_G0", Const, 10, ""},
+		{"R_ARM_LDC_PC_G1", Const, 10, ""},
+		{"R_ARM_LDC_PC_G2", Const, 10, ""},
+		{"R_ARM_LDC_SB_G0", Const, 10, ""},
+		{"R_ARM_LDC_SB_G1", Const, 10, ""},
+		{"R_ARM_LDC_SB_G2", Const, 10, ""},
+		{"R_ARM_LDRS_PC_G0", Const, 10, ""},
+		{"R_ARM_LDRS_PC_G1", Const, 10, ""},
+		{"R_ARM_LDRS_PC_G2", Const, 10, ""},
+		{"R_ARM_LDRS_SB_G0", Const, 10, ""},
+		{"R_ARM_LDRS_SB_G1", Const, 10, ""},
+		{"R_ARM_LDRS_SB_G2", Const, 10, ""},
+		{"R_ARM_LDR_PC_G1", Const, 10, ""},
+		{"R_ARM_LDR_PC_G2", Const, 10, ""},
+		{"R_ARM_LDR_SBREL_11_10_NC", Const, 10, ""},
+		{"R_ARM_LDR_SB_G0", Const, 10, ""},
+		{"R_ARM_LDR_SB_G1", Const, 10, ""},
+		{"R_ARM_LDR_SB_G2", Const, 10, ""},
+		{"R_ARM_ME_TOO", Const, 10, ""},
+		{"R_ARM_MOVT_ABS", Const, 10, ""},
+		{"R_ARM_MOVT_BREL", Const, 10, ""},
+		{"R_ARM_MOVT_PREL", Const, 10, ""},
+		{"R_ARM_MOVW_ABS_NC", Const, 10, ""},
+		{"R_ARM_MOVW_BREL", Const, 10, ""},
+		{"R_ARM_MOVW_BREL_NC", Const, 10, ""},
+		{"R_ARM_MOVW_PREL_NC", Const, 10, ""},
+		{"R_ARM_NONE", Const, 0, ""},
+		{"R_ARM_PC13", Const, 0, ""},
+		{"R_ARM_PC24", Const, 0, ""},
+		{"R_ARM_PLT32", Const, 0, ""},
+		{"R_ARM_PLT32_ABS", Const, 10, ""},
+		{"R_ARM_PREL31", Const, 10, ""},
+		{"R_ARM_PRIVATE_0", Const, 10, ""},
+		{"R_ARM_PRIVATE_1", Const, 10, ""},
+		{"R_ARM_PRIVATE_10", Const, 10, ""},
+		{"R_ARM_PRIVATE_11", Const, 10, ""},
+		{"R_ARM_PRIVATE_12", Const, 10, ""},
+		{"R_ARM_PRIVATE_13", Const, 10, ""},
+		{"R_ARM_PRIVATE_14", Const, 10, ""},
+		{"R_ARM_PRIVATE_15", Const, 10, ""},
+		{"R_ARM_PRIVATE_2", Const, 10, ""},
+		{"R_ARM_PRIVATE_3", Const, 10, ""},
+		{"R_ARM_PRIVATE_4", Const, 10, ""},
+		{"R_ARM_PRIVATE_5", Const, 10, ""},
+		{"R_ARM_PRIVATE_6", Const, 10, ""},
+		{"R_ARM_PRIVATE_7", Const, 10, ""},
+		{"R_ARM_PRIVATE_8", Const, 10, ""},
+		{"R_ARM_PRIVATE_9", Const, 10, ""},
+		{"R_ARM_RABS32", Const, 0, ""},
+		{"R_ARM_RBASE", Const, 0, ""},
+		{"R_ARM_REL32", Const, 0, ""},
+		{"R_ARM_REL32_NOI", Const, 10, ""},
+		{"R_ARM_RELATIVE", Const, 0, ""},
+		{"R_ARM_RPC24", Const, 0, ""},
+		{"R_ARM_RREL32", Const, 0, ""},
+		{"R_ARM_RSBREL32", Const, 0, ""},
+		{"R_ARM_RXPC25", Const, 10, ""},
+		{"R_ARM_SBREL31", Const, 10, ""},
+		{"R_ARM_SBREL32", Const, 0, ""},
+		{"R_ARM_SWI24", Const, 0, ""},
+		{"R_ARM_TARGET1", Const, 10, ""},
+		{"R_ARM_TARGET2", Const, 10, ""},
+		{"R_ARM_THM_ABS5", Const, 0, ""},
+		{"R_ARM_THM_ALU_ABS_G0_NC", Const, 10, ""},
+		{"R_ARM_THM_ALU_ABS_G1_NC", Const, 10, ""},
+		{"R_ARM_THM_ALU_ABS_G2_NC", Const, 10, ""},
+		{"R_ARM_THM_ALU_ABS_G3", Const, 10, ""},
+		{"R_ARM_THM_ALU_PREL_11_0", Const, 10, ""},
+		{"R_ARM_THM_GOT_BREL12", Const, 10, ""},
+		{"R_ARM_THM_JUMP11", Const, 10, ""},
+		{"R_ARM_THM_JUMP19", Const, 10, ""},
+		{"R_ARM_THM_JUMP24", Const, 10, ""},
+		{"R_ARM_THM_JUMP6", Const, 10, ""},
+		{"R_ARM_THM_JUMP8", Const, 10, ""},
+		{"R_ARM_THM_MOVT_ABS", Const, 10, ""},
+		{"R_ARM_THM_MOVT_BREL", Const, 10, ""},
+		{"R_ARM_THM_MOVT_PREL", Const, 10, ""},
+		{"R_ARM_THM_MOVW_ABS_NC", Const, 10, ""},
+		{"R_ARM_THM_MOVW_BREL", Const, 10, ""},
+		{"R_ARM_THM_MOVW_BREL_NC", Const, 10, ""},
+		{"R_ARM_THM_MOVW_PREL_NC", Const, 10, ""},
+		{"R_ARM_THM_PC12", Const, 10, ""},
+		{"R_ARM_THM_PC22", Const, 0, ""},
+		{"R_ARM_THM_PC8", Const, 0, ""},
+		{"R_ARM_THM_RPC22", Const, 0, ""},
+		{"R_ARM_THM_SWI8", Const, 0, ""},
+		{"R_ARM_THM_TLS_CALL", Const, 10, ""},
+		{"R_ARM_THM_TLS_DESCSEQ16", Const, 10, ""},
+		{"R_ARM_THM_TLS_DESCSEQ32", Const, 10, ""},
+		{"R_ARM_THM_XPC22", Const, 0, ""},
+		{"R_ARM_TLS_CALL", Const, 10, ""},
+		{"R_ARM_TLS_DESCSEQ", Const, 10, ""},
+		{"R_ARM_TLS_DTPMOD32", Const, 10, ""},
+		{"R_ARM_TLS_DTPOFF32", Const, 10, ""},
+		{"R_ARM_TLS_GD32", Const, 10, ""},
+		{"R_ARM_TLS_GOTDESC", Const, 10, ""},
+		{"R_ARM_TLS_IE12GP", Const, 10, ""},
+		{"R_ARM_TLS_IE32", Const, 10, ""},
+		{"R_ARM_TLS_LDM32", Const, 10, ""},
+		{"R_ARM_TLS_LDO12", Const, 10, ""},
+		{"R_ARM_TLS_LDO32", Const, 10, ""},
+		{"R_ARM_TLS_LE12", Const, 10, ""},
+		{"R_ARM_TLS_LE32", Const, 10, ""},
+		{"R_ARM_TLS_TPOFF32", Const, 10, ""},
+		{"R_ARM_V4BX", Const, 10, ""},
+		{"R_ARM_XPC25", Const, 0, ""},
+		{"R_INFO", Func, 0, "func(sym uint32, typ uint32) uint64"},
+		{"R_INFO32", Func, 0, "func(sym uint32, typ uint32) uint32"},
+		{"R_LARCH", Type, 19, ""},
+		{"R_LARCH_32", Const, 19, ""},
+		{"R_LARCH_32_PCREL", Const, 20, ""},
+		{"R_LARCH_64", Const, 19, ""},
+		{"R_LARCH_64_PCREL", Const, 22, ""},
+		{"R_LARCH_ABS64_HI12", Const, 20, ""},
+		{"R_LARCH_ABS64_LO20", Const, 20, ""},
+		{"R_LARCH_ABS_HI20", Const, 20, ""},
+		{"R_LARCH_ABS_LO12", Const, 20, ""},
+		{"R_LARCH_ADD16", Const, 19, ""},
+		{"R_LARCH_ADD24", Const, 19, ""},
+		{"R_LARCH_ADD32", Const, 19, ""},
+		{"R_LARCH_ADD6", Const, 22, ""},
+		{"R_LARCH_ADD64", Const, 19, ""},
+		{"R_LARCH_ADD8", Const, 19, ""},
+		{"R_LARCH_ADD_ULEB128", Const, 22, ""},
+		{"R_LARCH_ALIGN", Const, 22, ""},
+		{"R_LARCH_B16", Const, 20, ""},
+		{"R_LARCH_B21", Const, 20, ""},
+		{"R_LARCH_B26", Const, 20, ""},
+		{"R_LARCH_CFA", Const, 22, ""},
+		{"R_LARCH_COPY", Const, 19, ""},
+		{"R_LARCH_DELETE", Const, 22, ""},
+		{"R_LARCH_GNU_VTENTRY", Const, 20, ""},
+		{"R_LARCH_GNU_VTINHERIT", Const, 20, ""},
+		{"R_LARCH_GOT64_HI12", Const, 20, ""},
+		{"R_LARCH_GOT64_LO20", Const, 20, ""},
+		{"R_LARCH_GOT64_PC_HI12", Const, 20, ""},
+		{"R_LARCH_GOT64_PC_LO20", Const, 20, ""},
+		{"R_LARCH_GOT_HI20", Const, 20, ""},
+		{"R_LARCH_GOT_LO12", Const, 20, ""},
+		{"R_LARCH_GOT_PC_HI20", Const, 20, ""},
+		{"R_LARCH_GOT_PC_LO12", Const, 20, ""},
+		{"R_LARCH_IRELATIVE", Const, 19, ""},
+		{"R_LARCH_JUMP_SLOT", Const, 19, ""},
+		{"R_LARCH_MARK_LA", Const, 19, ""},
+		{"R_LARCH_MARK_PCREL", Const, 19, ""},
+		{"R_LARCH_NONE", Const, 19, ""},
+		{"R_LARCH_PCALA64_HI12", Const, 20, ""},
+		{"R_LARCH_PCALA64_LO20", Const, 20, ""},
+		{"R_LARCH_PCALA_HI20", Const, 20, ""},
+		{"R_LARCH_PCALA_LO12", Const, 20, ""},
+		{"R_LARCH_PCREL20_S2", Const, 22, ""},
+		{"R_LARCH_RELATIVE", Const, 19, ""},
+		{"R_LARCH_RELAX", Const, 20, ""},
+		{"R_LARCH_SOP_ADD", Const, 19, ""},
+		{"R_LARCH_SOP_AND", Const, 19, ""},
+		{"R_LARCH_SOP_ASSERT", Const, 19, ""},
+		{"R_LARCH_SOP_IF_ELSE", Const, 19, ""},
+		{"R_LARCH_SOP_NOT", Const, 19, ""},
+		{"R_LARCH_SOP_POP_32_S_0_10_10_16_S2", Const, 19, ""},
+		{"R_LARCH_SOP_POP_32_S_0_5_10_16_S2", Const, 19, ""},
+		{"R_LARCH_SOP_POP_32_S_10_12", Const, 19, ""},
+		{"R_LARCH_SOP_POP_32_S_10_16", Const, 19, ""},
+		{"R_LARCH_SOP_POP_32_S_10_16_S2", Const, 19, ""},
+		{"R_LARCH_SOP_POP_32_S_10_5", Const, 19, ""},
+		{"R_LARCH_SOP_POP_32_S_5_20", Const, 19, ""},
+		{"R_LARCH_SOP_POP_32_U", Const, 19, ""},
+		{"R_LARCH_SOP_POP_32_U_10_12", Const, 19, ""},
+		{"R_LARCH_SOP_PUSH_ABSOLUTE", Const, 19, ""},
+		{"R_LARCH_SOP_PUSH_DUP", Const, 19, ""},
+		{"R_LARCH_SOP_PUSH_GPREL", Const, 19, ""},
+		{"R_LARCH_SOP_PUSH_PCREL", Const, 19, ""},
+		{"R_LARCH_SOP_PUSH_PLT_PCREL", Const, 19, ""},
+		{"R_LARCH_SOP_PUSH_TLS_GD", Const, 19, ""},
+		{"R_LARCH_SOP_PUSH_TLS_GOT", Const, 19, ""},
+		{"R_LARCH_SOP_PUSH_TLS_TPREL", Const, 19, ""},
+		{"R_LARCH_SOP_SL", Const, 19, ""},
+		{"R_LARCH_SOP_SR", Const, 19, ""},
+		{"R_LARCH_SOP_SUB", Const, 19, ""},
+		{"R_LARCH_SUB16", Const, 19, ""},
+		{"R_LARCH_SUB24", Const, 19, ""},
+		{"R_LARCH_SUB32", Const, 19, ""},
+		{"R_LARCH_SUB6", Const, 22, ""},
+		{"R_LARCH_SUB64", Const, 19, ""},
+		{"R_LARCH_SUB8", Const, 19, ""},
+		{"R_LARCH_SUB_ULEB128", Const, 22, ""},
+		{"R_LARCH_TLS_DTPMOD32", Const, 19, ""},
+		{"R_LARCH_TLS_DTPMOD64", Const, 19, ""},
+		{"R_LARCH_TLS_DTPREL32", Const, 19, ""},
+		{"R_LARCH_TLS_DTPREL64", Const, 19, ""},
+		{"R_LARCH_TLS_GD_HI20", Const, 20, ""},
+		{"R_LARCH_TLS_GD_PC_HI20", Const, 20, ""},
+		{"R_LARCH_TLS_IE64_HI12", Const, 20, ""},
+		{"R_LARCH_TLS_IE64_LO20", Const, 20, ""},
+		{"R_LARCH_TLS_IE64_PC_HI12", Const, 20, ""},
+		{"R_LARCH_TLS_IE64_PC_LO20", Const, 20, ""},
+		{"R_LARCH_TLS_IE_HI20", Const, 20, ""},
+		{"R_LARCH_TLS_IE_LO12", Const, 20, ""},
+		{"R_LARCH_TLS_IE_PC_HI20", Const, 20, ""},
+		{"R_LARCH_TLS_IE_PC_LO12", Const, 20, ""},
+		{"R_LARCH_TLS_LD_HI20", Const, 20, ""},
+		{"R_LARCH_TLS_LD_PC_HI20", Const, 20, ""},
+		{"R_LARCH_TLS_LE64_HI12", Const, 20, ""},
+		{"R_LARCH_TLS_LE64_LO20", Const, 20, ""},
+		{"R_LARCH_TLS_LE_HI20", Const, 20, ""},
+		{"R_LARCH_TLS_LE_LO12", Const, 20, ""},
+		{"R_LARCH_TLS_TPREL32", Const, 19, ""},
+		{"R_LARCH_TLS_TPREL64", Const, 19, ""},
+		{"R_MIPS", Type, 6, ""},
+		{"R_MIPS_16", Const, 6, ""},
+		{"R_MIPS_26", Const, 6, ""},
+		{"R_MIPS_32", Const, 6, ""},
+		{"R_MIPS_64", Const, 6, ""},
+		{"R_MIPS_ADD_IMMEDIATE", Const, 6, ""},
+		{"R_MIPS_CALL16", Const, 6, ""},
+		{"R_MIPS_CALL_HI16", Const, 6, ""},
+		{"R_MIPS_CALL_LO16", Const, 6, ""},
+		{"R_MIPS_DELETE", Const, 6, ""},
+		{"R_MIPS_GOT16", Const, 6, ""},
+		{"R_MIPS_GOT_DISP", Const, 6, ""},
+		{"R_MIPS_GOT_HI16", Const, 6, ""},
+		{"R_MIPS_GOT_LO16", Const, 6, ""},
+		{"R_MIPS_GOT_OFST", Const, 6, ""},
+		{"R_MIPS_GOT_PAGE", Const, 6, ""},
+		{"R_MIPS_GPREL16", Const, 6, ""},
+		{"R_MIPS_GPREL32", Const, 6, ""},
+		{"R_MIPS_HI16", Const, 6, ""},
+		{"R_MIPS_HIGHER", Const, 6, ""},
+		{"R_MIPS_HIGHEST", Const, 6, ""},
+		{"R_MIPS_INSERT_A", Const, 6, ""},
+		{"R_MIPS_INSERT_B", Const, 6, ""},
+		{"R_MIPS_JALR", Const, 6, ""},
+		{"R_MIPS_LITERAL", Const, 6, ""},
+		{"R_MIPS_LO16", Const, 6, ""},
+		{"R_MIPS_NONE", Const, 6, ""},
+		{"R_MIPS_PC16", Const, 6, ""},
+		{"R_MIPS_PC32", Const, 22, ""},
+		{"R_MIPS_PJUMP", Const, 6, ""},
+		{"R_MIPS_REL16", Const, 6, ""},
+		{"R_MIPS_REL32", Const, 6, ""},
+		{"R_MIPS_RELGOT", Const, 6, ""},
+		{"R_MIPS_SCN_DISP", Const, 6, ""},
+		{"R_MIPS_SHIFT5", Const, 6, ""},
+		{"R_MIPS_SHIFT6", Const, 6, ""},
+		{"R_MIPS_SUB", Const, 6, ""},
+		{"R_MIPS_TLS_DTPMOD32", Const, 6, ""},
+		{"R_MIPS_TLS_DTPMOD64", Const, 6, ""},
+		{"R_MIPS_TLS_DTPREL32", Const, 6, ""},
+		{"R_MIPS_TLS_DTPREL64", Const, 6, ""},
+		{"R_MIPS_TLS_DTPREL_HI16", Const, 6, ""},
+		{"R_MIPS_TLS_DTPREL_LO16", Const, 6, ""},
+		{"R_MIPS_TLS_GD", Const, 6, ""},
+		{"R_MIPS_TLS_GOTTPREL", Const, 6, ""},
+		{"R_MIPS_TLS_LDM", Const, 6, ""},
+		{"R_MIPS_TLS_TPREL32", Const, 6, ""},
+		{"R_MIPS_TLS_TPREL64", Const, 6, ""},
+		{"R_MIPS_TLS_TPREL_HI16", Const, 6, ""},
+		{"R_MIPS_TLS_TPREL_LO16", Const, 6, ""},
+		{"R_PPC", Type, 0, ""},
+		{"R_PPC64", Type, 5, ""},
+		{"R_PPC64_ADDR14", Const, 5, ""},
+		{"R_PPC64_ADDR14_BRNTAKEN", Const, 5, ""},
+		{"R_PPC64_ADDR14_BRTAKEN", Const, 5, ""},
+		{"R_PPC64_ADDR16", Const, 5, ""},
+		{"R_PPC64_ADDR16_DS", Const, 5, ""},
+		{"R_PPC64_ADDR16_HA", Const, 5, ""},
+		{"R_PPC64_ADDR16_HI", Const, 5, ""},
+		{"R_PPC64_ADDR16_HIGH", Const, 10, ""},
+		{"R_PPC64_ADDR16_HIGHA", Const, 10, ""},
+		{"R_PPC64_ADDR16_HIGHER", Const, 5, ""},
+		{"R_PPC64_ADDR16_HIGHER34", Const, 20, ""},
+		{"R_PPC64_ADDR16_HIGHERA", Const, 5, ""},
+		{"R_PPC64_ADDR16_HIGHERA34", Const, 20, ""},
+		{"R_PPC64_ADDR16_HIGHEST", Const, 5, ""},
+		{"R_PPC64_ADDR16_HIGHEST34", Const, 20, ""},
+		{"R_PPC64_ADDR16_HIGHESTA", Const, 5, ""},
+		{"R_PPC64_ADDR16_HIGHESTA34", Const, 20, ""},
+		{"R_PPC64_ADDR16_LO", Const, 5, ""},
+		{"R_PPC64_ADDR16_LO_DS", Const, 5, ""},
+		{"R_PPC64_ADDR24", Const, 5, ""},
+		{"R_PPC64_ADDR32", Const, 5, ""},
+		{"R_PPC64_ADDR64", Const, 5, ""},
+		{"R_PPC64_ADDR64_LOCAL", Const, 10, ""},
+		{"R_PPC64_COPY", Const, 20, ""},
+		{"R_PPC64_D28", Const, 20, ""},
+		{"R_PPC64_D34", Const, 20, ""},
+		{"R_PPC64_D34_HA30", Const, 20, ""},
+		{"R_PPC64_D34_HI30", Const, 20, ""},
+		{"R_PPC64_D34_LO", Const, 20, ""},
+		{"R_PPC64_DTPMOD64", Const, 5, ""},
+		{"R_PPC64_DTPREL16", Const, 5, ""},
+		{"R_PPC64_DTPREL16_DS", Const, 5, ""},
+		{"R_PPC64_DTPREL16_HA", Const, 5, ""},
+		{"R_PPC64_DTPREL16_HI", Const, 5, ""},
+		{"R_PPC64_DTPREL16_HIGH", Const, 10, ""},
+		{"R_PPC64_DTPREL16_HIGHA", Const, 10, ""},
+		{"R_PPC64_DTPREL16_HIGHER", Const, 5, ""},
+		{"R_PPC64_DTPREL16_HIGHERA", Const, 5, ""},
+		{"R_PPC64_DTPREL16_HIGHEST", Const, 5, ""},
+		{"R_PPC64_DTPREL16_HIGHESTA", Const, 5, ""},
+		{"R_PPC64_DTPREL16_LO", Const, 5, ""},
+		{"R_PPC64_DTPREL16_LO_DS", Const, 5, ""},
+		{"R_PPC64_DTPREL34", Const, 20, ""},
+		{"R_PPC64_DTPREL64", Const, 5, ""},
+		{"R_PPC64_ENTRY", Const, 10, ""},
+		{"R_PPC64_GLOB_DAT", Const, 20, ""},
+		{"R_PPC64_GNU_VTENTRY", Const, 20, ""},
+		{"R_PPC64_GNU_VTINHERIT", Const, 20, ""},
+		{"R_PPC64_GOT16", Const, 5, ""},
+		{"R_PPC64_GOT16_DS", Const, 5, ""},
+		{"R_PPC64_GOT16_HA", Const, 5, ""},
+		{"R_PPC64_GOT16_HI", Const, 5, ""},
+		{"R_PPC64_GOT16_LO", Const, 5, ""},
+		{"R_PPC64_GOT16_LO_DS", Const, 5, ""},
+		{"R_PPC64_GOT_DTPREL16_DS", Const, 5, ""},
+		{"R_PPC64_GOT_DTPREL16_HA", Const, 5, ""},
+		{"R_PPC64_GOT_DTPREL16_HI", Const, 5, ""},
+		{"R_PPC64_GOT_DTPREL16_LO_DS", Const, 5, ""},
+		{"R_PPC64_GOT_DTPREL_PCREL34", Const, 20, ""},
+		{"R_PPC64_GOT_PCREL34", Const, 20, ""},
+		{"R_PPC64_GOT_TLSGD16", Const, 5, ""},
+		{"R_PPC64_GOT_TLSGD16_HA", Const, 5, ""},
+		{"R_PPC64_GOT_TLSGD16_HI", Const, 5, ""},
+		{"R_PPC64_GOT_TLSGD16_LO", Const, 5, ""},
+		{"R_PPC64_GOT_TLSGD_PCREL34", Const, 20, ""},
+		{"R_PPC64_GOT_TLSLD16", Const, 5, ""},
+		{"R_PPC64_GOT_TLSLD16_HA", Const, 5, ""},
+		{"R_PPC64_GOT_TLSLD16_HI", Const, 5, ""},
+		{"R_PPC64_GOT_TLSLD16_LO", Const, 5, ""},
+		{"R_PPC64_GOT_TLSLD_PCREL34", Const, 20, ""},
+		{"R_PPC64_GOT_TPREL16_DS", Const, 5, ""},
+		{"R_PPC64_GOT_TPREL16_HA", Const, 5, ""},
+		{"R_PPC64_GOT_TPREL16_HI", Const, 5, ""},
+		{"R_PPC64_GOT_TPREL16_LO_DS", Const, 5, ""},
+		{"R_PPC64_GOT_TPREL_PCREL34", Const, 20, ""},
+		{"R_PPC64_IRELATIVE", Const, 10, ""},
+		{"R_PPC64_JMP_IREL", Const, 10, ""},
+		{"R_PPC64_JMP_SLOT", Const, 5, ""},
+		{"R_PPC64_NONE", Const, 5, ""},
+		{"R_PPC64_PCREL28", Const, 20, ""},
+		{"R_PPC64_PCREL34", Const, 20, ""},
+		{"R_PPC64_PCREL_OPT", Const, 20, ""},
+		{"R_PPC64_PLT16_HA", Const, 20, ""},
+		{"R_PPC64_PLT16_HI", Const, 20, ""},
+		{"R_PPC64_PLT16_LO", Const, 20, ""},
+		{"R_PPC64_PLT16_LO_DS", Const, 10, ""},
+		{"R_PPC64_PLT32", Const, 20, ""},
+		{"R_PPC64_PLT64", Const, 20, ""},
+		{"R_PPC64_PLTCALL", Const, 20, ""},
+		{"R_PPC64_PLTCALL_NOTOC", Const, 20, ""},
+		{"R_PPC64_PLTGOT16", Const, 10, ""},
+		{"R_PPC64_PLTGOT16_DS", Const, 10, ""},
+		{"R_PPC64_PLTGOT16_HA", Const, 10, ""},
+		{"R_PPC64_PLTGOT16_HI", Const, 10, ""},
+		{"R_PPC64_PLTGOT16_LO", Const, 10, ""},
+		{"R_PPC64_PLTGOT_LO_DS", Const, 10, ""},
+		{"R_PPC64_PLTREL32", Const, 20, ""},
+		{"R_PPC64_PLTREL64", Const, 20, ""},
+		{"R_PPC64_PLTSEQ", Const, 20, ""},
+		{"R_PPC64_PLTSEQ_NOTOC", Const, 20, ""},
+		{"R_PPC64_PLT_PCREL34", Const, 20, ""},
+		{"R_PPC64_PLT_PCREL34_NOTOC", Const, 20, ""},
+		{"R_PPC64_REL14", Const, 5, ""},
+		{"R_PPC64_REL14_BRNTAKEN", Const, 5, ""},
+		{"R_PPC64_REL14_BRTAKEN", Const, 5, ""},
+		{"R_PPC64_REL16", Const, 5, ""},
+		{"R_PPC64_REL16DX_HA", Const, 10, ""},
+		{"R_PPC64_REL16_HA", Const, 5, ""},
+		{"R_PPC64_REL16_HI", Const, 5, ""},
+		{"R_PPC64_REL16_HIGH", Const, 20, ""},
+		{"R_PPC64_REL16_HIGHA", Const, 20, ""},
+		{"R_PPC64_REL16_HIGHER", Const, 20, ""},
+		{"R_PPC64_REL16_HIGHER34", Const, 20, ""},
+		{"R_PPC64_REL16_HIGHERA", Const, 20, ""},
+		{"R_PPC64_REL16_HIGHERA34", Const, 20, ""},
+		{"R_PPC64_REL16_HIGHEST", Const, 20, ""},
+		{"R_PPC64_REL16_HIGHEST34", Const, 20, ""},
+		{"R_PPC64_REL16_HIGHESTA", Const, 20, ""},
+		{"R_PPC64_REL16_HIGHESTA34", Const, 20, ""},
+		{"R_PPC64_REL16_LO", Const, 5, ""},
+		{"R_PPC64_REL24", Const, 5, ""},
+		{"R_PPC64_REL24_NOTOC", Const, 10, ""},
+		{"R_PPC64_REL24_P9NOTOC", Const, 21, ""},
+		{"R_PPC64_REL30", Const, 20, ""},
+		{"R_PPC64_REL32", Const, 5, ""},
+		{"R_PPC64_REL64", Const, 5, ""},
+		{"R_PPC64_RELATIVE", Const, 18, ""},
+		{"R_PPC64_SECTOFF", Const, 20, ""},
+		{"R_PPC64_SECTOFF_DS", Const, 10, ""},
+		{"R_PPC64_SECTOFF_HA", Const, 20, ""},
+		{"R_PPC64_SECTOFF_HI", Const, 20, ""},
+		{"R_PPC64_SECTOFF_LO", Const, 20, ""},
+		{"R_PPC64_SECTOFF_LO_DS", Const, 10, ""},
+		{"R_PPC64_TLS", Const, 5, ""},
+		{"R_PPC64_TLSGD", Const, 5, ""},
+		{"R_PPC64_TLSLD", Const, 5, ""},
+		{"R_PPC64_TOC", Const, 5, ""},
+		{"R_PPC64_TOC16", Const, 5, ""},
+		{"R_PPC64_TOC16_DS", Const, 5, ""},
+		{"R_PPC64_TOC16_HA", Const, 5, ""},
+		{"R_PPC64_TOC16_HI", Const, 5, ""},
+		{"R_PPC64_TOC16_LO", Const, 5, ""},
+		{"R_PPC64_TOC16_LO_DS", Const, 5, ""},
+		{"R_PPC64_TOCSAVE", Const, 10, ""},
+		{"R_PPC64_TPREL16", Const, 5, ""},
+		{"R_PPC64_TPREL16_DS", Const, 5, ""},
+		{"R_PPC64_TPREL16_HA", Const, 5, ""},
+		{"R_PPC64_TPREL16_HI", Const, 5, ""},
+		{"R_PPC64_TPREL16_HIGH", Const, 10, ""},
+		{"R_PPC64_TPREL16_HIGHA", Const, 10, ""},
+		{"R_PPC64_TPREL16_HIGHER", Const, 5, ""},
+		{"R_PPC64_TPREL16_HIGHERA", Const, 5, ""},
+		{"R_PPC64_TPREL16_HIGHEST", Const, 5, ""},
+		{"R_PPC64_TPREL16_HIGHESTA", Const, 5, ""},
+		{"R_PPC64_TPREL16_LO", Const, 5, ""},
+		{"R_PPC64_TPREL16_LO_DS", Const, 5, ""},
+		{"R_PPC64_TPREL34", Const, 20, ""},
+		{"R_PPC64_TPREL64", Const, 5, ""},
+		{"R_PPC64_UADDR16", Const, 20, ""},
+		{"R_PPC64_UADDR32", Const, 20, ""},
+		{"R_PPC64_UADDR64", Const, 20, ""},
+		{"R_PPC_ADDR14", Const, 0, ""},
+		{"R_PPC_ADDR14_BRNTAKEN", Const, 0, ""},
+		{"R_PPC_ADDR14_BRTAKEN", Const, 0, ""},
+		{"R_PPC_ADDR16", Const, 0, ""},
+		{"R_PPC_ADDR16_HA", Const, 0, ""},
+		{"R_PPC_ADDR16_HI", Const, 0, ""},
+		{"R_PPC_ADDR16_LO", Const, 0, ""},
+		{"R_PPC_ADDR24", Const, 0, ""},
+		{"R_PPC_ADDR32", Const, 0, ""},
+		{"R_PPC_COPY", Const, 0, ""},
+		{"R_PPC_DTPMOD32", Const, 0, ""},
+		{"R_PPC_DTPREL16", Const, 0, ""},
+		{"R_PPC_DTPREL16_HA", Const, 0, ""},
+		{"R_PPC_DTPREL16_HI", Const, 0, ""},
+		{"R_PPC_DTPREL16_LO", Const, 0, ""},
+		{"R_PPC_DTPREL32", Const, 0, ""},
+		{"R_PPC_EMB_BIT_FLD", Const, 0, ""},
+		{"R_PPC_EMB_MRKREF", Const, 0, ""},
+		{"R_PPC_EMB_NADDR16", Const, 0, ""},
+		{"R_PPC_EMB_NADDR16_HA", Const, 0, ""},
+		{"R_PPC_EMB_NADDR16_HI", Const, 0, ""},
+		{"R_PPC_EMB_NADDR16_LO", Const, 0, ""},
+		{"R_PPC_EMB_NADDR32", Const, 0, ""},
+		{"R_PPC_EMB_RELSDA", Const, 0, ""},
+		{"R_PPC_EMB_RELSEC16", Const, 0, ""},
+		{"R_PPC_EMB_RELST_HA", Const, 0, ""},
+		{"R_PPC_EMB_RELST_HI", Const, 0, ""},
+		{"R_PPC_EMB_RELST_LO", Const, 0, ""},
+		{"R_PPC_EMB_SDA21", Const, 0, ""},
+		{"R_PPC_EMB_SDA2I16", Const, 0, ""},
+		{"R_PPC_EMB_SDA2REL", Const, 0, ""},
+		{"R_PPC_EMB_SDAI16", Const, 0, ""},
+		{"R_PPC_GLOB_DAT", Const, 0, ""},
+		{"R_PPC_GOT16", Const, 0, ""},
+		{"R_PPC_GOT16_HA", Const, 0, ""},
+		{"R_PPC_GOT16_HI", Const, 0, ""},
+		{"R_PPC_GOT16_LO", Const, 0, ""},
+		{"R_PPC_GOT_TLSGD16", Const, 0, ""},
+		{"R_PPC_GOT_TLSGD16_HA", Const, 0, ""},
+		{"R_PPC_GOT_TLSGD16_HI", Const, 0, ""},
+		{"R_PPC_GOT_TLSGD16_LO", Const, 0, ""},
+		{"R_PPC_GOT_TLSLD16", Const, 0, ""},
+		{"R_PPC_GOT_TLSLD16_HA", Const, 0, ""},
+		{"R_PPC_GOT_TLSLD16_HI", Const, 0, ""},
+		{"R_PPC_GOT_TLSLD16_LO", Const, 0, ""},
+		{"R_PPC_GOT_TPREL16", Const, 0, ""},
+		{"R_PPC_GOT_TPREL16_HA", Const, 0, ""},
+		{"R_PPC_GOT_TPREL16_HI", Const, 0, ""},
+		{"R_PPC_GOT_TPREL16_LO", Const, 0, ""},
+		{"R_PPC_JMP_SLOT", Const, 0, ""},
+		{"R_PPC_LOCAL24PC", Const, 0, ""},
+		{"R_PPC_NONE", Const, 0, ""},
+		{"R_PPC_PLT16_HA", Const, 0, ""},
+		{"R_PPC_PLT16_HI", Const, 0, ""},
+		{"R_PPC_PLT16_LO", Const, 0, ""},
+		{"R_PPC_PLT32", Const, 0, ""},
+		{"R_PPC_PLTREL24", Const, 0, ""},
+		{"R_PPC_PLTREL32", Const, 0, ""},
+		{"R_PPC_REL14", Const, 0, ""},
+		{"R_PPC_REL14_BRNTAKEN", Const, 0, ""},
+		{"R_PPC_REL14_BRTAKEN", Const, 0, ""},
+		{"R_PPC_REL24", Const, 0, ""},
+		{"R_PPC_REL32", Const, 0, ""},
+		{"R_PPC_RELATIVE", Const, 0, ""},
+		{"R_PPC_SDAREL16", Const, 0, ""},
+		{"R_PPC_SECTOFF", Const, 0, ""},
+		{"R_PPC_SECTOFF_HA", Const, 0, ""},
+		{"R_PPC_SECTOFF_HI", Const, 0, ""},
+		{"R_PPC_SECTOFF_LO", Const, 0, ""},
+		{"R_PPC_TLS", Const, 0, ""},
+		{"R_PPC_TPREL16", Const, 0, ""},
+		{"R_PPC_TPREL16_HA", Const, 0, ""},
+		{"R_PPC_TPREL16_HI", Const, 0, ""},
+		{"R_PPC_TPREL16_LO", Const, 0, ""},
+		{"R_PPC_TPREL32", Const, 0, ""},
+		{"R_PPC_UADDR16", Const, 0, ""},
+		{"R_PPC_UADDR32", Const, 0, ""},
+		{"R_RISCV", Type, 11, ""},
+		{"R_RISCV_32", Const, 11, ""},
+		{"R_RISCV_32_PCREL", Const, 12, ""},
+		{"R_RISCV_64", Const, 11, ""},
+		{"R_RISCV_ADD16", Const, 11, ""},
+		{"R_RISCV_ADD32", Const, 11, ""},
+		{"R_RISCV_ADD64", Const, 11, ""},
+		{"R_RISCV_ADD8", Const, 11, ""},
+		{"R_RISCV_ALIGN", Const, 11, ""},
+		{"R_RISCV_BRANCH", Const, 11, ""},
+		{"R_RISCV_CALL", Const, 11, ""},
+		{"R_RISCV_CALL_PLT", Const, 11, ""},
+		{"R_RISCV_COPY", Const, 11, ""},
+		{"R_RISCV_GNU_VTENTRY", Const, 11, ""},
+		{"R_RISCV_GNU_VTINHERIT", Const, 11, ""},
+		{"R_RISCV_GOT_HI20", Const, 11, ""},
+		{"R_RISCV_GPREL_I", Const, 11, ""},
+		{"R_RISCV_GPREL_S", Const, 11, ""},
+		{"R_RISCV_HI20", Const, 11, ""},
+		{"R_RISCV_JAL", Const, 11, ""},
+		{"R_RISCV_JUMP_SLOT", Const, 11, ""},
+		{"R_RISCV_LO12_I", Const, 11, ""},
+		{"R_RISCV_LO12_S", Const, 11, ""},
+		{"R_RISCV_NONE", Const, 11, ""},
+		{"R_RISCV_PCREL_HI20", Const, 11, ""},
+		{"R_RISCV_PCREL_LO12_I", Const, 11, ""},
+		{"R_RISCV_PCREL_LO12_S", Const, 11, ""},
+		{"R_RISCV_RELATIVE", Const, 11, ""},
+		{"R_RISCV_RELAX", Const, 11, ""},
+		{"R_RISCV_RVC_BRANCH", Const, 11, ""},
+		{"R_RISCV_RVC_JUMP", Const, 11, ""},
+		{"R_RISCV_RVC_LUI", Const, 11, ""},
+		{"R_RISCV_SET16", Const, 11, ""},
+		{"R_RISCV_SET32", Const, 11, ""},
+		{"R_RISCV_SET6", Const, 11, ""},
+		{"R_RISCV_SET8", Const, 11, ""},
+		{"R_RISCV_SUB16", Const, 11, ""},
+		{"R_RISCV_SUB32", Const, 11, ""},
+		{"R_RISCV_SUB6", Const, 11, ""},
+		{"R_RISCV_SUB64", Const, 11, ""},
+		{"R_RISCV_SUB8", Const, 11, ""},
+		{"R_RISCV_TLS_DTPMOD32", Const, 11, ""},
+		{"R_RISCV_TLS_DTPMOD64", Const, 11, ""},
+		{"R_RISCV_TLS_DTPREL32", Const, 11, ""},
+		{"R_RISCV_TLS_DTPREL64", Const, 11, ""},
+		{"R_RISCV_TLS_GD_HI20", Const, 11, ""},
+		{"R_RISCV_TLS_GOT_HI20", Const, 11, ""},
+		{"R_RISCV_TLS_TPREL32", Const, 11, ""},
+		{"R_RISCV_TLS_TPREL64", Const, 11, ""},
+		{"R_RISCV_TPREL_ADD", Const, 11, ""},
+		{"R_RISCV_TPREL_HI20", Const, 11, ""},
+		{"R_RISCV_TPREL_I", Const, 11, ""},
+		{"R_RISCV_TPREL_LO12_I", Const, 11, ""},
+		{"R_RISCV_TPREL_LO12_S", Const, 11, ""},
+		{"R_RISCV_TPREL_S", Const, 11, ""},
+		{"R_SPARC", Type, 0, ""},
+		{"R_SPARC_10", Const, 0, ""},
+		{"R_SPARC_11", Const, 0, ""},
+		{"R_SPARC_13", Const, 0, ""},
+		{"R_SPARC_16", Const, 0, ""},
+		{"R_SPARC_22", Const, 0, ""},
+		{"R_SPARC_32", Const, 0, ""},
+		{"R_SPARC_5", Const, 0, ""},
+		{"R_SPARC_6", Const, 0, ""},
+		{"R_SPARC_64", Const, 0, ""},
+		{"R_SPARC_7", Const, 0, ""},
+		{"R_SPARC_8", Const, 0, ""},
+		{"R_SPARC_COPY", Const, 0, ""},
+		{"R_SPARC_DISP16", Const, 0, ""},
+		{"R_SPARC_DISP32", Const, 0, ""},
+		{"R_SPARC_DISP64", Const, 0, ""},
+		{"R_SPARC_DISP8", Const, 0, ""},
+		{"R_SPARC_GLOB_DAT", Const, 0, ""},
+		{"R_SPARC_GLOB_JMP", Const, 0, ""},
+		{"R_SPARC_GOT10", Const, 0, ""},
+		{"R_SPARC_GOT13", Const, 0, ""},
+		{"R_SPARC_GOT22", Const, 0, ""},
+		{"R_SPARC_H44", Const, 0, ""},
+		{"R_SPARC_HH22", Const, 0, ""},
+		{"R_SPARC_HI22", Const, 0, ""},
+		{"R_SPARC_HIPLT22", Const, 0, ""},
+		{"R_SPARC_HIX22", Const, 0, ""},
+		{"R_SPARC_HM10", Const, 0, ""},
+		{"R_SPARC_JMP_SLOT", Const, 0, ""},
+		{"R_SPARC_L44", Const, 0, ""},
+		{"R_SPARC_LM22", Const, 0, ""},
+		{"R_SPARC_LO10", Const, 0, ""},
+		{"R_SPARC_LOPLT10", Const, 0, ""},
+		{"R_SPARC_LOX10", Const, 0, ""},
+		{"R_SPARC_M44", Const, 0, ""},
+		{"R_SPARC_NONE", Const, 0, ""},
+		{"R_SPARC_OLO10", Const, 0, ""},
+		{"R_SPARC_PC10", Const, 0, ""},
+		{"R_SPARC_PC22", Const, 0, ""},
+		{"R_SPARC_PCPLT10", Const, 0, ""},
+		{"R_SPARC_PCPLT22", Const, 0, ""},
+		{"R_SPARC_PCPLT32", Const, 0, ""},
+		{"R_SPARC_PC_HH22", Const, 0, ""},
+		{"R_SPARC_PC_HM10", Const, 0, ""},
+		{"R_SPARC_PC_LM22", Const, 0, ""},
+		{"R_SPARC_PLT32", Const, 0, ""},
+		{"R_SPARC_PLT64", Const, 0, ""},
+		{"R_SPARC_REGISTER", Const, 0, ""},
+		{"R_SPARC_RELATIVE", Const, 0, ""},
+		{"R_SPARC_UA16", Const, 0, ""},
+		{"R_SPARC_UA32", Const, 0, ""},
+		{"R_SPARC_UA64", Const, 0, ""},
+		{"R_SPARC_WDISP16", Const, 0, ""},
+		{"R_SPARC_WDISP19", Const, 0, ""},
+		{"R_SPARC_WDISP22", Const, 0, ""},
+		{"R_SPARC_WDISP30", Const, 0, ""},
+		{"R_SPARC_WPLT30", Const, 0, ""},
+		{"R_SYM32", Func, 0, "func(info uint32) uint32"},
+		{"R_SYM64", Func, 0, "func(info uint64) uint32"},
+		{"R_TYPE32", Func, 0, "func(info uint32) uint32"},
+		{"R_TYPE64", Func, 0, "func(info uint64) uint32"},
+		{"R_X86_64", Type, 0, ""},
+		{"R_X86_64_16", Const, 0, ""},
+		{"R_X86_64_32", Const, 0, ""},
+		{"R_X86_64_32S", Const, 0, ""},
+		{"R_X86_64_64", Const, 0, ""},
+		{"R_X86_64_8", Const, 0, ""},
+		{"R_X86_64_COPY", Const, 0, ""},
+		{"R_X86_64_DTPMOD64", Const, 0, ""},
+		{"R_X86_64_DTPOFF32", Const, 0, ""},
+		{"R_X86_64_DTPOFF64", Const, 0, ""},
+		{"R_X86_64_GLOB_DAT", Const, 0, ""},
+		{"R_X86_64_GOT32", Const, 0, ""},
+		{"R_X86_64_GOT64", Const, 10, ""},
+		{"R_X86_64_GOTOFF64", Const, 10, ""},
+		{"R_X86_64_GOTPC32", Const, 10, ""},
+		{"R_X86_64_GOTPC32_TLSDESC", Const, 10, ""},
+		{"R_X86_64_GOTPC64", Const, 10, ""},
+		{"R_X86_64_GOTPCREL", Const, 0, ""},
+		{"R_X86_64_GOTPCREL64", Const, 10, ""},
+		{"R_X86_64_GOTPCRELX", Const, 10, ""},
+		{"R_X86_64_GOTPLT64", Const, 10, ""},
+		{"R_X86_64_GOTTPOFF", Const, 0, ""},
+		{"R_X86_64_IRELATIVE", Const, 10, ""},
+		{"R_X86_64_JMP_SLOT", Const, 0, ""},
+		{"R_X86_64_NONE", Const, 0, ""},
+		{"R_X86_64_PC16", Const, 0, ""},
+		{"R_X86_64_PC32", Const, 0, ""},
+		{"R_X86_64_PC32_BND", Const, 10, ""},
+		{"R_X86_64_PC64", Const, 10, ""},
+		{"R_X86_64_PC8", Const, 0, ""},
+		{"R_X86_64_PLT32", Const, 0, ""},
+		{"R_X86_64_PLT32_BND", Const, 10, ""},
+		{"R_X86_64_PLTOFF64", Const, 10, ""},
+		{"R_X86_64_RELATIVE", Const, 0, ""},
+		{"R_X86_64_RELATIVE64", Const, 10, ""},
+		{"R_X86_64_REX_GOTPCRELX", Const, 10, ""},
+		{"R_X86_64_SIZE32", Const, 10, ""},
+		{"R_X86_64_SIZE64", Const, 10, ""},
+		{"R_X86_64_TLSDESC", Const, 10, ""},
+		{"R_X86_64_TLSDESC_CALL", Const, 10, ""},
+		{"R_X86_64_TLSGD", Const, 0, ""},
+		{"R_X86_64_TLSLD", Const, 0, ""},
+		{"R_X86_64_TPOFF32", Const, 0, ""},
+		{"R_X86_64_TPOFF64", Const, 0, ""},
+		{"Rel32", Type, 0, ""},
+		{"Rel32.Info", Field, 0, ""},
+		{"Rel32.Off", Field, 0, ""},
+		{"Rel64", Type, 0, ""},
+		{"Rel64.Info", Field, 0, ""},
+		{"Rel64.Off", Field, 0, ""},
+		{"Rela32", Type, 0, ""},
+		{"Rela32.Addend", Field, 0, ""},
+		{"Rela32.Info", Field, 0, ""},
+		{"Rela32.Off", Field, 0, ""},
+		{"Rela64", Type, 0, ""},
+		{"Rela64.Addend", Field, 0, ""},
+		{"Rela64.Info", Field, 0, ""},
+		{"Rela64.Off", Field, 0, ""},
+		{"SHF_ALLOC", Const, 0, ""},
+		{"SHF_COMPRESSED", Const, 6, ""},
+		{"SHF_EXECINSTR", Const, 0, ""},
+		{"SHF_GROUP", Const, 0, ""},
+		{"SHF_INFO_LINK", Const, 0, ""},
+		{"SHF_LINK_ORDER", Const, 0, ""},
+		{"SHF_MASKOS", Const, 0, ""},
+		{"SHF_MASKPROC", Const, 0, ""},
+		{"SHF_MERGE", Const, 0, ""},
+		{"SHF_OS_NONCONFORMING", Const, 0, ""},
+		{"SHF_STRINGS", Const, 0, ""},
+		{"SHF_TLS", Const, 0, ""},
+		{"SHF_WRITE", Const, 0, ""},
+		{"SHN_ABS", Const, 0, ""},
+		{"SHN_COMMON", Const, 0, ""},
+		{"SHN_HIOS", Const, 0, ""},
+		{"SHN_HIPROC", Const, 0, ""},
+		{"SHN_HIRESERVE", Const, 0, ""},
+		{"SHN_LOOS", Const, 0, ""},
+		{"SHN_LOPROC", Const, 0, ""},
+		{"SHN_LORESERVE", Const, 0, ""},
+		{"SHN_UNDEF", Const, 0, ""},
+		{"SHN_XINDEX", Const, 0, ""},
+		{"SHT_DYNAMIC", Const, 0, ""},
+		{"SHT_DYNSYM", Const, 0, ""},
+		{"SHT_FINI_ARRAY", Const, 0, ""},
+		{"SHT_GNU_ATTRIBUTES", Const, 0, ""},
+		{"SHT_GNU_HASH", Const, 0, ""},
+		{"SHT_GNU_LIBLIST", Const, 0, ""},
+		{"SHT_GNU_VERDEF", Const, 0, ""},
+		{"SHT_GNU_VERNEED", Const, 0, ""},
+		{"SHT_GNU_VERSYM", Const, 0, ""},
+		{"SHT_GROUP", Const, 0, ""},
+		{"SHT_HASH", Const, 0, ""},
+		{"SHT_HIOS", Const, 0, ""},
+		{"SHT_HIPROC", Const, 0, ""},
+		{"SHT_HIUSER", Const, 0, ""},
+		{"SHT_INIT_ARRAY", Const, 0, ""},
+		{"SHT_LOOS", Const, 0, ""},
+		{"SHT_LOPROC", Const, 0, ""},
+		{"SHT_LOUSER", Const, 0, ""},
+		{"SHT_MIPS_ABIFLAGS", Const, 17, ""},
+		{"SHT_NOBITS", Const, 0, ""},
+		{"SHT_NOTE", Const, 0, ""},
+		{"SHT_NULL", Const, 0, ""},
+		{"SHT_PREINIT_ARRAY", Const, 0, ""},
+		{"SHT_PROGBITS", Const, 0, ""},
+		{"SHT_REL", Const, 0, ""},
+		{"SHT_RELA", Const, 0, ""},
+		{"SHT_RISCV_ATTRIBUTES", Const, 25, ""},
+		{"SHT_SHLIB", Const, 0, ""},
+		{"SHT_STRTAB", Const, 0, ""},
+		{"SHT_SYMTAB", Const, 0, ""},
+		{"SHT_SYMTAB_SHNDX", Const, 0, ""},
+		{"STB_GLOBAL", Const, 0, ""},
+		{"STB_HIOS", Const, 0, ""},
+		{"STB_HIPROC", Const, 0, ""},
+		{"STB_LOCAL", Const, 0, ""},
+		{"STB_LOOS", Const, 0, ""},
+		{"STB_LOPROC", Const, 0, ""},
+		{"STB_WEAK", Const, 0, ""},
+		{"STT_COMMON", Const, 0, ""},
+		{"STT_FILE", Const, 0, ""},
+		{"STT_FUNC", Const, 0, ""},
+		{"STT_GNU_IFUNC", Const, 23, ""},
+		{"STT_HIOS", Const, 0, ""},
+		{"STT_HIPROC", Const, 0, ""},
+		{"STT_LOOS", Const, 0, ""},
+		{"STT_LOPROC", Const, 0, ""},
+		{"STT_NOTYPE", Const, 0, ""},
+		{"STT_OBJECT", Const, 0, ""},
+		{"STT_RELC", Const, 23, ""},
+		{"STT_SECTION", Const, 0, ""},
+		{"STT_SRELC", Const, 23, ""},
+		{"STT_TLS", Const, 0, ""},
+		{"STV_DEFAULT", Const, 0, ""},
+		{"STV_HIDDEN", Const, 0, ""},
+		{"STV_INTERNAL", Const, 0, ""},
+		{"STV_PROTECTED", Const, 0, ""},
+		{"ST_BIND", Func, 0, "func(info uint8) SymBind"},
+		{"ST_INFO", Func, 0, "func(bind SymBind, typ SymType) uint8"},
+		{"ST_TYPE", Func, 0, "func(info uint8) SymType"},
+		{"ST_VISIBILITY", Func, 0, "func(other uint8) SymVis"},
+		{"Section", Type, 0, ""},
+		{"Section.ReaderAt", Field, 0, ""},
+		{"Section.SectionHeader", Field, 0, ""},
+		{"Section32", Type, 0, ""},
+		{"Section32.Addr", Field, 0, ""},
+		{"Section32.Addralign", Field, 0, ""},
+		{"Section32.Entsize", Field, 0, ""},
+		{"Section32.Flags", Field, 0, ""},
+		{"Section32.Info", Field, 0, ""},
+		{"Section32.Link", Field, 0, ""},
+		{"Section32.Name", Field, 0, ""},
+		{"Section32.Off", Field, 0, ""},
+		{"Section32.Size", Field, 0, ""},
+		{"Section32.Type", Field, 0, ""},
+		{"Section64", Type, 0, ""},
+		{"Section64.Addr", Field, 0, ""},
+		{"Section64.Addralign", Field, 0, ""},
+		{"Section64.Entsize", Field, 0, ""},
+		{"Section64.Flags", Field, 0, ""},
+		{"Section64.Info", Field, 0, ""},
+		{"Section64.Link", Field, 0, ""},
+		{"Section64.Name", Field, 0, ""},
+		{"Section64.Off", Field, 0, ""},
+		{"Section64.Size", Field, 0, ""},
+		{"Section64.Type", Field, 0, ""},
+		{"SectionFlag", Type, 0, ""},
+		{"SectionHeader", Type, 0, ""},
+		{"SectionHeader.Addr", Field, 0, ""},
+		{"SectionHeader.Addralign", Field, 0, ""},
+		{"SectionHeader.Entsize", Field, 0, ""},
+		{"SectionHeader.FileSize", Field, 6, ""},
+		{"SectionHeader.Flags", Field, 0, ""},
+		{"SectionHeader.Info", Field, 0, ""},
+		{"SectionHeader.Link", Field, 0, ""},
+		{"SectionHeader.Name", Field, 0, ""},
+		{"SectionHeader.Offset", Field, 0, ""},
+		{"SectionHeader.Size", Field, 0, ""},
+		{"SectionHeader.Type", Field, 0, ""},
+		{"SectionIndex", Type, 0, ""},
+		{"SectionType", Type, 0, ""},
+		{"Sym32", Type, 0, ""},
+		{"Sym32.Info", Field, 0, ""},
+		{"Sym32.Name", Field, 0, ""},
+		{"Sym32.Other", Field, 0, ""},
+		{"Sym32.Shndx", Field, 0, ""},
+		{"Sym32.Size", Field, 0, ""},
+		{"Sym32.Value", Field, 0, ""},
+		{"Sym32Size", Const, 0, ""},
+		{"Sym64", Type, 0, ""},
+		{"Sym64.Info", Field, 0, ""},
+		{"Sym64.Name", Field, 0, ""},
+		{"Sym64.Other", Field, 0, ""},
+		{"Sym64.Shndx", Field, 0, ""},
+		{"Sym64.Size", Field, 0, ""},
+		{"Sym64.Value", Field, 0, ""},
+		{"Sym64Size", Const, 0, ""},
+		{"SymBind", Type, 0, ""},
+		{"SymType", Type, 0, ""},
+		{"SymVis", Type, 0, ""},
+		{"Symbol", Type, 0, ""},
+		{"Symbol.HasVersion", Field, 24, ""},
+		{"Symbol.Info", Field, 0, ""},
+		{"Symbol.Library", Field, 13, ""},
+		{"Symbol.Name", Field, 0, ""},
+		{"Symbol.Other", Field, 0, ""},
+		{"Symbol.Section", Field, 0, ""},
+		{"Symbol.Size", Field, 0, ""},
+		{"Symbol.Value", Field, 0, ""},
+		{"Symbol.Version", Field, 13, ""},
+		{"Symbol.VersionIndex", Field, 24, ""},
+		{"Type", Type, 0, ""},
+		{"VER_FLG_BASE", Const, 24, ""},
+		{"VER_FLG_INFO", Const, 24, ""},
+		{"VER_FLG_WEAK", Const, 24, ""},
+		{"Version", Type, 0, ""},
+		{"VersionIndex", Type, 24, ""},
+	},
+	"debug/gosym": {
+		{"(*DecodingError).Error", Method, 0, ""},
+		{"(*LineTable).LineToPC", Method, 0, ""},
+		{"(*LineTable).PCToLine", Method, 0, ""},
+		{"(*Sym).BaseName", Method, 0, ""},
+		{"(*Sym).PackageName", Method, 0, ""},
+		{"(*Sym).ReceiverName", Method, 0, ""},
+		{"(*Sym).Static", Method, 0, ""},
+		{"(*Table).LineToPC", Method, 0, ""},
+		{"(*Table).LookupFunc", Method, 0, ""},
+		{"(*Table).LookupSym", Method, 0, ""},
+		{"(*Table).PCToFunc", Method, 0, ""},
+		{"(*Table).PCToLine", Method, 0, ""},
+		{"(*Table).SymByAddr", Method, 0, ""},
+		{"(*UnknownLineError).Error", Method, 0, ""},
+		{"(Func).BaseName", Method, 0, ""},
+		{"(Func).PackageName", Method, 0, ""},
+		{"(Func).ReceiverName", Method, 0, ""},
+		{"(Func).Static", Method, 0, ""},
+		{"(UnknownFileError).Error", Method, 0, ""},
+		{"DecodingError", Type, 0, ""},
+		{"Func", Type, 0, ""},
+		{"Func.End", Field, 0, ""},
+		{"Func.Entry", Field, 0, ""},
+		{"Func.FrameSize", Field, 0, ""},
+		{"Func.LineTable", Field, 0, ""},
+		{"Func.Locals", Field, 0, ""},
+		{"Func.Obj", Field, 0, ""},
+		{"Func.Params", Field, 0, ""},
+		{"Func.Sym", Field, 0, ""},
+		{"LineTable", Type, 0, ""},
+		{"LineTable.Data", Field, 0, ""},
+		{"LineTable.Line", Field, 0, ""},
+		{"LineTable.PC", Field, 0, ""},
+		{"NewLineTable", Func, 0, "func(data []byte, text uint64) *LineTable"},
+		{"NewTable", Func, 0, "func(symtab []byte, pcln *LineTable) (*Table, error)"},
+		{"Obj", Type, 0, ""},
+		{"Obj.Funcs", Field, 0, ""},
+		{"Obj.Paths", Field, 0, ""},
+		{"Sym", Type, 0, ""},
+		{"Sym.Func", Field, 0, ""},
+		{"Sym.GoType", Field, 0, ""},
+		{"Sym.Name", Field, 0, ""},
+		{"Sym.Type", Field, 0, ""},
+		{"Sym.Value", Field, 0, ""},
+		{"Table", Type, 0, ""},
+		{"Table.Files", Field, 0, ""},
+		{"Table.Funcs", Field, 0, ""},
+		{"Table.Objs", Field, 0, ""},
+		{"Table.Syms", Field, 0, ""},
+		{"UnknownFileError", Type, 0, ""},
+		{"UnknownLineError", Type, 0, ""},
+		{"UnknownLineError.File", Field, 0, ""},
+		{"UnknownLineError.Line", Field, 0, ""},
+	},
+	"debug/macho": {
+		{"(*FatFile).Close", Method, 3, ""},
+		{"(*File).Close", Method, 0, ""},
+		{"(*File).DWARF", Method, 0, ""},
+		{"(*File).ImportedLibraries", Method, 0, ""},
+		{"(*File).ImportedSymbols", Method, 0, ""},
+		{"(*File).Section", Method, 0, ""},
+		{"(*File).Segment", Method, 0, ""},
+		{"(*FormatError).Error", Method, 0, ""},
+		{"(*Section).Data", Method, 0, ""},
+		{"(*Section).Open", Method, 0, ""},
+		{"(*Segment).Data", Method, 0, ""},
+		{"(*Segment).Open", Method, 0, ""},
+		{"(Cpu).GoString", Method, 0, ""},
+		{"(Cpu).String", Method, 0, ""},
+		{"(Dylib).Raw", Method, 0, ""},
+		{"(Dysymtab).Raw", Method, 0, ""},
+		{"(FatArch).Close", Method, 3, ""},
+		{"(FatArch).DWARF", Method, 3, ""},
+		{"(FatArch).ImportedLibraries", Method, 3, ""},
+		{"(FatArch).ImportedSymbols", Method, 3, ""},
+		{"(FatArch).Section", Method, 3, ""},
+		{"(FatArch).Segment", Method, 3, ""},
+		{"(LoadBytes).Raw", Method, 0, ""},
+		{"(LoadCmd).GoString", Method, 0, ""},
+		{"(LoadCmd).String", Method, 0, ""},
+		{"(RelocTypeARM).GoString", Method, 10, ""},
+		{"(RelocTypeARM).String", Method, 10, ""},
+		{"(RelocTypeARM64).GoString", Method, 10, ""},
+		{"(RelocTypeARM64).String", Method, 10, ""},
+		{"(RelocTypeGeneric).GoString", Method, 10, ""},
+		{"(RelocTypeGeneric).String", Method, 10, ""},
+		{"(RelocTypeX86_64).GoString", Method, 10, ""},
+		{"(RelocTypeX86_64).String", Method, 10, ""},
+		{"(Rpath).Raw", Method, 10, ""},
+		{"(Section).ReadAt", Method, 0, ""},
+		{"(Segment).Raw", Method, 0, ""},
+		{"(Segment).ReadAt", Method, 0, ""},
+		{"(Symtab).Raw", Method, 0, ""},
+		{"(Type).GoString", Method, 10, ""},
+		{"(Type).String", Method, 10, ""},
+		{"ARM64_RELOC_ADDEND", Const, 10, ""},
+		{"ARM64_RELOC_BRANCH26", Const, 10, ""},
+		{"ARM64_RELOC_GOT_LOAD_PAGE21", Const, 10, ""},
+		{"ARM64_RELOC_GOT_LOAD_PAGEOFF12", Const, 10, ""},
+		{"ARM64_RELOC_PAGE21", Const, 10, ""},
+		{"ARM64_RELOC_PAGEOFF12", Const, 10, ""},
+		{"ARM64_RELOC_POINTER_TO_GOT", Const, 10, ""},
+		{"ARM64_RELOC_SUBTRACTOR", Const, 10, ""},
+		{"ARM64_RELOC_TLVP_LOAD_PAGE21", Const, 10, ""},
+		{"ARM64_RELOC_TLVP_LOAD_PAGEOFF12", Const, 10, ""},
+		{"ARM64_RELOC_UNSIGNED", Const, 10, ""},
+		{"ARM_RELOC_BR24", Const, 10, ""},
+		{"ARM_RELOC_HALF", Const, 10, ""},
+		{"ARM_RELOC_HALF_SECTDIFF", Const, 10, ""},
+		{"ARM_RELOC_LOCAL_SECTDIFF", Const, 10, ""},
+		{"ARM_RELOC_PAIR", Const, 10, ""},
+		{"ARM_RELOC_PB_LA_PTR", Const, 10, ""},
+		{"ARM_RELOC_SECTDIFF", Const, 10, ""},
+		{"ARM_RELOC_VANILLA", Const, 10, ""},
+		{"ARM_THUMB_32BIT_BRANCH", Const, 10, ""},
+		{"ARM_THUMB_RELOC_BR22", Const, 10, ""},
+		{"Cpu", Type, 0, ""},
+		{"Cpu386", Const, 0, ""},
+		{"CpuAmd64", Const, 0, ""},
+		{"CpuArm", Const, 3, ""},
+		{"CpuArm64", Const, 11, ""},
+		{"CpuPpc", Const, 3, ""},
+		{"CpuPpc64", Const, 3, ""},
+		{"Dylib", Type, 0, ""},
+		{"Dylib.CompatVersion", Field, 0, ""},
+		{"Dylib.CurrentVersion", Field, 0, ""},
+		{"Dylib.LoadBytes", Field, 0, ""},
+		{"Dylib.Name", Field, 0, ""},
+		{"Dylib.Time", Field, 0, ""},
+		{"DylibCmd", Type, 0, ""},
+		{"DylibCmd.Cmd", Field, 0, ""},
+		{"DylibCmd.CompatVersion", Field, 0, ""},
+		{"DylibCmd.CurrentVersion", Field, 0, ""},
+		{"DylibCmd.Len", Field, 0, ""},
+		{"DylibCmd.Name", Field, 0, ""},
+		{"DylibCmd.Time", Field, 0, ""},
+		{"Dysymtab", Type, 0, ""},
+		{"Dysymtab.DysymtabCmd", Field, 0, ""},
+		{"Dysymtab.IndirectSyms", Field, 0, ""},
+		{"Dysymtab.LoadBytes", Field, 0, ""},
+		{"DysymtabCmd", Type, 0, ""},
+		{"DysymtabCmd.Cmd", Field, 0, ""},
+		{"DysymtabCmd.Extrefsymoff", Field, 0, ""},
+		{"DysymtabCmd.Extreloff", Field, 0, ""},
+		{"DysymtabCmd.Iextdefsym", Field, 0, ""},
+		{"DysymtabCmd.Ilocalsym", Field, 0, ""},
+		{"DysymtabCmd.Indirectsymoff", Field, 0, ""},
+		{"DysymtabCmd.Iundefsym", Field, 0, ""},
+		{"DysymtabCmd.Len", Field, 0, ""},
+		{"DysymtabCmd.Locreloff", Field, 0, ""},
+		{"DysymtabCmd.Modtaboff", Field, 0, ""},
+		{"DysymtabCmd.Nextdefsym", Field, 0, ""},
+		{"DysymtabCmd.Nextrefsyms", Field, 0, ""},
+		{"DysymtabCmd.Nextrel", Field, 0, ""},
+		{"DysymtabCmd.Nindirectsyms", Field, 0, ""},
+		{"DysymtabCmd.Nlocalsym", Field, 0, ""},
+		{"DysymtabCmd.Nlocrel", Field, 0, ""},
+		{"DysymtabCmd.Nmodtab", Field, 0, ""},
+		{"DysymtabCmd.Ntoc", Field, 0, ""},
+		{"DysymtabCmd.Nundefsym", Field, 0, ""},
+		{"DysymtabCmd.Tocoffset", Field, 0, ""},
+		{"ErrNotFat", Var, 3, ""},
+		{"FatArch", Type, 3, ""},
+		{"FatArch.FatArchHeader", Field, 3, ""},
+		{"FatArch.File", Field, 3, ""},
+		{"FatArchHeader", Type, 3, ""},
+		{"FatArchHeader.Align", Field, 3, ""},
+		{"FatArchHeader.Cpu", Field, 3, ""},
+		{"FatArchHeader.Offset", Field, 3, ""},
+		{"FatArchHeader.Size", Field, 3, ""},
+		{"FatArchHeader.SubCpu", Field, 3, ""},
+		{"FatFile", Type, 3, ""},
+		{"FatFile.Arches", Field, 3, ""},
+		{"FatFile.Magic", Field, 3, ""},
+		{"File", Type, 0, ""},
+		{"File.ByteOrder", Field, 0, ""},
+		{"File.Dysymtab", Field, 0, ""},
+		{"File.FileHeader", Field, 0, ""},
+		{"File.Loads", Field, 0, ""},
+		{"File.Sections", Field, 0, ""},
+		{"File.Symtab", Field, 0, ""},
+		{"FileHeader", Type, 0, ""},
+		{"FileHeader.Cmdsz", Field, 0, ""},
+		{"FileHeader.Cpu", Field, 0, ""},
+		{"FileHeader.Flags", Field, 0, ""},
+		{"FileHeader.Magic", Field, 0, ""},
+		{"FileHeader.Ncmd", Field, 0, ""},
+		{"FileHeader.SubCpu", Field, 0, ""},
+		{"FileHeader.Type", Field, 0, ""},
+		{"FlagAllModsBound", Const, 10, ""},
+		{"FlagAllowStackExecution", Const, 10, ""},
+		{"FlagAppExtensionSafe", Const, 10, ""},
+		{"FlagBindAtLoad", Const, 10, ""},
+		{"FlagBindsToWeak", Const, 10, ""},
+		{"FlagCanonical", Const, 10, ""},
+		{"FlagDeadStrippableDylib", Const, 10, ""},
+		{"FlagDyldLink", Const, 10, ""},
+		{"FlagForceFlat", Const, 10, ""},
+		{"FlagHasTLVDescriptors", Const, 10, ""},
+		{"FlagIncrLink", Const, 10, ""},
+		{"FlagLazyInit", Const, 10, ""},
+		{"FlagNoFixPrebinding", Const, 10, ""},
+		{"FlagNoHeapExecution", Const, 10, ""},
+		{"FlagNoMultiDefs", Const, 10, ""},
+		{"FlagNoReexportedDylibs", Const, 10, ""},
+		{"FlagNoUndefs", Const, 10, ""},
+		{"FlagPIE", Const, 10, ""},
+		{"FlagPrebindable", Const, 10, ""},
+		{"FlagPrebound", Const, 10, ""},
+		{"FlagRootSafe", Const, 10, ""},
+		{"FlagSetuidSafe", Const, 10, ""},
+		{"FlagSplitSegs", Const, 10, ""},
+		{"FlagSubsectionsViaSymbols", Const, 10, ""},
+		{"FlagTwoLevel", Const, 10, ""},
+		{"FlagWeakDefines", Const, 10, ""},
+		{"FormatError", Type, 0, ""},
+		{"GENERIC_RELOC_LOCAL_SECTDIFF", Const, 10, ""},
+		{"GENERIC_RELOC_PAIR", Const, 10, ""},
+		{"GENERIC_RELOC_PB_LA_PTR", Const, 10, ""},
+		{"GENERIC_RELOC_SECTDIFF", Const, 10, ""},
+		{"GENERIC_RELOC_TLV", Const, 10, ""},
+		{"GENERIC_RELOC_VANILLA", Const, 10, ""},
+		{"Load", Type, 0, ""},
+		{"LoadBytes", Type, 0, ""},
+		{"LoadCmd", Type, 0, ""},
+		{"LoadCmdDylib", Const, 0, ""},
+		{"LoadCmdDylinker", Const, 0, ""},
+		{"LoadCmdDysymtab", Const, 0, ""},
+		{"LoadCmdRpath", Const, 10, ""},
+		{"LoadCmdSegment", Const, 0, ""},
+		{"LoadCmdSegment64", Const, 0, ""},
+		{"LoadCmdSymtab", Const, 0, ""},
+		{"LoadCmdThread", Const, 0, ""},
+		{"LoadCmdUnixThread", Const, 0, ""},
+		{"Magic32", Const, 0, ""},
+		{"Magic64", Const, 0, ""},
+		{"MagicFat", Const, 3, ""},
+		{"NewFatFile", Func, 3, "func(r io.ReaderAt) (*FatFile, error)"},
+		{"NewFile", Func, 0, "func(r io.ReaderAt) (*File, error)"},
+		{"Nlist32", Type, 0, ""},
+		{"Nlist32.Desc", Field, 0, ""},
+		{"Nlist32.Name", Field, 0, ""},
+		{"Nlist32.Sect", Field, 0, ""},
+		{"Nlist32.Type", Field, 0, ""},
+		{"Nlist32.Value", Field, 0, ""},
+		{"Nlist64", Type, 0, ""},
+		{"Nlist64.Desc", Field, 0, ""},
+		{"Nlist64.Name", Field, 0, ""},
+		{"Nlist64.Sect", Field, 0, ""},
+		{"Nlist64.Type", Field, 0, ""},
+		{"Nlist64.Value", Field, 0, ""},
+		{"Open", Func, 0, "func(name string) (*File, error)"},
+		{"OpenFat", Func, 3, "func(name string) (*FatFile, error)"},
+		{"Regs386", Type, 0, ""},
+		{"Regs386.AX", Field, 0, ""},
+		{"Regs386.BP", Field, 0, ""},
+		{"Regs386.BX", Field, 0, ""},
+		{"Regs386.CS", Field, 0, ""},
+		{"Regs386.CX", Field, 0, ""},
+		{"Regs386.DI", Field, 0, ""},
+		{"Regs386.DS", Field, 0, ""},
+		{"Regs386.DX", Field, 0, ""},
+		{"Regs386.ES", Field, 0, ""},
+		{"Regs386.FLAGS", Field, 0, ""},
+		{"Regs386.FS", Field, 0, ""},
+		{"Regs386.GS", Field, 0, ""},
+		{"Regs386.IP", Field, 0, ""},
+		{"Regs386.SI", Field, 0, ""},
+		{"Regs386.SP", Field, 0, ""},
+		{"Regs386.SS", Field, 0, ""},
+		{"RegsAMD64", Type, 0, ""},
+		{"RegsAMD64.AX", Field, 0, ""},
+		{"RegsAMD64.BP", Field, 0, ""},
+		{"RegsAMD64.BX", Field, 0, ""},
+		{"RegsAMD64.CS", Field, 0, ""},
+		{"RegsAMD64.CX", Field, 0, ""},
+		{"RegsAMD64.DI", Field, 0, ""},
+		{"RegsAMD64.DX", Field, 0, ""},
+		{"RegsAMD64.FLAGS", Field, 0, ""},
+		{"RegsAMD64.FS", Field, 0, ""},
+		{"RegsAMD64.GS", Field, 0, ""},
+		{"RegsAMD64.IP", Field, 0, ""},
+		{"RegsAMD64.R10", Field, 0, ""},
+		{"RegsAMD64.R11", Field, 0, ""},
+		{"RegsAMD64.R12", Field, 0, ""},
+		{"RegsAMD64.R13", Field, 0, ""},
+		{"RegsAMD64.R14", Field, 0, ""},
+		{"RegsAMD64.R15", Field, 0, ""},
+		{"RegsAMD64.R8", Field, 0, ""},
+		{"RegsAMD64.R9", Field, 0, ""},
+		{"RegsAMD64.SI", Field, 0, ""},
+		{"RegsAMD64.SP", Field, 0, ""},
+		{"Reloc", Type, 10, ""},
+		{"Reloc.Addr", Field, 10, ""},
+		{"Reloc.Extern", Field, 10, ""},
+		{"Reloc.Len", Field, 10, ""},
+		{"Reloc.Pcrel", Field, 10, ""},
+		{"Reloc.Scattered", Field, 10, ""},
+		{"Reloc.Type", Field, 10, ""},
+		{"Reloc.Value", Field, 10, ""},
+		{"RelocTypeARM", Type, 10, ""},
+		{"RelocTypeARM64", Type, 10, ""},
+		{"RelocTypeGeneric", Type, 10, ""},
+		{"RelocTypeX86_64", Type, 10, ""},
+		{"Rpath", Type, 10, ""},
+		{"Rpath.LoadBytes", Field, 10, ""},
+		{"Rpath.Path", Field, 10, ""},
+		{"RpathCmd", Type, 10, ""},
+		{"RpathCmd.Cmd", Field, 10, ""},
+		{"RpathCmd.Len", Field, 10, ""},
+		{"RpathCmd.Path", Field, 10, ""},
+		{"Section", Type, 0, ""},
+		{"Section.ReaderAt", Field, 0, ""},
+		{"Section.Relocs", Field, 10, ""},
+		{"Section.SectionHeader", Field, 0, ""},
+		{"Section32", Type, 0, ""},
+		{"Section32.Addr", Field, 0, ""},
+		{"Section32.Align", Field, 0, ""},
+		{"Section32.Flags", Field, 0, ""},
+		{"Section32.Name", Field, 0, ""},
+		{"Section32.Nreloc", Field, 0, ""},
+		{"Section32.Offset", Field, 0, ""},
+		{"Section32.Reloff", Field, 0, ""},
+		{"Section32.Reserve1", Field, 0, ""},
+		{"Section32.Reserve2", Field, 0, ""},
+		{"Section32.Seg", Field, 0, ""},
+		{"Section32.Size", Field, 0, ""},
+		{"Section64", Type, 0, ""},
+		{"Section64.Addr", Field, 0, ""},
+		{"Section64.Align", Field, 0, ""},
+		{"Section64.Flags", Field, 0, ""},
+		{"Section64.Name", Field, 0, ""},
+		{"Section64.Nreloc", Field, 0, ""},
+		{"Section64.Offset", Field, 0, ""},
+		{"Section64.Reloff", Field, 0, ""},
+		{"Section64.Reserve1", Field, 0, ""},
+		{"Section64.Reserve2", Field, 0, ""},
+		{"Section64.Reserve3", Field, 0, ""},
+		{"Section64.Seg", Field, 0, ""},
+		{"Section64.Size", Field, 0, ""},
+		{"SectionHeader", Type, 0, ""},
+		{"SectionHeader.Addr", Field, 0, ""},
+		{"SectionHeader.Align", Field, 0, ""},
+		{"SectionHeader.Flags", Field, 0, ""},
+		{"SectionHeader.Name", Field, 0, ""},
+		{"SectionHeader.Nreloc", Field, 0, ""},
+		{"SectionHeader.Offset", Field, 0, ""},
+		{"SectionHeader.Reloff", Field, 0, ""},
+		{"SectionHeader.Seg", Field, 0, ""},
+		{"SectionHeader.Size", Field, 0, ""},
+		{"Segment", Type, 0, ""},
+		{"Segment.LoadBytes", Field, 0, ""},
+		{"Segment.ReaderAt", Field, 0, ""},
+		{"Segment.SegmentHeader", Field, 0, ""},
+		{"Segment32", Type, 0, ""},
+		{"Segment32.Addr", Field, 0, ""},
+		{"Segment32.Cmd", Field, 0, ""},
+		{"Segment32.Filesz", Field, 0, ""},
+		{"Segment32.Flag", Field, 0, ""},
+		{"Segment32.Len", Field, 0, ""},
+		{"Segment32.Maxprot", Field, 0, ""},
+		{"Segment32.Memsz", Field, 0, ""},
+		{"Segment32.Name", Field, 0, ""},
+		{"Segment32.Nsect", Field, 0, ""},
+		{"Segment32.Offset", Field, 0, ""},
+		{"Segment32.Prot", Field, 0, ""},
+		{"Segment64", Type, 0, ""},
+		{"Segment64.Addr", Field, 0, ""},
+		{"Segment64.Cmd", Field, 0, ""},
+		{"Segment64.Filesz", Field, 0, ""},
+		{"Segment64.Flag", Field, 0, ""},
+		{"Segment64.Len", Field, 0, ""},
+		{"Segment64.Maxprot", Field, 0, ""},
+		{"Segment64.Memsz", Field, 0, ""},
+		{"Segment64.Name", Field, 0, ""},
+		{"Segment64.Nsect", Field, 0, ""},
+		{"Segment64.Offset", Field, 0, ""},
+		{"Segment64.Prot", Field, 0, ""},
+		{"SegmentHeader", Type, 0, ""},
+		{"SegmentHeader.Addr", Field, 0, ""},
+		{"SegmentHeader.Cmd", Field, 0, ""},
+		{"SegmentHeader.Filesz", Field, 0, ""},
+		{"SegmentHeader.Flag", Field, 0, ""},
+		{"SegmentHeader.Len", Field, 0, ""},
+		{"SegmentHeader.Maxprot", Field, 0, ""},
+		{"SegmentHeader.Memsz", Field, 0, ""},
+		{"SegmentHeader.Name", Field, 0, ""},
+		{"SegmentHeader.Nsect", Field, 0, ""},
+		{"SegmentHeader.Offset", Field, 0, ""},
+		{"SegmentHeader.Prot", Field, 0, ""},
+		{"Symbol", Type, 0, ""},
+		{"Symbol.Desc", Field, 0, ""},
+		{"Symbol.Name", Field, 0, ""},
+		{"Symbol.Sect", Field, 0, ""},
+		{"Symbol.Type", Field, 0, ""},
+		{"Symbol.Value", Field, 0, ""},
+		{"Symtab", Type, 0, ""},
+		{"Symtab.LoadBytes", Field, 0, ""},
+		{"Symtab.Syms", Field, 0, ""},
+		{"Symtab.SymtabCmd", Field, 0, ""},
+		{"SymtabCmd", Type, 0, ""},
+		{"SymtabCmd.Cmd", Field, 0, ""},
+		{"SymtabCmd.Len", Field, 0, ""},
+		{"SymtabCmd.Nsyms", Field, 0, ""},
+		{"SymtabCmd.Stroff", Field, 0, ""},
+		{"SymtabCmd.Strsize", Field, 0, ""},
+		{"SymtabCmd.Symoff", Field, 0, ""},
+		{"Thread", Type, 0, ""},
+		{"Thread.Cmd", Field, 0, ""},
+		{"Thread.Data", Field, 0, ""},
+		{"Thread.Len", Field, 0, ""},
+		{"Thread.Type", Field, 0, ""},
+		{"Type", Type, 0, ""},
+		{"TypeBundle", Const, 3, ""},
+		{"TypeDylib", Const, 3, ""},
+		{"TypeExec", Const, 0, ""},
+		{"TypeObj", Const, 0, ""},
+		{"X86_64_RELOC_BRANCH", Const, 10, ""},
+		{"X86_64_RELOC_GOT", Const, 10, ""},
+		{"X86_64_RELOC_GOT_LOAD", Const, 10, ""},
+		{"X86_64_RELOC_SIGNED", Const, 10, ""},
+		{"X86_64_RELOC_SIGNED_1", Const, 10, ""},
+		{"X86_64_RELOC_SIGNED_2", Const, 10, ""},
+		{"X86_64_RELOC_SIGNED_4", Const, 10, ""},
+		{"X86_64_RELOC_SUBTRACTOR", Const, 10, ""},
+		{"X86_64_RELOC_TLV", Const, 10, ""},
+		{"X86_64_RELOC_UNSIGNED", Const, 10, ""},
+	},
+	"debug/pe": {
+		{"(*COFFSymbol).FullName", Method, 8, ""},
+		{"(*File).COFFSymbolReadSectionDefAux", Method, 19, ""},
+		{"(*File).Close", Method, 0, ""},
+		{"(*File).DWARF", Method, 0, ""},
+		{"(*File).ImportedLibraries", Method, 0, ""},
+		{"(*File).ImportedSymbols", Method, 0, ""},
+		{"(*File).Section", Method, 0, ""},
+		{"(*FormatError).Error", Method, 0, ""},
+		{"(*Section).Data", Method, 0, ""},
+		{"(*Section).Open", Method, 0, ""},
+		{"(Section).ReadAt", Method, 0, ""},
+		{"(StringTable).String", Method, 8, ""},
+		{"COFFSymbol", Type, 1, ""},
+		{"COFFSymbol.Name", Field, 1, ""},
+		{"COFFSymbol.NumberOfAuxSymbols", Field, 1, ""},
+		{"COFFSymbol.SectionNumber", Field, 1, ""},
+		{"COFFSymbol.StorageClass", Field, 1, ""},
+		{"COFFSymbol.Type", Field, 1, ""},
+		{"COFFSymbol.Value", Field, 1, ""},
+		{"COFFSymbolAuxFormat5", Type, 19, ""},
+		{"COFFSymbolAuxFormat5.Checksum", Field, 19, ""},
+		{"COFFSymbolAuxFormat5.NumLineNumbers", Field, 19, ""},
+		{"COFFSymbolAuxFormat5.NumRelocs", Field, 19, ""},
+		{"COFFSymbolAuxFormat5.SecNum", Field, 19, ""},
+		{"COFFSymbolAuxFormat5.Selection", Field, 19, ""},
+		{"COFFSymbolAuxFormat5.Size", Field, 19, ""},
+		{"COFFSymbolSize", Const, 1, ""},
+		{"DataDirectory", Type, 3, ""},
+		{"DataDirectory.Size", Field, 3, ""},
+		{"DataDirectory.VirtualAddress", Field, 3, ""},
+		{"File", Type, 0, ""},
+		{"File.COFFSymbols", Field, 8, ""},
+		{"File.FileHeader", Field, 0, ""},
+		{"File.OptionalHeader", Field, 3, ""},
+		{"File.Sections", Field, 0, ""},
+		{"File.StringTable", Field, 8, ""},
+		{"File.Symbols", Field, 1, ""},
+		{"FileHeader", Type, 0, ""},
+		{"FileHeader.Characteristics", Field, 0, ""},
+		{"FileHeader.Machine", Field, 0, ""},
+		{"FileHeader.NumberOfSections", Field, 0, ""},
+		{"FileHeader.NumberOfSymbols", Field, 0, ""},
+		{"FileHeader.PointerToSymbolTable", Field, 0, ""},
+		{"FileHeader.SizeOfOptionalHeader", Field, 0, ""},
+		{"FileHeader.TimeDateStamp", Field, 0, ""},
+		{"FormatError", Type, 0, ""},
+		{"IMAGE_COMDAT_SELECT_ANY", Const, 19, ""},
+		{"IMAGE_COMDAT_SELECT_ASSOCIATIVE", Const, 19, ""},
+		{"IMAGE_COMDAT_SELECT_EXACT_MATCH", Const, 19, ""},
+		{"IMAGE_COMDAT_SELECT_LARGEST", Const, 19, ""},
+		{"IMAGE_COMDAT_SELECT_NODUPLICATES", Const, 19, ""},
+		{"IMAGE_COMDAT_SELECT_SAME_SIZE", Const, 19, ""},
+		{"IMAGE_DIRECTORY_ENTRY_ARCHITECTURE", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_BASERELOC", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_DEBUG", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_EXCEPTION", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_EXPORT", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_GLOBALPTR", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_IAT", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_IMPORT", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_RESOURCE", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_SECURITY", Const, 11, ""},
+		{"IMAGE_DIRECTORY_ENTRY_TLS", Const, 11, ""},
+		{"IMAGE_DLLCHARACTERISTICS_APPCONTAINER", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_GUARD_CF", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_NO_BIND", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_NO_ISOLATION", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_NO_SEH", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_NX_COMPAT", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE", Const, 15, ""},
+		{"IMAGE_DLLCHARACTERISTICS_WDM_DRIVER", Const, 15, ""},
+		{"IMAGE_FILE_32BIT_MACHINE", Const, 15, ""},
+		{"IMAGE_FILE_AGGRESIVE_WS_TRIM", Const, 15, ""},
+		{"IMAGE_FILE_BYTES_REVERSED_HI", Const, 15, ""},
+		{"IMAGE_FILE_BYTES_REVERSED_LO", Const, 15, ""},
+		{"IMAGE_FILE_DEBUG_STRIPPED", Const, 15, ""},
+		{"IMAGE_FILE_DLL", Const, 15, ""},
+		{"IMAGE_FILE_EXECUTABLE_IMAGE", Const, 15, ""},
+		{"IMAGE_FILE_LARGE_ADDRESS_AWARE", Const, 15, ""},
+		{"IMAGE_FILE_LINE_NUMS_STRIPPED", Const, 15, ""},
+		{"IMAGE_FILE_LOCAL_SYMS_STRIPPED", Const, 15, ""},
+		{"IMAGE_FILE_MACHINE_AM33", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_AMD64", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_ARM", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_ARM64", Const, 11, ""},
+		{"IMAGE_FILE_MACHINE_ARMNT", Const, 12, ""},
+		{"IMAGE_FILE_MACHINE_EBC", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_I386", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_IA64", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_LOONGARCH32", Const, 19, ""},
+		{"IMAGE_FILE_MACHINE_LOONGARCH64", Const, 19, ""},
+		{"IMAGE_FILE_MACHINE_M32R", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_MIPS16", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_MIPSFPU", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_MIPSFPU16", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_POWERPC", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_POWERPCFP", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_R4000", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_RISCV128", Const, 20, ""},
+		{"IMAGE_FILE_MACHINE_RISCV32", Const, 20, ""},
+		{"IMAGE_FILE_MACHINE_RISCV64", Const, 20, ""},
+		{"IMAGE_FILE_MACHINE_SH3", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_SH3DSP", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_SH4", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_SH5", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_THUMB", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_UNKNOWN", Const, 0, ""},
+		{"IMAGE_FILE_MACHINE_WCEMIPSV2", Const, 0, ""},
+		{"IMAGE_FILE_NET_RUN_FROM_SWAP", Const, 15, ""},
+		{"IMAGE_FILE_RELOCS_STRIPPED", Const, 15, ""},
+		{"IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP", Const, 15, ""},
+		{"IMAGE_FILE_SYSTEM", Const, 15, ""},
+		{"IMAGE_FILE_UP_SYSTEM_ONLY", Const, 15, ""},
+		{"IMAGE_SCN_CNT_CODE", Const, 19, ""},
+		{"IMAGE_SCN_CNT_INITIALIZED_DATA", Const, 19, ""},
+		{"IMAGE_SCN_CNT_UNINITIALIZED_DATA", Const, 19, ""},
+		{"IMAGE_SCN_LNK_COMDAT", Const, 19, ""},
+		{"IMAGE_SCN_MEM_DISCARDABLE", Const, 19, ""},
+		{"IMAGE_SCN_MEM_EXECUTE", Const, 19, ""},
+		{"IMAGE_SCN_MEM_READ", Const, 19, ""},
+		{"IMAGE_SCN_MEM_WRITE", Const, 19, ""},
+		{"IMAGE_SUBSYSTEM_EFI_APPLICATION", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_EFI_ROM", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_NATIVE", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_NATIVE_WINDOWS", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_OS2_CUI", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_POSIX_CUI", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_UNKNOWN", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_WINDOWS_CE_GUI", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_WINDOWS_CUI", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_WINDOWS_GUI", Const, 15, ""},
+		{"IMAGE_SUBSYSTEM_XBOX", Const, 15, ""},
+		{"ImportDirectory", Type, 0, ""},
+		{"ImportDirectory.FirstThunk", Field, 0, ""},
+		{"ImportDirectory.ForwarderChain", Field, 0, ""},
+		{"ImportDirectory.Name", Field, 0, ""},
+		{"ImportDirectory.OriginalFirstThunk", Field, 0, ""},
+		{"ImportDirectory.TimeDateStamp", Field, 0, ""},
+		{"NewFile", Func, 0, "func(r io.ReaderAt) (*File, error)"},
+		{"Open", Func, 0, "func(name string) (*File, error)"},
+		{"OptionalHeader32", Type, 3, ""},
+		{"OptionalHeader32.AddressOfEntryPoint", Field, 3, ""},
+		{"OptionalHeader32.BaseOfCode", Field, 3, ""},
+		{"OptionalHeader32.BaseOfData", Field, 3, ""},
+		{"OptionalHeader32.CheckSum", Field, 3, ""},
+		{"OptionalHeader32.DataDirectory", Field, 3, ""},
+		{"OptionalHeader32.DllCharacteristics", Field, 3, ""},
+		{"OptionalHeader32.FileAlignment", Field, 3, ""},
+		{"OptionalHeader32.ImageBase", Field, 3, ""},
+		{"OptionalHeader32.LoaderFlags", Field, 3, ""},
+		{"OptionalHeader32.Magic", Field, 3, ""},
+		{"OptionalHeader32.MajorImageVersion", Field, 3, ""},
+		{"OptionalHeader32.MajorLinkerVersion", Field, 3, ""},
+		{"OptionalHeader32.MajorOperatingSystemVersion", Field, 3, ""},
+		{"OptionalHeader32.MajorSubsystemVersion", Field, 3, ""},
+		{"OptionalHeader32.MinorImageVersion", Field, 3, ""},
+		{"OptionalHeader32.MinorLinkerVersion", Field, 3, ""},
+		{"OptionalHeader32.MinorOperatingSystemVersion", Field, 3, ""},
+		{"OptionalHeader32.MinorSubsystemVersion", Field, 3, ""},
+		{"OptionalHeader32.NumberOfRvaAndSizes", Field, 3, ""},
+		{"OptionalHeader32.SectionAlignment", Field, 3, ""},
+		{"OptionalHeader32.SizeOfCode", Field, 3, ""},
+		{"OptionalHeader32.SizeOfHeaders", Field, 3, ""},
+		{"OptionalHeader32.SizeOfHeapCommit", Field, 3, ""},
+		{"OptionalHeader32.SizeOfHeapReserve", Field, 3, ""},
+		{"OptionalHeader32.SizeOfImage", Field, 3, ""},
+		{"OptionalHeader32.SizeOfInitializedData", Field, 3, ""},
+		{"OptionalHeader32.SizeOfStackCommit", Field, 3, ""},
+		{"OptionalHeader32.SizeOfStackReserve", Field, 3, ""},
+		{"OptionalHeader32.SizeOfUninitializedData", Field, 3, ""},
+		{"OptionalHeader32.Subsystem", Field, 3, ""},
+		{"OptionalHeader32.Win32VersionValue", Field, 3, ""},
+		{"OptionalHeader64", Type, 3, ""},
+		{"OptionalHeader64.AddressOfEntryPoint", Field, 3, ""},
+		{"OptionalHeader64.BaseOfCode", Field, 3, ""},
+		{"OptionalHeader64.CheckSum", Field, 3, ""},
+		{"OptionalHeader64.DataDirectory", Field, 3, ""},
+		{"OptionalHeader64.DllCharacteristics", Field, 3, ""},
+		{"OptionalHeader64.FileAlignment", Field, 3, ""},
+		{"OptionalHeader64.ImageBase", Field, 3, ""},
+		{"OptionalHeader64.LoaderFlags", Field, 3, ""},
+		{"OptionalHeader64.Magic", Field, 3, ""},
+		{"OptionalHeader64.MajorImageVersion", Field, 3, ""},
+		{"OptionalHeader64.MajorLinkerVersion", Field, 3, ""},
+		{"OptionalHeader64.MajorOperatingSystemVersion", Field, 3, ""},
+		{"OptionalHeader64.MajorSubsystemVersion", Field, 3, ""},
+		{"OptionalHeader64.MinorImageVersion", Field, 3, ""},
+		{"OptionalHeader64.MinorLinkerVersion", Field, 3, ""},
+		{"OptionalHeader64.MinorOperatingSystemVersion", Field, 3, ""},
+		{"OptionalHeader64.MinorSubsystemVersion", Field, 3, ""},
+		{"OptionalHeader64.NumberOfRvaAndSizes", Field, 3, ""},
+		{"OptionalHeader64.SectionAlignment", Field, 3, ""},
+		{"OptionalHeader64.SizeOfCode", Field, 3, ""},
+		{"OptionalHeader64.SizeOfHeaders", Field, 3, ""},
+		{"OptionalHeader64.SizeOfHeapCommit", Field, 3, ""},
+		{"OptionalHeader64.SizeOfHeapReserve", Field, 3, ""},
+		{"OptionalHeader64.SizeOfImage", Field, 3, ""},
+		{"OptionalHeader64.SizeOfInitializedData", Field, 3, ""},
+		{"OptionalHeader64.SizeOfStackCommit", Field, 3, ""},
+		{"OptionalHeader64.SizeOfStackReserve", Field, 3, ""},
+		{"OptionalHeader64.SizeOfUninitializedData", Field, 3, ""},
+		{"OptionalHeader64.Subsystem", Field, 3, ""},
+		{"OptionalHeader64.Win32VersionValue", Field, 3, ""},
+		{"Reloc", Type, 8, ""},
+		{"Reloc.SymbolTableIndex", Field, 8, ""},
+		{"Reloc.Type", Field, 8, ""},
+		{"Reloc.VirtualAddress", Field, 8, ""},
+		{"Section", Type, 0, ""},
+		{"Section.ReaderAt", Field, 0, ""},
+		{"Section.Relocs", Field, 8, ""},
+		{"Section.SectionHeader", Field, 0, ""},
+		{"SectionHeader", Type, 0, ""},
+		{"SectionHeader.Characteristics", Field, 0, ""},
+		{"SectionHeader.Name", Field, 0, ""},
+		{"SectionHeader.NumberOfLineNumbers", Field, 0, ""},
+		{"SectionHeader.NumberOfRelocations", Field, 0, ""},
+		{"SectionHeader.Offset", Field, 0, ""},
+		{"SectionHeader.PointerToLineNumbers", Field, 0, ""},
+		{"SectionHeader.PointerToRelocations", Field, 0, ""},
+		{"SectionHeader.Size", Field, 0, ""},
+		{"SectionHeader.VirtualAddress", Field, 0, ""},
+		{"SectionHeader.VirtualSize", Field, 0, ""},
+		{"SectionHeader32", Type, 0, ""},
+		{"SectionHeader32.Characteristics", Field, 0, ""},
+		{"SectionHeader32.Name", Field, 0, ""},
+		{"SectionHeader32.NumberOfLineNumbers", Field, 0, ""},
+		{"SectionHeader32.NumberOfRelocations", Field, 0, ""},
+		{"SectionHeader32.PointerToLineNumbers", Field, 0, ""},
+		{"SectionHeader32.PointerToRawData", Field, 0, ""},
+		{"SectionHeader32.PointerToRelocations", Field, 0, ""},
+		{"SectionHeader32.SizeOfRawData", Field, 0, ""},
+		{"SectionHeader32.VirtualAddress", Field, 0, ""},
+		{"SectionHeader32.VirtualSize", Field, 0, ""},
+		{"StringTable", Type, 8, ""},
+		{"Symbol", Type, 1, ""},
+		{"Symbol.Name", Field, 1, ""},
+		{"Symbol.SectionNumber", Field, 1, ""},
+		{"Symbol.StorageClass", Field, 1, ""},
+		{"Symbol.Type", Field, 1, ""},
+		{"Symbol.Value", Field, 1, ""},
+	},
+	"debug/plan9obj": {
+		{"(*File).Close", Method, 3, ""},
+		{"(*File).Section", Method, 3, ""},
+		{"(*File).Symbols", Method, 3, ""},
+		{"(*Section).Data", Method, 3, ""},
+		{"(*Section).Open", Method, 3, ""},
+		{"(Section).ReadAt", Method, 3, ""},
+		{"ErrNoSymbols", Var, 18, ""},
+		{"File", Type, 3, ""},
+		{"File.FileHeader", Field, 3, ""},
+		{"File.Sections", Field, 3, ""},
+		{"FileHeader", Type, 3, ""},
+		{"FileHeader.Bss", Field, 3, ""},
+		{"FileHeader.Entry", Field, 3, ""},
+		{"FileHeader.HdrSize", Field, 4, ""},
+		{"FileHeader.LoadAddress", Field, 4, ""},
+		{"FileHeader.Magic", Field, 3, ""},
+		{"FileHeader.PtrSize", Field, 3, ""},
+		{"Magic386", Const, 3, ""},
+		{"Magic64", Const, 3, ""},
+		{"MagicAMD64", Const, 3, ""},
+		{"MagicARM", Const, 3, ""},
+		{"NewFile", Func, 3, "func(r io.ReaderAt) (*File, error)"},
+		{"Open", Func, 3, "func(name string) (*File, error)"},
+		{"Section", Type, 3, ""},
+		{"Section.ReaderAt", Field, 3, ""},
+		{"Section.SectionHeader", Field, 3, ""},
+		{"SectionHeader", Type, 3, ""},
+		{"SectionHeader.Name", Field, 3, ""},
+		{"SectionHeader.Offset", Field, 3, ""},
+		{"SectionHeader.Size", Field, 3, ""},
+		{"Sym", Type, 3, ""},
+		{"Sym.Name", Field, 3, ""},
+		{"Sym.Type", Field, 3, ""},
+		{"Sym.Value", Field, 3, ""},
+	},
+	"embed": {
+		{"(FS).Open", Method, 16, ""},
+		{"(FS).ReadDir", Method, 16, ""},
+		{"(FS).ReadFile", Method, 16, ""},
+		{"FS", Type, 16, ""},
+	},
+	"encoding": {
+		{"BinaryAppender", Type, 24, ""},
+		{"BinaryMarshaler", Type, 2, ""},
+		{"BinaryUnmarshaler", Type, 2, ""},
+		{"TextAppender", Type, 24, ""},
+		{"TextMarshaler", Type, 2, ""},
+		{"TextUnmarshaler", Type, 2, ""},
+	},
+	"encoding/ascii85": {
+		{"(CorruptInputError).Error", Method, 0, ""},
+		{"CorruptInputError", Type, 0, ""},
+		{"Decode", Func, 0, "func(dst []byte, src []byte, flush bool) (ndst int, nsrc int, err error)"},
+		{"Encode", Func, 0, "func(dst []byte, src []byte) int"},
+		{"MaxEncodedLen", Func, 0, "func(n int) int"},
+		{"NewDecoder", Func, 0, "func(r io.Reader) io.Reader"},
+		{"NewEncoder", Func, 0, "func(w io.Writer) io.WriteCloser"},
+	},
+	"encoding/asn1": {
+		{"(BitString).At", Method, 0, ""},
+		{"(BitString).RightAlign", Method, 0, ""},
+		{"(ObjectIdentifier).Equal", Method, 0, ""},
+		{"(ObjectIdentifier).String", Method, 3, ""},
+		{"(StructuralError).Error", Method, 0, ""},
+		{"(SyntaxError).Error", Method, 0, ""},
+		{"BitString", Type, 0, ""},
+		{"BitString.BitLength", Field, 0, ""},
+		{"BitString.Bytes", Field, 0, ""},
+		{"ClassApplication", Const, 6, ""},
+		{"ClassContextSpecific", Const, 6, ""},
+		{"ClassPrivate", Const, 6, ""},
+		{"ClassUniversal", Const, 6, ""},
+		{"Enumerated", Type, 0, ""},
+		{"Flag", Type, 0, ""},
+		{"Marshal", Func, 0, "func(val any) ([]byte, error)"},
+		{"MarshalWithParams", Func, 10, "func(val any, params string) ([]byte, error)"},
+		{"NullBytes", Var, 9, ""},
+		{"NullRawValue", Var, 9, ""},
+		{"ObjectIdentifier", Type, 0, ""},
+		{"RawContent", Type, 0, ""},
+		{"RawValue", Type, 0, ""},
+		{"RawValue.Bytes", Field, 0, ""},
+		{"RawValue.Class", Field, 0, ""},
+		{"RawValue.FullBytes", Field, 0, ""},
+		{"RawValue.IsCompound", Field, 0, ""},
+		{"RawValue.Tag", Field, 0, ""},
+		{"StructuralError", Type, 0, ""},
+		{"StructuralError.Msg", Field, 0, ""},
+		{"SyntaxError", Type, 0, ""},
+		{"SyntaxError.Msg", Field, 0, ""},
+		{"TagBMPString", Const, 14, ""},
+		{"TagBitString", Const, 6, ""},
+		{"TagBoolean", Const, 6, ""},
+		{"TagEnum", Const, 6, ""},
+		{"TagGeneralString", Const, 6, ""},
+		{"TagGeneralizedTime", Const, 6, ""},
+		{"TagIA5String", Const, 6, ""},
+		{"TagInteger", Const, 6, ""},
+		{"TagNull", Const, 9, ""},
+		{"TagNumericString", Const, 10, ""},
+		{"TagOID", Const, 6, ""},
+		{"TagOctetString", Const, 6, ""},
+		{"TagPrintableString", Const, 6, ""},
+		{"TagSequence", Const, 6, ""},
+		{"TagSet", Const, 6, ""},
+		{"TagT61String", Const, 6, ""},
+		{"TagUTCTime", Const, 6, ""},
+		{"TagUTF8String", Const, 6, ""},
+		{"Unmarshal", Func, 0, "func(b []byte, val any) (rest []byte, err error)"},
+		{"UnmarshalWithParams", Func, 0, "func(b []byte, val any, params string) (rest []byte, err error)"},
+	},
+	"encoding/base32": {
+		{"(*Encoding).AppendDecode", Method, 22, ""},
+		{"(*Encoding).AppendEncode", Method, 22, ""},
+		{"(*Encoding).Decode", Method, 0, ""},
+		{"(*Encoding).DecodeString", Method, 0, ""},
+		{"(*Encoding).DecodedLen", Method, 0, ""},
+		{"(*Encoding).Encode", Method, 0, ""},
+		{"(*Encoding).EncodeToString", Method, 0, ""},
+		{"(*Encoding).EncodedLen", Method, 0, ""},
+		{"(CorruptInputError).Error", Method, 0, ""},
+		{"(Encoding).WithPadding", Method, 9, ""},
+		{"CorruptInputError", Type, 0, ""},
+		{"Encoding", Type, 0, ""},
+		{"HexEncoding", Var, 0, ""},
+		{"NewDecoder", Func, 0, "func(enc *Encoding, r io.Reader) io.Reader"},
+		{"NewEncoder", Func, 0, "func(enc *Encoding, w io.Writer) io.WriteCloser"},
+		{"NewEncoding", Func, 0, "func(encoder string) *Encoding"},
+		{"NoPadding", Const, 9, ""},
+		{"StdEncoding", Var, 0, ""},
+		{"StdPadding", Const, 9, ""},
+	},
+	"encoding/base64": {
+		{"(*Encoding).AppendDecode", Method, 22, ""},
+		{"(*Encoding).AppendEncode", Method, 22, ""},
+		{"(*Encoding).Decode", Method, 0, ""},
+		{"(*Encoding).DecodeString", Method, 0, ""},
+		{"(*Encoding).DecodedLen", Method, 0, ""},
+		{"(*Encoding).Encode", Method, 0, ""},
+		{"(*Encoding).EncodeToString", Method, 0, ""},
+		{"(*Encoding).EncodedLen", Method, 0, ""},
+		{"(CorruptInputError).Error", Method, 0, ""},
+		{"(Encoding).Strict", Method, 8, ""},
+		{"(Encoding).WithPadding", Method, 5, ""},
+		{"CorruptInputError", Type, 0, ""},
+		{"Encoding", Type, 0, ""},
+		{"NewDecoder", Func, 0, "func(enc *Encoding, r io.Reader) io.Reader"},
+		{"NewEncoder", Func, 0, "func(enc *Encoding, w io.Writer) io.WriteCloser"},
+		{"NewEncoding", Func, 0, "func(encoder string) *Encoding"},
+		{"NoPadding", Const, 5, ""},
+		{"RawStdEncoding", Var, 5, ""},
+		{"RawURLEncoding", Var, 5, ""},
+		{"StdEncoding", Var, 0, ""},
+		{"StdPadding", Const, 5, ""},
+		{"URLEncoding", Var, 0, ""},
+	},
+	"encoding/binary": {
+		{"Append", Func, 23, "func(buf []byte, order ByteOrder, data any) ([]byte, error)"},
+		{"AppendByteOrder", Type, 19, ""},
+		{"AppendUvarint", Func, 19, "func(buf []byte, x uint64) []byte"},
+		{"AppendVarint", Func, 19, "func(buf []byte, x int64) []byte"},
+		{"BigEndian", Var, 0, ""},
+		{"ByteOrder", Type, 0, ""},
+		{"Decode", Func, 23, "func(buf []byte, order ByteOrder, data any) (int, error)"},
+		{"Encode", Func, 23, "func(buf []byte, order ByteOrder, data any) (int, error)"},
+		{"LittleEndian", Var, 0, ""},
+		{"MaxVarintLen16", Const, 0, ""},
+		{"MaxVarintLen32", Const, 0, ""},
+		{"MaxVarintLen64", Const, 0, ""},
+		{"NativeEndian", Var, 21, ""},
+		{"PutUvarint", Func, 0, "func(buf []byte, x uint64) int"},
+		{"PutVarint", Func, 0, "func(buf []byte, x int64) int"},
+		{"Read", Func, 0, "func(r io.Reader, order ByteOrder, data any) error"},
+		{"ReadUvarint", Func, 0, "func(r io.ByteReader) (uint64, error)"},
+		{"ReadVarint", Func, 0, "func(r io.ByteReader) (int64, error)"},
+		{"Size", Func, 0, "func(v any) int"},
+		{"Uvarint", Func, 0, "func(buf []byte) (uint64, int)"},
+		{"Varint", Func, 0, "func(buf []byte) (int64, int)"},
+		{"Write", Func, 0, "func(w io.Writer, order ByteOrder, data any) error"},
+	},
+	"encoding/csv": {
+		{"(*ParseError).Error", Method, 0, ""},
+		{"(*ParseError).Unwrap", Method, 13, ""},
+		{"(*Reader).FieldPos", Method, 17, ""},
+		{"(*Reader).InputOffset", Method, 19, ""},
+		{"(*Reader).Read", Method, 0, ""},
+		{"(*Reader).ReadAll", Method, 0, ""},
+		{"(*Writer).Error", Method, 1, ""},
+		{"(*Writer).Flush", Method, 0, ""},
+		{"(*Writer).Write", Method, 0, ""},
+		{"(*Writer).WriteAll", Method, 0, ""},
+		{"ErrBareQuote", Var, 0, ""},
+		{"ErrFieldCount", Var, 0, ""},
+		{"ErrQuote", Var, 0, ""},
+		{"ErrTrailingComma", Var, 0, ""},
+		{"NewReader", Func, 0, "func(r io.Reader) *Reader"},
+		{"NewWriter", Func, 0, "func(w io.Writer) *Writer"},
+		{"ParseError", Type, 0, ""},
+		{"ParseError.Column", Field, 0, ""},
+		{"ParseError.Err", Field, 0, ""},
+		{"ParseError.Line", Field, 0, ""},
+		{"ParseError.StartLine", Field, 10, ""},
+		{"Reader", Type, 0, ""},
+		{"Reader.Comma", Field, 0, ""},
+		{"Reader.Comment", Field, 0, ""},
+		{"Reader.FieldsPerRecord", Field, 0, ""},
+		{"Reader.LazyQuotes", Field, 0, ""},
+		{"Reader.ReuseRecord", Field, 9, ""},
+		{"Reader.TrailingComma", Field, 0, ""},
+		{"Reader.TrimLeadingSpace", Field, 0, ""},
+		{"Writer", Type, 0, ""},
+		{"Writer.Comma", Field, 0, ""},
+		{"Writer.UseCRLF", Field, 0, ""},
+	},
+	"encoding/gob": {
+		{"(*Decoder).Decode", Method, 0, ""},
+		{"(*Decoder).DecodeValue", Method, 0, ""},
+		{"(*Encoder).Encode", Method, 0, ""},
+		{"(*Encoder).EncodeValue", Method, 0, ""},
+		{"CommonType", Type, 0, ""},
+		{"CommonType.Id", Field, 0, ""},
+		{"CommonType.Name", Field, 0, ""},
+		{"Decoder", Type, 0, ""},
+		{"Encoder", Type, 0, ""},
+		{"GobDecoder", Type, 0, ""},
+		{"GobEncoder", Type, 0, ""},
+		{"NewDecoder", Func, 0, "func(r io.Reader) *Decoder"},
+		{"NewEncoder", Func, 0, "func(w io.Writer) *Encoder"},
+		{"Register", Func, 0, "func(value any)"},
+		{"RegisterName", Func, 0, "func(name string, value any)"},
+	},
+	"encoding/hex": {
+		{"(InvalidByteError).Error", Method, 0, ""},
+		{"AppendDecode", Func, 22, "func(dst []byte, src []byte) ([]byte, error)"},
+		{"AppendEncode", Func, 22, "func(dst []byte, src []byte) []byte"},
+		{"Decode", Func, 0, "func(dst []byte, src []byte) (int, error)"},
+		{"DecodeString", Func, 0, "func(s string) ([]byte, error)"},
+		{"DecodedLen", Func, 0, "func(x int) int"},
+		{"Dump", Func, 0, "func(data []byte) string"},
+		{"Dumper", Func, 0, "func(w io.Writer) io.WriteCloser"},
+		{"Encode", Func, 0, "func(dst []byte, src []byte) int"},
+		{"EncodeToString", Func, 0, "func(src []byte) string"},
+		{"EncodedLen", Func, 0, "func(n int) int"},
+		{"ErrLength", Var, 0, ""},
+		{"InvalidByteError", Type, 0, ""},
+		{"NewDecoder", Func, 10, "func(r io.Reader) io.Reader"},
+		{"NewEncoder", Func, 10, "func(w io.Writer) io.Writer"},
+	},
+	"encoding/json": {
+		{"(*Decoder).Buffered", Method, 1, ""},
+		{"(*Decoder).Decode", Method, 0, ""},
+		{"(*Decoder).DisallowUnknownFields", Method, 10, ""},
+		{"(*Decoder).InputOffset", Method, 14, ""},
+		{"(*Decoder).More", Method, 5, ""},
+		{"(*Decoder).Token", Method, 5, ""},
+		{"(*Decoder).UseNumber", Method, 1, ""},
+		{"(*Encoder).Encode", Method, 0, ""},
+		{"(*Encoder).SetEscapeHTML", Method, 7, ""},
+		{"(*Encoder).SetIndent", Method, 7, ""},
+		{"(*InvalidUTF8Error).Error", Method, 0, ""},
+		{"(*InvalidUnmarshalError).Error", Method, 0, ""},
+		{"(*MarshalerError).Error", Method, 0, ""},
+		{"(*MarshalerError).Unwrap", Method, 13, ""},
+		{"(*RawMessage).MarshalJSON", Method, 0, ""},
+		{"(*RawMessage).UnmarshalJSON", Method, 0, ""},
+		{"(*SyntaxError).Error", Method, 0, ""},
+		{"(*UnmarshalFieldError).Error", Method, 0, ""},
+		{"(*UnmarshalTypeError).Error", Method, 0, ""},
+		{"(*UnsupportedTypeError).Error", Method, 0, ""},
+		{"(*UnsupportedValueError).Error", Method, 0, ""},
+		{"(Delim).String", Method, 5, ""},
+		{"(Number).Float64", Method, 1, ""},
+		{"(Number).Int64", Method, 1, ""},
+		{"(Number).String", Method, 1, ""},
+		{"(RawMessage).MarshalJSON", Method, 8, ""},
+		{"Compact", Func, 0, "func(dst *bytes.Buffer, src []byte) error"},
+		{"Decoder", Type, 0, ""},
+		{"Delim", Type, 5, ""},
+		{"Encoder", Type, 0, ""},
+		{"HTMLEscape", Func, 0, "func(dst *bytes.Buffer, src []byte)"},
+		{"Indent", Func, 0, "func(dst *bytes.Buffer, src []byte, prefix string, indent string) error"},
+		{"InvalidUTF8Error", Type, 0, ""},
+		{"InvalidUTF8Error.S", Field, 0, ""},
+		{"InvalidUnmarshalError", Type, 0, ""},
+		{"InvalidUnmarshalError.Type", Field, 0, ""},
+		{"Marshal", Func, 0, "func(v any) ([]byte, error)"},
+		{"MarshalIndent", Func, 0, "func(v any, prefix string, indent string) ([]byte, error)"},
+		{"Marshaler", Type, 0, ""},
+		{"MarshalerError", Type, 0, ""},
+		{"MarshalerError.Err", Field, 0, ""},
+		{"MarshalerError.Type", Field, 0, ""},
+		{"NewDecoder", Func, 0, "func(r io.Reader) *Decoder"},
+		{"NewEncoder", Func, 0, "func(w io.Writer) *Encoder"},
+		{"Number", Type, 1, ""},
+		{"RawMessage", Type, 0, ""},
+		{"SyntaxError", Type, 0, ""},
+		{"SyntaxError.Offset", Field, 0, ""},
+		{"Token", Type, 5, ""},
+		{"Unmarshal", Func, 0, "func(data []byte, v any) error"},
+		{"UnmarshalFieldError", Type, 0, ""},
+		{"UnmarshalFieldError.Field", Field, 0, ""},
+		{"UnmarshalFieldError.Key", Field, 0, ""},
+		{"UnmarshalFieldError.Type", Field, 0, ""},
+		{"UnmarshalTypeError", Type, 0, ""},
+		{"UnmarshalTypeError.Field", Field, 8, ""},
+		{"UnmarshalTypeError.Offset", Field, 5, ""},
+		{"UnmarshalTypeError.Struct", Field, 8, ""},
+		{"UnmarshalTypeError.Type", Field, 0, ""},
+		{"UnmarshalTypeError.Value", Field, 0, ""},
+		{"Unmarshaler", Type, 0, ""},
+		{"UnsupportedTypeError", Type, 0, ""},
+		{"UnsupportedTypeError.Type", Field, 0, ""},
+		{"UnsupportedValueError", Type, 0, ""},
+		{"UnsupportedValueError.Str", Field, 0, ""},
+		{"UnsupportedValueError.Value", Field, 0, ""},
+		{"Valid", Func, 9, "func(data []byte) bool"},
+	},
+	"encoding/pem": {
+		{"Block", Type, 0, ""},
+		{"Block.Bytes", Field, 0, ""},
+		{"Block.Headers", Field, 0, ""},
+		{"Block.Type", Field, 0, ""},
+		{"Decode", Func, 0, "func(data []byte) (p *Block, rest []byte)"},
+		{"Encode", Func, 0, "func(out io.Writer, b *Block) error"},
+		{"EncodeToMemory", Func, 0, "func(b *Block) []byte"},
+	},
+	"encoding/xml": {
+		{"(*Decoder).Decode", Method, 0, ""},
+		{"(*Decoder).DecodeElement", Method, 0, ""},
+		{"(*Decoder).InputOffset", Method, 4, ""},
+		{"(*Decoder).InputPos", Method, 19, ""},
+		{"(*Decoder).RawToken", Method, 0, ""},
+		{"(*Decoder).Skip", Method, 0, ""},
+		{"(*Decoder).Token", Method, 0, ""},
+		{"(*Encoder).Close", Method, 20, ""},
+		{"(*Encoder).Encode", Method, 0, ""},
+		{"(*Encoder).EncodeElement", Method, 2, ""},
+		{"(*Encoder).EncodeToken", Method, 2, ""},
+		{"(*Encoder).Flush", Method, 2, ""},
+		{"(*Encoder).Indent", Method, 1, ""},
+		{"(*SyntaxError).Error", Method, 0, ""},
+		{"(*TagPathError).Error", Method, 0, ""},
+		{"(*UnsupportedTypeError).Error", Method, 0, ""},
+		{"(CharData).Copy", Method, 0, ""},
+		{"(Comment).Copy", Method, 0, ""},
+		{"(Directive).Copy", Method, 0, ""},
+		{"(ProcInst).Copy", Method, 0, ""},
+		{"(StartElement).Copy", Method, 0, ""},
+		{"(StartElement).End", Method, 2, ""},
+		{"(UnmarshalError).Error", Method, 0, ""},
+		{"Attr", Type, 0, ""},
+		{"Attr.Name", Field, 0, ""},
+		{"Attr.Value", Field, 0, ""},
+		{"CharData", Type, 0, ""},
+		{"Comment", Type, 0, ""},
+		{"CopyToken", Func, 0, "func(t Token) Token"},
+		{"Decoder", Type, 0, ""},
+		{"Decoder.AutoClose", Field, 0, ""},
+		{"Decoder.CharsetReader", Field, 0, ""},
+		{"Decoder.DefaultSpace", Field, 1, ""},
+		{"Decoder.Entity", Field, 0, ""},
+		{"Decoder.Strict", Field, 0, ""},
+		{"Directive", Type, 0, ""},
+		{"Encoder", Type, 0, ""},
+		{"EndElement", Type, 0, ""},
+		{"EndElement.Name", Field, 0, ""},
+		{"Escape", Func, 0, "func(w io.Writer, s []byte)"},
+		{"EscapeText", Func, 1, "func(w io.Writer, s []byte) error"},
+		{"HTMLAutoClose", Var, 0, ""},
+		{"HTMLEntity", Var, 0, ""},
+		{"Header", Const, 0, ""},
+		{"Marshal", Func, 0, "func(v any) ([]byte, error)"},
+		{"MarshalIndent", Func, 0, "func(v any, prefix string, indent string) ([]byte, error)"},
+		{"Marshaler", Type, 2, ""},
+		{"MarshalerAttr", Type, 2, ""},
+		{"Name", Type, 0, ""},
+		{"Name.Local", Field, 0, ""},
+		{"Name.Space", Field, 0, ""},
+		{"NewDecoder", Func, 0, "func(r io.Reader) *Decoder"},
+		{"NewEncoder", Func, 0, "func(w io.Writer) *Encoder"},
+		{"NewTokenDecoder", Func, 10, "func(t TokenReader) *Decoder"},
+		{"ProcInst", Type, 0, ""},
+		{"ProcInst.Inst", Field, 0, ""},
+		{"ProcInst.Target", Field, 0, ""},
+		{"StartElement", Type, 0, ""},
+		{"StartElement.Attr", Field, 0, ""},
+		{"StartElement.Name", Field, 0, ""},
+		{"SyntaxError", Type, 0, ""},
+		{"SyntaxError.Line", Field, 0, ""},
+		{"SyntaxError.Msg", Field, 0, ""},
+		{"TagPathError", Type, 0, ""},
+		{"TagPathError.Field1", Field, 0, ""},
+		{"TagPathError.Field2", Field, 0, ""},
+		{"TagPathError.Struct", Field, 0, ""},
+		{"TagPathError.Tag1", Field, 0, ""},
+		{"TagPathError.Tag2", Field, 0, ""},
+		{"Token", Type, 0, ""},
+		{"TokenReader", Type, 10, ""},
+		{"Unmarshal", Func, 0, "func(data []byte, v any) error"},
+		{"UnmarshalError", Type, 0, ""},
+		{"Unmarshaler", Type, 2, ""},
+		{"UnmarshalerAttr", Type, 2, ""},
+		{"UnsupportedTypeError", Type, 0, ""},
+		{"UnsupportedTypeError.Type", Field, 0, ""},
+	},
+	"errors": {
+		{"As", Func, 13, "func(err error, target any) bool"},
+		{"ErrUnsupported", Var, 21, ""},
+		{"Is", Func, 13, "func(err error, target error) bool"},
+		{"Join", Func, 20, "func(errs ...error) error"},
+		{"New", Func, 0, "func(text string) error"},
+		{"Unwrap", Func, 13, "func(err error) error"},
+	},
+	"expvar": {
+		{"(*Float).Add", Method, 0, ""},
+		{"(*Float).Set", Method, 0, ""},
+		{"(*Float).String", Method, 0, ""},
+		{"(*Float).Value", Method, 8, ""},
+		{"(*Int).Add", Method, 0, ""},
+		{"(*Int).Set", Method, 0, ""},
+		{"(*Int).String", Method, 0, ""},
+		{"(*Int).Value", Method, 8, ""},
+		{"(*Map).Add", Method, 0, ""},
+		{"(*Map).AddFloat", Method, 0, ""},
+		{"(*Map).Delete", Method, 12, ""},
+		{"(*Map).Do", Method, 0, ""},
+		{"(*Map).Get", Method, 0, ""},
+		{"(*Map).Init", Method, 0, ""},
+		{"(*Map).Set", Method, 0, ""},
+		{"(*Map).String", Method, 0, ""},
+		{"(*String).Set", Method, 0, ""},
+		{"(*String).String", Method, 0, ""},
+		{"(*String).Value", Method, 8, ""},
+		{"(Func).String", Method, 0, ""},
+		{"(Func).Value", Method, 8, ""},
+		{"Do", Func, 0, "func(f func(KeyValue))"},
+		{"Float", Type, 0, ""},
+		{"Func", Type, 0, ""},
+		{"Get", Func, 0, "func(name string) Var"},
+		{"Handler", Func, 8, "func() http.Handler"},
+		{"Int", Type, 0, ""},
+		{"KeyValue", Type, 0, ""},
+		{"KeyValue.Key", Field, 0, ""},
+		{"KeyValue.Value", Field, 0, ""},
+		{"Map", Type, 0, ""},
+		{"NewFloat", Func, 0, "func(name string) *Float"},
+		{"NewInt", Func, 0, "func(name string) *Int"},
+		{"NewMap", Func, 0, "func(name string) *Map"},
+		{"NewString", Func, 0, "func(name string) *String"},
+		{"Publish", Func, 0, "func(name string, v Var)"},
+		{"String", Type, 0, ""},
+		{"Var", Type, 0, ""},
+	},
+	"flag": {
+		{"(*FlagSet).Arg", Method, 0, ""},
+		{"(*FlagSet).Args", Method, 0, ""},
+		{"(*FlagSet).Bool", Method, 0, ""},
+		{"(*FlagSet).BoolFunc", Method, 21, ""},
+		{"(*FlagSet).BoolVar", Method, 0, ""},
+		{"(*FlagSet).Duration", Method, 0, ""},
+		{"(*FlagSet).DurationVar", Method, 0, ""},
+		{"(*FlagSet).ErrorHandling", Method, 10, ""},
+		{"(*FlagSet).Float64", Method, 0, ""},
+		{"(*FlagSet).Float64Var", Method, 0, ""},
+		{"(*FlagSet).Func", Method, 16, ""},
+		{"(*FlagSet).Init", Method, 0, ""},
+		{"(*FlagSet).Int", Method, 0, ""},
+		{"(*FlagSet).Int64", Method, 0, ""},
+		{"(*FlagSet).Int64Var", Method, 0, ""},
+		{"(*FlagSet).IntVar", Method, 0, ""},
+		{"(*FlagSet).Lookup", Method, 0, ""},
+		{"(*FlagSet).NArg", Method, 0, ""},
+		{"(*FlagSet).NFlag", Method, 0, ""},
+		{"(*FlagSet).Name", Method, 10, ""},
+		{"(*FlagSet).Output", Method, 10, ""},
+		{"(*FlagSet).Parse", Method, 0, ""},
+		{"(*FlagSet).Parsed", Method, 0, ""},
+		{"(*FlagSet).PrintDefaults", Method, 0, ""},
+		{"(*FlagSet).Set", Method, 0, ""},
+		{"(*FlagSet).SetOutput", Method, 0, ""},
+		{"(*FlagSet).String", Method, 0, ""},
+		{"(*FlagSet).StringVar", Method, 0, ""},
+		{"(*FlagSet).TextVar", Method, 19, ""},
+		{"(*FlagSet).Uint", Method, 0, ""},
+		{"(*FlagSet).Uint64", Method, 0, ""},
+		{"(*FlagSet).Uint64Var", Method, 0, ""},
+		{"(*FlagSet).UintVar", Method, 0, ""},
+		{"(*FlagSet).Var", Method, 0, ""},
+		{"(*FlagSet).Visit", Method, 0, ""},
+		{"(*FlagSet).VisitAll", Method, 0, ""},
+		{"Arg", Func, 0, "func(i int) string"},
+		{"Args", Func, 0, "func() []string"},
+		{"Bool", Func, 0, "func(name string, value bool, usage string) *bool"},
+		{"BoolFunc", Func, 21, "func(name string, usage string, fn func(string) error)"},
+		{"BoolVar", Func, 0, "func(p *bool, name string, value bool, usage string)"},
+		{"CommandLine", Var, 2, ""},
+		{"ContinueOnError", Const, 0, ""},
+		{"Duration", Func, 0, "func(name string, value time.Duration, usage string) *time.Duration"},
+		{"DurationVar", Func, 0, "func(p *time.Duration, name string, value time.Duration, usage string)"},
+		{"ErrHelp", Var, 0, ""},
+		{"ErrorHandling", Type, 0, ""},
+		{"ExitOnError", Const, 0, ""},
+		{"Flag", Type, 0, ""},
+		{"Flag.DefValue", Field, 0, ""},
+		{"Flag.Name", Field, 0, ""},
+		{"Flag.Usage", Field, 0, ""},
+		{"Flag.Value", Field, 0, ""},
+		{"FlagSet", Type, 0, ""},
+		{"FlagSet.Usage", Field, 0, ""},
+		{"Float64", Func, 0, "func(name string, value float64, usage string) *float64"},
+		{"Float64Var", Func, 0, "func(p *float64, name string, value float64, usage string)"},
+		{"Func", Func, 16, "func(name string, usage string, fn func(string) error)"},
+		{"Getter", Type, 2, ""},
+		{"Int", Func, 0, "func(name string, value int, usage string) *int"},
+		{"Int64", Func, 0, "func(name string, value int64, usage string) *int64"},
+		{"Int64Var", Func, 0, "func(p *int64, name string, value int64, usage string)"},
+		{"IntVar", Func, 0, "func(p *int, name string, value int, usage string)"},
+		{"Lookup", Func, 0, "func(name string) *Flag"},
+		{"NArg", Func, 0, "func() int"},
+		{"NFlag", Func, 0, "func() int"},
+		{"NewFlagSet", Func, 0, "func(name string, errorHandling ErrorHandling) *FlagSet"},
+		{"PanicOnError", Const, 0, ""},
+		{"Parse", Func, 0, "func()"},
+		{"Parsed", Func, 0, "func() bool"},
+		{"PrintDefaults", Func, 0, "func()"},
+		{"Set", Func, 0, "func(name string, value string) error"},
+		{"String", Func, 0, "func(name string, value string, usage string) *string"},
+		{"StringVar", Func, 0, "func(p *string, name string, value string, usage string)"},
+		{"TextVar", Func, 19, "func(p encoding.TextUnmarshaler, name string, value encoding.TextMarshaler, usage string)"},
+		{"Uint", Func, 0, "func(name string, value uint, usage string) *uint"},
+		{"Uint64", Func, 0, "func(name string, value uint64, usage string) *uint64"},
+		{"Uint64Var", Func, 0, "func(p *uint64, name string, value uint64, usage string)"},
+		{"UintVar", Func, 0, "func(p *uint, name string, value uint, usage string)"},
+		{"UnquoteUsage", Func, 5, "func(flag *Flag) (name string, usage string)"},
+		{"Usage", Var, 0, ""},
+		{"Value", Type, 0, ""},
+		{"Var", Func, 0, "func(value Value, name string, usage string)"},
+		{"Visit", Func, 0, "func(fn func(*Flag))"},
+		{"VisitAll", Func, 0, "func(fn func(*Flag))"},
+	},
+	"fmt": {
+		{"Append", Func, 19, "func(b []byte, a ...any) []byte"},
+		{"Appendf", Func, 19, "func(b []byte, format string, a ...any) []byte"},
+		{"Appendln", Func, 19, "func(b []byte, a ...any) []byte"},
+		{"Errorf", Func, 0, "func(format string, a ...any) error"},
+		{"FormatString", Func, 20, "func(state State, verb rune) string"},
+		{"Formatter", Type, 0, ""},
+		{"Fprint", Func, 0, "func(w io.Writer, a ...any) (n int, err error)"},
+		{"Fprintf", Func, 0, "func(w io.Writer, format string, a ...any) (n int, err error)"},
+		{"Fprintln", Func, 0, "func(w io.Writer, a ...any) (n int, err error)"},
+		{"Fscan", Func, 0, "func(r io.Reader, a ...any) (n int, err error)"},
+		{"Fscanf", Func, 0, "func(r io.Reader, format string, a ...any) (n int, err error)"},
+		{"Fscanln", Func, 0, "func(r io.Reader, a ...any) (n int, err error)"},
+		{"GoStringer", Type, 0, ""},
+		{"Print", Func, 0, "func(a ...any) (n int, err error)"},
+		{"Printf", Func, 0, "func(format string, a ...any) (n int, err error)"},
+		{"Println", Func, 0, "func(a ...any) (n int, err error)"},
+		{"Scan", Func, 0, "func(a ...any) (n int, err error)"},
+		{"ScanState", Type, 0, ""},
+		{"Scanf", Func, 0, "func(format string, a ...any) (n int, err error)"},
+		{"Scanln", Func, 0, "func(a ...any) (n int, err error)"},
+		{"Scanner", Type, 0, ""},
+		{"Sprint", Func, 0, "func(a ...any) string"},
+		{"Sprintf", Func, 0, "func(format string, a ...any) string"},
+		{"Sprintln", Func, 0, "func(a ...any) string"},
+		{"Sscan", Func, 0, "func(str string, a ...any) (n int, err error)"},
+		{"Sscanf", Func, 0, "func(str string, format string, a ...any) (n int, err error)"},
+		{"Sscanln", Func, 0, "func(str string, a ...any) (n int, err error)"},
+		{"State", Type, 0, ""},
+		{"Stringer", Type, 0, ""},
+	},
+	"go/ast": {
+		{"(*ArrayType).End", Method, 0, ""},
+		{"(*ArrayType).Pos", Method, 0, ""},
+		{"(*AssignStmt).End", Method, 0, ""},
+		{"(*AssignStmt).Pos", Method, 0, ""},
+		{"(*BadDecl).End", Method, 0, ""},
+		{"(*BadDecl).Pos", Method, 0, ""},
+		{"(*BadExpr).End", Method, 0, ""},
+		{"(*BadExpr).Pos", Method, 0, ""},
+		{"(*BadStmt).End", Method, 0, ""},
+		{"(*BadStmt).Pos", Method, 0, ""},
+		{"(*BasicLit).End", Method, 0, ""},
+		{"(*BasicLit).Pos", Method, 0, ""},
+		{"(*BinaryExpr).End", Method, 0, ""},
+		{"(*BinaryExpr).Pos", Method, 0, ""},
+		{"(*BlockStmt).End", Method, 0, ""},
+		{"(*BlockStmt).Pos", Method, 0, ""},
+		{"(*BranchStmt).End", Method, 0, ""},
+		{"(*BranchStmt).Pos", Method, 0, ""},
+		{"(*CallExpr).End", Method, 0, ""},
+		{"(*CallExpr).Pos", Method, 0, ""},
+		{"(*CaseClause).End", Method, 0, ""},
+		{"(*CaseClause).Pos", Method, 0, ""},
+		{"(*ChanType).End", Method, 0, ""},
+		{"(*ChanType).Pos", Method, 0, ""},
+		{"(*CommClause).End", Method, 0, ""},
+		{"(*CommClause).Pos", Method, 0, ""},
+		{"(*Comment).End", Method, 0, ""},
+		{"(*Comment).Pos", Method, 0, ""},
+		{"(*CommentGroup).End", Method, 0, ""},
+		{"(*CommentGroup).Pos", Method, 0, ""},
+		{"(*CommentGroup).Text", Method, 0, ""},
+		{"(*CompositeLit).End", Method, 0, ""},
+		{"(*CompositeLit).Pos", Method, 0, ""},
+		{"(*DeclStmt).End", Method, 0, ""},
+		{"(*DeclStmt).Pos", Method, 0, ""},
+		{"(*DeferStmt).End", Method, 0, ""},
+		{"(*DeferStmt).Pos", Method, 0, ""},
+		{"(*Ellipsis).End", Method, 0, ""},
+		{"(*Ellipsis).Pos", Method, 0, ""},
+		{"(*EmptyStmt).End", Method, 0, ""},
+		{"(*EmptyStmt).Pos", Method, 0, ""},
+		{"(*ExprStmt).End", Method, 0, ""},
+		{"(*ExprStmt).Pos", Method, 0, ""},
+		{"(*Field).End", Method, 0, ""},
+		{"(*Field).Pos", Method, 0, ""},
+		{"(*FieldList).End", Method, 0, ""},
+		{"(*FieldList).NumFields", Method, 0, ""},
+		{"(*FieldList).Pos", Method, 0, ""},
+		{"(*File).End", Method, 0, ""},
+		{"(*File).Pos", Method, 0, ""},
+		{"(*ForStmt).End", Method, 0, ""},
+		{"(*ForStmt).Pos", Method, 0, ""},
+		{"(*FuncDecl).End", Method, 0, ""},
+		{"(*FuncDecl).Pos", Method, 0, ""},
+		{"(*FuncLit).End", Method, 0, ""},
+		{"(*FuncLit).Pos", Method, 0, ""},
+		{"(*FuncType).End", Method, 0, ""},
+		{"(*FuncType).Pos", Method, 0, ""},
+		{"(*GenDecl).End", Method, 0, ""},
+		{"(*GenDecl).Pos", Method, 0, ""},
+		{"(*GoStmt).End", Method, 0, ""},
+		{"(*GoStmt).Pos", Method, 0, ""},
+		{"(*Ident).End", Method, 0, ""},
+		{"(*Ident).IsExported", Method, 0, ""},
+		{"(*Ident).Pos", Method, 0, ""},
+		{"(*Ident).String", Method, 0, ""},
+		{"(*IfStmt).End", Method, 0, ""},
+		{"(*IfStmt).Pos", Method, 0, ""},
+		{"(*ImportSpec).End", Method, 0, ""},
+		{"(*ImportSpec).Pos", Method, 0, ""},
+		{"(*IncDecStmt).End", Method, 0, ""},
+		{"(*IncDecStmt).Pos", Method, 0, ""},
+		{"(*IndexExpr).End", Method, 0, ""},
+		{"(*IndexExpr).Pos", Method, 0, ""},
+		{"(*IndexListExpr).End", Method, 18, ""},
+		{"(*IndexListExpr).Pos", Method, 18, ""},
+		{"(*InterfaceType).End", Method, 0, ""},
+		{"(*InterfaceType).Pos", Method, 0, ""},
+		{"(*KeyValueExpr).End", Method, 0, ""},
+		{"(*KeyValueExpr).Pos", Method, 0, ""},
+		{"(*LabeledStmt).End", Method, 0, ""},
+		{"(*LabeledStmt).Pos", Method, 0, ""},
+		{"(*MapType).End", Method, 0, ""},
+		{"(*MapType).Pos", Method, 0, ""},
+		{"(*Object).Pos", Method, 0, ""},
+		{"(*Package).End", Method, 0, ""},
+		{"(*Package).Pos", Method, 0, ""},
+		{"(*ParenExpr).End", Method, 0, ""},
+		{"(*ParenExpr).Pos", Method, 0, ""},
+		{"(*RangeStmt).End", Method, 0, ""},
+		{"(*RangeStmt).Pos", Method, 0, ""},
+		{"(*ReturnStmt).End", Method, 0, ""},
+		{"(*ReturnStmt).Pos", Method, 0, ""},
+		{"(*Scope).Insert", Method, 0, ""},
+		{"(*Scope).Lookup", Method, 0, ""},
+		{"(*Scope).String", Method, 0, ""},
+		{"(*SelectStmt).End", Method, 0, ""},
+		{"(*SelectStmt).Pos", Method, 0, ""},
+		{"(*SelectorExpr).End", Method, 0, ""},
+		{"(*SelectorExpr).Pos", Method, 0, ""},
+		{"(*SendStmt).End", Method, 0, ""},
+		{"(*SendStmt).Pos", Method, 0, ""},
+		{"(*SliceExpr).End", Method, 0, ""},
+		{"(*SliceExpr).Pos", Method, 0, ""},
+		{"(*StarExpr).End", Method, 0, ""},
+		{"(*StarExpr).Pos", Method, 0, ""},
+		{"(*StructType).End", Method, 0, ""},
+		{"(*StructType).Pos", Method, 0, ""},
+		{"(*SwitchStmt).End", Method, 0, ""},
+		{"(*SwitchStmt).Pos", Method, 0, ""},
+		{"(*TypeAssertExpr).End", Method, 0, ""},
+		{"(*TypeAssertExpr).Pos", Method, 0, ""},
+		{"(*TypeSpec).End", Method, 0, ""},
+		{"(*TypeSpec).Pos", Method, 0, ""},
+		{"(*TypeSwitchStmt).End", Method, 0, ""},
+		{"(*TypeSwitchStmt).Pos", Method, 0, ""},
+		{"(*UnaryExpr).End", Method, 0, ""},
+		{"(*UnaryExpr).Pos", Method, 0, ""},
+		{"(*ValueSpec).End", Method, 0, ""},
+		{"(*ValueSpec).Pos", Method, 0, ""},
+		{"(CommentMap).Comments", Method, 1, ""},
+		{"(CommentMap).Filter", Method, 1, ""},
+		{"(CommentMap).String", Method, 1, ""},
+		{"(CommentMap).Update", Method, 1, ""},
+		{"(ObjKind).String", Method, 0, ""},
+		{"ArrayType", Type, 0, ""},
+		{"ArrayType.Elt", Field, 0, ""},
+		{"ArrayType.Lbrack", Field, 0, ""},
+		{"ArrayType.Len", Field, 0, ""},
+		{"AssignStmt", Type, 0, ""},
+		{"AssignStmt.Lhs", Field, 0, ""},
+		{"AssignStmt.Rhs", Field, 0, ""},
+		{"AssignStmt.Tok", Field, 0, ""},
+		{"AssignStmt.TokPos", Field, 0, ""},
+		{"Bad", Const, 0, ""},
+		{"BadDecl", Type, 0, ""},
+		{"BadDecl.From", Field, 0, ""},
+		{"BadDecl.To", Field, 0, ""},
+		{"BadExpr", Type, 0, ""},
+		{"BadExpr.From", Field, 0, ""},
+		{"BadExpr.To", Field, 0, ""},
+		{"BadStmt", Type, 0, ""},
+		{"BadStmt.From", Field, 0, ""},
+		{"BadStmt.To", Field, 0, ""},
+		{"BasicLit", Type, 0, ""},
+		{"BasicLit.Kind", Field, 0, ""},
+		{"BasicLit.Value", Field, 0, ""},
+		{"BasicLit.ValuePos", Field, 0, ""},
+		{"BinaryExpr", Type, 0, ""},
+		{"BinaryExpr.Op", Field, 0, ""},
+		{"BinaryExpr.OpPos", Field, 0, ""},
+		{"BinaryExpr.X", Field, 0, ""},
+		{"BinaryExpr.Y", Field, 0, ""},
+		{"BlockStmt", Type, 0, ""},
+		{"BlockStmt.Lbrace", Field, 0, ""},
+		{"BlockStmt.List", Field, 0, ""},
+		{"BlockStmt.Rbrace", Field, 0, ""},
+		{"BranchStmt", Type, 0, ""},
+		{"BranchStmt.Label", Field, 0, ""},
+		{"BranchStmt.Tok", Field, 0, ""},
+		{"BranchStmt.TokPos", Field, 0, ""},
+		{"CallExpr", Type, 0, ""},
+		{"CallExpr.Args", Field, 0, ""},
+		{"CallExpr.Ellipsis", Field, 0, ""},
+		{"CallExpr.Fun", Field, 0, ""},
+		{"CallExpr.Lparen", Field, 0, ""},
+		{"CallExpr.Rparen", Field, 0, ""},
+		{"CaseClause", Type, 0, ""},
+		{"CaseClause.Body", Field, 0, ""},
+		{"CaseClause.Case", Field, 0, ""},
+		{"CaseClause.Colon", Field, 0, ""},
+		{"CaseClause.List", Field, 0, ""},
+		{"ChanDir", Type, 0, ""},
+		{"ChanType", Type, 0, ""},
+		{"ChanType.Arrow", Field, 1, ""},
+		{"ChanType.Begin", Field, 0, ""},
+		{"ChanType.Dir", Field, 0, ""},
+		{"ChanType.Value", Field, 0, ""},
+		{"CommClause", Type, 0, ""},
+		{"CommClause.Body", Field, 0, ""},
+		{"CommClause.Case", Field, 0, ""},
+		{"CommClause.Colon", Field, 0, ""},
+		{"CommClause.Comm", Field, 0, ""},
+		{"Comment", Type, 0, ""},
+		{"Comment.Slash", Field, 0, ""},
+		{"Comment.Text", Field, 0, ""},
+		{"CommentGroup", Type, 0, ""},
+		{"CommentGroup.List", Field, 0, ""},
+		{"CommentMap", Type, 1, ""},
+		{"CompositeLit", Type, 0, ""},
+		{"CompositeLit.Elts", Field, 0, ""},
+		{"CompositeLit.Incomplete", Field, 11, ""},
+		{"CompositeLit.Lbrace", Field, 0, ""},
+		{"CompositeLit.Rbrace", Field, 0, ""},
+		{"CompositeLit.Type", Field, 0, ""},
+		{"Con", Const, 0, ""},
+		{"Decl", Type, 0, ""},
+		{"DeclStmt", Type, 0, ""},
+		{"DeclStmt.Decl", Field, 0, ""},
+		{"DeferStmt", Type, 0, ""},
+		{"DeferStmt.Call", Field, 0, ""},
+		{"DeferStmt.Defer", Field, 0, ""},
+		{"Ellipsis", Type, 0, ""},
+		{"Ellipsis.Ellipsis", Field, 0, ""},
+		{"Ellipsis.Elt", Field, 0, ""},
+		{"EmptyStmt", Type, 0, ""},
+		{"EmptyStmt.Implicit", Field, 5, ""},
+		{"EmptyStmt.Semicolon", Field, 0, ""},
+		{"Expr", Type, 0, ""},
+		{"ExprStmt", Type, 0, ""},
+		{"ExprStmt.X", Field, 0, ""},
+		{"Field", Type, 0, ""},
+		{"Field.Comment", Field, 0, ""},
+		{"Field.Doc", Field, 0, ""},
+		{"Field.Names", Field, 0, ""},
+		{"Field.Tag", Field, 0, ""},
+		{"Field.Type", Field, 0, ""},
+		{"FieldFilter", Type, 0, ""},
+		{"FieldList", Type, 0, ""},
+		{"FieldList.Closing", Field, 0, ""},
+		{"FieldList.List", Field, 0, ""},
+		{"FieldList.Opening", Field, 0, ""},
+		{"File", Type, 0, ""},
+		{"File.Comments", Field, 0, ""},
+		{"File.Decls", Field, 0, ""},
+		{"File.Doc", Field, 0, ""},
+		{"File.FileEnd", Field, 20, ""},
+		{"File.FileStart", Field, 20, ""},
+		{"File.GoVersion", Field, 21, ""},
+		{"File.Imports", Field, 0, ""},
+		{"File.Name", Field, 0, ""},
+		{"File.Package", Field, 0, ""},
+		{"File.Scope", Field, 0, ""},
+		{"File.Unresolved", Field, 0, ""},
+		{"FileExports", Func, 0, "func(src *File) bool"},
+		{"Filter", Type, 0, ""},
+		{"FilterDecl", Func, 0, "func(decl Decl, f Filter) bool"},
+		{"FilterFile", Func, 0, "func(src *File, f Filter) bool"},
+		{"FilterFuncDuplicates", Const, 0, ""},
+		{"FilterImportDuplicates", Const, 0, ""},
+		{"FilterPackage", Func, 0, "func(pkg *Package, f Filter) bool"},
+		{"FilterUnassociatedComments", Const, 0, ""},
+		{"ForStmt", Type, 0, ""},
+		{"ForStmt.Body", Field, 0, ""},
+		{"ForStmt.Cond", Field, 0, ""},
+		{"ForStmt.For", Field, 0, ""},
+		{"ForStmt.Init", Field, 0, ""},
+		{"ForStmt.Post", Field, 0, ""},
+		{"Fprint", Func, 0, "func(w io.Writer, fset *token.FileSet, x any, f FieldFilter) error"},
+		{"Fun", Const, 0, ""},
+		{"FuncDecl", Type, 0, ""},
+		{"FuncDecl.Body", Field, 0, ""},
+		{"FuncDecl.Doc", Field, 0, ""},
+		{"FuncDecl.Name", Field, 0, ""},
+		{"FuncDecl.Recv", Field, 0, ""},
+		{"FuncDecl.Type", Field, 0, ""},
+		{"FuncLit", Type, 0, ""},
+		{"FuncLit.Body", Field, 0, ""},
+		{"FuncLit.Type", Field, 0, ""},
+		{"FuncType", Type, 0, ""},
+		{"FuncType.Func", Field, 0, ""},
+		{"FuncType.Params", Field, 0, ""},
+		{"FuncType.Results", Field, 0, ""},
+		{"FuncType.TypeParams", Field, 18, ""},
+		{"GenDecl", Type, 0, ""},
+		{"GenDecl.Doc", Field, 0, ""},
+		{"GenDecl.Lparen", Field, 0, ""},
+		{"GenDecl.Rparen", Field, 0, ""},
+		{"GenDecl.Specs", Field, 0, ""},
+		{"GenDecl.Tok", Field, 0, ""},
+		{"GenDecl.TokPos", Field, 0, ""},
+		{"GoStmt", Type, 0, ""},
+		{"GoStmt.Call", Field, 0, ""},
+		{"GoStmt.Go", Field, 0, ""},
+		{"Ident", Type, 0, ""},
+		{"Ident.Name", Field, 0, ""},
+		{"Ident.NamePos", Field, 0, ""},
+		{"Ident.Obj", Field, 0, ""},
+		{"IfStmt", Type, 0, ""},
+		{"IfStmt.Body", Field, 0, ""},
+		{"IfStmt.Cond", Field, 0, ""},
+		{"IfStmt.Else", Field, 0, ""},
+		{"IfStmt.If", Field, 0, ""},
+		{"IfStmt.Init", Field, 0, ""},
+		{"ImportSpec", Type, 0, ""},
+		{"ImportSpec.Comment", Field, 0, ""},
+		{"ImportSpec.Doc", Field, 0, ""},
+		{"ImportSpec.EndPos", Field, 0, ""},
+		{"ImportSpec.Name", Field, 0, ""},
+		{"ImportSpec.Path", Field, 0, ""},
+		{"Importer", Type, 0, ""},
+		{"IncDecStmt", Type, 0, ""},
+		{"IncDecStmt.Tok", Field, 0, ""},
+		{"IncDecStmt.TokPos", Field, 0, ""},
+		{"IncDecStmt.X", Field, 0, ""},
+		{"IndexExpr", Type, 0, ""},
+		{"IndexExpr.Index", Field, 0, ""},
+		{"IndexExpr.Lbrack", Field, 0, ""},
+		{"IndexExpr.Rbrack", Field, 0, ""},
+		{"IndexExpr.X", Field, 0, ""},
+		{"IndexListExpr", Type, 18, ""},
+		{"IndexListExpr.Indices", Field, 18, ""},
+		{"IndexListExpr.Lbrack", Field, 18, ""},
+		{"IndexListExpr.Rbrack", Field, 18, ""},
+		{"IndexListExpr.X", Field, 18, ""},
+		{"Inspect", Func, 0, "func(node Node, f func(Node) bool)"},
+		{"InterfaceType", Type, 0, ""},
+		{"InterfaceType.Incomplete", Field, 0, ""},
+		{"InterfaceType.Interface", Field, 0, ""},
+		{"InterfaceType.Methods", Field, 0, ""},
+		{"IsExported", Func, 0, "func(name string) bool"},
+		{"IsGenerated", Func, 21, "func(file *File) bool"},
+		{"KeyValueExpr", Type, 0, ""},
+		{"KeyValueExpr.Colon", Field, 0, ""},
+		{"KeyValueExpr.Key", Field, 0, ""},
+		{"KeyValueExpr.Value", Field, 0, ""},
+		{"LabeledStmt", Type, 0, ""},
+		{"LabeledStmt.Colon", Field, 0, ""},
+		{"LabeledStmt.Label", Field, 0, ""},
+		{"LabeledStmt.Stmt", Field, 0, ""},
+		{"Lbl", Const, 0, ""},
+		{"MapType", Type, 0, ""},
+		{"MapType.Key", Field, 0, ""},
+		{"MapType.Map", Field, 0, ""},
+		{"MapType.Value", Field, 0, ""},
+		{"MergeMode", Type, 0, ""},
+		{"MergePackageFiles", Func, 0, "func(pkg *Package, mode MergeMode) *File"},
+		{"NewCommentMap", Func, 1, "func(fset *token.FileSet, node Node, comments []*CommentGroup) CommentMap"},
+		{"NewIdent", Func, 0, "func(name string) *Ident"},
+		{"NewObj", Func, 0, "func(kind ObjKind, name string) *Object"},
+		{"NewPackage", Func, 0, "func(fset *token.FileSet, files map[string]*File, importer Importer, universe *Scope) (*Package, error)"},
+		{"NewScope", Func, 0, "func(outer *Scope) *Scope"},
+		{"Node", Type, 0, ""},
+		{"NotNilFilter", Func, 0, "func(_ string, v reflect.Value) bool"},
+		{"ObjKind", Type, 0, ""},
+		{"Object", Type, 0, ""},
+		{"Object.Data", Field, 0, ""},
+		{"Object.Decl", Field, 0, ""},
+		{"Object.Kind", Field, 0, ""},
+		{"Object.Name", Field, 0, ""},
+		{"Object.Type", Field, 0, ""},
+		{"Package", Type, 0, ""},
+		{"Package.Files", Field, 0, ""},
+		{"Package.Imports", Field, 0, ""},
+		{"Package.Name", Field, 0, ""},
+		{"Package.Scope", Field, 0, ""},
+		{"PackageExports", Func, 0, "func(pkg *Package) bool"},
+		{"ParenExpr", Type, 0, ""},
+		{"ParenExpr.Lparen", Field, 0, ""},
+		{"ParenExpr.Rparen", Field, 0, ""},
+		{"ParenExpr.X", Field, 0, ""},
+		{"Pkg", Const, 0, ""},
+		{"Preorder", Func, 23, "func(root Node) iter.Seq[Node]"},
+		{"Print", Func, 0, "func(fset *token.FileSet, x any) error"},
+		{"RECV", Const, 0, ""},
+		{"RangeStmt", Type, 0, ""},
+		{"RangeStmt.Body", Field, 0, ""},
+		{"RangeStmt.For", Field, 0, ""},
+		{"RangeStmt.Key", Field, 0, ""},
+		{"RangeStmt.Range", Field, 20, ""},
+		{"RangeStmt.Tok", Field, 0, ""},
+		{"RangeStmt.TokPos", Field, 0, ""},
+		{"RangeStmt.Value", Field, 0, ""},
+		{"RangeStmt.X", Field, 0, ""},
+		{"ReturnStmt", Type, 0, ""},
+		{"ReturnStmt.Results", Field, 0, ""},
+		{"ReturnStmt.Return", Field, 0, ""},
+		{"SEND", Const, 0, ""},
+		{"Scope", Type, 0, ""},
+		{"Scope.Objects", Field, 0, ""},
+		{"Scope.Outer", Field, 0, ""},
+		{"SelectStmt", Type, 0, ""},
+		{"SelectStmt.Body", Field, 0, ""},
+		{"SelectStmt.Select", Field, 0, ""},
+		{"SelectorExpr", Type, 0, ""},
+		{"SelectorExpr.Sel", Field, 0, ""},
+		{"SelectorExpr.X", Field, 0, ""},
+		{"SendStmt", Type, 0, ""},
+		{"SendStmt.Arrow", Field, 0, ""},
+		{"SendStmt.Chan", Field, 0, ""},
+		{"SendStmt.Value", Field, 0, ""},
+		{"SliceExpr", Type, 0, ""},
+		{"SliceExpr.High", Field, 0, ""},
+		{"SliceExpr.Lbrack", Field, 0, ""},
+		{"SliceExpr.Low", Field, 0, ""},
+		{"SliceExpr.Max", Field, 2, ""},
+		{"SliceExpr.Rbrack", Field, 0, ""},
+		{"SliceExpr.Slice3", Field, 2, ""},
+		{"SliceExpr.X", Field, 0, ""},
+		{"SortImports", Func, 0, "func(fset *token.FileSet, f *File)"},
+		{"Spec", Type, 0, ""},
+		{"StarExpr", Type, 0, ""},
+		{"StarExpr.Star", Field, 0, ""},
+		{"StarExpr.X", Field, 0, ""},
+		{"Stmt", Type, 0, ""},
+		{"StructType", Type, 0, ""},
+		{"StructType.Fields", Field, 0, ""},
+		{"StructType.Incomplete", Field, 0, ""},
+		{"StructType.Struct", Field, 0, ""},
+		{"SwitchStmt", Type, 0, ""},
+		{"SwitchStmt.Body", Field, 0, ""},
+		{"SwitchStmt.Init", Field, 0, ""},
+		{"SwitchStmt.Switch", Field, 0, ""},
+		{"SwitchStmt.Tag", Field, 0, ""},
+		{"Typ", Const, 0, ""},
+		{"TypeAssertExpr", Type, 0, ""},
+		{"TypeAssertExpr.Lparen", Field, 2, ""},
+		{"TypeAssertExpr.Rparen", Field, 2, ""},
+		{"TypeAssertExpr.Type", Field, 0, ""},
+		{"TypeAssertExpr.X", Field, 0, ""},
+		{"TypeSpec", Type, 0, ""},
+		{"TypeSpec.Assign", Field, 9, ""},
+		{"TypeSpec.Comment", Field, 0, ""},
+		{"TypeSpec.Doc", Field, 0, ""},
+		{"TypeSpec.Name", Field, 0, ""},
+		{"TypeSpec.Type", Field, 0, ""},
+		{"TypeSpec.TypeParams", Field, 18, ""},
+		{"TypeSwitchStmt", Type, 0, ""},
+		{"TypeSwitchStmt.Assign", Field, 0, ""},
+		{"TypeSwitchStmt.Body", Field, 0, ""},
+		{"TypeSwitchStmt.Init", Field, 0, ""},
+		{"TypeSwitchStmt.Switch", Field, 0, ""},
+		{"UnaryExpr", Type, 0, ""},
+		{"UnaryExpr.Op", Field, 0, ""},
+		{"UnaryExpr.OpPos", Field, 0, ""},
+		{"UnaryExpr.X", Field, 0, ""},
+		{"Unparen", Func, 22, "func(e Expr) Expr"},
+		{"ValueSpec", Type, 0, ""},
+		{"ValueSpec.Comment", Field, 0, ""},
+		{"ValueSpec.Doc", Field, 0, ""},
+		{"ValueSpec.Names", Field, 0, ""},
+		{"ValueSpec.Type", Field, 0, ""},
+		{"ValueSpec.Values", Field, 0, ""},
+		{"Var", Const, 0, ""},
+		{"Visitor", Type, 0, ""},
+		{"Walk", Func, 0, "func(v Visitor, node Node)"},
+	},
+	"go/build": {
+		{"(*Context).Import", Method, 0, ""},
+		{"(*Context).ImportDir", Method, 0, ""},
+		{"(*Context).MatchFile", Method, 2, ""},
+		{"(*Context).SrcDirs", Method, 0, ""},
+		{"(*MultiplePackageError).Error", Method, 4, ""},
+		{"(*NoGoError).Error", Method, 0, ""},
+		{"(*Package).IsCommand", Method, 0, ""},
+		{"AllowBinary", Const, 0, ""},
+		{"ArchChar", Func, 0, "func(goarch string) (string, error)"},
+		{"Context", Type, 0, ""},
+		{"Context.BuildTags", Field, 0, ""},
+		{"Context.CgoEnabled", Field, 0, ""},
+		{"Context.Compiler", Field, 0, ""},
+		{"Context.Dir", Field, 14, ""},
+		{"Context.GOARCH", Field, 0, ""},
+		{"Context.GOOS", Field, 0, ""},
+		{"Context.GOPATH", Field, 0, ""},
+		{"Context.GOROOT", Field, 0, ""},
+		{"Context.HasSubdir", Field, 0, ""},
+		{"Context.InstallSuffix", Field, 1, ""},
+		{"Context.IsAbsPath", Field, 0, ""},
+		{"Context.IsDir", Field, 0, ""},
+		{"Context.JoinPath", Field, 0, ""},
+		{"Context.OpenFile", Field, 0, ""},
+		{"Context.ReadDir", Field, 0, ""},
+		{"Context.ReleaseTags", Field, 1, ""},
+		{"Context.SplitPathList", Field, 0, ""},
+		{"Context.ToolTags", Field, 17, ""},
+		{"Context.UseAllFiles", Field, 0, ""},
+		{"Default", Var, 0, ""},
+		{"Directive", Type, 21, ""},
+		{"Directive.Pos", Field, 21, ""},
+		{"Directive.Text", Field, 21, ""},
+		{"FindOnly", Const, 0, ""},
+		{"IgnoreVendor", Const, 6, ""},
+		{"Import", Func, 0, "func(path string, srcDir string, mode ImportMode) (*Package, error)"},
+		{"ImportComment", Const, 4, ""},
+		{"ImportDir", Func, 0, "func(dir string, mode ImportMode) (*Package, error)"},
+		{"ImportMode", Type, 0, ""},
+		{"IsLocalImport", Func, 0, "func(path string) bool"},
+		{"MultiplePackageError", Type, 4, ""},
+		{"MultiplePackageError.Dir", Field, 4, ""},
+		{"MultiplePackageError.Files", Field, 4, ""},
+		{"MultiplePackageError.Packages", Field, 4, ""},
+		{"NoGoError", Type, 0, ""},
+		{"NoGoError.Dir", Field, 0, ""},
+		{"Package", Type, 0, ""},
+		{"Package.AllTags", Field, 2, ""},
+		{"Package.BinDir", Field, 0, ""},
+		{"Package.BinaryOnly", Field, 7, ""},
+		{"Package.CFiles", Field, 0, ""},
+		{"Package.CXXFiles", Field, 2, ""},
+		{"Package.CgoCFLAGS", Field, 0, ""},
+		{"Package.CgoCPPFLAGS", Field, 2, ""},
+		{"Package.CgoCXXFLAGS", Field, 2, ""},
+		{"Package.CgoFFLAGS", Field, 7, ""},
+		{"Package.CgoFiles", Field, 0, ""},
+		{"Package.CgoLDFLAGS", Field, 0, ""},
+		{"Package.CgoPkgConfig", Field, 0, ""},
+		{"Package.ConflictDir", Field, 2, ""},
+		{"Package.Dir", Field, 0, ""},
+		{"Package.Directives", Field, 21, ""},
+		{"Package.Doc", Field, 0, ""},
+		{"Package.EmbedPatternPos", Field, 16, ""},
+		{"Package.EmbedPatterns", Field, 16, ""},
+		{"Package.FFiles", Field, 7, ""},
+		{"Package.GoFiles", Field, 0, ""},
+		{"Package.Goroot", Field, 0, ""},
+		{"Package.HFiles", Field, 0, ""},
+		{"Package.IgnoredGoFiles", Field, 1, ""},
+		{"Package.IgnoredOtherFiles", Field, 16, ""},
+		{"Package.ImportComment", Field, 4, ""},
+		{"Package.ImportPath", Field, 0, ""},
+		{"Package.ImportPos", Field, 0, ""},
+		{"Package.Imports", Field, 0, ""},
+		{"Package.InvalidGoFiles", Field, 6, ""},
+		{"Package.MFiles", Field, 3, ""},
+		{"Package.Name", Field, 0, ""},
+		{"Package.PkgObj", Field, 0, ""},
+		{"Package.PkgRoot", Field, 0, ""},
+		{"Package.PkgTargetRoot", Field, 5, ""},
+		{"Package.Root", Field, 0, ""},
+		{"Package.SFiles", Field, 0, ""},
+		{"Package.SrcRoot", Field, 0, ""},
+		{"Package.SwigCXXFiles", Field, 1, ""},
+		{"Package.SwigFiles", Field, 1, ""},
+		{"Package.SysoFiles", Field, 0, ""},
+		{"Package.TestDirectives", Field, 21, ""},
+		{"Package.TestEmbedPatternPos", Field, 16, ""},
+		{"Package.TestEmbedPatterns", Field, 16, ""},
+		{"Package.TestGoFiles", Field, 0, ""},
+		{"Package.TestImportPos", Field, 0, ""},
+		{"Package.TestImports", Field, 0, ""},
+		{"Package.XTestDirectives", Field, 21, ""},
+		{"Package.XTestEmbedPatternPos", Field, 16, ""},
+		{"Package.XTestEmbedPatterns", Field, 16, ""},
+		{"Package.XTestGoFiles", Field, 0, ""},
+		{"Package.XTestImportPos", Field, 0, ""},
+		{"Package.XTestImports", Field, 0, ""},
+		{"ToolDir", Var, 0, ""},
+	},
+	"go/build/constraint": {
+		{"(*AndExpr).Eval", Method, 16, ""},
+		{"(*AndExpr).String", Method, 16, ""},
+		{"(*NotExpr).Eval", Method, 16, ""},
+		{"(*NotExpr).String", Method, 16, ""},
+		{"(*OrExpr).Eval", Method, 16, ""},
+		{"(*OrExpr).String", Method, 16, ""},
+		{"(*SyntaxError).Error", Method, 16, ""},
+		{"(*TagExpr).Eval", Method, 16, ""},
+		{"(*TagExpr).String", Method, 16, ""},
+		{"AndExpr", Type, 16, ""},
+		{"AndExpr.X", Field, 16, ""},
+		{"AndExpr.Y", Field, 16, ""},
+		{"Expr", Type, 16, ""},
+		{"GoVersion", Func, 21, "func(x Expr) string"},
+		{"IsGoBuild", Func, 16, "func(line string) bool"},
+		{"IsPlusBuild", Func, 16, "func(line string) bool"},
+		{"NotExpr", Type, 16, ""},
+		{"NotExpr.X", Field, 16, ""},
+		{"OrExpr", Type, 16, ""},
+		{"OrExpr.X", Field, 16, ""},
+		{"OrExpr.Y", Field, 16, ""},
+		{"Parse", Func, 16, "func(line string) (Expr, error)"},
+		{"PlusBuildLines", Func, 16, "func(x Expr) ([]string, error)"},
+		{"SyntaxError", Type, 16, ""},
+		{"SyntaxError.Err", Field, 16, ""},
+		{"SyntaxError.Offset", Field, 16, ""},
+		{"TagExpr", Type, 16, ""},
+		{"TagExpr.Tag", Field, 16, ""},
+	},
+	"go/constant": {
+		{"(Kind).String", Method, 18, ""},
+		{"BinaryOp", Func, 5, "func(x_ Value, op token.Token, y_ Value) Value"},
+		{"BitLen", Func, 5, "func(x Value) int"},
+		{"Bool", Const, 5, ""},
+		{"BoolVal", Func, 5, "func(x Value) bool"},
+		{"Bytes", Func, 5, "func(x Value) []byte"},
+		{"Compare", Func, 5, "func(x_ Value, op token.Token, y_ Value) bool"},
+		{"Complex", Const, 5, ""},
+		{"Denom", Func, 5, "func(x Value) Value"},
+		{"Float", Const, 5, ""},
+		{"Float32Val", Func, 5, "func(x Value) (float32, bool)"},
+		{"Float64Val", Func, 5, "func(x Value) (float64, bool)"},
+		{"Imag", Func, 5, "func(x Value) Value"},
+		{"Int", Const, 5, ""},
+		{"Int64Val", Func, 5, "func(x Value) (int64, bool)"},
+		{"Kind", Type, 5, ""},
+		{"Make", Func, 13, "func(x any) Value"},
+		{"MakeBool", Func, 5, "func(b bool) Value"},
+		{"MakeFloat64", Func, 5, "func(x float64) Value"},
+		{"MakeFromBytes", Func, 5, "func(bytes []byte) Value"},
+		{"MakeFromLiteral", Func, 5, "func(lit string, tok token.Token, zero uint) Value"},
+		{"MakeImag", Func, 5, "func(x Value) Value"},
+		{"MakeInt64", Func, 5, "func(x int64) Value"},
+		{"MakeString", Func, 5, "func(s string) Value"},
+		{"MakeUint64", Func, 5, "func(x uint64) Value"},
+		{"MakeUnknown", Func, 5, "func() Value"},
+		{"Num", Func, 5, "func(x Value) Value"},
+		{"Real", Func, 5, "func(x Value) Value"},
+		{"Shift", Func, 5, "func(x Value, op token.Token, s uint) Value"},
+		{"Sign", Func, 5, "func(x Value) int"},
+		{"String", Const, 5, ""},
+		{"StringVal", Func, 5, "func(x Value) string"},
+		{"ToComplex", Func, 6, "func(x Value) Value"},
+		{"ToFloat", Func, 6, "func(x Value) Value"},
+		{"ToInt", Func, 6, "func(x Value) Value"},
+		{"Uint64Val", Func, 5, "func(x Value) (uint64, bool)"},
+		{"UnaryOp", Func, 5, "func(op token.Token, y Value, prec uint) Value"},
+		{"Unknown", Const, 5, ""},
+		{"Val", Func, 13, "func(x Value) any"},
+		{"Value", Type, 5, ""},
+	},
+	"go/doc": {
+		{"(*Package).Filter", Method, 0, ""},
+		{"(*Package).HTML", Method, 19, ""},
+		{"(*Package).Markdown", Method, 19, ""},
+		{"(*Package).Parser", Method, 19, ""},
+		{"(*Package).Printer", Method, 19, ""},
+		{"(*Package).Synopsis", Method, 19, ""},
+		{"(*Package).Text", Method, 19, ""},
+		{"AllDecls", Const, 0, ""},
+		{"AllMethods", Const, 0, ""},
+		{"Example", Type, 0, ""},
+		{"Example.Code", Field, 0, ""},
+		{"Example.Comments", Field, 0, ""},
+		{"Example.Doc", Field, 0, ""},
+		{"Example.EmptyOutput", Field, 1, ""},
+		{"Example.Name", Field, 0, ""},
+		{"Example.Order", Field, 1, ""},
+		{"Example.Output", Field, 0, ""},
+		{"Example.Play", Field, 1, ""},
+		{"Example.Suffix", Field, 14, ""},
+		{"Example.Unordered", Field, 7, ""},
+		{"Examples", Func, 0, "func(testFiles ...*ast.File) []*Example"},
+		{"Filter", Type, 0, ""},
+		{"Func", Type, 0, ""},
+		{"Func.Decl", Field, 0, ""},
+		{"Func.Doc", Field, 0, ""},
+		{"Func.Examples", Field, 14, ""},
+		{"Func.Level", Field, 0, ""},
+		{"Func.Name", Field, 0, ""},
+		{"Func.Orig", Field, 0, ""},
+		{"Func.Recv", Field, 0, ""},
+		{"IllegalPrefixes", Var, 1, ""},
+		{"IsPredeclared", Func, 8, "func(s string) bool"},
+		{"Mode", Type, 0, ""},
+		{"New", Func, 0, "func(pkg *ast.Package, importPath string, mode Mode) *Package"},
+		{"NewFromFiles", Func, 14, "func(fset *token.FileSet, files []*ast.File, importPath string, opts ...any) (*Package, error)"},
+		{"Note", Type, 1, ""},
+		{"Note.Body", Field, 1, ""},
+		{"Note.End", Field, 1, ""},
+		{"Note.Pos", Field, 1, ""},
+		{"Note.UID", Field, 1, ""},
+		{"Package", Type, 0, ""},
+		{"Package.Bugs", Field, 0, ""},
+		{"Package.Consts", Field, 0, ""},
+		{"Package.Doc", Field, 0, ""},
+		{"Package.Examples", Field, 14, ""},
+		{"Package.Filenames", Field, 0, ""},
+		{"Package.Funcs", Field, 0, ""},
+		{"Package.ImportPath", Field, 0, ""},
+		{"Package.Imports", Field, 0, ""},
+		{"Package.Name", Field, 0, ""},
+		{"Package.Notes", Field, 1, ""},
+		{"Package.Types", Field, 0, ""},
+		{"Package.Vars", Field, 0, ""},
+		{"PreserveAST", Const, 12, ""},
+		{"Synopsis", Func, 0, "func(text string) string"},
+		{"ToHTML", Func, 0, "func(w io.Writer, text string, words map[string]string)"},
+		{"ToText", Func, 0, "func(w io.Writer, text string, prefix string, codePrefix string, width int)"},
+		{"Type", Type, 0, ""},
+		{"Type.Consts", Field, 0, ""},
+		{"Type.Decl", Field, 0, ""},
+		{"Type.Doc", Field, 0, ""},
+		{"Type.Examples", Field, 14, ""},
+		{"Type.Funcs", Field, 0, ""},
+		{"Type.Methods", Field, 0, ""},
+		{"Type.Name", Field, 0, ""},
+		{"Type.Vars", Field, 0, ""},
+		{"Value", Type, 0, ""},
+		{"Value.Decl", Field, 0, ""},
+		{"Value.Doc", Field, 0, ""},
+		{"Value.Names", Field, 0, ""},
+	},
+	"go/doc/comment": {
+		{"(*DocLink).DefaultURL", Method, 19, ""},
+		{"(*Heading).DefaultID", Method, 19, ""},
+		{"(*List).BlankBefore", Method, 19, ""},
+		{"(*List).BlankBetween", Method, 19, ""},
+		{"(*Parser).Parse", Method, 19, ""},
+		{"(*Printer).Comment", Method, 19, ""},
+		{"(*Printer).HTML", Method, 19, ""},
+		{"(*Printer).Markdown", Method, 19, ""},
+		{"(*Printer).Text", Method, 19, ""},
+		{"Block", Type, 19, ""},
+		{"Code", Type, 19, ""},
+		{"Code.Text", Field, 19, ""},
+		{"DefaultLookupPackage", Func, 19, "func(name string) (importPath string, ok bool)"},
+		{"Doc", Type, 19, ""},
+		{"Doc.Content", Field, 19, ""},
+		{"Doc.Links", Field, 19, ""},
+		{"DocLink", Type, 19, ""},
+		{"DocLink.ImportPath", Field, 19, ""},
+		{"DocLink.Name", Field, 19, ""},
+		{"DocLink.Recv", Field, 19, ""},
+		{"DocLink.Text", Field, 19, ""},
+		{"Heading", Type, 19, ""},
+		{"Heading.Text", Field, 19, ""},
+		{"Italic", Type, 19, ""},
+		{"Link", Type, 19, ""},
+		{"Link.Auto", Field, 19, ""},
+		{"Link.Text", Field, 19, ""},
+		{"Link.URL", Field, 19, ""},
+		{"LinkDef", Type, 19, ""},
+		{"LinkDef.Text", Field, 19, ""},
+		{"LinkDef.URL", Field, 19, ""},
+		{"LinkDef.Used", Field, 19, ""},
+		{"List", Type, 19, ""},
+		{"List.ForceBlankBefore", Field, 19, ""},
+		{"List.ForceBlankBetween", Field, 19, ""},
+		{"List.Items", Field, 19, ""},
+		{"ListItem", Type, 19, ""},
+		{"ListItem.Content", Field, 19, ""},
+		{"ListItem.Number", Field, 19, ""},
+		{"Paragraph", Type, 19, ""},
+		{"Paragraph.Text", Field, 19, ""},
+		{"Parser", Type, 19, ""},
+		{"Parser.LookupPackage", Field, 19, ""},
+		{"Parser.LookupSym", Field, 19, ""},
+		{"Parser.Words", Field, 19, ""},
+		{"Plain", Type, 19, ""},
+		{"Printer", Type, 19, ""},
+		{"Printer.DocLinkBaseURL", Field, 19, ""},
+		{"Printer.DocLinkURL", Field, 19, ""},
+		{"Printer.HeadingID", Field, 19, ""},
+		{"Printer.HeadingLevel", Field, 19, ""},
+		{"Printer.TextCodePrefix", Field, 19, ""},
+		{"Printer.TextPrefix", Field, 19, ""},
+		{"Printer.TextWidth", Field, 19, ""},
+		{"Text", Type, 19, ""},
+	},
+	"go/format": {
+		{"Node", Func, 1, "func(dst io.Writer, fset *token.FileSet, node any) error"},
+		{"Source", Func, 1, "func(src []byte) ([]byte, error)"},
+	},
+	"go/importer": {
+		{"Default", Func, 5, "func() types.Importer"},
+		{"For", Func, 5, "func(compiler string, lookup Lookup) types.Importer"},
+		{"ForCompiler", Func, 12, "func(fset *token.FileSet, compiler string, lookup Lookup) types.Importer"},
+		{"Lookup", Type, 5, ""},
+	},
+	"go/parser": {
+		{"AllErrors", Const, 1, ""},
+		{"DeclarationErrors", Const, 0, ""},
+		{"ImportsOnly", Const, 0, ""},
+		{"Mode", Type, 0, ""},
+		{"PackageClauseOnly", Const, 0, ""},
+		{"ParseComments", Const, 0, ""},
+		{"ParseDir", Func, 0, "func(fset *token.FileSet, path string, filter func(fs.FileInfo) bool, mode Mode) (pkgs map[string]*ast.Package, first error)"},
+		{"ParseExpr", Func, 0, "func(x string) (ast.Expr, error)"},
+		{"ParseExprFrom", Func, 5, "func(fset *token.FileSet, filename string, src any, mode Mode) (expr ast.Expr, err error)"},
+		{"ParseFile", Func, 0, "func(fset *token.FileSet, filename string, src any, mode Mode) (f *ast.File, err error)"},
+		{"SkipObjectResolution", Const, 17, ""},
+		{"SpuriousErrors", Const, 0, ""},
+		{"Trace", Const, 0, ""},
+	},
+	"go/printer": {
+		{"(*Config).Fprint", Method, 0, ""},
+		{"CommentedNode", Type, 0, ""},
+		{"CommentedNode.Comments", Field, 0, ""},
+		{"CommentedNode.Node", Field, 0, ""},
+		{"Config", Type, 0, ""},
+		{"Config.Indent", Field, 1, ""},
+		{"Config.Mode", Field, 0, ""},
+		{"Config.Tabwidth", Field, 0, ""},
+		{"Fprint", Func, 0, "func(output io.Writer, fset *token.FileSet, node any) error"},
+		{"Mode", Type, 0, ""},
+		{"RawFormat", Const, 0, ""},
+		{"SourcePos", Const, 0, ""},
+		{"TabIndent", Const, 0, ""},
+		{"UseSpaces", Const, 0, ""},
+	},
+	"go/scanner": {
+		{"(*ErrorList).Add", Method, 0, ""},
+		{"(*ErrorList).RemoveMultiples", Method, 0, ""},
+		{"(*ErrorList).Reset", Method, 0, ""},
+		{"(*Scanner).Init", Method, 0, ""},
+		{"(*Scanner).Scan", Method, 0, ""},
+		{"(Error).Error", Method, 0, ""},
+		{"(ErrorList).Err", Method, 0, ""},
+		{"(ErrorList).Error", Method, 0, ""},
+		{"(ErrorList).Len", Method, 0, ""},
+		{"(ErrorList).Less", Method, 0, ""},
+		{"(ErrorList).Sort", Method, 0, ""},
+		{"(ErrorList).Swap", Method, 0, ""},
+		{"Error", Type, 0, ""},
+		{"Error.Msg", Field, 0, ""},
+		{"Error.Pos", Field, 0, ""},
+		{"ErrorHandler", Type, 0, ""},
+		{"ErrorList", Type, 0, ""},
+		{"Mode", Type, 0, ""},
+		{"PrintError", Func, 0, "func(w io.Writer, err error)"},
+		{"ScanComments", Const, 0, ""},
+		{"Scanner", Type, 0, ""},
+		{"Scanner.ErrorCount", Field, 0, ""},
+	},
+	"go/token": {
+		{"(*File).AddLine", Method, 0, ""},
+		{"(*File).AddLineColumnInfo", Method, 11, ""},
+		{"(*File).AddLineInfo", Method, 0, ""},
+		{"(*File).Base", Method, 0, ""},
+		{"(*File).Line", Method, 0, ""},
+		{"(*File).LineCount", Method, 0, ""},
+		{"(*File).LineStart", Method, 12, ""},
+		{"(*File).Lines", Method, 21, ""},
+		{"(*File).MergeLine", Method, 2, ""},
+		{"(*File).Name", Method, 0, ""},
+		{"(*File).Offset", Method, 0, ""},
+		{"(*File).Pos", Method, 0, ""},
+		{"(*File).Position", Method, 0, ""},
+		{"(*File).PositionFor", Method, 4, ""},
+		{"(*File).SetLines", Method, 0, ""},
+		{"(*File).SetLinesForContent", Method, 0, ""},
+		{"(*File).Size", Method, 0, ""},
+		{"(*FileSet).AddFile", Method, 0, ""},
+		{"(*FileSet).Base", Method, 0, ""},
+		{"(*FileSet).File", Method, 0, ""},
+		{"(*FileSet).Iterate", Method, 0, ""},
+		{"(*FileSet).Position", Method, 0, ""},
+		{"(*FileSet).PositionFor", Method, 4, ""},
+		{"(*FileSet).Read", Method, 0, ""},
+		{"(*FileSet).RemoveFile", Method, 20, ""},
+		{"(*FileSet).Write", Method, 0, ""},
+		{"(*Position).IsValid", Method, 0, ""},
+		{"(Pos).IsValid", Method, 0, ""},
+		{"(Position).String", Method, 0, ""},
+		{"(Token).IsKeyword", Method, 0, ""},
+		{"(Token).IsLiteral", Method, 0, ""},
+		{"(Token).IsOperator", Method, 0, ""},
+		{"(Token).Precedence", Method, 0, ""},
+		{"(Token).String", Method, 0, ""},
+		{"ADD", Const, 0, ""},
+		{"ADD_ASSIGN", Const, 0, ""},
+		{"AND", Const, 0, ""},
+		{"AND_ASSIGN", Const, 0, ""},
+		{"AND_NOT", Const, 0, ""},
+		{"AND_NOT_ASSIGN", Const, 0, ""},
+		{"ARROW", Const, 0, ""},
+		{"ASSIGN", Const, 0, ""},
+		{"BREAK", Const, 0, ""},
+		{"CASE", Const, 0, ""},
+		{"CHAN", Const, 0, ""},
+		{"CHAR", Const, 0, ""},
+		{"COLON", Const, 0, ""},
+		{"COMMA", Const, 0, ""},
+		{"COMMENT", Const, 0, ""},
+		{"CONST", Const, 0, ""},
+		{"CONTINUE", Const, 0, ""},
+		{"DEC", Const, 0, ""},
+		{"DEFAULT", Const, 0, ""},
+		{"DEFER", Const, 0, ""},
+		{"DEFINE", Const, 0, ""},
+		{"ELLIPSIS", Const, 0, ""},
+		{"ELSE", Const, 0, ""},
+		{"EOF", Const, 0, ""},
+		{"EQL", Const, 0, ""},
+		{"FALLTHROUGH", Const, 0, ""},
+		{"FLOAT", Const, 0, ""},
+		{"FOR", Const, 0, ""},
+		{"FUNC", Const, 0, ""},
+		{"File", Type, 0, ""},
+		{"FileSet", Type, 0, ""},
+		{"GEQ", Const, 0, ""},
+		{"GO", Const, 0, ""},
+		{"GOTO", Const, 0, ""},
+		{"GTR", Const, 0, ""},
+		{"HighestPrec", Const, 0, ""},
+		{"IDENT", Const, 0, ""},
+		{"IF", Const, 0, ""},
+		{"ILLEGAL", Const, 0, ""},
+		{"IMAG", Const, 0, ""},
+		{"IMPORT", Const, 0, ""},
+		{"INC", Const, 0, ""},
+		{"INT", Const, 0, ""},
+		{"INTERFACE", Const, 0, ""},
+		{"IsExported", Func, 13, "func(name string) bool"},
+		{"IsIdentifier", Func, 13, "func(name string) bool"},
+		{"IsKeyword", Func, 13, "func(name string) bool"},
+		{"LAND", Const, 0, ""},
+		{"LBRACE", Const, 0, ""},
+		{"LBRACK", Const, 0, ""},
+		{"LEQ", Const, 0, ""},
+		{"LOR", Const, 0, ""},
+		{"LPAREN", Const, 0, ""},
+		{"LSS", Const, 0, ""},
+		{"Lookup", Func, 0, "func(ident string) Token"},
+		{"LowestPrec", Const, 0, ""},
+		{"MAP", Const, 0, ""},
+		{"MUL", Const, 0, ""},
+		{"MUL_ASSIGN", Const, 0, ""},
+		{"NEQ", Const, 0, ""},
+		{"NOT", Const, 0, ""},
+		{"NewFileSet", Func, 0, "func() *FileSet"},
+		{"NoPos", Const, 0, ""},
+		{"OR", Const, 0, ""},
+		{"OR_ASSIGN", Const, 0, ""},
+		{"PACKAGE", Const, 0, ""},
+		{"PERIOD", Const, 0, ""},
+		{"Pos", Type, 0, ""},
+		{"Position", Type, 0, ""},
+		{"Position.Column", Field, 0, ""},
+		{"Position.Filename", Field, 0, ""},
+		{"Position.Line", Field, 0, ""},
+		{"Position.Offset", Field, 0, ""},
+		{"QUO", Const, 0, ""},
+		{"QUO_ASSIGN", Const, 0, ""},
+		{"RANGE", Const, 0, ""},
+		{"RBRACE", Const, 0, ""},
+		{"RBRACK", Const, 0, ""},
+		{"REM", Const, 0, ""},
+		{"REM_ASSIGN", Const, 0, ""},
+		{"RETURN", Const, 0, ""},
+		{"RPAREN", Const, 0, ""},
+		{"SELECT", Const, 0, ""},
+		{"SEMICOLON", Const, 0, ""},
+		{"SHL", Const, 0, ""},
+		{"SHL_ASSIGN", Const, 0, ""},
+		{"SHR", Const, 0, ""},
+		{"SHR_ASSIGN", Const, 0, ""},
+		{"STRING", Const, 0, ""},
+		{"STRUCT", Const, 0, ""},
+		{"SUB", Const, 0, ""},
+		{"SUB_ASSIGN", Const, 0, ""},
+		{"SWITCH", Const, 0, ""},
+		{"TILDE", Const, 18, ""},
+		{"TYPE", Const, 0, ""},
+		{"Token", Type, 0, ""},
+		{"UnaryPrec", Const, 0, ""},
+		{"VAR", Const, 0, ""},
+		{"XOR", Const, 0, ""},
+		{"XOR_ASSIGN", Const, 0, ""},
+	},
+	"go/types": {
+		{"(*Alias).Obj", Method, 22, ""},
+		{"(*Alias).Origin", Method, 23, ""},
+		{"(*Alias).Rhs", Method, 23, ""},
+		{"(*Alias).SetTypeParams", Method, 23, ""},
+		{"(*Alias).String", Method, 22, ""},
+		{"(*Alias).TypeArgs", Method, 23, ""},
+		{"(*Alias).TypeParams", Method, 23, ""},
+		{"(*Alias).Underlying", Method, 22, ""},
+		{"(*ArgumentError).Error", Method, 18, ""},
+		{"(*ArgumentError).Unwrap", Method, 18, ""},
+		{"(*Array).Elem", Method, 5, ""},
+		{"(*Array).Len", Method, 5, ""},
+		{"(*Array).String", Method, 5, ""},
+		{"(*Array).Underlying", Method, 5, ""},
+		{"(*Basic).Info", Method, 5, ""},
+		{"(*Basic).Kind", Method, 5, ""},
+		{"(*Basic).Name", Method, 5, ""},
+		{"(*Basic).String", Method, 5, ""},
+		{"(*Basic).Underlying", Method, 5, ""},
+		{"(*Builtin).Exported", Method, 5, ""},
+		{"(*Builtin).Id", Method, 5, ""},
+		{"(*Builtin).Name", Method, 5, ""},
+		{"(*Builtin).Parent", Method, 5, ""},
+		{"(*Builtin).Pkg", Method, 5, ""},
+		{"(*Builtin).Pos", Method, 5, ""},
+		{"(*Builtin).String", Method, 5, ""},
+		{"(*Builtin).Type", Method, 5, ""},
+		{"(*Chan).Dir", Method, 5, ""},
+		{"(*Chan).Elem", Method, 5, ""},
+		{"(*Chan).String", Method, 5, ""},
+		{"(*Chan).Underlying", Method, 5, ""},
+		{"(*Checker).Files", Method, 5, ""},
+		{"(*Config).Check", Method, 5, ""},
+		{"(*Const).Exported", Method, 5, ""},
+		{"(*Const).Id", Method, 5, ""},
+		{"(*Const).Name", Method, 5, ""},
+		{"(*Const).Parent", Method, 5, ""},
+		{"(*Const).Pkg", Method, 5, ""},
+		{"(*Const).Pos", Method, 5, ""},
+		{"(*Const).String", Method, 5, ""},
+		{"(*Const).Type", Method, 5, ""},
+		{"(*Const).Val", Method, 5, ""},
+		{"(*Func).Exported", Method, 5, ""},
+		{"(*Func).FullName", Method, 5, ""},
+		{"(*Func).Id", Method, 5, ""},
+		{"(*Func).Name", Method, 5, ""},
+		{"(*Func).Origin", Method, 19, ""},
+		{"(*Func).Parent", Method, 5, ""},
+		{"(*Func).Pkg", Method, 5, ""},
+		{"(*Func).Pos", Method, 5, ""},
+		{"(*Func).Scope", Method, 5, ""},
+		{"(*Func).Signature", Method, 23, ""},
+		{"(*Func).String", Method, 5, ""},
+		{"(*Func).Type", Method, 5, ""},
+		{"(*Info).ObjectOf", Method, 5, ""},
+		{"(*Info).PkgNameOf", Method, 22, ""},
+		{"(*Info).TypeOf", Method, 5, ""},
+		{"(*Initializer).String", Method, 5, ""},
+		{"(*Interface).Complete", Method, 5, ""},
+		{"(*Interface).Embedded", Method, 5, ""},
+		{"(*Interface).EmbeddedType", Method, 11, ""},
+		{"(*Interface).EmbeddedTypes", Method, 24, ""},
+		{"(*Interface).Empty", Method, 5, ""},
+		{"(*Interface).ExplicitMethod", Method, 5, ""},
+		{"(*Interface).ExplicitMethods", Method, 24, ""},
+		{"(*Interface).IsComparable", Method, 18, ""},
+		{"(*Interface).IsImplicit", Method, 18, ""},
+		{"(*Interface).IsMethodSet", Method, 18, ""},
+		{"(*Interface).MarkImplicit", Method, 18, ""},
+		{"(*Interface).Method", Method, 5, ""},
+		{"(*Interface).Methods", Method, 24, ""},
+		{"(*Interface).NumEmbeddeds", Method, 5, ""},
+		{"(*Interface).NumExplicitMethods", Method, 5, ""},
+		{"(*Interface).NumMethods", Method, 5, ""},
+		{"(*Interface).String", Method, 5, ""},
+		{"(*Interface).Underlying", Method, 5, ""},
+		{"(*Label).Exported", Method, 5, ""},
+		{"(*Label).Id", Method, 5, ""},
+		{"(*Label).Name", Method, 5, ""},
+		{"(*Label).Parent", Method, 5, ""},
+		{"(*Label).Pkg", Method, 5, ""},
+		{"(*Label).Pos", Method, 5, ""},
+		{"(*Label).String", Method, 5, ""},
+		{"(*Label).Type", Method, 5, ""},
+		{"(*Map).Elem", Method, 5, ""},
+		{"(*Map).Key", Method, 5, ""},
+		{"(*Map).String", Method, 5, ""},
+		{"(*Map).Underlying", Method, 5, ""},
+		{"(*MethodSet).At", Method, 5, ""},
+		{"(*MethodSet).Len", Method, 5, ""},
+		{"(*MethodSet).Lookup", Method, 5, ""},
+		{"(*MethodSet).Methods", Method, 24, ""},
+		{"(*MethodSet).String", Method, 5, ""},
+		{"(*Named).AddMethod", Method, 5, ""},
+		{"(*Named).Method", Method, 5, ""},
+		{"(*Named).Methods", Method, 24, ""},
+		{"(*Named).NumMethods", Method, 5, ""},
+		{"(*Named).Obj", Method, 5, ""},
+		{"(*Named).Origin", Method, 18, ""},
+		{"(*Named).SetTypeParams", Method, 18, ""},
+		{"(*Named).SetUnderlying", Method, 5, ""},
+		{"(*Named).String", Method, 5, ""},
+		{"(*Named).TypeArgs", Method, 18, ""},
+		{"(*Named).TypeParams", Method, 18, ""},
+		{"(*Named).Underlying", Method, 5, ""},
+		{"(*Nil).Exported", Method, 5, ""},
+		{"(*Nil).Id", Method, 5, ""},
+		{"(*Nil).Name", Method, 5, ""},
+		{"(*Nil).Parent", Method, 5, ""},
+		{"(*Nil).Pkg", Method, 5, ""},
+		{"(*Nil).Pos", Method, 5, ""},
+		{"(*Nil).String", Method, 5, ""},
+		{"(*Nil).Type", Method, 5, ""},
+		{"(*Package).Complete", Method, 5, ""},
+		{"(*Package).GoVersion", Method, 21, ""},
+		{"(*Package).Imports", Method, 5, ""},
+		{"(*Package).MarkComplete", Method, 5, ""},
+		{"(*Package).Name", Method, 5, ""},
+		{"(*Package).Path", Method, 5, ""},
+		{"(*Package).Scope", Method, 5, ""},
+		{"(*Package).SetImports", Method, 5, ""},
+		{"(*Package).SetName", Method, 6, ""},
+		{"(*Package).String", Method, 5, ""},
+		{"(*PkgName).Exported", Method, 5, ""},
+		{"(*PkgName).Id", Method, 5, ""},
+		{"(*PkgName).Imported", Method, 5, ""},
+		{"(*PkgName).Name", Method, 5, ""},
+		{"(*PkgName).Parent", Method, 5, ""},
+		{"(*PkgName).Pkg", Method, 5, ""},
+		{"(*PkgName).Pos", Method, 5, ""},
+		{"(*PkgName).String", Method, 5, ""},
+		{"(*PkgName).Type", Method, 5, ""},
+		{"(*Pointer).Elem", Method, 5, ""},
+		{"(*Pointer).String", Method, 5, ""},
+		{"(*Pointer).Underlying", Method, 5, ""},
+		{"(*Scope).Child", Method, 5, ""},
+		{"(*Scope).Children", Method, 24, ""},
+		{"(*Scope).Contains", Method, 5, ""},
+		{"(*Scope).End", Method, 5, ""},
+		{"(*Scope).Innermost", Method, 5, ""},
+		{"(*Scope).Insert", Method, 5, ""},
+		{"(*Scope).Len", Method, 5, ""},
+		{"(*Scope).Lookup", Method, 5, ""},
+		{"(*Scope).LookupParent", Method, 5, ""},
+		{"(*Scope).Names", Method, 5, ""},
+		{"(*Scope).NumChildren", Method, 5, ""},
+		{"(*Scope).Parent", Method, 5, ""},
+		{"(*Scope).Pos", Method, 5, ""},
+		{"(*Scope).String", Method, 5, ""},
+		{"(*Scope).WriteTo", Method, 5, ""},
+		{"(*Selection).Index", Method, 5, ""},
+		{"(*Selection).Indirect", Method, 5, ""},
+		{"(*Selection).Kind", Method, 5, ""},
+		{"(*Selection).Obj", Method, 5, ""},
+		{"(*Selection).Recv", Method, 5, ""},
+		{"(*Selection).String", Method, 5, ""},
+		{"(*Selection).Type", Method, 5, ""},
+		{"(*Signature).Params", Method, 5, ""},
+		{"(*Signature).Recv", Method, 5, ""},
+		{"(*Signature).RecvTypeParams", Method, 18, ""},
+		{"(*Signature).Results", Method, 5, ""},
+		{"(*Signature).String", Method, 5, ""},
+		{"(*Signature).TypeParams", Method, 18, ""},
+		{"(*Signature).Underlying", Method, 5, ""},
+		{"(*Signature).Variadic", Method, 5, ""},
+		{"(*Slice).Elem", Method, 5, ""},
+		{"(*Slice).String", Method, 5, ""},
+		{"(*Slice).Underlying", Method, 5, ""},
+		{"(*StdSizes).Alignof", Method, 5, ""},
+		{"(*StdSizes).Offsetsof", Method, 5, ""},
+		{"(*StdSizes).Sizeof", Method, 5, ""},
+		{"(*Struct).Field", Method, 5, ""},
+		{"(*Struct).Fields", Method, 24, ""},
+		{"(*Struct).NumFields", Method, 5, ""},
+		{"(*Struct).String", Method, 5, ""},
+		{"(*Struct).Tag", Method, 5, ""},
+		{"(*Struct).Underlying", Method, 5, ""},
+		{"(*Term).String", Method, 18, ""},
+		{"(*Term).Tilde", Method, 18, ""},
+		{"(*Term).Type", Method, 18, ""},
+		{"(*Tuple).At", Method, 5, ""},
+		{"(*Tuple).Len", Method, 5, ""},
+		{"(*Tuple).String", Method, 5, ""},
+		{"(*Tuple).Underlying", Method, 5, ""},
+		{"(*Tuple).Variables", Method, 24, ""},
+		{"(*TypeList).At", Method, 18, ""},
+		{"(*TypeList).Len", Method, 18, ""},
+		{"(*TypeList).Types", Method, 24, ""},
+		{"(*TypeName).Exported", Method, 5, ""},
+		{"(*TypeName).Id", Method, 5, ""},
+		{"(*TypeName).IsAlias", Method, 9, ""},
+		{"(*TypeName).Name", Method, 5, ""},
+		{"(*TypeName).Parent", Method, 5, ""},
+		{"(*TypeName).Pkg", Method, 5, ""},
+		{"(*TypeName).Pos", Method, 5, ""},
+		{"(*TypeName).String", Method, 5, ""},
+		{"(*TypeName).Type", Method, 5, ""},
+		{"(*TypeParam).Constraint", Method, 18, ""},
+		{"(*TypeParam).Index", Method, 18, ""},
+		{"(*TypeParam).Obj", Method, 18, ""},
+		{"(*TypeParam).SetConstraint", Method, 18, ""},
+		{"(*TypeParam).String", Method, 18, ""},
+		{"(*TypeParam).Underlying", Method, 18, ""},
+		{"(*TypeParamList).At", Method, 18, ""},
+		{"(*TypeParamList).Len", Method, 18, ""},
+		{"(*TypeParamList).TypeParams", Method, 24, ""},
+		{"(*Union).Len", Method, 18, ""},
+		{"(*Union).String", Method, 18, ""},
+		{"(*Union).Term", Method, 18, ""},
+		{"(*Union).Terms", Method, 24, ""},
+		{"(*Union).Underlying", Method, 18, ""},
+		{"(*Var).Anonymous", Method, 5, ""},
+		{"(*Var).Embedded", Method, 11, ""},
+		{"(*Var).Exported", Method, 5, ""},
+		{"(*Var).Id", Method, 5, ""},
+		{"(*Var).IsField", Method, 5, ""},
+		{"(*Var).Kind", Method, 25, ""},
+		{"(*Var).Name", Method, 5, ""},
+		{"(*Var).Origin", Method, 19, ""},
+		{"(*Var).Parent", Method, 5, ""},
+		{"(*Var).Pkg", Method, 5, ""},
+		{"(*Var).Pos", Method, 5, ""},
+		{"(*Var).SetKind", Method, 25, ""},
+		{"(*Var).String", Method, 5, ""},
+		{"(*Var).Type", Method, 5, ""},
+		{"(Checker).ObjectOf", Method, 5, ""},
+		{"(Checker).PkgNameOf", Method, 22, ""},
+		{"(Checker).TypeOf", Method, 5, ""},
+		{"(Error).Error", Method, 5, ""},
+		{"(TypeAndValue).Addressable", Method, 5, ""},
+		{"(TypeAndValue).Assignable", Method, 5, ""},
+		{"(TypeAndValue).HasOk", Method, 5, ""},
+		{"(TypeAndValue).IsBuiltin", Method, 5, ""},
+		{"(TypeAndValue).IsNil", Method, 5, ""},
+		{"(TypeAndValue).IsType", Method, 5, ""},
+		{"(TypeAndValue).IsValue", Method, 5, ""},
+		{"(TypeAndValue).IsVoid", Method, 5, ""},
+		{"(VarKind).String", Method, 25, ""},
+		{"Alias", Type, 22, ""},
+		{"ArgumentError", Type, 18, ""},
+		{"ArgumentError.Err", Field, 18, ""},
+		{"ArgumentError.Index", Field, 18, ""},
+		{"Array", Type, 5, ""},
+		{"AssertableTo", Func, 5, "func(V *Interface, T Type) bool"},
+		{"AssignableTo", Func, 5, "func(V Type, T Type) bool"},
+		{"Basic", Type, 5, ""},
+		{"BasicInfo", Type, 5, ""},
+		{"BasicKind", Type, 5, ""},
+		{"Bool", Const, 5, ""},
+		{"Builtin", Type, 5, ""},
+		{"Byte", Const, 5, ""},
+		{"Chan", Type, 5, ""},
+		{"ChanDir", Type, 5, ""},
+		{"CheckExpr", Func, 13, "func(fset *token.FileSet, pkg *Package, pos token.Pos, expr ast.Expr, info *Info) (err error)"},
+		{"Checker", Type, 5, ""},
+		{"Checker.Info", Field, 5, ""},
+		{"Comparable", Func, 5, "func(T Type) bool"},
+		{"Complex128", Const, 5, ""},
+		{"Complex64", Const, 5, ""},
+		{"Config", Type, 5, ""},
+		{"Config.Context", Field, 18, ""},
+		{"Config.DisableUnusedImportCheck", Field, 5, ""},
+		{"Config.Error", Field, 5, ""},
+		{"Config.FakeImportC", Field, 5, ""},
+		{"Config.GoVersion", Field, 18, ""},
+		{"Config.IgnoreFuncBodies", Field, 5, ""},
+		{"Config.Importer", Field, 5, ""},
+		{"Config.Sizes", Field, 5, ""},
+		{"Const", Type, 5, ""},
+		{"Context", Type, 18, ""},
+		{"ConvertibleTo", Func, 5, "func(V Type, T Type) bool"},
+		{"DefPredeclaredTestFuncs", Func, 5, "func()"},
+		{"Default", Func, 8, "func(t Type) Type"},
+		{"Error", Type, 5, ""},
+		{"Error.Fset", Field, 5, ""},
+		{"Error.Msg", Field, 5, ""},
+		{"Error.Pos", Field, 5, ""},
+		{"Error.Soft", Field, 5, ""},
+		{"Eval", Func, 5, "func(fset *token.FileSet, pkg *Package, pos token.Pos, expr string) (_ TypeAndValue, err error)"},
+		{"ExprString", Func, 5, "func(x ast.Expr) string"},
+		{"FieldVal", Const, 5, ""},
+		{"FieldVar", Const, 25, ""},
+		{"Float32", Const, 5, ""},
+		{"Float64", Const, 5, ""},
+		{"Func", Type, 5, ""},
+		{"Id", Func, 5, "func(pkg *Package, name string) string"},
+		{"Identical", Func, 5, "func(x Type, y Type) bool"},
+		{"IdenticalIgnoreTags", Func, 8, "func(x Type, y Type) bool"},
+		{"Implements", Func, 5, "func(V Type, T *Interface) bool"},
+		{"ImportMode", Type, 6, ""},
+		{"Importer", Type, 5, ""},
+		{"ImporterFrom", Type, 6, ""},
+		{"Info", Type, 5, ""},
+		{"Info.Defs", Field, 5, ""},
+		{"Info.FileVersions", Field, 22, ""},
+		{"Info.Implicits", Field, 5, ""},
+		{"Info.InitOrder", Field, 5, ""},
+		{"Info.Instances", Field, 18, ""},
+		{"Info.Scopes", Field, 5, ""},
+		{"Info.Selections", Field, 5, ""},
+		{"Info.Types", Field, 5, ""},
+		{"Info.Uses", Field, 5, ""},
+		{"Initializer", Type, 5, ""},
+		{"Initializer.Lhs", Field, 5, ""},
+		{"Initializer.Rhs", Field, 5, ""},
+		{"Instance", Type, 18, ""},
+		{"Instance.Type", Field, 18, ""},
+		{"Instance.TypeArgs", Field, 18, ""},
+		{"Instantiate", Func, 18, "func(ctxt *Context, orig Type, targs []Type, validate bool) (Type, error)"},
+		{"Int", Const, 5, ""},
+		{"Int16", Const, 5, ""},
+		{"Int32", Const, 5, ""},
+		{"Int64", Const, 5, ""},
+		{"Int8", Const, 5, ""},
+		{"Interface", Type, 5, ""},
+		{"Invalid", Const, 5, ""},
+		{"IsBoolean", Const, 5, ""},
+		{"IsComplex", Const, 5, ""},
+		{"IsConstType", Const, 5, ""},
+		{"IsFloat", Const, 5, ""},
+		{"IsInteger", Const, 5, ""},
+		{"IsInterface", Func, 5, "func(t Type) bool"},
+		{"IsNumeric", Const, 5, ""},
+		{"IsOrdered", Const, 5, ""},
+		{"IsString", Const, 5, ""},
+		{"IsUnsigned", Const, 5, ""},
+		{"IsUntyped", Const, 5, ""},
+		{"Label", Type, 5, ""},
+		{"LocalVar", Const, 25, ""},
+		{"LookupFieldOrMethod", Func, 5, "func(T Type, addressable bool, pkg *Package, name string) (obj Object, index []int, indirect bool)"},
+		{"LookupSelection", Func, 25, ""},
+		{"Map", Type, 5, ""},
+		{"MethodExpr", Const, 5, ""},
+		{"MethodSet", Type, 5, ""},
+		{"MethodVal", Const, 5, ""},
+		{"MissingMethod", Func, 5, "func(V Type, T *Interface, static bool) (method *Func, wrongType bool)"},
+		{"Named", Type, 5, ""},
+		{"NewAlias", Func, 22, "func(obj *TypeName, rhs Type) *Alias"},
+		{"NewArray", Func, 5, "func(elem Type, len int64) *Array"},
+		{"NewChan", Func, 5, "func(dir ChanDir, elem Type) *Chan"},
+		{"NewChecker", Func, 5, "func(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Checker"},
+		{"NewConst", Func, 5, "func(pos token.Pos, pkg *Package, name string, typ Type, val constant.Value) *Const"},
+		{"NewContext", Func, 18, "func() *Context"},
+		{"NewField", Func, 5, "func(pos token.Pos, pkg *Package, name string, typ Type, embedded bool) *Var"},
+		{"NewFunc", Func, 5, "func(pos token.Pos, pkg *Package, name string, sig *Signature) *Func"},
+		{"NewInterface", Func, 5, "func(methods []*Func, embeddeds []*Named) *Interface"},
+		{"NewInterfaceType", Func, 11, "func(methods []*Func, embeddeds []Type) *Interface"},
+		{"NewLabel", Func, 5, "func(pos token.Pos, pkg *Package, name string) *Label"},
+		{"NewMap", Func, 5, "func(key Type, elem Type) *Map"},
+		{"NewMethodSet", Func, 5, "func(T Type) *MethodSet"},
+		{"NewNamed", Func, 5, "func(obj *TypeName, underlying Type, methods []*Func) *Named"},
+		{"NewPackage", Func, 5, "func(path string, name string) *Package"},
+		{"NewParam", Func, 5, "func(pos token.Pos, pkg *Package, name string, typ Type) *Var"},
+		{"NewPkgName", Func, 5, "func(pos token.Pos, pkg *Package, name string, imported *Package) *PkgName"},
+		{"NewPointer", Func, 5, "func(elem Type) *Pointer"},
+		{"NewScope", Func, 5, "func(parent *Scope, pos token.Pos, end token.Pos, comment string) *Scope"},
+		{"NewSignature", Func, 5, "func(recv *Var, params *Tuple, results *Tuple, variadic bool) *Signature"},
+		{"NewSignatureType", Func, 18, "func(recv *Var, recvTypeParams []*TypeParam, typeParams []*TypeParam, params *Tuple, results *Tuple, variadic bool) *Signature"},
+		{"NewSlice", Func, 5, "func(elem Type) *Slice"},
+		{"NewStruct", Func, 5, "func(fields []*Var, tags []string) *Struct"},
+		{"NewTerm", Func, 18, "func(tilde bool, typ Type) *Term"},
+		{"NewTuple", Func, 5, "func(x ...*Var) *Tuple"},
+		{"NewTypeName", Func, 5, "func(pos token.Pos, pkg *Package, name string, typ Type) *TypeName"},
+		{"NewTypeParam", Func, 18, "func(obj *TypeName, constraint Type) *TypeParam"},
+		{"NewUnion", Func, 18, "func(terms []*Term) *Union"},
+		{"NewVar", Func, 5, "func(pos token.Pos, pkg *Package, name string, typ Type) *Var"},
+		{"Nil", Type, 5, ""},
+		{"Object", Type, 5, ""},
+		{"ObjectString", Func, 5, "func(obj Object, qf Qualifier) string"},
+		{"Package", Type, 5, ""},
+		{"PackageVar", Const, 25, ""},
+		{"ParamVar", Const, 25, ""},
+		{"PkgName", Type, 5, ""},
+		{"Pointer", Type, 5, ""},
+		{"Qualifier", Type, 5, ""},
+		{"RecvOnly", Const, 5, ""},
+		{"RecvVar", Const, 25, ""},
+		{"RelativeTo", Func, 5, "func(pkg *Package) Qualifier"},
+		{"ResultVar", Const, 25, ""},
+		{"Rune", Const, 5, ""},
+		{"Satisfies", Func, 20, "func(V Type, T *Interface) bool"},
+		{"Scope", Type, 5, ""},
+		{"Selection", Type, 5, ""},
+		{"SelectionKind", Type, 5, ""},
+		{"SelectionString", Func, 5, "func(s *Selection, qf Qualifier) string"},
+		{"SendOnly", Const, 5, ""},
+		{"SendRecv", Const, 5, ""},
+		{"Signature", Type, 5, ""},
+		{"Sizes", Type, 5, ""},
+		{"SizesFor", Func, 9, "func(compiler string, arch string) Sizes"},
+		{"Slice", Type, 5, ""},
+		{"StdSizes", Type, 5, ""},
+		{"StdSizes.MaxAlign", Field, 5, ""},
+		{"StdSizes.WordSize", Field, 5, ""},
+		{"String", Const, 5, ""},
+		{"Struct", Type, 5, ""},
+		{"Term", Type, 18, ""},
+		{"Tuple", Type, 5, ""},
+		{"Typ", Var, 5, ""},
+		{"Type", Type, 5, ""},
+		{"TypeAndValue", Type, 5, ""},
+		{"TypeAndValue.Type", Field, 5, ""},
+		{"TypeAndValue.Value", Field, 5, ""},
+		{"TypeList", Type, 18, ""},
+		{"TypeName", Type, 5, ""},
+		{"TypeParam", Type, 18, ""},
+		{"TypeParamList", Type, 18, ""},
+		{"TypeString", Func, 5, "func(typ Type, qf Qualifier) string"},
+		{"Uint", Const, 5, ""},
+		{"Uint16", Const, 5, ""},
+		{"Uint32", Const, 5, ""},
+		{"Uint64", Const, 5, ""},
+		{"Uint8", Const, 5, ""},
+		{"Uintptr", Const, 5, ""},
+		{"Unalias", Func, 22, "func(t Type) Type"},
+		{"Union", Type, 18, ""},
+		{"Universe", Var, 5, ""},
+		{"Unsafe", Var, 5, ""},
+		{"UnsafePointer", Const, 5, ""},
+		{"UntypedBool", Const, 5, ""},
+		{"UntypedComplex", Const, 5, ""},
+		{"UntypedFloat", Const, 5, ""},
+		{"UntypedInt", Const, 5, ""},
+		{"UntypedNil", Const, 5, ""},
+		{"UntypedRune", Const, 5, ""},
+		{"UntypedString", Const, 5, ""},
+		{"Var", Type, 5, ""},
+		{"VarKind", Type, 25, ""},
+		{"WriteExpr", Func, 5, "func(buf *bytes.Buffer, x ast.Expr)"},
+		{"WriteSignature", Func, 5, "func(buf *bytes.Buffer, sig *Signature, qf Qualifier)"},
+		{"WriteType", Func, 5, "func(buf *bytes.Buffer, typ Type, qf Qualifier)"},
+	},
+	"go/version": {
+		{"Compare", Func, 22, "func(x string, y string) int"},
+		{"IsValid", Func, 22, "func(x string) bool"},
+		{"Lang", Func, 22, "func(x string) string"},
+	},
+	"hash": {
+		{"Hash", Type, 0, ""},
+		{"Hash32", Type, 0, ""},
+		{"Hash64", Type, 0, ""},
+	},
+	"hash/adler32": {
+		{"Checksum", Func, 0, "func(data []byte) uint32"},
+		{"New", Func, 0, "func() hash.Hash32"},
+		{"Size", Const, 0, ""},
+	},
+	"hash/crc32": {
+		{"Castagnoli", Const, 0, ""},
+		{"Checksum", Func, 0, "func(data []byte, tab *Table) uint32"},
+		{"ChecksumIEEE", Func, 0, "func(data []byte) uint32"},
+		{"IEEE", Const, 0, ""},
+		{"IEEETable", Var, 0, ""},
+		{"Koopman", Const, 0, ""},
+		{"MakeTable", Func, 0, "func(poly uint32) *Table"},
+		{"New", Func, 0, "func(tab *Table) hash.Hash32"},
+		{"NewIEEE", Func, 0, "func() hash.Hash32"},
+		{"Size", Const, 0, ""},
+		{"Table", Type, 0, ""},
+		{"Update", Func, 0, "func(crc uint32, tab *Table, p []byte) uint32"},
+	},
+	"hash/crc64": {
+		{"Checksum", Func, 0, "func(data []byte, tab *Table) uint64"},
+		{"ECMA", Const, 0, ""},
+		{"ISO", Const, 0, ""},
+		{"MakeTable", Func, 0, "func(poly uint64) *Table"},
+		{"New", Func, 0, "func(tab *Table) hash.Hash64"},
+		{"Size", Const, 0, ""},
+		{"Table", Type, 0, ""},
+		{"Update", Func, 0, "func(crc uint64, tab *Table, p []byte) uint64"},
+	},
+	"hash/fnv": {
+		{"New128", Func, 9, "func() hash.Hash"},
+		{"New128a", Func, 9, "func() hash.Hash"},
+		{"New32", Func, 0, "func() hash.Hash32"},
+		{"New32a", Func, 0, "func() hash.Hash32"},
+		{"New64", Func, 0, "func() hash.Hash64"},
+		{"New64a", Func, 0, "func() hash.Hash64"},
+	},
+	"hash/maphash": {
+		{"(*Hash).BlockSize", Method, 14, ""},
+		{"(*Hash).Reset", Method, 14, ""},
+		{"(*Hash).Seed", Method, 14, ""},
+		{"(*Hash).SetSeed", Method, 14, ""},
+		{"(*Hash).Size", Method, 14, ""},
+		{"(*Hash).Sum", Method, 14, ""},
+		{"(*Hash).Sum64", Method, 14, ""},
+		{"(*Hash).Write", Method, 14, ""},
+		{"(*Hash).WriteByte", Method, 14, ""},
+		{"(*Hash).WriteString", Method, 14, ""},
+		{"Bytes", Func, 19, "func(seed Seed, b []byte) uint64"},
+		{"Comparable", Func, 24, "func[T comparable](seed Seed, v T) uint64"},
+		{"Hash", Type, 14, ""},
+		{"MakeSeed", Func, 14, "func() Seed"},
+		{"Seed", Type, 14, ""},
+		{"String", Func, 19, "func(seed Seed, s string) uint64"},
+		{"WriteComparable", Func, 24, "func[T comparable](h *Hash, x T)"},
+	},
+	"html": {
+		{"EscapeString", Func, 0, "func(s string) string"},
+		{"UnescapeString", Func, 0, "func(s string) string"},
+	},
+	"html/template": {
+		{"(*Error).Error", Method, 0, ""},
+		{"(*Template).AddParseTree", Method, 0, ""},
+		{"(*Template).Clone", Method, 0, ""},
+		{"(*Template).DefinedTemplates", Method, 6, ""},
+		{"(*Template).Delims", Method, 0, ""},
+		{"(*Template).Execute", Method, 0, ""},
+		{"(*Template).ExecuteTemplate", Method, 0, ""},
+		{"(*Template).Funcs", Method, 0, ""},
+		{"(*Template).Lookup", Method, 0, ""},
+		{"(*Template).Name", Method, 0, ""},
+		{"(*Template).New", Method, 0, ""},
+		{"(*Template).Option", Method, 5, ""},
+		{"(*Template).Parse", Method, 0, ""},
+		{"(*Template).ParseFS", Method, 16, ""},
+		{"(*Template).ParseFiles", Method, 0, ""},
+		{"(*Template).ParseGlob", Method, 0, ""},
+		{"(*Template).Templates", Method, 0, ""},
+		{"CSS", Type, 0, ""},
+		{"ErrAmbigContext", Const, 0, ""},
+		{"ErrBadHTML", Const, 0, ""},
+		{"ErrBranchEnd", Const, 0, ""},
+		{"ErrEndContext", Const, 0, ""},
+		{"ErrJSTemplate", Const, 21, ""},
+		{"ErrNoSuchTemplate", Const, 0, ""},
+		{"ErrOutputContext", Const, 0, ""},
+		{"ErrPartialCharset", Const, 0, ""},
+		{"ErrPartialEscape", Const, 0, ""},
+		{"ErrPredefinedEscaper", Const, 9, ""},
+		{"ErrRangeLoopReentry", Const, 0, ""},
+		{"ErrSlashAmbig", Const, 0, ""},
+		{"Error", Type, 0, ""},
+		{"Error.Description", Field, 0, ""},
+		{"Error.ErrorCode", Field, 0, ""},
+		{"Error.Line", Field, 0, ""},
+		{"Error.Name", Field, 0, ""},
+		{"Error.Node", Field, 4, ""},
+		{"ErrorCode", Type, 0, ""},
+		{"FuncMap", Type, 0, ""},
+		{"HTML", Type, 0, ""},
+		{"HTMLAttr", Type, 0, ""},
+		{"HTMLEscape", Func, 0, "func(w io.Writer, b []byte)"},
+		{"HTMLEscapeString", Func, 0, "func(s string) string"},
+		{"HTMLEscaper", Func, 0, "func(args ...any) string"},
+		{"IsTrue", Func, 6, "func(val any) (truth bool, ok bool)"},
+		{"JS", Type, 0, ""},
+		{"JSEscape", Func, 0, "func(w io.Writer, b []byte)"},
+		{"JSEscapeString", Func, 0, "func(s string) string"},
+		{"JSEscaper", Func, 0, "func(args ...any) string"},
+		{"JSStr", Type, 0, ""},
+		{"Must", Func, 0, "func(t *Template, err error) *Template"},
+		{"New", Func, 0, "func(name string) *Template"},
+		{"OK", Const, 0, ""},
+		{"ParseFS", Func, 16, "func(fs fs.FS, patterns ...string) (*Template, error)"},
+		{"ParseFiles", Func, 0, "func(filenames ...string) (*Template, error)"},
+		{"ParseGlob", Func, 0, "func(pattern string) (*Template, error)"},
+		{"Srcset", Type, 10, ""},
+		{"Template", Type, 0, ""},
+		{"Template.Tree", Field, 2, ""},
+		{"URL", Type, 0, ""},
+		{"URLQueryEscaper", Func, 0, "func(args ...any) string"},
+	},
+	"image": {
+		{"(*Alpha).AlphaAt", Method, 4, ""},
+		{"(*Alpha).At", Method, 0, ""},
+		{"(*Alpha).Bounds", Method, 0, ""},
+		{"(*Alpha).ColorModel", Method, 0, ""},
+		{"(*Alpha).Opaque", Method, 0, ""},
+		{"(*Alpha).PixOffset", Method, 0, ""},
+		{"(*Alpha).RGBA64At", Method, 17, ""},
+		{"(*Alpha).Set", Method, 0, ""},
+		{"(*Alpha).SetAlpha", Method, 0, ""},
+		{"(*Alpha).SetRGBA64", Method, 17, ""},
+		{"(*Alpha).SubImage", Method, 0, ""},
+		{"(*Alpha16).Alpha16At", Method, 4, ""},
+		{"(*Alpha16).At", Method, 0, ""},
+		{"(*Alpha16).Bounds", Method, 0, ""},
+		{"(*Alpha16).ColorModel", Method, 0, ""},
+		{"(*Alpha16).Opaque", Method, 0, ""},
+		{"(*Alpha16).PixOffset", Method, 0, ""},
+		{"(*Alpha16).RGBA64At", Method, 17, ""},
+		{"(*Alpha16).Set", Method, 0, ""},
+		{"(*Alpha16).SetAlpha16", Method, 0, ""},
+		{"(*Alpha16).SetRGBA64", Method, 17, ""},
+		{"(*Alpha16).SubImage", Method, 0, ""},
+		{"(*CMYK).At", Method, 5, ""},
+		{"(*CMYK).Bounds", Method, 5, ""},
+		{"(*CMYK).CMYKAt", Method, 5, ""},
+		{"(*CMYK).ColorModel", Method, 5, ""},
+		{"(*CMYK).Opaque", Method, 5, ""},
+		{"(*CMYK).PixOffset", Method, 5, ""},
+		{"(*CMYK).RGBA64At", Method, 17, ""},
+		{"(*CMYK).Set", Method, 5, ""},
+		{"(*CMYK).SetCMYK", Method, 5, ""},
+		{"(*CMYK).SetRGBA64", Method, 17, ""},
+		{"(*CMYK).SubImage", Method, 5, ""},
+		{"(*Gray).At", Method, 0, ""},
+		{"(*Gray).Bounds", Method, 0, ""},
+		{"(*Gray).ColorModel", Method, 0, ""},
+		{"(*Gray).GrayAt", Method, 4, ""},
+		{"(*Gray).Opaque", Method, 0, ""},
+		{"(*Gray).PixOffset", Method, 0, ""},
+		{"(*Gray).RGBA64At", Method, 17, ""},
+		{"(*Gray).Set", Method, 0, ""},
+		{"(*Gray).SetGray", Method, 0, ""},
+		{"(*Gray).SetRGBA64", Method, 17, ""},
+		{"(*Gray).SubImage", Method, 0, ""},
+		{"(*Gray16).At", Method, 0, ""},
+		{"(*Gray16).Bounds", Method, 0, ""},
+		{"(*Gray16).ColorModel", Method, 0, ""},
+		{"(*Gray16).Gray16At", Method, 4, ""},
+		{"(*Gray16).Opaque", Method, 0, ""},
+		{"(*Gray16).PixOffset", Method, 0, ""},
+		{"(*Gray16).RGBA64At", Method, 17, ""},
+		{"(*Gray16).Set", Method, 0, ""},
+		{"(*Gray16).SetGray16", Method, 0, ""},
+		{"(*Gray16).SetRGBA64", Method, 17, ""},
+		{"(*Gray16).SubImage", Method, 0, ""},
+		{"(*NRGBA).At", Method, 0, ""},
+		{"(*NRGBA).Bounds", Method, 0, ""},
+		{"(*NRGBA).ColorModel", Method, 0, ""},
+		{"(*NRGBA).NRGBAAt", Method, 4, ""},
+		{"(*NRGBA).Opaque", Method, 0, ""},
+		{"(*NRGBA).PixOffset", Method, 0, ""},
+		{"(*NRGBA).RGBA64At", Method, 17, ""},
+		{"(*NRGBA).Set", Method, 0, ""},
+		{"(*NRGBA).SetNRGBA", Method, 0, ""},
+		{"(*NRGBA).SetRGBA64", Method, 17, ""},
+		{"(*NRGBA).SubImage", Method, 0, ""},
+		{"(*NRGBA64).At", Method, 0, ""},
+		{"(*NRGBA64).Bounds", Method, 0, ""},
+		{"(*NRGBA64).ColorModel", Method, 0, ""},
+		{"(*NRGBA64).NRGBA64At", Method, 4, ""},
+		{"(*NRGBA64).Opaque", Method, 0, ""},
+		{"(*NRGBA64).PixOffset", Method, 0, ""},
+		{"(*NRGBA64).RGBA64At", Method, 17, ""},
+		{"(*NRGBA64).Set", Method, 0, ""},
+		{"(*NRGBA64).SetNRGBA64", Method, 0, ""},
+		{"(*NRGBA64).SetRGBA64", Method, 17, ""},
+		{"(*NRGBA64).SubImage", Method, 0, ""},
+		{"(*NYCbCrA).AOffset", Method, 6, ""},
+		{"(*NYCbCrA).At", Method, 6, ""},
+		{"(*NYCbCrA).Bounds", Method, 6, ""},
+		{"(*NYCbCrA).COffset", Method, 6, ""},
+		{"(*NYCbCrA).ColorModel", Method, 6, ""},
+		{"(*NYCbCrA).NYCbCrAAt", Method, 6, ""},
+		{"(*NYCbCrA).Opaque", Method, 6, ""},
+		{"(*NYCbCrA).RGBA64At", Method, 17, ""},
+		{"(*NYCbCrA).SubImage", Method, 6, ""},
+		{"(*NYCbCrA).YCbCrAt", Method, 6, ""},
+		{"(*NYCbCrA).YOffset", Method, 6, ""},
+		{"(*Paletted).At", Method, 0, ""},
+		{"(*Paletted).Bounds", Method, 0, ""},
+		{"(*Paletted).ColorIndexAt", Method, 0, ""},
+		{"(*Paletted).ColorModel", Method, 0, ""},
+		{"(*Paletted).Opaque", Method, 0, ""},
+		{"(*Paletted).PixOffset", Method, 0, ""},
+		{"(*Paletted).RGBA64At", Method, 17, ""},
+		{"(*Paletted).Set", Method, 0, ""},
+		{"(*Paletted).SetColorIndex", Method, 0, ""},
+		{"(*Paletted).SetRGBA64", Method, 17, ""},
+		{"(*Paletted).SubImage", Method, 0, ""},
+		{"(*RGBA).At", Method, 0, ""},
+		{"(*RGBA).Bounds", Method, 0, ""},
+		{"(*RGBA).ColorModel", Method, 0, ""},
+		{"(*RGBA).Opaque", Method, 0, ""},
+		{"(*RGBA).PixOffset", Method, 0, ""},
+		{"(*RGBA).RGBA64At", Method, 17, ""},
+		{"(*RGBA).RGBAAt", Method, 4, ""},
+		{"(*RGBA).Set", Method, 0, ""},
+		{"(*RGBA).SetRGBA", Method, 0, ""},
+		{"(*RGBA).SetRGBA64", Method, 17, ""},
+		{"(*RGBA).SubImage", Method, 0, ""},
+		{"(*RGBA64).At", Method, 0, ""},
+		{"(*RGBA64).Bounds", Method, 0, ""},
+		{"(*RGBA64).ColorModel", Method, 0, ""},
+		{"(*RGBA64).Opaque", Method, 0, ""},
+		{"(*RGBA64).PixOffset", Method, 0, ""},
+		{"(*RGBA64).RGBA64At", Method, 4, ""},
+		{"(*RGBA64).Set", Method, 0, ""},
+		{"(*RGBA64).SetRGBA64", Method, 0, ""},
+		{"(*RGBA64).SubImage", Method, 0, ""},
+		{"(*Uniform).At", Method, 0, ""},
+		{"(*Uniform).Bounds", Method, 0, ""},
+		{"(*Uniform).ColorModel", Method, 0, ""},
+		{"(*Uniform).Convert", Method, 0, ""},
+		{"(*Uniform).Opaque", Method, 0, ""},
+		{"(*Uniform).RGBA", Method, 0, ""},
+		{"(*Uniform).RGBA64At", Method, 17, ""},
+		{"(*YCbCr).At", Method, 0, ""},
+		{"(*YCbCr).Bounds", Method, 0, ""},
+		{"(*YCbCr).COffset", Method, 0, ""},
+		{"(*YCbCr).ColorModel", Method, 0, ""},
+		{"(*YCbCr).Opaque", Method, 0, ""},
+		{"(*YCbCr).RGBA64At", Method, 17, ""},
+		{"(*YCbCr).SubImage", Method, 0, ""},
+		{"(*YCbCr).YCbCrAt", Method, 4, ""},
+		{"(*YCbCr).YOffset", Method, 0, ""},
+		{"(Point).Add", Method, 0, ""},
+		{"(Point).Div", Method, 0, ""},
+		{"(Point).Eq", Method, 0, ""},
+		{"(Point).In", Method, 0, ""},
+		{"(Point).Mod", Method, 0, ""},
+		{"(Point).Mul", Method, 0, ""},
+		{"(Point).String", Method, 0, ""},
+		{"(Point).Sub", Method, 0, ""},
+		{"(Rectangle).Add", Method, 0, ""},
+		{"(Rectangle).At", Method, 5, ""},
+		{"(Rectangle).Bounds", Method, 5, ""},
+		{"(Rectangle).Canon", Method, 0, ""},
+		{"(Rectangle).ColorModel", Method, 5, ""},
+		{"(Rectangle).Dx", Method, 0, ""},
+		{"(Rectangle).Dy", Method, 0, ""},
+		{"(Rectangle).Empty", Method, 0, ""},
+		{"(Rectangle).Eq", Method, 0, ""},
+		{"(Rectangle).In", Method, 0, ""},
+		{"(Rectangle).Inset", Method, 0, ""},
+		{"(Rectangle).Intersect", Method, 0, ""},
+		{"(Rectangle).Overlaps", Method, 0, ""},
+		{"(Rectangle).RGBA64At", Method, 17, ""},
+		{"(Rectangle).Size", Method, 0, ""},
+		{"(Rectangle).String", Method, 0, ""},
+		{"(Rectangle).Sub", Method, 0, ""},
+		{"(Rectangle).Union", Method, 0, ""},
+		{"(YCbCrSubsampleRatio).String", Method, 0, ""},
+		{"Alpha", Type, 0, ""},
+		{"Alpha.Pix", Field, 0, ""},
+		{"Alpha.Rect", Field, 0, ""},
+		{"Alpha.Stride", Field, 0, ""},
+		{"Alpha16", Type, 0, ""},
+		{"Alpha16.Pix", Field, 0, ""},
+		{"Alpha16.Rect", Field, 0, ""},
+		{"Alpha16.Stride", Field, 0, ""},
+		{"Black", Var, 0, ""},
+		{"CMYK", Type, 5, ""},
+		{"CMYK.Pix", Field, 5, ""},
+		{"CMYK.Rect", Field, 5, ""},
+		{"CMYK.Stride", Field, 5, ""},
+		{"Config", Type, 0, ""},
+		{"Config.ColorModel", Field, 0, ""},
+		{"Config.Height", Field, 0, ""},
+		{"Config.Width", Field, 0, ""},
+		{"Decode", Func, 0, "func(r io.Reader) (Image, string, error)"},
+		{"DecodeConfig", Func, 0, "func(r io.Reader) (Config, string, error)"},
+		{"ErrFormat", Var, 0, ""},
+		{"Gray", Type, 0, ""},
+		{"Gray.Pix", Field, 0, ""},
+		{"Gray.Rect", Field, 0, ""},
+		{"Gray.Stride", Field, 0, ""},
+		{"Gray16", Type, 0, ""},
+		{"Gray16.Pix", Field, 0, ""},
+		{"Gray16.Rect", Field, 0, ""},
+		{"Gray16.Stride", Field, 0, ""},
+		{"Image", Type, 0, ""},
+		{"NRGBA", Type, 0, ""},
+		{"NRGBA.Pix", Field, 0, ""},
+		{"NRGBA.Rect", Field, 0, ""},
+		{"NRGBA.Stride", Field, 0, ""},
+		{"NRGBA64", Type, 0, ""},
+		{"NRGBA64.Pix", Field, 0, ""},
+		{"NRGBA64.Rect", Field, 0, ""},
+		{"NRGBA64.Stride", Field, 0, ""},
+		{"NYCbCrA", Type, 6, ""},
+		{"NYCbCrA.A", Field, 6, ""},
+		{"NYCbCrA.AStride", Field, 6, ""},
+		{"NYCbCrA.YCbCr", Field, 6, ""},
+		{"NewAlpha", Func, 0, "func(r Rectangle) *Alpha"},
+		{"NewAlpha16", Func, 0, "func(r Rectangle) *Alpha16"},
+		{"NewCMYK", Func, 5, "func(r Rectangle) *CMYK"},
+		{"NewGray", Func, 0, "func(r Rectangle) *Gray"},
+		{"NewGray16", Func, 0, "func(r Rectangle) *Gray16"},
+		{"NewNRGBA", Func, 0, "func(r Rectangle) *NRGBA"},
+		{"NewNRGBA64", Func, 0, "func(r Rectangle) *NRGBA64"},
+		{"NewNYCbCrA", Func, 6, "func(r Rectangle, subsampleRatio YCbCrSubsampleRatio) *NYCbCrA"},
+		{"NewPaletted", Func, 0, "func(r Rectangle, p color.Palette) *Paletted"},
+		{"NewRGBA", Func, 0, "func(r Rectangle) *RGBA"},
+		{"NewRGBA64", Func, 0, "func(r Rectangle) *RGBA64"},
+		{"NewUniform", Func, 0, "func(c color.Color) *Uniform"},
+		{"NewYCbCr", Func, 0, "func(r Rectangle, subsampleRatio YCbCrSubsampleRatio) *YCbCr"},
+		{"Opaque", Var, 0, ""},
+		{"Paletted", Type, 0, ""},
+		{"Paletted.Palette", Field, 0, ""},
+		{"Paletted.Pix", Field, 0, ""},
+		{"Paletted.Rect", Field, 0, ""},
+		{"Paletted.Stride", Field, 0, ""},
+		{"PalettedImage", Type, 0, ""},
+		{"Point", Type, 0, ""},
+		{"Point.X", Field, 0, ""},
+		{"Point.Y", Field, 0, ""},
+		{"Pt", Func, 0, "func(X int, Y int) Point"},
+		{"RGBA", Type, 0, ""},
+		{"RGBA.Pix", Field, 0, ""},
+		{"RGBA.Rect", Field, 0, ""},
+		{"RGBA.Stride", Field, 0, ""},
+		{"RGBA64", Type, 0, ""},
+		{"RGBA64.Pix", Field, 0, ""},
+		{"RGBA64.Rect", Field, 0, ""},
+		{"RGBA64.Stride", Field, 0, ""},
+		{"RGBA64Image", Type, 17, ""},
+		{"Rect", Func, 0, "func(x0 int, y0 int, x1 int, y1 int) Rectangle"},
+		{"Rectangle", Type, 0, ""},
+		{"Rectangle.Max", Field, 0, ""},
+		{"Rectangle.Min", Field, 0, ""},
+		{"RegisterFormat", Func, 0, "func(name string, magic string, decode func(io.Reader) (Image, error), decodeConfig func(io.Reader) (Config, error))"},
+		{"Transparent", Var, 0, ""},
+		{"Uniform", Type, 0, ""},
+		{"Uniform.C", Field, 0, ""},
+		{"White", Var, 0, ""},
+		{"YCbCr", Type, 0, ""},
+		{"YCbCr.CStride", Field, 0, ""},
+		{"YCbCr.Cb", Field, 0, ""},
+		{"YCbCr.Cr", Field, 0, ""},
+		{"YCbCr.Rect", Field, 0, ""},
+		{"YCbCr.SubsampleRatio", Field, 0, ""},
+		{"YCbCr.Y", Field, 0, ""},
+		{"YCbCr.YStride", Field, 0, ""},
+		{"YCbCrSubsampleRatio", Type, 0, ""},
+		{"YCbCrSubsampleRatio410", Const, 5, ""},
+		{"YCbCrSubsampleRatio411", Const, 5, ""},
+		{"YCbCrSubsampleRatio420", Const, 0, ""},
+		{"YCbCrSubsampleRatio422", Const, 0, ""},
+		{"YCbCrSubsampleRatio440", Const, 1, ""},
+		{"YCbCrSubsampleRatio444", Const, 0, ""},
+		{"ZP", Var, 0, ""},
+		{"ZR", Var, 0, ""},
+	},
+	"image/color": {
+		{"(Alpha).RGBA", Method, 0, ""},
+		{"(Alpha16).RGBA", Method, 0, ""},
+		{"(CMYK).RGBA", Method, 5, ""},
+		{"(Gray).RGBA", Method, 0, ""},
+		{"(Gray16).RGBA", Method, 0, ""},
+		{"(NRGBA).RGBA", Method, 0, ""},
+		{"(NRGBA64).RGBA", Method, 0, ""},
+		{"(NYCbCrA).RGBA", Method, 6, ""},
+		{"(Palette).Convert", Method, 0, ""},
+		{"(Palette).Index", Method, 0, ""},
+		{"(RGBA).RGBA", Method, 0, ""},
+		{"(RGBA64).RGBA", Method, 0, ""},
+		{"(YCbCr).RGBA", Method, 0, ""},
+		{"Alpha", Type, 0, ""},
+		{"Alpha.A", Field, 0, ""},
+		{"Alpha16", Type, 0, ""},
+		{"Alpha16.A", Field, 0, ""},
+		{"Alpha16Model", Var, 0, ""},
+		{"AlphaModel", Var, 0, ""},
+		{"Black", Var, 0, ""},
+		{"CMYK", Type, 5, ""},
+		{"CMYK.C", Field, 5, ""},
+		{"CMYK.K", Field, 5, ""},
+		{"CMYK.M", Field, 5, ""},
+		{"CMYK.Y", Field, 5, ""},
+		{"CMYKModel", Var, 5, ""},
+		{"CMYKToRGB", Func, 5, "func(c uint8, m uint8, y uint8, k uint8) (uint8, uint8, uint8)"},
+		{"Color", Type, 0, ""},
+		{"Gray", Type, 0, ""},
+		{"Gray.Y", Field, 0, ""},
+		{"Gray16", Type, 0, ""},
+		{"Gray16.Y", Field, 0, ""},
+		{"Gray16Model", Var, 0, ""},
+		{"GrayModel", Var, 0, ""},
+		{"Model", Type, 0, ""},
+		{"ModelFunc", Func, 0, "func(f func(Color) Color) Model"},
+		{"NRGBA", Type, 0, ""},
+		{"NRGBA.A", Field, 0, ""},
+		{"NRGBA.B", Field, 0, ""},
+		{"NRGBA.G", Field, 0, ""},
+		{"NRGBA.R", Field, 0, ""},
+		{"NRGBA64", Type, 0, ""},
+		{"NRGBA64.A", Field, 0, ""},
+		{"NRGBA64.B", Field, 0, ""},
+		{"NRGBA64.G", Field, 0, ""},
+		{"NRGBA64.R", Field, 0, ""},
+		{"NRGBA64Model", Var, 0, ""},
+		{"NRGBAModel", Var, 0, ""},
+		{"NYCbCrA", Type, 6, ""},
+		{"NYCbCrA.A", Field, 6, ""},
+		{"NYCbCrA.YCbCr", Field, 6, ""},
+		{"NYCbCrAModel", Var, 6, ""},
+		{"Opaque", Var, 0, ""},
+		{"Palette", Type, 0, ""},
+		{"RGBA", Type, 0, ""},
+		{"RGBA.A", Field, 0, ""},
+		{"RGBA.B", Field, 0, ""},
+		{"RGBA.G", Field, 0, ""},
+		{"RGBA.R", Field, 0, ""},
+		{"RGBA64", Type, 0, ""},
+		{"RGBA64.A", Field, 0, ""},
+		{"RGBA64.B", Field, 0, ""},
+		{"RGBA64.G", Field, 0, ""},
+		{"RGBA64.R", Field, 0, ""},
+		{"RGBA64Model", Var, 0, ""},
+		{"RGBAModel", Var, 0, ""},
+		{"RGBToCMYK", Func, 5, "func(r uint8, g uint8, b uint8) (uint8, uint8, uint8, uint8)"},
+		{"RGBToYCbCr", Func, 0, "func(r uint8, g uint8, b uint8) (uint8, uint8, uint8)"},
+		{"Transparent", Var, 0, ""},
+		{"White", Var, 0, ""},
+		{"YCbCr", Type, 0, ""},
+		{"YCbCr.Cb", Field, 0, ""},
+		{"YCbCr.Cr", Field, 0, ""},
+		{"YCbCr.Y", Field, 0, ""},
+		{"YCbCrModel", Var, 0, ""},
+		{"YCbCrToRGB", Func, 0, "func(y uint8, cb uint8, cr uint8) (uint8, uint8, uint8)"},
+	},
+	"image/color/palette": {
+		{"Plan9", Var, 2, ""},
+		{"WebSafe", Var, 2, ""},
+	},
+	"image/draw": {
+		{"(Op).Draw", Method, 2, ""},
+		{"Draw", Func, 0, "func(dst Image, r image.Rectangle, src image.Image, sp image.Point, op Op)"},
+		{"DrawMask", Func, 0, "func(dst Image, r image.Rectangle, src image.Image, sp image.Point, mask image.Image, mp image.Point, op Op)"},
+		{"Drawer", Type, 2, ""},
+		{"FloydSteinberg", Var, 2, ""},
+		{"Image", Type, 0, ""},
+		{"Op", Type, 0, ""},
+		{"Over", Const, 0, ""},
+		{"Quantizer", Type, 2, ""},
+		{"RGBA64Image", Type, 17, ""},
+		{"Src", Const, 0, ""},
+	},
+	"image/gif": {
+		{"Decode", Func, 0, "func(r io.Reader) (image.Image, error)"},
+		{"DecodeAll", Func, 0, "func(r io.Reader) (*GIF, error)"},
+		{"DecodeConfig", Func, 0, "func(r io.Reader) (image.Config, error)"},
+		{"DisposalBackground", Const, 5, ""},
+		{"DisposalNone", Const, 5, ""},
+		{"DisposalPrevious", Const, 5, ""},
+		{"Encode", Func, 2, "func(w io.Writer, m image.Image, o *Options) error"},
+		{"EncodeAll", Func, 2, "func(w io.Writer, g *GIF) error"},
+		{"GIF", Type, 0, ""},
+		{"GIF.BackgroundIndex", Field, 5, ""},
+		{"GIF.Config", Field, 5, ""},
+		{"GIF.Delay", Field, 0, ""},
+		{"GIF.Disposal", Field, 5, ""},
+		{"GIF.Image", Field, 0, ""},
+		{"GIF.LoopCount", Field, 0, ""},
+		{"Options", Type, 2, ""},
+		{"Options.Drawer", Field, 2, ""},
+		{"Options.NumColors", Field, 2, ""},
+		{"Options.Quantizer", Field, 2, ""},
+	},
+	"image/jpeg": {
+		{"(FormatError).Error", Method, 0, ""},
+		{"(UnsupportedError).Error", Method, 0, ""},
+		{"Decode", Func, 0, "func(r io.Reader) (image.Image, error)"},
+		{"DecodeConfig", Func, 0, "func(r io.Reader) (image.Config, error)"},
+		{"DefaultQuality", Const, 0, ""},
+		{"Encode", Func, 0, "func(w io.Writer, m image.Image, o *Options) error"},
+		{"FormatError", Type, 0, ""},
+		{"Options", Type, 0, ""},
+		{"Options.Quality", Field, 0, ""},
+		{"Reader", Type, 0, ""},
+		{"UnsupportedError", Type, 0, ""},
+	},
+	"image/png": {
+		{"(*Encoder).Encode", Method, 4, ""},
+		{"(FormatError).Error", Method, 0, ""},
+		{"(UnsupportedError).Error", Method, 0, ""},
+		{"BestCompression", Const, 4, ""},
+		{"BestSpeed", Const, 4, ""},
+		{"CompressionLevel", Type, 4, ""},
+		{"Decode", Func, 0, "func(r io.Reader) (image.Image, error)"},
+		{"DecodeConfig", Func, 0, "func(r io.Reader) (image.Config, error)"},
+		{"DefaultCompression", Const, 4, ""},
+		{"Encode", Func, 0, "func(w io.Writer, m image.Image) error"},
+		{"Encoder", Type, 4, ""},
+		{"Encoder.BufferPool", Field, 9, ""},
+		{"Encoder.CompressionLevel", Field, 4, ""},
+		{"EncoderBuffer", Type, 9, ""},
+		{"EncoderBufferPool", Type, 9, ""},
+		{"FormatError", Type, 0, ""},
+		{"NoCompression", Const, 4, ""},
+		{"UnsupportedError", Type, 0, ""},
+	},
+	"index/suffixarray": {
+		{"(*Index).Bytes", Method, 0, ""},
+		{"(*Index).FindAllIndex", Method, 0, ""},
+		{"(*Index).Lookup", Method, 0, ""},
+		{"(*Index).Read", Method, 0, ""},
+		{"(*Index).Write", Method, 0, ""},
+		{"Index", Type, 0, ""},
+		{"New", Func, 0, "func(data []byte) *Index"},
+	},
+	"io": {
+		{"(*LimitedReader).Read", Method, 0, ""},
+		{"(*OffsetWriter).Seek", Method, 20, ""},
+		{"(*OffsetWriter).Write", Method, 20, ""},
+		{"(*OffsetWriter).WriteAt", Method, 20, ""},
+		{"(*PipeReader).Close", Method, 0, ""},
+		{"(*PipeReader).CloseWithError", Method, 0, ""},
+		{"(*PipeReader).Read", Method, 0, ""},
+		{"(*PipeWriter).Close", Method, 0, ""},
+		{"(*PipeWriter).CloseWithError", Method, 0, ""},
+		{"(*PipeWriter).Write", Method, 0, ""},
+		{"(*SectionReader).Outer", Method, 22, ""},
+		{"(*SectionReader).Read", Method, 0, ""},
+		{"(*SectionReader).ReadAt", Method, 0, ""},
+		{"(*SectionReader).Seek", Method, 0, ""},
+		{"(*SectionReader).Size", Method, 0, ""},
+		{"ByteReader", Type, 0, ""},
+		{"ByteScanner", Type, 0, ""},
+		{"ByteWriter", Type, 1, ""},
+		{"Closer", Type, 0, ""},
+		{"Copy", Func, 0, "func(dst Writer, src Reader) (written int64, err error)"},
+		{"CopyBuffer", Func, 5, "func(dst Writer, src Reader, buf []byte) (written int64, err error)"},
+		{"CopyN", Func, 0, "func(dst Writer, src Reader, n int64) (written int64, err error)"},
+		{"Discard", Var, 16, ""},
+		{"EOF", Var, 0, ""},
+		{"ErrClosedPipe", Var, 0, ""},
+		{"ErrNoProgress", Var, 1, ""},
+		{"ErrShortBuffer", Var, 0, ""},
+		{"ErrShortWrite", Var, 0, ""},
+		{"ErrUnexpectedEOF", Var, 0, ""},
+		{"LimitReader", Func, 0, "func(r Reader, n int64) Reader"},
+		{"LimitedReader", Type, 0, ""},
+		{"LimitedReader.N", Field, 0, ""},
+		{"LimitedReader.R", Field, 0, ""},
+		{"MultiReader", Func, 0, "func(readers ...Reader) Reader"},
+		{"MultiWriter", Func, 0, "func(writers ...Writer) Writer"},
+		{"NewOffsetWriter", Func, 20, "func(w WriterAt, off int64) *OffsetWriter"},
+		{"NewSectionReader", Func, 0, "func(r ReaderAt, off int64, n int64) *SectionReader"},
+		{"NopCloser", Func, 16, "func(r Reader) ReadCloser"},
+		{"OffsetWriter", Type, 20, ""},
+		{"Pipe", Func, 0, "func() (*PipeReader, *PipeWriter)"},
+		{"PipeReader", Type, 0, ""},
+		{"PipeWriter", Type, 0, ""},
+		{"ReadAll", Func, 16, "func(r Reader) ([]byte, error)"},
+		{"ReadAtLeast", Func, 0, "func(r Reader, buf []byte, min int) (n int, err error)"},
+		{"ReadCloser", Type, 0, ""},
+		{"ReadFull", Func, 0, "func(r Reader, buf []byte) (n int, err error)"},
+		{"ReadSeekCloser", Type, 16, ""},
+		{"ReadSeeker", Type, 0, ""},
+		{"ReadWriteCloser", Type, 0, ""},
+		{"ReadWriteSeeker", Type, 0, ""},
+		{"ReadWriter", Type, 0, ""},
+		{"Reader", Type, 0, ""},
+		{"ReaderAt", Type, 0, ""},
+		{"ReaderFrom", Type, 0, ""},
+		{"RuneReader", Type, 0, ""},
+		{"RuneScanner", Type, 0, ""},
+		{"SectionReader", Type, 0, ""},
+		{"SeekCurrent", Const, 7, ""},
+		{"SeekEnd", Const, 7, ""},
+		{"SeekStart", Const, 7, ""},
+		{"Seeker", Type, 0, ""},
+		{"StringWriter", Type, 12, ""},
+		{"TeeReader", Func, 0, "func(r Reader, w Writer) Reader"},
+		{"WriteCloser", Type, 0, ""},
+		{"WriteSeeker", Type, 0, ""},
+		{"WriteString", Func, 0, "func(w Writer, s string) (n int, err error)"},
+		{"Writer", Type, 0, ""},
+		{"WriterAt", Type, 0, ""},
+		{"WriterTo", Type, 0, ""},
+	},
+	"io/fs": {
+		{"(*PathError).Error", Method, 16, ""},
+		{"(*PathError).Timeout", Method, 16, ""},
+		{"(*PathError).Unwrap", Method, 16, ""},
+		{"(FileMode).IsDir", Method, 16, ""},
+		{"(FileMode).IsRegular", Method, 16, ""},
+		{"(FileMode).Perm", Method, 16, ""},
+		{"(FileMode).String", Method, 16, ""},
+		{"(FileMode).Type", Method, 16, ""},
+		{"DirEntry", Type, 16, ""},
+		{"ErrClosed", Var, 16, ""},
+		{"ErrExist", Var, 16, ""},
+		{"ErrInvalid", Var, 16, ""},
+		{"ErrNotExist", Var, 16, ""},
+		{"ErrPermission", Var, 16, ""},
+		{"FS", Type, 16, ""},
+		{"File", Type, 16, ""},
+		{"FileInfo", Type, 16, ""},
+		{"FileInfoToDirEntry", Func, 17, "func(info FileInfo) DirEntry"},
+		{"FileMode", Type, 16, ""},
+		{"FormatDirEntry", Func, 21, "func(dir DirEntry) string"},
+		{"FormatFileInfo", Func, 21, "func(info FileInfo) string"},
+		{"Glob", Func, 16, "func(fsys FS, pattern string) (matches []string, err error)"},
+		{"GlobFS", Type, 16, ""},
+		{"Lstat", Func, 25, ""},
+		{"ModeAppend", Const, 16, ""},
+		{"ModeCharDevice", Const, 16, ""},
+		{"ModeDevice", Const, 16, ""},
+		{"ModeDir", Const, 16, ""},
+		{"ModeExclusive", Const, 16, ""},
+		{"ModeIrregular", Const, 16, ""},
+		{"ModeNamedPipe", Const, 16, ""},
+		{"ModePerm", Const, 16, ""},
+		{"ModeSetgid", Const, 16, ""},
+		{"ModeSetuid", Const, 16, ""},
+		{"ModeSocket", Const, 16, ""},
+		{"ModeSticky", Const, 16, ""},
+		{"ModeSymlink", Const, 16, ""},
+		{"ModeTemporary", Const, 16, ""},
+		{"ModeType", Const, 16, ""},
+		{"PathError", Type, 16, ""},
+		{"PathError.Err", Field, 16, ""},
+		{"PathError.Op", Field, 16, ""},
+		{"PathError.Path", Field, 16, ""},
+		{"ReadDir", Func, 16, "func(fsys FS, name string) ([]DirEntry, error)"},
+		{"ReadDirFS", Type, 16, ""},
+		{"ReadDirFile", Type, 16, ""},
+		{"ReadFile", Func, 16, "func(fsys FS, name string) ([]byte, error)"},
+		{"ReadFileFS", Type, 16, ""},
+		{"ReadLink", Func, 25, ""},
+		{"ReadLinkFS", Type, 25, ""},
+		{"SkipAll", Var, 20, ""},
+		{"SkipDir", Var, 16, ""},
+		{"Stat", Func, 16, "func(fsys FS, name string) (FileInfo, error)"},
+		{"StatFS", Type, 16, ""},
+		{"Sub", Func, 16, "func(fsys FS, dir string) (FS, error)"},
+		{"SubFS", Type, 16, ""},
+		{"ValidPath", Func, 16, "func(name string) bool"},
+		{"WalkDir", Func, 16, "func(fsys FS, root string, fn WalkDirFunc) error"},
+		{"WalkDirFunc", Type, 16, ""},
+	},
+	"io/ioutil": {
+		{"Discard", Var, 0, ""},
+		{"NopCloser", Func, 0, "func(r io.Reader) io.ReadCloser"},
+		{"ReadAll", Func, 0, "func(r io.Reader) ([]byte, error)"},
+		{"ReadDir", Func, 0, "func(dirname string) ([]fs.FileInfo, error)"},
+		{"ReadFile", Func, 0, "func(filename string) ([]byte, error)"},
+		{"TempDir", Func, 0, "func(dir string, pattern string) (name string, err error)"},
+		{"TempFile", Func, 0, "func(dir string, pattern string) (f *os.File, err error)"},
+		{"WriteFile", Func, 0, "func(filename string, data []byte, perm fs.FileMode) error"},
+	},
+	"iter": {
+		{"Pull", Func, 23, "func[V any](seq Seq[V]) (next func() (V, bool), stop func())"},
+		{"Pull2", Func, 23, "func[K, V any](seq Seq2[K, V]) (next func() (K, V, bool), stop func())"},
+		{"Seq", Type, 23, ""},
+		{"Seq2", Type, 23, ""},
+	},
+	"log": {
+		{"(*Logger).Fatal", Method, 0, ""},
+		{"(*Logger).Fatalf", Method, 0, ""},
+		{"(*Logger).Fatalln", Method, 0, ""},
+		{"(*Logger).Flags", Method, 0, ""},
+		{"(*Logger).Output", Method, 0, ""},
+		{"(*Logger).Panic", Method, 0, ""},
+		{"(*Logger).Panicf", Method, 0, ""},
+		{"(*Logger).Panicln", Method, 0, ""},
+		{"(*Logger).Prefix", Method, 0, ""},
+		{"(*Logger).Print", Method, 0, ""},
+		{"(*Logger).Printf", Method, 0, ""},
+		{"(*Logger).Println", Method, 0, ""},
+		{"(*Logger).SetFlags", Method, 0, ""},
+		{"(*Logger).SetOutput", Method, 5, ""},
+		{"(*Logger).SetPrefix", Method, 0, ""},
+		{"(*Logger).Writer", Method, 12, ""},
+		{"Default", Func, 16, "func() *Logger"},
+		{"Fatal", Func, 0, "func(v ...any)"},
+		{"Fatalf", Func, 0, "func(format string, v ...any)"},
+		{"Fatalln", Func, 0, "func(v ...any)"},
+		{"Flags", Func, 0, "func() int"},
+		{"LUTC", Const, 5, ""},
+		{"Ldate", Const, 0, ""},
+		{"Llongfile", Const, 0, ""},
+		{"Lmicroseconds", Const, 0, ""},
+		{"Lmsgprefix", Const, 14, ""},
+		{"Logger", Type, 0, ""},
+		{"Lshortfile", Const, 0, ""},
+		{"LstdFlags", Const, 0, ""},
+		{"Ltime", Const, 0, ""},
+		{"New", Func, 0, "func(out io.Writer, prefix string, flag int) *Logger"},
+		{"Output", Func, 5, "func(calldepth int, s string) error"},
+		{"Panic", Func, 0, "func(v ...any)"},
+		{"Panicf", Func, 0, "func(format string, v ...any)"},
+		{"Panicln", Func, 0, "func(v ...any)"},
+		{"Prefix", Func, 0, "func() string"},
+		{"Print", Func, 0, "func(v ...any)"},
+		{"Printf", Func, 0, "func(format string, v ...any)"},
+		{"Println", Func, 0, "func(v ...any)"},
+		{"SetFlags", Func, 0, "func(flag int)"},
+		{"SetOutput", Func, 0, "func(w io.Writer)"},
+		{"SetPrefix", Func, 0, "func(prefix string)"},
+		{"Writer", Func, 13, "func() io.Writer"},
+	},
+	"log/slog": {
+		{"(*JSONHandler).Enabled", Method, 21, ""},
+		{"(*JSONHandler).Handle", Method, 21, ""},
+		{"(*JSONHandler).WithAttrs", Method, 21, ""},
+		{"(*JSONHandler).WithGroup", Method, 21, ""},
+		{"(*Level).UnmarshalJSON", Method, 21, ""},
+		{"(*Level).UnmarshalText", Method, 21, ""},
+		{"(*LevelVar).AppendText", Method, 24, ""},
+		{"(*LevelVar).Level", Method, 21, ""},
+		{"(*LevelVar).MarshalText", Method, 21, ""},
+		{"(*LevelVar).Set", Method, 21, ""},
+		{"(*LevelVar).String", Method, 21, ""},
+		{"(*LevelVar).UnmarshalText", Method, 21, ""},
+		{"(*Logger).Debug", Method, 21, ""},
+		{"(*Logger).DebugContext", Method, 21, ""},
+		{"(*Logger).Enabled", Method, 21, ""},
+		{"(*Logger).Error", Method, 21, ""},
+		{"(*Logger).ErrorContext", Method, 21, ""},
+		{"(*Logger).Handler", Method, 21, ""},
+		{"(*Logger).Info", Method, 21, ""},
+		{"(*Logger).InfoContext", Method, 21, ""},
+		{"(*Logger).Log", Method, 21, ""},
+		{"(*Logger).LogAttrs", Method, 21, ""},
+		{"(*Logger).Warn", Method, 21, ""},
+		{"(*Logger).WarnContext", Method, 21, ""},
+		{"(*Logger).With", Method, 21, ""},
+		{"(*Logger).WithGroup", Method, 21, ""},
+		{"(*Record).Add", Method, 21, ""},
+		{"(*Record).AddAttrs", Method, 21, ""},
+		{"(*TextHandler).Enabled", Method, 21, ""},
+		{"(*TextHandler).Handle", Method, 21, ""},
+		{"(*TextHandler).WithAttrs", Method, 21, ""},
+		{"(*TextHandler).WithGroup", Method, 21, ""},
+		{"(Attr).Equal", Method, 21, ""},
+		{"(Attr).String", Method, 21, ""},
+		{"(Kind).String", Method, 21, ""},
+		{"(Level).AppendText", Method, 24, ""},
+		{"(Level).Level", Method, 21, ""},
+		{"(Level).MarshalJSON", Method, 21, ""},
+		{"(Level).MarshalText", Method, 21, ""},
+		{"(Level).String", Method, 21, ""},
+		{"(Record).Attrs", Method, 21, ""},
+		{"(Record).Clone", Method, 21, ""},
+		{"(Record).NumAttrs", Method, 21, ""},
+		{"(Value).Any", Method, 21, ""},
+		{"(Value).Bool", Method, 21, ""},
+		{"(Value).Duration", Method, 21, ""},
+		{"(Value).Equal", Method, 21, ""},
+		{"(Value).Float64", Method, 21, ""},
+		{"(Value).Group", Method, 21, ""},
+		{"(Value).Int64", Method, 21, ""},
+		{"(Value).Kind", Method, 21, ""},
+		{"(Value).LogValuer", Method, 21, ""},
+		{"(Value).Resolve", Method, 21, ""},
+		{"(Value).String", Method, 21, ""},
+		{"(Value).Time", Method, 21, ""},
+		{"(Value).Uint64", Method, 21, ""},
+		{"Any", Func, 21, "func(key string, value any) Attr"},
+		{"AnyValue", Func, 21, "func(v any) Value"},
+		{"Attr", Type, 21, ""},
+		{"Attr.Key", Field, 21, ""},
+		{"Attr.Value", Field, 21, ""},
+		{"Bool", Func, 21, "func(key string, v bool) Attr"},
+		{"BoolValue", Func, 21, "func(v bool) Value"},
+		{"Debug", Func, 21, "func(msg string, args ...any)"},
+		{"DebugContext", Func, 21, "func(ctx context.Context, msg string, args ...any)"},
+		{"Default", Func, 21, "func() *Logger"},
+		{"DiscardHandler", Var, 24, ""},
+		{"Duration", Func, 21, "func(key string, v time.Duration) Attr"},
+		{"DurationValue", Func, 21, "func(v time.Duration) Value"},
+		{"Error", Func, 21, "func(msg string, args ...any)"},
+		{"ErrorContext", Func, 21, "func(ctx context.Context, msg string, args ...any)"},
+		{"Float64", Func, 21, "func(key string, v float64) Attr"},
+		{"Float64Value", Func, 21, "func(v float64) Value"},
+		{"Group", Func, 21, "func(key string, args ...any) Attr"},
+		{"GroupValue", Func, 21, "func(as ...Attr) Value"},
+		{"Handler", Type, 21, ""},
+		{"HandlerOptions", Type, 21, ""},
+		{"HandlerOptions.AddSource", Field, 21, ""},
+		{"HandlerOptions.Level", Field, 21, ""},
+		{"HandlerOptions.ReplaceAttr", Field, 21, ""},
+		{"Info", Func, 21, "func(msg string, args ...any)"},
+		{"InfoContext", Func, 21, "func(ctx context.Context, msg string, args ...any)"},
+		{"Int", Func, 21, "func(key string, value int) Attr"},
+		{"Int64", Func, 21, "func(key string, value int64) Attr"},
+		{"Int64Value", Func, 21, "func(v int64) Value"},
+		{"IntValue", Func, 21, "func(v int) Value"},
+		{"JSONHandler", Type, 21, ""},
+		{"Kind", Type, 21, ""},
+		{"KindAny", Const, 21, ""},
+		{"KindBool", Const, 21, ""},
+		{"KindDuration", Const, 21, ""},
+		{"KindFloat64", Const, 21, ""},
+		{"KindGroup", Const, 21, ""},
+		{"KindInt64", Const, 21, ""},
+		{"KindLogValuer", Const, 21, ""},
+		{"KindString", Const, 21, ""},
+		{"KindTime", Const, 21, ""},
+		{"KindUint64", Const, 21, ""},
+		{"Level", Type, 21, ""},
+		{"LevelDebug", Const, 21, ""},
+		{"LevelError", Const, 21, ""},
+		{"LevelInfo", Const, 21, ""},
+		{"LevelKey", Const, 21, ""},
+		{"LevelVar", Type, 21, ""},
+		{"LevelWarn", Const, 21, ""},
+		{"Leveler", Type, 21, ""},
+		{"Log", Func, 21, "func(ctx context.Context, level Level, msg string, args ...any)"},
+		{"LogAttrs", Func, 21, "func(ctx context.Context, level Level, msg string, attrs ...Attr)"},
+		{"LogValuer", Type, 21, ""},
+		{"Logger", Type, 21, ""},
+		{"MessageKey", Const, 21, ""},
+		{"New", Func, 21, "func(h Handler) *Logger"},
+		{"NewJSONHandler", Func, 21, "func(w io.Writer, opts *HandlerOptions) *JSONHandler"},
+		{"NewLogLogger", Func, 21, "func(h Handler, level Level) *log.Logger"},
+		{"NewRecord", Func, 21, "func(t time.Time, level Level, msg string, pc uintptr) Record"},
+		{"NewTextHandler", Func, 21, "func(w io.Writer, opts *HandlerOptions) *TextHandler"},
+		{"Record", Type, 21, ""},
+		{"Record.Level", Field, 21, ""},
+		{"Record.Message", Field, 21, ""},
+		{"Record.PC", Field, 21, ""},
+		{"Record.Time", Field, 21, ""},
+		{"SetDefault", Func, 21, "func(l *Logger)"},
+		{"SetLogLoggerLevel", Func, 22, "func(level Level) (oldLevel Level)"},
+		{"Source", Type, 21, ""},
+		{"Source.File", Field, 21, ""},
+		{"Source.Function", Field, 21, ""},
+		{"Source.Line", Field, 21, ""},
+		{"SourceKey", Const, 21, ""},
+		{"String", Func, 21, "func(key string, value string) Attr"},
+		{"StringValue", Func, 21, "func(value string) Value"},
+		{"TextHandler", Type, 21, ""},
+		{"Time", Func, 21, "func(key string, v time.Time) Attr"},
+		{"TimeKey", Const, 21, ""},
+		{"TimeValue", Func, 21, "func(v time.Time) Value"},
+		{"Uint64", Func, 21, "func(key string, v uint64) Attr"},
+		{"Uint64Value", Func, 21, "func(v uint64) Value"},
+		{"Value", Type, 21, ""},
+		{"Warn", Func, 21, "func(msg string, args ...any)"},
+		{"WarnContext", Func, 21, "func(ctx context.Context, msg string, args ...any)"},
+		{"With", Func, 21, "func(args ...any) *Logger"},
+	},
+	"log/syslog": {
+		{"(*Writer).Alert", Method, 0, ""},
+		{"(*Writer).Close", Method, 0, ""},
+		{"(*Writer).Crit", Method, 0, ""},
+		{"(*Writer).Debug", Method, 0, ""},
+		{"(*Writer).Emerg", Method, 0, ""},
+		{"(*Writer).Err", Method, 0, ""},
+		{"(*Writer).Info", Method, 0, ""},
+		{"(*Writer).Notice", Method, 0, ""},
+		{"(*Writer).Warning", Method, 0, ""},
+		{"(*Writer).Write", Method, 0, ""},
+		{"Dial", Func, 0, "func(network string, raddr string, priority Priority, tag string) (*Writer, error)"},
+		{"LOG_ALERT", Const, 0, ""},
+		{"LOG_AUTH", Const, 1, ""},
+		{"LOG_AUTHPRIV", Const, 1, ""},
+		{"LOG_CRIT", Const, 0, ""},
+		{"LOG_CRON", Const, 1, ""},
+		{"LOG_DAEMON", Const, 1, ""},
+		{"LOG_DEBUG", Const, 0, ""},
+		{"LOG_EMERG", Const, 0, ""},
+		{"LOG_ERR", Const, 0, ""},
+		{"LOG_FTP", Const, 1, ""},
+		{"LOG_INFO", Const, 0, ""},
+		{"LOG_KERN", Const, 1, ""},
+		{"LOG_LOCAL0", Const, 1, ""},
+		{"LOG_LOCAL1", Const, 1, ""},
+		{"LOG_LOCAL2", Const, 1, ""},
+		{"LOG_LOCAL3", Const, 1, ""},
+		{"LOG_LOCAL4", Const, 1, ""},
+		{"LOG_LOCAL5", Const, 1, ""},
+		{"LOG_LOCAL6", Const, 1, ""},
+		{"LOG_LOCAL7", Const, 1, ""},
+		{"LOG_LPR", Const, 1, ""},
+		{"LOG_MAIL", Const, 1, ""},
+		{"LOG_NEWS", Const, 1, ""},
+		{"LOG_NOTICE", Const, 0, ""},
+		{"LOG_SYSLOG", Const, 1, ""},
+		{"LOG_USER", Const, 1, ""},
+		{"LOG_UUCP", Const, 1, ""},
+		{"LOG_WARNING", Const, 0, ""},
+		{"New", Func, 0, "func(priority Priority, tag string) (*Writer, error)"},
+		{"NewLogger", Func, 0, "func(p Priority, logFlag int) (*log.Logger, error)"},
+		{"Priority", Type, 0, ""},
+		{"Writer", Type, 0, ""},
+	},
+	"maps": {
+		{"All", Func, 23, "func[Map ~map[K]V, K comparable, V any](m Map) iter.Seq2[K, V]"},
+		{"Clone", Func, 21, "func[M ~map[K]V, K comparable, V any](m M) M"},
+		{"Collect", Func, 23, "func[K comparable, V any](seq iter.Seq2[K, V]) map[K]V"},
+		{"Copy", Func, 21, "func[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2)"},
+		{"DeleteFunc", Func, 21, "func[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool)"},
+		{"Equal", Func, 21, "func[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool"},
+		{"EqualFunc", Func, 21, "func[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool"},
+		{"Insert", Func, 23, "func[Map ~map[K]V, K comparable, V any](m Map, seq iter.Seq2[K, V])"},
+		{"Keys", Func, 23, "func[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[K]"},
+		{"Values", Func, 23, "func[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[V]"},
+	},
+	"math": {
+		{"Abs", Func, 0, "func(x float64) float64"},
+		{"Acos", Func, 0, "func(x float64) float64"},
+		{"Acosh", Func, 0, "func(x float64) float64"},
+		{"Asin", Func, 0, "func(x float64) float64"},
+		{"Asinh", Func, 0, "func(x float64) float64"},
+		{"Atan", Func, 0, "func(x float64) float64"},
+		{"Atan2", Func, 0, "func(y float64, x float64) float64"},
+		{"Atanh", Func, 0, "func(x float64) float64"},
+		{"Cbrt", Func, 0, "func(x float64) float64"},
+		{"Ceil", Func, 0, "func(x float64) float64"},
+		{"Copysign", Func, 0, "func(f float64, sign float64) float64"},
+		{"Cos", Func, 0, "func(x float64) float64"},
+		{"Cosh", Func, 0, "func(x float64) float64"},
+		{"Dim", Func, 0, "func(x float64, y float64) float64"},
+		{"E", Const, 0, ""},
+		{"Erf", Func, 0, "func(x float64) float64"},
+		{"Erfc", Func, 0, "func(x float64) float64"},
+		{"Erfcinv", Func, 10, "func(x float64) float64"},
+		{"Erfinv", Func, 10, "func(x float64) float64"},
+		{"Exp", Func, 0, "func(x float64) float64"},
+		{"Exp2", Func, 0, "func(x float64) float64"},
+		{"Expm1", Func, 0, "func(x float64) float64"},
+		{"FMA", Func, 14, "func(x float64, y float64, z float64) float64"},
+		{"Float32bits", Func, 0, "func(f float32) uint32"},
+		{"Float32frombits", Func, 0, "func(b uint32) float32"},
+		{"Float64bits", Func, 0, "func(f float64) uint64"},
+		{"Float64frombits", Func, 0, "func(b uint64) float64"},
+		{"Floor", Func, 0, "func(x float64) float64"},
+		{"Frexp", Func, 0, "func(f float64) (frac float64, exp int)"},
+		{"Gamma", Func, 0, "func(x float64) float64"},
+		{"Hypot", Func, 0, "func(p float64, q float64) float64"},
+		{"Ilogb", Func, 0, "func(x float64) int"},
+		{"Inf", Func, 0, "func(sign int) float64"},
+		{"IsInf", Func, 0, "func(f float64, sign int) bool"},
+		{"IsNaN", Func, 0, "func(f float64) (is bool)"},
+		{"J0", Func, 0, "func(x float64) float64"},
+		{"J1", Func, 0, "func(x float64) float64"},
+		{"Jn", Func, 0, "func(n int, x float64) float64"},
+		{"Ldexp", Func, 0, "func(frac float64, exp int) float64"},
+		{"Lgamma", Func, 0, "func(x float64) (lgamma float64, sign int)"},
+		{"Ln10", Const, 0, ""},
+		{"Ln2", Const, 0, ""},
+		{"Log", Func, 0, "func(x float64) float64"},
+		{"Log10", Func, 0, "func(x float64) float64"},
+		{"Log10E", Const, 0, ""},
+		{"Log1p", Func, 0, "func(x float64) float64"},
+		{"Log2", Func, 0, "func(x float64) float64"},
+		{"Log2E", Const, 0, ""},
+		{"Logb", Func, 0, "func(x float64) float64"},
+		{"Max", Func, 0, "func(x float64, y float64) float64"},
+		{"MaxFloat32", Const, 0, ""},
+		{"MaxFloat64", Const, 0, ""},
+		{"MaxInt", Const, 17, ""},
+		{"MaxInt16", Const, 0, ""},
+		{"MaxInt32", Const, 0, ""},
+		{"MaxInt64", Const, 0, ""},
+		{"MaxInt8", Const, 0, ""},
+		{"MaxUint", Const, 17, ""},
+		{"MaxUint16", Const, 0, ""},
+		{"MaxUint32", Const, 0, ""},
+		{"MaxUint64", Const, 0, ""},
+		{"MaxUint8", Const, 0, ""},
+		{"Min", Func, 0, "func(x float64, y float64) float64"},
+		{"MinInt", Const, 17, ""},
+		{"MinInt16", Const, 0, ""},
+		{"MinInt32", Const, 0, ""},
+		{"MinInt64", Const, 0, ""},
+		{"MinInt8", Const, 0, ""},
+		{"Mod", Func, 0, "func(x float64, y float64) float64"},
+		{"Modf", Func, 0, "func(f float64) (int float64, frac float64)"},
+		{"NaN", Func, 0, "func() float64"},
+		{"Nextafter", Func, 0, "func(x float64, y float64) (r float64)"},
+		{"Nextafter32", Func, 4, "func(x float32, y float32) (r float32)"},
+		{"Phi", Const, 0, ""},
+		{"Pi", Const, 0, ""},
+		{"Pow", Func, 0, "func(x float64, y float64) float64"},
+		{"Pow10", Func, 0, "func(n int) float64"},
+		{"Remainder", Func, 0, "func(x float64, y float64) float64"},
+		{"Round", Func, 10, "func(x float64) float64"},
+		{"RoundToEven", Func, 10, "func(x float64) float64"},
+		{"Signbit", Func, 0, "func(x float64) bool"},
+		{"Sin", Func, 0, "func(x float64) float64"},
+		{"Sincos", Func, 0, "func(x float64) (sin float64, cos float64)"},
+		{"Sinh", Func, 0, "func(x float64) float64"},
+		{"SmallestNonzeroFloat32", Const, 0, ""},
+		{"SmallestNonzeroFloat64", Const, 0, ""},
+		{"Sqrt", Func, 0, "func(x float64) float64"},
+		{"Sqrt2", Const, 0, ""},
+		{"SqrtE", Const, 0, ""},
+		{"SqrtPhi", Const, 0, ""},
+		{"SqrtPi", Const, 0, ""},
+		{"Tan", Func, 0, "func(x float64) float64"},
+		{"Tanh", Func, 0, "func(x float64) float64"},
+		{"Trunc", Func, 0, "func(x float64) float64"},
+		{"Y0", Func, 0, "func(x float64) float64"},
+		{"Y1", Func, 0, "func(x float64) float64"},
+		{"Yn", Func, 0, "func(n int, x float64) float64"},
+	},
+	"math/big": {
+		{"(*Float).Abs", Method, 5, ""},
+		{"(*Float).Acc", Method, 5, ""},
+		{"(*Float).Add", Method, 5, ""},
+		{"(*Float).Append", Method, 5, ""},
+		{"(*Float).AppendText", Method, 24, ""},
+		{"(*Float).Cmp", Method, 5, ""},
+		{"(*Float).Copy", Method, 5, ""},
+		{"(*Float).Float32", Method, 5, ""},
+		{"(*Float).Float64", Method, 5, ""},
+		{"(*Float).Format", Method, 5, ""},
+		{"(*Float).GobDecode", Method, 7, ""},
+		{"(*Float).GobEncode", Method, 7, ""},
+		{"(*Float).Int", Method, 5, ""},
+		{"(*Float).Int64", Method, 5, ""},
+		{"(*Float).IsInf", Method, 5, ""},
+		{"(*Float).IsInt", Method, 5, ""},
+		{"(*Float).MantExp", Method, 5, ""},
+		{"(*Float).MarshalText", Method, 6, ""},
+		{"(*Float).MinPrec", Method, 5, ""},
+		{"(*Float).Mode", Method, 5, ""},
+		{"(*Float).Mul", Method, 5, ""},
+		{"(*Float).Neg", Method, 5, ""},
+		{"(*Float).Parse", Method, 5, ""},
+		{"(*Float).Prec", Method, 5, ""},
+		{"(*Float).Quo", Method, 5, ""},
+		{"(*Float).Rat", Method, 5, ""},
+		{"(*Float).Scan", Method, 8, ""},
+		{"(*Float).Set", Method, 5, ""},
+		{"(*Float).SetFloat64", Method, 5, ""},
+		{"(*Float).SetInf", Method, 5, ""},
+		{"(*Float).SetInt", Method, 5, ""},
+		{"(*Float).SetInt64", Method, 5, ""},
+		{"(*Float).SetMantExp", Method, 5, ""},
+		{"(*Float).SetMode", Method, 5, ""},
+		{"(*Float).SetPrec", Method, 5, ""},
+		{"(*Float).SetRat", Method, 5, ""},
+		{"(*Float).SetString", Method, 5, ""},
+		{"(*Float).SetUint64", Method, 5, ""},
+		{"(*Float).Sign", Method, 5, ""},
+		{"(*Float).Signbit", Method, 5, ""},
+		{"(*Float).Sqrt", Method, 10, ""},
+		{"(*Float).String", Method, 5, ""},
+		{"(*Float).Sub", Method, 5, ""},
+		{"(*Float).Text", Method, 5, ""},
+		{"(*Float).Uint64", Method, 5, ""},
+		{"(*Float).UnmarshalText", Method, 6, ""},
+		{"(*Int).Abs", Method, 0, ""},
+		{"(*Int).Add", Method, 0, ""},
+		{"(*Int).And", Method, 0, ""},
+		{"(*Int).AndNot", Method, 0, ""},
+		{"(*Int).Append", Method, 6, ""},
+		{"(*Int).AppendText", Method, 24, ""},
+		{"(*Int).Binomial", Method, 0, ""},
+		{"(*Int).Bit", Method, 0, ""},
+		{"(*Int).BitLen", Method, 0, ""},
+		{"(*Int).Bits", Method, 0, ""},
+		{"(*Int).Bytes", Method, 0, ""},
+		{"(*Int).Cmp", Method, 0, ""},
+		{"(*Int).CmpAbs", Method, 10, ""},
+		{"(*Int).Div", Method, 0, ""},
+		{"(*Int).DivMod", Method, 0, ""},
+		{"(*Int).Exp", Method, 0, ""},
+		{"(*Int).FillBytes", Method, 15, ""},
+		{"(*Int).Float64", Method, 21, ""},
+		{"(*Int).Format", Method, 0, ""},
+		{"(*Int).GCD", Method, 0, ""},
+		{"(*Int).GobDecode", Method, 0, ""},
+		{"(*Int).GobEncode", Method, 0, ""},
+		{"(*Int).Int64", Method, 0, ""},
+		{"(*Int).IsInt64", Method, 9, ""},
+		{"(*Int).IsUint64", Method, 9, ""},
+		{"(*Int).Lsh", Method, 0, ""},
+		{"(*Int).MarshalJSON", Method, 1, ""},
+		{"(*Int).MarshalText", Method, 3, ""},
+		{"(*Int).Mod", Method, 0, ""},
+		{"(*Int).ModInverse", Method, 0, ""},
+		{"(*Int).ModSqrt", Method, 5, ""},
+		{"(*Int).Mul", Method, 0, ""},
+		{"(*Int).MulRange", Method, 0, ""},
+		{"(*Int).Neg", Method, 0, ""},
+		{"(*Int).Not", Method, 0, ""},
+		{"(*Int).Or", Method, 0, ""},
+		{"(*Int).ProbablyPrime", Method, 0, ""},
+		{"(*Int).Quo", Method, 0, ""},
+		{"(*Int).QuoRem", Method, 0, ""},
+		{"(*Int).Rand", Method, 0, ""},
+		{"(*Int).Rem", Method, 0, ""},
+		{"(*Int).Rsh", Method, 0, ""},
+		{"(*Int).Scan", Method, 0, ""},
+		{"(*Int).Set", Method, 0, ""},
+		{"(*Int).SetBit", Method, 0, ""},
+		{"(*Int).SetBits", Method, 0, ""},
+		{"(*Int).SetBytes", Method, 0, ""},
+		{"(*Int).SetInt64", Method, 0, ""},
+		{"(*Int).SetString", Method, 0, ""},
+		{"(*Int).SetUint64", Method, 1, ""},
+		{"(*Int).Sign", Method, 0, ""},
+		{"(*Int).Sqrt", Method, 8, ""},
+		{"(*Int).String", Method, 0, ""},
+		{"(*Int).Sub", Method, 0, ""},
+		{"(*Int).Text", Method, 6, ""},
+		{"(*Int).TrailingZeroBits", Method, 13, ""},
+		{"(*Int).Uint64", Method, 1, ""},
+		{"(*Int).UnmarshalJSON", Method, 1, ""},
+		{"(*Int).UnmarshalText", Method, 3, ""},
+		{"(*Int).Xor", Method, 0, ""},
+		{"(*Rat).Abs", Method, 0, ""},
+		{"(*Rat).Add", Method, 0, ""},
+		{"(*Rat).AppendText", Method, 24, ""},
+		{"(*Rat).Cmp", Method, 0, ""},
+		{"(*Rat).Denom", Method, 0, ""},
+		{"(*Rat).Float32", Method, 4, ""},
+		{"(*Rat).Float64", Method, 1, ""},
+		{"(*Rat).FloatPrec", Method, 22, ""},
+		{"(*Rat).FloatString", Method, 0, ""},
+		{"(*Rat).GobDecode", Method, 0, ""},
+		{"(*Rat).GobEncode", Method, 0, ""},
+		{"(*Rat).Inv", Method, 0, ""},
+		{"(*Rat).IsInt", Method, 0, ""},
+		{"(*Rat).MarshalText", Method, 3, ""},
+		{"(*Rat).Mul", Method, 0, ""},
+		{"(*Rat).Neg", Method, 0, ""},
+		{"(*Rat).Num", Method, 0, ""},
+		{"(*Rat).Quo", Method, 0, ""},
+		{"(*Rat).RatString", Method, 0, ""},
+		{"(*Rat).Scan", Method, 0, ""},
+		{"(*Rat).Set", Method, 0, ""},
+		{"(*Rat).SetFloat64", Method, 1, ""},
+		{"(*Rat).SetFrac", Method, 0, ""},
+		{"(*Rat).SetFrac64", Method, 0, ""},
+		{"(*Rat).SetInt", Method, 0, ""},
+		{"(*Rat).SetInt64", Method, 0, ""},
+		{"(*Rat).SetString", Method, 0, ""},
+		{"(*Rat).SetUint64", Method, 13, ""},
+		{"(*Rat).Sign", Method, 0, ""},
+		{"(*Rat).String", Method, 0, ""},
+		{"(*Rat).Sub", Method, 0, ""},
+		{"(*Rat).UnmarshalText", Method, 3, ""},
+		{"(Accuracy).String", Method, 5, ""},
+		{"(ErrNaN).Error", Method, 5, ""},
+		{"(RoundingMode).String", Method, 5, ""},
+		{"Above", Const, 5, ""},
+		{"Accuracy", Type, 5, ""},
+		{"AwayFromZero", Const, 5, ""},
+		{"Below", Const, 5, ""},
+		{"ErrNaN", Type, 5, ""},
+		{"Exact", Const, 5, ""},
+		{"Float", Type, 5, ""},
+		{"Int", Type, 0, ""},
+		{"Jacobi", Func, 5, "func(x *Int, y *Int) int"},
+		{"MaxBase", Const, 0, ""},
+		{"MaxExp", Const, 5, ""},
+		{"MaxPrec", Const, 5, ""},
+		{"MinExp", Const, 5, ""},
+		{"NewFloat", Func, 5, "func(x float64) *Float"},
+		{"NewInt", Func, 0, "func(x int64) *Int"},
+		{"NewRat", Func, 0, "func(a int64, b int64) *Rat"},
+		{"ParseFloat", Func, 5, "func(s string, base int, prec uint, mode RoundingMode) (f *Float, b int, err error)"},
+		{"Rat", Type, 0, ""},
+		{"RoundingMode", Type, 5, ""},
+		{"ToNearestAway", Const, 5, ""},
+		{"ToNearestEven", Const, 5, ""},
+		{"ToNegativeInf", Const, 5, ""},
+		{"ToPositiveInf", Const, 5, ""},
+		{"ToZero", Const, 5, ""},
+		{"Word", Type, 0, ""},
+	},
+	"math/bits": {
+		{"Add", Func, 12, "func(x uint, y uint, carry uint) (sum uint, carryOut uint)"},
+		{"Add32", Func, 12, "func(x uint32, y uint32, carry uint32) (sum uint32, carryOut uint32)"},
+		{"Add64", Func, 12, "func(x uint64, y uint64, carry uint64) (sum uint64, carryOut uint64)"},
+		{"Div", Func, 12, "func(hi uint, lo uint, y uint) (quo uint, rem uint)"},
+		{"Div32", Func, 12, "func(hi uint32, lo uint32, y uint32) (quo uint32, rem uint32)"},
+		{"Div64", Func, 12, "func(hi uint64, lo uint64, y uint64) (quo uint64, rem uint64)"},
+		{"LeadingZeros", Func, 9, "func(x uint) int"},
+		{"LeadingZeros16", Func, 9, "func(x uint16) int"},
+		{"LeadingZeros32", Func, 9, "func(x uint32) int"},
+		{"LeadingZeros64", Func, 9, "func(x uint64) int"},
+		{"LeadingZeros8", Func, 9, "func(x uint8) int"},
+		{"Len", Func, 9, "func(x uint) int"},
+		{"Len16", Func, 9, "func(x uint16) (n int)"},
+		{"Len32", Func, 9, "func(x uint32) (n int)"},
+		{"Len64", Func, 9, "func(x uint64) (n int)"},
+		{"Len8", Func, 9, "func(x uint8) int"},
+		{"Mul", Func, 12, "func(x uint, y uint) (hi uint, lo uint)"},
+		{"Mul32", Func, 12, "func(x uint32, y uint32) (hi uint32, lo uint32)"},
+		{"Mul64", Func, 12, "func(x uint64, y uint64) (hi uint64, lo uint64)"},
+		{"OnesCount", Func, 9, "func(x uint) int"},
+		{"OnesCount16", Func, 9, "func(x uint16) int"},
+		{"OnesCount32", Func, 9, "func(x uint32) int"},
+		{"OnesCount64", Func, 9, "func(x uint64) int"},
+		{"OnesCount8", Func, 9, "func(x uint8) int"},
+		{"Rem", Func, 14, "func(hi uint, lo uint, y uint) uint"},
+		{"Rem32", Func, 14, "func(hi uint32, lo uint32, y uint32) uint32"},
+		{"Rem64", Func, 14, "func(hi uint64, lo uint64, y uint64) uint64"},
+		{"Reverse", Func, 9, "func(x uint) uint"},
+		{"Reverse16", Func, 9, "func(x uint16) uint16"},
+		{"Reverse32", Func, 9, "func(x uint32) uint32"},
+		{"Reverse64", Func, 9, "func(x uint64) uint64"},
+		{"Reverse8", Func, 9, "func(x uint8) uint8"},
+		{"ReverseBytes", Func, 9, "func(x uint) uint"},
+		{"ReverseBytes16", Func, 9, "func(x uint16) uint16"},
+		{"ReverseBytes32", Func, 9, "func(x uint32) uint32"},
+		{"ReverseBytes64", Func, 9, "func(x uint64) uint64"},
+		{"RotateLeft", Func, 9, "func(x uint, k int) uint"},
+		{"RotateLeft16", Func, 9, "func(x uint16, k int) uint16"},
+		{"RotateLeft32", Func, 9, "func(x uint32, k int) uint32"},
+		{"RotateLeft64", Func, 9, "func(x uint64, k int) uint64"},
+		{"RotateLeft8", Func, 9, "func(x uint8, k int) uint8"},
+		{"Sub", Func, 12, "func(x uint, y uint, borrow uint) (diff uint, borrowOut uint)"},
+		{"Sub32", Func, 12, "func(x uint32, y uint32, borrow uint32) (diff uint32, borrowOut uint32)"},
+		{"Sub64", Func, 12, "func(x uint64, y uint64, borrow uint64) (diff uint64, borrowOut uint64)"},
+		{"TrailingZeros", Func, 9, "func(x uint) int"},
+		{"TrailingZeros16", Func, 9, "func(x uint16) int"},
+		{"TrailingZeros32", Func, 9, "func(x uint32) int"},
+		{"TrailingZeros64", Func, 9, "func(x uint64) int"},
+		{"TrailingZeros8", Func, 9, "func(x uint8) int"},
+		{"UintSize", Const, 9, ""},
+	},
+	"math/cmplx": {
+		{"Abs", Func, 0, "func(x complex128) float64"},
+		{"Acos", Func, 0, "func(x complex128) complex128"},
+		{"Acosh", Func, 0, "func(x complex128) complex128"},
+		{"Asin", Func, 0, "func(x complex128) complex128"},
+		{"Asinh", Func, 0, "func(x complex128) complex128"},
+		{"Atan", Func, 0, "func(x complex128) complex128"},
+		{"Atanh", Func, 0, "func(x complex128) complex128"},
+		{"Conj", Func, 0, "func(x complex128) complex128"},
+		{"Cos", Func, 0, "func(x complex128) complex128"},
+		{"Cosh", Func, 0, "func(x complex128) complex128"},
+		{"Cot", Func, 0, "func(x complex128) complex128"},
+		{"Exp", Func, 0, "func(x complex128) complex128"},
+		{"Inf", Func, 0, "func() complex128"},
+		{"IsInf", Func, 0, "func(x complex128) bool"},
+		{"IsNaN", Func, 0, "func(x complex128) bool"},
+		{"Log", Func, 0, "func(x complex128) complex128"},
+		{"Log10", Func, 0, "func(x complex128) complex128"},
+		{"NaN", Func, 0, "func() complex128"},
+		{"Phase", Func, 0, "func(x complex128) float64"},
+		{"Polar", Func, 0, "func(x complex128) (r float64, θ float64)"},
+		{"Pow", Func, 0, "func(x complex128, y complex128) complex128"},
+		{"Rect", Func, 0, "func(r float64, θ float64) complex128"},
+		{"Sin", Func, 0, "func(x complex128) complex128"},
+		{"Sinh", Func, 0, "func(x complex128) complex128"},
+		{"Sqrt", Func, 0, "func(x complex128) complex128"},
+		{"Tan", Func, 0, "func(x complex128) complex128"},
+		{"Tanh", Func, 0, "func(x complex128) complex128"},
+	},
+	"math/rand": {
+		{"(*Rand).ExpFloat64", Method, 0, ""},
+		{"(*Rand).Float32", Method, 0, ""},
+		{"(*Rand).Float64", Method, 0, ""},
+		{"(*Rand).Int", Method, 0, ""},
+		{"(*Rand).Int31", Method, 0, ""},
+		{"(*Rand).Int31n", Method, 0, ""},
+		{"(*Rand).Int63", Method, 0, ""},
+		{"(*Rand).Int63n", Method, 0, ""},
+		{"(*Rand).Intn", Method, 0, ""},
+		{"(*Rand).NormFloat64", Method, 0, ""},
+		{"(*Rand).Perm", Method, 0, ""},
+		{"(*Rand).Read", Method, 6, ""},
+		{"(*Rand).Seed", Method, 0, ""},
+		{"(*Rand).Shuffle", Method, 10, ""},
+		{"(*Rand).Uint32", Method, 0, ""},
+		{"(*Rand).Uint64", Method, 8, ""},
+		{"(*Zipf).Uint64", Method, 0, ""},
+		{"ExpFloat64", Func, 0, "func() float64"},
+		{"Float32", Func, 0, "func() float32"},
+		{"Float64", Func, 0, "func() float64"},
+		{"Int", Func, 0, "func() int"},
+		{"Int31", Func, 0, "func() int32"},
+		{"Int31n", Func, 0, "func(n int32) int32"},
+		{"Int63", Func, 0, "func() int64"},
+		{"Int63n", Func, 0, "func(n int64) int64"},
+		{"Intn", Func, 0, "func(n int) int"},
+		{"New", Func, 0, "func(src Source) *Rand"},
+		{"NewSource", Func, 0, "func(seed int64) Source"},
+		{"NewZipf", Func, 0, "func(r *Rand, s float64, v float64, imax uint64) *Zipf"},
+		{"NormFloat64", Func, 0, "func() float64"},
+		{"Perm", Func, 0, "func(n int) []int"},
+		{"Rand", Type, 0, ""},
+		{"Read", Func, 6, "func(p []byte) (n int, err error)"},
+		{"Seed", Func, 0, "func(seed int64)"},
+		{"Shuffle", Func, 10, "func(n int, swap func(i int, j int))"},
+		{"Source", Type, 0, ""},
+		{"Source64", Type, 8, ""},
+		{"Uint32", Func, 0, "func() uint32"},
+		{"Uint64", Func, 8, "func() uint64"},
+		{"Zipf", Type, 0, ""},
+	},
+	"math/rand/v2": {
+		{"(*ChaCha8).AppendBinary", Method, 24, ""},
+		{"(*ChaCha8).MarshalBinary", Method, 22, ""},
+		{"(*ChaCha8).Read", Method, 23, ""},
+		{"(*ChaCha8).Seed", Method, 22, ""},
+		{"(*ChaCha8).Uint64", Method, 22, ""},
+		{"(*ChaCha8).UnmarshalBinary", Method, 22, ""},
+		{"(*PCG).AppendBinary", Method, 24, ""},
+		{"(*PCG).MarshalBinary", Method, 22, ""},
+		{"(*PCG).Seed", Method, 22, ""},
+		{"(*PCG).Uint64", Method, 22, ""},
+		{"(*PCG).UnmarshalBinary", Method, 22, ""},
+		{"(*Rand).ExpFloat64", Method, 22, ""},
+		{"(*Rand).Float32", Method, 22, ""},
+		{"(*Rand).Float64", Method, 22, ""},
+		{"(*Rand).Int", Method, 22, ""},
+		{"(*Rand).Int32", Method, 22, ""},
+		{"(*Rand).Int32N", Method, 22, ""},
+		{"(*Rand).Int64", Method, 22, ""},
+		{"(*Rand).Int64N", Method, 22, ""},
+		{"(*Rand).IntN", Method, 22, ""},
+		{"(*Rand).NormFloat64", Method, 22, ""},
+		{"(*Rand).Perm", Method, 22, ""},
+		{"(*Rand).Shuffle", Method, 22, ""},
+		{"(*Rand).Uint", Method, 23, ""},
+		{"(*Rand).Uint32", Method, 22, ""},
+		{"(*Rand).Uint32N", Method, 22, ""},
+		{"(*Rand).Uint64", Method, 22, ""},
+		{"(*Rand).Uint64N", Method, 22, ""},
+		{"(*Rand).UintN", Method, 22, ""},
+		{"(*Zipf).Uint64", Method, 22, ""},
+		{"ChaCha8", Type, 22, ""},
+		{"ExpFloat64", Func, 22, "func() float64"},
+		{"Float32", Func, 22, "func() float32"},
+		{"Float64", Func, 22, "func() float64"},
+		{"Int", Func, 22, "func() int"},
+		{"Int32", Func, 22, "func() int32"},
+		{"Int32N", Func, 22, "func(n int32) int32"},
+		{"Int64", Func, 22, "func() int64"},
+		{"Int64N", Func, 22, "func(n int64) int64"},
+		{"IntN", Func, 22, "func(n int) int"},
+		{"N", Func, 22, "func[Int intType](n Int) Int"},
+		{"New", Func, 22, "func(src Source) *Rand"},
+		{"NewChaCha8", Func, 22, "func(seed [32]byte) *ChaCha8"},
+		{"NewPCG", Func, 22, "func(seed1 uint64, seed2 uint64) *PCG"},
+		{"NewZipf", Func, 22, "func(r *Rand, s float64, v float64, imax uint64) *Zipf"},
+		{"NormFloat64", Func, 22, "func() float64"},
+		{"PCG", Type, 22, ""},
+		{"Perm", Func, 22, "func(n int) []int"},
+		{"Rand", Type, 22, ""},
+		{"Shuffle", Func, 22, "func(n int, swap func(i int, j int))"},
+		{"Source", Type, 22, ""},
+		{"Uint", Func, 23, "func() uint"},
+		{"Uint32", Func, 22, "func() uint32"},
+		{"Uint32N", Func, 22, "func(n uint32) uint32"},
+		{"Uint64", Func, 22, "func() uint64"},
+		{"Uint64N", Func, 22, "func(n uint64) uint64"},
+		{"UintN", Func, 22, "func(n uint) uint"},
+		{"Zipf", Type, 22, ""},
+	},
+	"mime": {
+		{"(*WordDecoder).Decode", Method, 5, ""},
+		{"(*WordDecoder).DecodeHeader", Method, 5, ""},
+		{"(WordEncoder).Encode", Method, 5, ""},
+		{"AddExtensionType", Func, 0, "func(ext string, typ string) error"},
+		{"BEncoding", Const, 5, ""},
+		{"ErrInvalidMediaParameter", Var, 9, ""},
+		{"ExtensionsByType", Func, 5, "func(typ string) ([]string, error)"},
+		{"FormatMediaType", Func, 0, "func(t string, param map[string]string) string"},
+		{"ParseMediaType", Func, 0, "func(v string) (mediatype string, params map[string]string, err error)"},
+		{"QEncoding", Const, 5, ""},
+		{"TypeByExtension", Func, 0, "func(ext string) string"},
+		{"WordDecoder", Type, 5, ""},
+		{"WordDecoder.CharsetReader", Field, 5, ""},
+		{"WordEncoder", Type, 5, ""},
+	},
+	"mime/multipart": {
+		{"(*FileHeader).Open", Method, 0, ""},
+		{"(*Form).RemoveAll", Method, 0, ""},
+		{"(*Part).Close", Method, 0, ""},
+		{"(*Part).FileName", Method, 0, ""},
+		{"(*Part).FormName", Method, 0, ""},
+		{"(*Part).Read", Method, 0, ""},
+		{"(*Reader).NextPart", Method, 0, ""},
+		{"(*Reader).NextRawPart", Method, 14, ""},
+		{"(*Reader).ReadForm", Method, 0, ""},
+		{"(*Writer).Boundary", Method, 0, ""},
+		{"(*Writer).Close", Method, 0, ""},
+		{"(*Writer).CreateFormField", Method, 0, ""},
+		{"(*Writer).CreateFormFile", Method, 0, ""},
+		{"(*Writer).CreatePart", Method, 0, ""},
+		{"(*Writer).FormDataContentType", Method, 0, ""},
+		{"(*Writer).SetBoundary", Method, 1, ""},
+		{"(*Writer).WriteField", Method, 0, ""},
+		{"ErrMessageTooLarge", Var, 9, ""},
+		{"File", Type, 0, ""},
+		{"FileContentDisposition", Func, 25, ""},
+		{"FileHeader", Type, 0, ""},
+		{"FileHeader.Filename", Field, 0, ""},
+		{"FileHeader.Header", Field, 0, ""},
+		{"FileHeader.Size", Field, 9, ""},
+		{"Form", Type, 0, ""},
+		{"Form.File", Field, 0, ""},
+		{"Form.Value", Field, 0, ""},
+		{"NewReader", Func, 0, "func(r io.Reader, boundary string) *Reader"},
+		{"NewWriter", Func, 0, "func(w io.Writer) *Writer"},
+		{"Part", Type, 0, ""},
+		{"Part.Header", Field, 0, ""},
+		{"Reader", Type, 0, ""},
+		{"Writer", Type, 0, ""},
+	},
+	"mime/quotedprintable": {
+		{"(*Reader).Read", Method, 5, ""},
+		{"(*Writer).Close", Method, 5, ""},
+		{"(*Writer).Write", Method, 5, ""},
+		{"NewReader", Func, 5, "func(r io.Reader) *Reader"},
+		{"NewWriter", Func, 5, "func(w io.Writer) *Writer"},
+		{"Reader", Type, 5, ""},
+		{"Writer", Type, 5, ""},
+		{"Writer.Binary", Field, 5, ""},
+	},
+	"net": {
+		{"(*AddrError).Error", Method, 0, ""},
+		{"(*AddrError).Temporary", Method, 0, ""},
+		{"(*AddrError).Timeout", Method, 0, ""},
+		{"(*Buffers).Read", Method, 8, ""},
+		{"(*Buffers).WriteTo", Method, 8, ""},
+		{"(*DNSConfigError).Error", Method, 0, ""},
+		{"(*DNSConfigError).Temporary", Method, 0, ""},
+		{"(*DNSConfigError).Timeout", Method, 0, ""},
+		{"(*DNSConfigError).Unwrap", Method, 13, ""},
+		{"(*DNSError).Error", Method, 0, ""},
+		{"(*DNSError).Temporary", Method, 0, ""},
+		{"(*DNSError).Timeout", Method, 0, ""},
+		{"(*DNSError).Unwrap", Method, 23, ""},
+		{"(*Dialer).Dial", Method, 1, ""},
+		{"(*Dialer).DialContext", Method, 7, ""},
+		{"(*Dialer).MultipathTCP", Method, 21, ""},
+		{"(*Dialer).SetMultipathTCP", Method, 21, ""},
+		{"(*IP).UnmarshalText", Method, 2, ""},
+		{"(*IPAddr).Network", Method, 0, ""},
+		{"(*IPAddr).String", Method, 0, ""},
+		{"(*IPConn).Close", Method, 0, ""},
+		{"(*IPConn).File", Method, 0, ""},
+		{"(*IPConn).LocalAddr", Method, 0, ""},
+		{"(*IPConn).Read", Method, 0, ""},
+		{"(*IPConn).ReadFrom", Method, 0, ""},
+		{"(*IPConn).ReadFromIP", Method, 0, ""},
+		{"(*IPConn).ReadMsgIP", Method, 1, ""},
+		{"(*IPConn).RemoteAddr", Method, 0, ""},
+		{"(*IPConn).SetDeadline", Method, 0, ""},
+		{"(*IPConn).SetReadBuffer", Method, 0, ""},
+		{"(*IPConn).SetReadDeadline", Method, 0, ""},
+		{"(*IPConn).SetWriteBuffer", Method, 0, ""},
+		{"(*IPConn).SetWriteDeadline", Method, 0, ""},
+		{"(*IPConn).SyscallConn", Method, 9, ""},
+		{"(*IPConn).Write", Method, 0, ""},
+		{"(*IPConn).WriteMsgIP", Method, 1, ""},
+		{"(*IPConn).WriteTo", Method, 0, ""},
+		{"(*IPConn).WriteToIP", Method, 0, ""},
+		{"(*IPNet).Contains", Method, 0, ""},
+		{"(*IPNet).Network", Method, 0, ""},
+		{"(*IPNet).String", Method, 0, ""},
+		{"(*Interface).Addrs", Method, 0, ""},
+		{"(*Interface).MulticastAddrs", Method, 0, ""},
+		{"(*ListenConfig).Listen", Method, 11, ""},
+		{"(*ListenConfig).ListenPacket", Method, 11, ""},
+		{"(*ListenConfig).MultipathTCP", Method, 21, ""},
+		{"(*ListenConfig).SetMultipathTCP", Method, 21, ""},
+		{"(*OpError).Error", Method, 0, ""},
+		{"(*OpError).Temporary", Method, 0, ""},
+		{"(*OpError).Timeout", Method, 0, ""},
+		{"(*OpError).Unwrap", Method, 13, ""},
+		{"(*ParseError).Error", Method, 0, ""},
+		{"(*ParseError).Temporary", Method, 17, ""},
+		{"(*ParseError).Timeout", Method, 17, ""},
+		{"(*Resolver).LookupAddr", Method, 8, ""},
+		{"(*Resolver).LookupCNAME", Method, 8, ""},
+		{"(*Resolver).LookupHost", Method, 8, ""},
+		{"(*Resolver).LookupIP", Method, 15, ""},
+		{"(*Resolver).LookupIPAddr", Method, 8, ""},
+		{"(*Resolver).LookupMX", Method, 8, ""},
+		{"(*Resolver).LookupNS", Method, 8, ""},
+		{"(*Resolver).LookupNetIP", Method, 18, ""},
+		{"(*Resolver).LookupPort", Method, 8, ""},
+		{"(*Resolver).LookupSRV", Method, 8, ""},
+		{"(*Resolver).LookupTXT", Method, 8, ""},
+		{"(*TCPAddr).AddrPort", Method, 18, ""},
+		{"(*TCPAddr).Network", Method, 0, ""},
+		{"(*TCPAddr).String", Method, 0, ""},
+		{"(*TCPConn).Close", Method, 0, ""},
+		{"(*TCPConn).CloseRead", Method, 0, ""},
+		{"(*TCPConn).CloseWrite", Method, 0, ""},
+		{"(*TCPConn).File", Method, 0, ""},
+		{"(*TCPConn).LocalAddr", Method, 0, ""},
+		{"(*TCPConn).MultipathTCP", Method, 21, ""},
+		{"(*TCPConn).Read", Method, 0, ""},
+		{"(*TCPConn).ReadFrom", Method, 0, ""},
+		{"(*TCPConn).RemoteAddr", Method, 0, ""},
+		{"(*TCPConn).SetDeadline", Method, 0, ""},
+		{"(*TCPConn).SetKeepAlive", Method, 0, ""},
+		{"(*TCPConn).SetKeepAliveConfig", Method, 23, ""},
+		{"(*TCPConn).SetKeepAlivePeriod", Method, 2, ""},
+		{"(*TCPConn).SetLinger", Method, 0, ""},
+		{"(*TCPConn).SetNoDelay", Method, 0, ""},
+		{"(*TCPConn).SetReadBuffer", Method, 0, ""},
+		{"(*TCPConn).SetReadDeadline", Method, 0, ""},
+		{"(*TCPConn).SetWriteBuffer", Method, 0, ""},
+		{"(*TCPConn).SetWriteDeadline", Method, 0, ""},
+		{"(*TCPConn).SyscallConn", Method, 9, ""},
+		{"(*TCPConn).Write", Method, 0, ""},
+		{"(*TCPConn).WriteTo", Method, 22, ""},
+		{"(*TCPListener).Accept", Method, 0, ""},
+		{"(*TCPListener).AcceptTCP", Method, 0, ""},
+		{"(*TCPListener).Addr", Method, 0, ""},
+		{"(*TCPListener).Close", Method, 0, ""},
+		{"(*TCPListener).File", Method, 0, ""},
+		{"(*TCPListener).SetDeadline", Method, 0, ""},
+		{"(*TCPListener).SyscallConn", Method, 10, ""},
+		{"(*UDPAddr).AddrPort", Method, 18, ""},
+		{"(*UDPAddr).Network", Method, 0, ""},
+		{"(*UDPAddr).String", Method, 0, ""},
+		{"(*UDPConn).Close", Method, 0, ""},
+		{"(*UDPConn).File", Method, 0, ""},
+		{"(*UDPConn).LocalAddr", Method, 0, ""},
+		{"(*UDPConn).Read", Method, 0, ""},
+		{"(*UDPConn).ReadFrom", Method, 0, ""},
+		{"(*UDPConn).ReadFromUDP", Method, 0, ""},
+		{"(*UDPConn).ReadFromUDPAddrPort", Method, 18, ""},
+		{"(*UDPConn).ReadMsgUDP", Method, 1, ""},
+		{"(*UDPConn).ReadMsgUDPAddrPort", Method, 18, ""},
+		{"(*UDPConn).RemoteAddr", Method, 0, ""},
+		{"(*UDPConn).SetDeadline", Method, 0, ""},
+		{"(*UDPConn).SetReadBuffer", Method, 0, ""},
+		{"(*UDPConn).SetReadDeadline", Method, 0, ""},
+		{"(*UDPConn).SetWriteBuffer", Method, 0, ""},
+		{"(*UDPConn).SetWriteDeadline", Method, 0, ""},
+		{"(*UDPConn).SyscallConn", Method, 9, ""},
+		{"(*UDPConn).Write", Method, 0, ""},
+		{"(*UDPConn).WriteMsgUDP", Method, 1, ""},
+		{"(*UDPConn).WriteMsgUDPAddrPort", Method, 18, ""},
+		{"(*UDPConn).WriteTo", Method, 0, ""},
+		{"(*UDPConn).WriteToUDP", Method, 0, ""},
+		{"(*UDPConn).WriteToUDPAddrPort", Method, 18, ""},
+		{"(*UnixAddr).Network", Method, 0, ""},
+		{"(*UnixAddr).String", Method, 0, ""},
+		{"(*UnixConn).Close", Method, 0, ""},
+		{"(*UnixConn).CloseRead", Method, 1, ""},
+		{"(*UnixConn).CloseWrite", Method, 1, ""},
+		{"(*UnixConn).File", Method, 0, ""},
+		{"(*UnixConn).LocalAddr", Method, 0, ""},
+		{"(*UnixConn).Read", Method, 0, ""},
+		{"(*UnixConn).ReadFrom", Method, 0, ""},
+		{"(*UnixConn).ReadFromUnix", Method, 0, ""},
+		{"(*UnixConn).ReadMsgUnix", Method, 0, ""},
+		{"(*UnixConn).RemoteAddr", Method, 0, ""},
+		{"(*UnixConn).SetDeadline", Method, 0, ""},
+		{"(*UnixConn).SetReadBuffer", Method, 0, ""},
+		{"(*UnixConn).SetReadDeadline", Method, 0, ""},
+		{"(*UnixConn).SetWriteBuffer", Method, 0, ""},
+		{"(*UnixConn).SetWriteDeadline", Method, 0, ""},
+		{"(*UnixConn).SyscallConn", Method, 9, ""},
+		{"(*UnixConn).Write", Method, 0, ""},
+		{"(*UnixConn).WriteMsgUnix", Method, 0, ""},
+		{"(*UnixConn).WriteTo", Method, 0, ""},
+		{"(*UnixConn).WriteToUnix", Method, 0, ""},
+		{"(*UnixListener).Accept", Method, 0, ""},
+		{"(*UnixListener).AcceptUnix", Method, 0, ""},
+		{"(*UnixListener).Addr", Method, 0, ""},
+		{"(*UnixListener).Close", Method, 0, ""},
+		{"(*UnixListener).File", Method, 0, ""},
+		{"(*UnixListener).SetDeadline", Method, 0, ""},
+		{"(*UnixListener).SetUnlinkOnClose", Method, 8, ""},
+		{"(*UnixListener).SyscallConn", Method, 10, ""},
+		{"(Flags).String", Method, 0, ""},
+		{"(HardwareAddr).String", Method, 0, ""},
+		{"(IP).AppendText", Method, 24, ""},
+		{"(IP).DefaultMask", Method, 0, ""},
+		{"(IP).Equal", Method, 0, ""},
+		{"(IP).IsGlobalUnicast", Method, 0, ""},
+		{"(IP).IsInterfaceLocalMulticast", Method, 0, ""},
+		{"(IP).IsLinkLocalMulticast", Method, 0, ""},
+		{"(IP).IsLinkLocalUnicast", Method, 0, ""},
+		{"(IP).IsLoopback", Method, 0, ""},
+		{"(IP).IsMulticast", Method, 0, ""},
+		{"(IP).IsPrivate", Method, 17, ""},
+		{"(IP).IsUnspecified", Method, 0, ""},
+		{"(IP).MarshalText", Method, 2, ""},
+		{"(IP).Mask", Method, 0, ""},
+		{"(IP).String", Method, 0, ""},
+		{"(IP).To16", Method, 0, ""},
+		{"(IP).To4", Method, 0, ""},
+		{"(IPMask).Size", Method, 0, ""},
+		{"(IPMask).String", Method, 0, ""},
+		{"(InvalidAddrError).Error", Method, 0, ""},
+		{"(InvalidAddrError).Temporary", Method, 0, ""},
+		{"(InvalidAddrError).Timeout", Method, 0, ""},
+		{"(UnknownNetworkError).Error", Method, 0, ""},
+		{"(UnknownNetworkError).Temporary", Method, 0, ""},
+		{"(UnknownNetworkError).Timeout", Method, 0, ""},
+		{"Addr", Type, 0, ""},
+		{"AddrError", Type, 0, ""},
+		{"AddrError.Addr", Field, 0, ""},
+		{"AddrError.Err", Field, 0, ""},
+		{"Buffers", Type, 8, ""},
+		{"CIDRMask", Func, 0, "func(ones int, bits int) IPMask"},
+		{"Conn", Type, 0, ""},
+		{"DNSConfigError", Type, 0, ""},
+		{"DNSConfigError.Err", Field, 0, ""},
+		{"DNSError", Type, 0, ""},
+		{"DNSError.Err", Field, 0, ""},
+		{"DNSError.IsNotFound", Field, 13, ""},
+		{"DNSError.IsTemporary", Field, 6, ""},
+		{"DNSError.IsTimeout", Field, 0, ""},
+		{"DNSError.Name", Field, 0, ""},
+		{"DNSError.Server", Field, 0, ""},
+		{"DNSError.UnwrapErr", Field, 23, ""},
+		{"DefaultResolver", Var, 8, ""},
+		{"Dial", Func, 0, "func(network string, address string) (Conn, error)"},
+		{"DialIP", Func, 0, "func(network string, laddr *IPAddr, raddr *IPAddr) (*IPConn, error)"},
+		{"DialTCP", Func, 0, "func(network string, laddr *TCPAddr, raddr *TCPAddr) (*TCPConn, error)"},
+		{"DialTimeout", Func, 0, "func(network string, address string, timeout time.Duration) (Conn, error)"},
+		{"DialUDP", Func, 0, "func(network string, laddr *UDPAddr, raddr *UDPAddr) (*UDPConn, error)"},
+		{"DialUnix", Func, 0, "func(network string, laddr *UnixAddr, raddr *UnixAddr) (*UnixConn, error)"},
+		{"Dialer", Type, 1, ""},
+		{"Dialer.Cancel", Field, 6, ""},
+		{"Dialer.Control", Field, 11, ""},
+		{"Dialer.ControlContext", Field, 20, ""},
+		{"Dialer.Deadline", Field, 1, ""},
+		{"Dialer.DualStack", Field, 2, ""},
+		{"Dialer.FallbackDelay", Field, 5, ""},
+		{"Dialer.KeepAlive", Field, 3, ""},
+		{"Dialer.KeepAliveConfig", Field, 23, ""},
+		{"Dialer.LocalAddr", Field, 1, ""},
+		{"Dialer.Resolver", Field, 8, ""},
+		{"Dialer.Timeout", Field, 1, ""},
+		{"ErrClosed", Var, 16, ""},
+		{"ErrWriteToConnected", Var, 0, ""},
+		{"Error", Type, 0, ""},
+		{"FileConn", Func, 0, "func(f *os.File) (c Conn, err error)"},
+		{"FileListener", Func, 0, "func(f *os.File) (ln Listener, err error)"},
+		{"FilePacketConn", Func, 0, "func(f *os.File) (c PacketConn, err error)"},
+		{"FlagBroadcast", Const, 0, ""},
+		{"FlagLoopback", Const, 0, ""},
+		{"FlagMulticast", Const, 0, ""},
+		{"FlagPointToPoint", Const, 0, ""},
+		{"FlagRunning", Const, 20, ""},
+		{"FlagUp", Const, 0, ""},
+		{"Flags", Type, 0, ""},
+		{"HardwareAddr", Type, 0, ""},
+		{"IP", Type, 0, ""},
+		{"IPAddr", Type, 0, ""},
+		{"IPAddr.IP", Field, 0, ""},
+		{"IPAddr.Zone", Field, 1, ""},
+		{"IPConn", Type, 0, ""},
+		{"IPMask", Type, 0, ""},
+		{"IPNet", Type, 0, ""},
+		{"IPNet.IP", Field, 0, ""},
+		{"IPNet.Mask", Field, 0, ""},
+		{"IPv4", Func, 0, "func(a byte, b byte, c byte, d byte) IP"},
+		{"IPv4Mask", Func, 0, "func(a byte, b byte, c byte, d byte) IPMask"},
+		{"IPv4allrouter", Var, 0, ""},
+		{"IPv4allsys", Var, 0, ""},
+		{"IPv4bcast", Var, 0, ""},
+		{"IPv4len", Const, 0, ""},
+		{"IPv4zero", Var, 0, ""},
+		{"IPv6interfacelocalallnodes", Var, 0, ""},
+		{"IPv6len", Const, 0, ""},
+		{"IPv6linklocalallnodes", Var, 0, ""},
+		{"IPv6linklocalallrouters", Var, 0, ""},
+		{"IPv6loopback", Var, 0, ""},
+		{"IPv6unspecified", Var, 0, ""},
+		{"IPv6zero", Var, 0, ""},
+		{"Interface", Type, 0, ""},
+		{"Interface.Flags", Field, 0, ""},
+		{"Interface.HardwareAddr", Field, 0, ""},
+		{"Interface.Index", Field, 0, ""},
+		{"Interface.MTU", Field, 0, ""},
+		{"Interface.Name", Field, 0, ""},
+		{"InterfaceAddrs", Func, 0, "func() ([]Addr, error)"},
+		{"InterfaceByIndex", Func, 0, "func(index int) (*Interface, error)"},
+		{"InterfaceByName", Func, 0, "func(name string) (*Interface, error)"},
+		{"Interfaces", Func, 0, "func() ([]Interface, error)"},
+		{"InvalidAddrError", Type, 0, ""},
+		{"JoinHostPort", Func, 0, "func(host string, port string) string"},
+		{"KeepAliveConfig", Type, 23, ""},
+		{"KeepAliveConfig.Count", Field, 23, ""},
+		{"KeepAliveConfig.Enable", Field, 23, ""},
+		{"KeepAliveConfig.Idle", Field, 23, ""},
+		{"KeepAliveConfig.Interval", Field, 23, ""},
+		{"Listen", Func, 0, "func(network string, address string) (Listener, error)"},
+		{"ListenConfig", Type, 11, ""},
+		{"ListenConfig.Control", Field, 11, ""},
+		{"ListenConfig.KeepAlive", Field, 13, ""},
+		{"ListenConfig.KeepAliveConfig", Field, 23, ""},
+		{"ListenIP", Func, 0, "func(network string, laddr *IPAddr) (*IPConn, error)"},
+		{"ListenMulticastUDP", Func, 0, "func(network string, ifi *Interface, gaddr *UDPAddr) (*UDPConn, error)"},
+		{"ListenPacket", Func, 0, "func(network string, address string) (PacketConn, error)"},
+		{"ListenTCP", Func, 0, "func(network string, laddr *TCPAddr) (*TCPListener, error)"},
+		{"ListenUDP", Func, 0, "func(network string, laddr *UDPAddr) (*UDPConn, error)"},
+		{"ListenUnix", Func, 0, "func(network string, laddr *UnixAddr) (*UnixListener, error)"},
+		{"ListenUnixgram", Func, 0, "func(network string, laddr *UnixAddr) (*UnixConn, error)"},
+		{"Listener", Type, 0, ""},
+		{"LookupAddr", Func, 0, "func(addr string) (names []string, err error)"},
+		{"LookupCNAME", Func, 0, "func(host string) (cname string, err error)"},
+		{"LookupHost", Func, 0, "func(host string) (addrs []string, err error)"},
+		{"LookupIP", Func, 0, "func(host string) ([]IP, error)"},
+		{"LookupMX", Func, 0, "func(name string) ([]*MX, error)"},
+		{"LookupNS", Func, 1, "func(name string) ([]*NS, error)"},
+		{"LookupPort", Func, 0, "func(network string, service string) (port int, err error)"},
+		{"LookupSRV", Func, 0, "func(service string, proto string, name string) (cname string, addrs []*SRV, err error)"},
+		{"LookupTXT", Func, 0, "func(name string) ([]string, error)"},
+		{"MX", Type, 0, ""},
+		{"MX.Host", Field, 0, ""},
+		{"MX.Pref", Field, 0, ""},
+		{"NS", Type, 1, ""},
+		{"NS.Host", Field, 1, ""},
+		{"OpError", Type, 0, ""},
+		{"OpError.Addr", Field, 0, ""},
+		{"OpError.Err", Field, 0, ""},
+		{"OpError.Net", Field, 0, ""},
+		{"OpError.Op", Field, 0, ""},
+		{"OpError.Source", Field, 5, ""},
+		{"PacketConn", Type, 0, ""},
+		{"ParseCIDR", Func, 0, "func(s string) (IP, *IPNet, error)"},
+		{"ParseError", Type, 0, ""},
+		{"ParseError.Text", Field, 0, ""},
+		{"ParseError.Type", Field, 0, ""},
+		{"ParseIP", Func, 0, "func(s string) IP"},
+		{"ParseMAC", Func, 0, "func(s string) (hw HardwareAddr, err error)"},
+		{"Pipe", Func, 0, "func() (Conn, Conn)"},
+		{"ResolveIPAddr", Func, 0, "func(network string, address string) (*IPAddr, error)"},
+		{"ResolveTCPAddr", Func, 0, "func(network string, address string) (*TCPAddr, error)"},
+		{"ResolveUDPAddr", Func, 0, "func(network string, address string) (*UDPAddr, error)"},
+		{"ResolveUnixAddr", Func, 0, "func(network string, address string) (*UnixAddr, error)"},
+		{"Resolver", Type, 8, ""},
+		{"Resolver.Dial", Field, 9, ""},
+		{"Resolver.PreferGo", Field, 8, ""},
+		{"Resolver.StrictErrors", Field, 9, ""},
+		{"SRV", Type, 0, ""},
+		{"SRV.Port", Field, 0, ""},
+		{"SRV.Priority", Field, 0, ""},
+		{"SRV.Target", Field, 0, ""},
+		{"SRV.Weight", Field, 0, ""},
+		{"SplitHostPort", Func, 0, "func(hostport string) (host string, port string, err error)"},
+		{"TCPAddr", Type, 0, ""},
+		{"TCPAddr.IP", Field, 0, ""},
+		{"TCPAddr.Port", Field, 0, ""},
+		{"TCPAddr.Zone", Field, 1, ""},
+		{"TCPAddrFromAddrPort", Func, 18, "func(addr netip.AddrPort) *TCPAddr"},
+		{"TCPConn", Type, 0, ""},
+		{"TCPListener", Type, 0, ""},
+		{"UDPAddr", Type, 0, ""},
+		{"UDPAddr.IP", Field, 0, ""},
+		{"UDPAddr.Port", Field, 0, ""},
+		{"UDPAddr.Zone", Field, 1, ""},
+		{"UDPAddrFromAddrPort", Func, 18, "func(addr netip.AddrPort) *UDPAddr"},
+		{"UDPConn", Type, 0, ""},
+		{"UnixAddr", Type, 0, ""},
+		{"UnixAddr.Name", Field, 0, ""},
+		{"UnixAddr.Net", Field, 0, ""},
+		{"UnixConn", Type, 0, ""},
+		{"UnixListener", Type, 0, ""},
+		{"UnknownNetworkError", Type, 0, ""},
+	},
+	"net/http": {
+		{"(*Client).CloseIdleConnections", Method, 12, ""},
+		{"(*Client).Do", Method, 0, ""},
+		{"(*Client).Get", Method, 0, ""},
+		{"(*Client).Head", Method, 0, ""},
+		{"(*Client).Post", Method, 0, ""},
+		{"(*Client).PostForm", Method, 0, ""},
+		{"(*Cookie).String", Method, 0, ""},
+		{"(*Cookie).Valid", Method, 18, ""},
+		{"(*MaxBytesError).Error", Method, 19, ""},
+		{"(*ProtocolError).Error", Method, 0, ""},
+		{"(*ProtocolError).Is", Method, 21, ""},
+		{"(*Protocols).SetHTTP1", Method, 24, ""},
+		{"(*Protocols).SetHTTP2", Method, 24, ""},
+		{"(*Protocols).SetUnencryptedHTTP2", Method, 24, ""},
+		{"(*Request).AddCookie", Method, 0, ""},
+		{"(*Request).BasicAuth", Method, 4, ""},
+		{"(*Request).Clone", Method, 13, ""},
+		{"(*Request).Context", Method, 7, ""},
+		{"(*Request).Cookie", Method, 0, ""},
+		{"(*Request).Cookies", Method, 0, ""},
+		{"(*Request).CookiesNamed", Method, 23, ""},
+		{"(*Request).FormFile", Method, 0, ""},
+		{"(*Request).FormValue", Method, 0, ""},
+		{"(*Request).MultipartReader", Method, 0, ""},
+		{"(*Request).ParseForm", Method, 0, ""},
+		{"(*Request).ParseMultipartForm", Method, 0, ""},
+		{"(*Request).PathValue", Method, 22, ""},
+		{"(*Request).PostFormValue", Method, 1, ""},
+		{"(*Request).ProtoAtLeast", Method, 0, ""},
+		{"(*Request).Referer", Method, 0, ""},
+		{"(*Request).SetBasicAuth", Method, 0, ""},
+		{"(*Request).SetPathValue", Method, 22, ""},
+		{"(*Request).UserAgent", Method, 0, ""},
+		{"(*Request).WithContext", Method, 7, ""},
+		{"(*Request).Write", Method, 0, ""},
+		{"(*Request).WriteProxy", Method, 0, ""},
+		{"(*Response).Cookies", Method, 0, ""},
+		{"(*Response).Location", Method, 0, ""},
+		{"(*Response).ProtoAtLeast", Method, 0, ""},
+		{"(*Response).Write", Method, 0, ""},
+		{"(*ResponseController).EnableFullDuplex", Method, 21, ""},
+		{"(*ResponseController).Flush", Method, 20, ""},
+		{"(*ResponseController).Hijack", Method, 20, ""},
+		{"(*ResponseController).SetReadDeadline", Method, 20, ""},
+		{"(*ResponseController).SetWriteDeadline", Method, 20, ""},
+		{"(*ServeMux).Handle", Method, 0, ""},
+		{"(*ServeMux).HandleFunc", Method, 0, ""},
+		{"(*ServeMux).Handler", Method, 1, ""},
+		{"(*ServeMux).ServeHTTP", Method, 0, ""},
+		{"(*Server).Close", Method, 8, ""},
+		{"(*Server).ListenAndServe", Method, 0, ""},
+		{"(*Server).ListenAndServeTLS", Method, 0, ""},
+		{"(*Server).RegisterOnShutdown", Method, 9, ""},
+		{"(*Server).Serve", Method, 0, ""},
+		{"(*Server).ServeTLS", Method, 9, ""},
+		{"(*Server).SetKeepAlivesEnabled", Method, 3, ""},
+		{"(*Server).Shutdown", Method, 8, ""},
+		{"(*Transport).CancelRequest", Method, 1, ""},
+		{"(*Transport).Clone", Method, 13, ""},
+		{"(*Transport).CloseIdleConnections", Method, 0, ""},
+		{"(*Transport).RegisterProtocol", Method, 0, ""},
+		{"(*Transport).RoundTrip", Method, 0, ""},
+		{"(ConnState).String", Method, 3, ""},
+		{"(Dir).Open", Method, 0, ""},
+		{"(HandlerFunc).ServeHTTP", Method, 0, ""},
+		{"(Header).Add", Method, 0, ""},
+		{"(Header).Clone", Method, 13, ""},
+		{"(Header).Del", Method, 0, ""},
+		{"(Header).Get", Method, 0, ""},
+		{"(Header).Set", Method, 0, ""},
+		{"(Header).Values", Method, 14, ""},
+		{"(Header).Write", Method, 0, ""},
+		{"(Header).WriteSubset", Method, 0, ""},
+		{"(Protocols).HTTP1", Method, 24, ""},
+		{"(Protocols).HTTP2", Method, 24, ""},
+		{"(Protocols).String", Method, 24, ""},
+		{"(Protocols).UnencryptedHTTP2", Method, 24, ""},
+		{"AllowQuerySemicolons", Func, 17, "func(h Handler) Handler"},
+		{"CanonicalHeaderKey", Func, 0, "func(s string) string"},
+		{"Client", Type, 0, ""},
+		{"Client.CheckRedirect", Field, 0, ""},
+		{"Client.Jar", Field, 0, ""},
+		{"Client.Timeout", Field, 3, ""},
+		{"Client.Transport", Field, 0, ""},
+		{"CloseNotifier", Type, 1, ""},
+		{"ConnState", Type, 3, ""},
+		{"Cookie", Type, 0, ""},
+		{"Cookie.Domain", Field, 0, ""},
+		{"Cookie.Expires", Field, 0, ""},
+		{"Cookie.HttpOnly", Field, 0, ""},
+		{"Cookie.MaxAge", Field, 0, ""},
+		{"Cookie.Name", Field, 0, ""},
+		{"Cookie.Partitioned", Field, 23, ""},
+		{"Cookie.Path", Field, 0, ""},
+		{"Cookie.Quoted", Field, 23, ""},
+		{"Cookie.Raw", Field, 0, ""},
+		{"Cookie.RawExpires", Field, 0, ""},
+		{"Cookie.SameSite", Field, 11, ""},
+		{"Cookie.Secure", Field, 0, ""},
+		{"Cookie.Unparsed", Field, 0, ""},
+		{"Cookie.Value", Field, 0, ""},
+		{"CookieJar", Type, 0, ""},
+		{"DefaultClient", Var, 0, ""},
+		{"DefaultMaxHeaderBytes", Const, 0, ""},
+		{"DefaultMaxIdleConnsPerHost", Const, 0, ""},
+		{"DefaultServeMux", Var, 0, ""},
+		{"DefaultTransport", Var, 0, ""},
+		{"DetectContentType", Func, 0, "func(data []byte) string"},
+		{"Dir", Type, 0, ""},
+		{"ErrAbortHandler", Var, 8, ""},
+		{"ErrBodyNotAllowed", Var, 0, ""},
+		{"ErrBodyReadAfterClose", Var, 0, ""},
+		{"ErrContentLength", Var, 0, ""},
+		{"ErrHandlerTimeout", Var, 0, ""},
+		{"ErrHeaderTooLong", Var, 0, ""},
+		{"ErrHijacked", Var, 0, ""},
+		{"ErrLineTooLong", Var, 0, ""},
+		{"ErrMissingBoundary", Var, 0, ""},
+		{"ErrMissingContentLength", Var, 0, ""},
+		{"ErrMissingFile", Var, 0, ""},
+		{"ErrNoCookie", Var, 0, ""},
+		{"ErrNoLocation", Var, 0, ""},
+		{"ErrNotMultipart", Var, 0, ""},
+		{"ErrNotSupported", Var, 0, ""},
+		{"ErrSchemeMismatch", Var, 21, ""},
+		{"ErrServerClosed", Var, 8, ""},
+		{"ErrShortBody", Var, 0, ""},
+		{"ErrSkipAltProtocol", Var, 6, ""},
+		{"ErrUnexpectedTrailer", Var, 0, ""},
+		{"ErrUseLastResponse", Var, 7, ""},
+		{"ErrWriteAfterFlush", Var, 0, ""},
+		{"Error", Func, 0, "func(w ResponseWriter, error string, code int)"},
+		{"FS", Func, 16, "func(fsys fs.FS) FileSystem"},
+		{"File", Type, 0, ""},
+		{"FileServer", Func, 0, "func(root FileSystem) Handler"},
+		{"FileServerFS", Func, 22, "func(root fs.FS) Handler"},
+		{"FileSystem", Type, 0, ""},
+		{"Flusher", Type, 0, ""},
+		{"Get", Func, 0, "func(url string) (resp *Response, err error)"},
+		{"HTTP2Config", Type, 24, ""},
+		{"HTTP2Config.CountError", Field, 24, ""},
+		{"HTTP2Config.MaxConcurrentStreams", Field, 24, ""},
+		{"HTTP2Config.MaxDecoderHeaderTableSize", Field, 24, ""},
+		{"HTTP2Config.MaxEncoderHeaderTableSize", Field, 24, ""},
+		{"HTTP2Config.MaxReadFrameSize", Field, 24, ""},
+		{"HTTP2Config.MaxReceiveBufferPerConnection", Field, 24, ""},
+		{"HTTP2Config.MaxReceiveBufferPerStream", Field, 24, ""},
+		{"HTTP2Config.PermitProhibitedCipherSuites", Field, 24, ""},
+		{"HTTP2Config.PingTimeout", Field, 24, ""},
+		{"HTTP2Config.SendPingTimeout", Field, 24, ""},
+		{"HTTP2Config.WriteByteTimeout", Field, 24, ""},
+		{"Handle", Func, 0, "func(pattern string, handler Handler)"},
+		{"HandleFunc", Func, 0, "func(pattern string, handler func(ResponseWriter, *Request))"},
+		{"Handler", Type, 0, ""},
+		{"HandlerFunc", Type, 0, ""},
+		{"Head", Func, 0, "func(url string) (resp *Response, err error)"},
+		{"Header", Type, 0, ""},
+		{"Hijacker", Type, 0, ""},
+		{"ListenAndServe", Func, 0, "func(addr string, handler Handler) error"},
+		{"ListenAndServeTLS", Func, 0, "func(addr string, certFile string, keyFile string, handler Handler) error"},
+		{"LocalAddrContextKey", Var, 7, ""},
+		{"MaxBytesError", Type, 19, ""},
+		{"MaxBytesError.Limit", Field, 19, ""},
+		{"MaxBytesHandler", Func, 18, "func(h Handler, n int64) Handler"},
+		{"MaxBytesReader", Func, 0, "func(w ResponseWriter, r io.ReadCloser, n int64) io.ReadCloser"},
+		{"MethodConnect", Const, 6, ""},
+		{"MethodDelete", Const, 6, ""},
+		{"MethodGet", Const, 6, ""},
+		{"MethodHead", Const, 6, ""},
+		{"MethodOptions", Const, 6, ""},
+		{"MethodPatch", Const, 6, ""},
+		{"MethodPost", Const, 6, ""},
+		{"MethodPut", Const, 6, ""},
+		{"MethodTrace", Const, 6, ""},
+		{"NewFileTransport", Func, 0, "func(fs FileSystem) RoundTripper"},
+		{"NewFileTransportFS", Func, 22, "func(fsys fs.FS) RoundTripper"},
+		{"NewRequest", Func, 0, "func(method string, url string, body io.Reader) (*Request, error)"},
+		{"NewRequestWithContext", Func, 13, "func(ctx context.Context, method string, url string, body io.Reader) (*Request, error)"},
+		{"NewResponseController", Func, 20, "func(rw ResponseWriter) *ResponseController"},
+		{"NewServeMux", Func, 0, "func() *ServeMux"},
+		{"NoBody", Var, 8, ""},
+		{"NotFound", Func, 0, "func(w ResponseWriter, r *Request)"},
+		{"NotFoundHandler", Func, 0, "func() Handler"},
+		{"ParseCookie", Func, 23, "func(line string) ([]*Cookie, error)"},
+		{"ParseHTTPVersion", Func, 0, "func(vers string) (major int, minor int, ok bool)"},
+		{"ParseSetCookie", Func, 23, "func(line string) (*Cookie, error)"},
+		{"ParseTime", Func, 1, "func(text string) (t time.Time, err error)"},
+		{"Post", Func, 0, "func(url string, contentType string, body io.Reader) (resp *Response, err error)"},
+		{"PostForm", Func, 0, "func(url string, data url.Values) (resp *Response, err error)"},
+		{"ProtocolError", Type, 0, ""},
+		{"ProtocolError.ErrorString", Field, 0, ""},
+		{"Protocols", Type, 24, ""},
+		{"ProxyFromEnvironment", Func, 0, "func(req *Request) (*url.URL, error)"},
+		{"ProxyURL", Func, 0, "func(fixedURL *url.URL) func(*Request) (*url.URL, error)"},
+		{"PushOptions", Type, 8, ""},
+		{"PushOptions.Header", Field, 8, ""},
+		{"PushOptions.Method", Field, 8, ""},
+		{"Pusher", Type, 8, ""},
+		{"ReadRequest", Func, 0, "func(b *bufio.Reader) (*Request, error)"},
+		{"ReadResponse", Func, 0, "func(r *bufio.Reader, req *Request) (*Response, error)"},
+		{"Redirect", Func, 0, "func(w ResponseWriter, r *Request, url string, code int)"},
+		{"RedirectHandler", Func, 0, "func(url string, code int) Handler"},
+		{"Request", Type, 0, ""},
+		{"Request.Body", Field, 0, ""},
+		{"Request.Cancel", Field, 5, ""},
+		{"Request.Close", Field, 0, ""},
+		{"Request.ContentLength", Field, 0, ""},
+		{"Request.Form", Field, 0, ""},
+		{"Request.GetBody", Field, 8, ""},
+		{"Request.Header", Field, 0, ""},
+		{"Request.Host", Field, 0, ""},
+		{"Request.Method", Field, 0, ""},
+		{"Request.MultipartForm", Field, 0, ""},
+		{"Request.Pattern", Field, 23, ""},
+		{"Request.PostForm", Field, 1, ""},
+		{"Request.Proto", Field, 0, ""},
+		{"Request.ProtoMajor", Field, 0, ""},
+		{"Request.ProtoMinor", Field, 0, ""},
+		{"Request.RemoteAddr", Field, 0, ""},
+		{"Request.RequestURI", Field, 0, ""},
+		{"Request.Response", Field, 7, ""},
+		{"Request.TLS", Field, 0, ""},
+		{"Request.Trailer", Field, 0, ""},
+		{"Request.TransferEncoding", Field, 0, ""},
+		{"Request.URL", Field, 0, ""},
+		{"Response", Type, 0, ""},
+		{"Response.Body", Field, 0, ""},
+		{"Response.Close", Field, 0, ""},
+		{"Response.ContentLength", Field, 0, ""},
+		{"Response.Header", Field, 0, ""},
+		{"Response.Proto", Field, 0, ""},
+		{"Response.ProtoMajor", Field, 0, ""},
+		{"Response.ProtoMinor", Field, 0, ""},
+		{"Response.Request", Field, 0, ""},
+		{"Response.Status", Field, 0, ""},
+		{"Response.StatusCode", Field, 0, ""},
+		{"Response.TLS", Field, 3, ""},
+		{"Response.Trailer", Field, 0, ""},
+		{"Response.TransferEncoding", Field, 0, ""},
+		{"Response.Uncompressed", Field, 7, ""},
+		{"ResponseController", Type, 20, ""},
+		{"ResponseWriter", Type, 0, ""},
+		{"RoundTripper", Type, 0, ""},
+		{"SameSite", Type, 11, ""},
+		{"SameSiteDefaultMode", Const, 11, ""},
+		{"SameSiteLaxMode", Const, 11, ""},
+		{"SameSiteNoneMode", Const, 13, ""},
+		{"SameSiteStrictMode", Const, 11, ""},
+		{"Serve", Func, 0, "func(l net.Listener, handler Handler) error"},
+		{"ServeContent", Func, 0, "func(w ResponseWriter, req *Request, name string, modtime time.Time, content io.ReadSeeker)"},
+		{"ServeFile", Func, 0, "func(w ResponseWriter, r *Request, name string)"},
+		{"ServeFileFS", Func, 22, "func(w ResponseWriter, r *Request, fsys fs.FS, name string)"},
+		{"ServeMux", Type, 0, ""},
+		{"ServeTLS", Func, 9, "func(l net.Listener, handler Handler, certFile string, keyFile string) error"},
+		{"Server", Type, 0, ""},
+		{"Server.Addr", Field, 0, ""},
+		{"Server.BaseContext", Field, 13, ""},
+		{"Server.ConnContext", Field, 13, ""},
+		{"Server.ConnState", Field, 3, ""},
+		{"Server.DisableGeneralOptionsHandler", Field, 20, ""},
+		{"Server.ErrorLog", Field, 3, ""},
+		{"Server.HTTP2", Field, 24, ""},
+		{"Server.Handler", Field, 0, ""},
+		{"Server.IdleTimeout", Field, 8, ""},
+		{"Server.MaxHeaderBytes", Field, 0, ""},
+		{"Server.Protocols", Field, 24, ""},
+		{"Server.ReadHeaderTimeout", Field, 8, ""},
+		{"Server.ReadTimeout", Field, 0, ""},
+		{"Server.TLSConfig", Field, 0, ""},
+		{"Server.TLSNextProto", Field, 1, ""},
+		{"Server.WriteTimeout", Field, 0, ""},
+		{"ServerContextKey", Var, 7, ""},
+		{"SetCookie", Func, 0, "func(w ResponseWriter, cookie *Cookie)"},
+		{"StateActive", Const, 3, ""},
+		{"StateClosed", Const, 3, ""},
+		{"StateHijacked", Const, 3, ""},
+		{"StateIdle", Const, 3, ""},
+		{"StateNew", Const, 3, ""},
+		{"StatusAccepted", Const, 0, ""},
+		{"StatusAlreadyReported", Const, 7, ""},
+		{"StatusBadGateway", Const, 0, ""},
+		{"StatusBadRequest", Const, 0, ""},
+		{"StatusConflict", Const, 0, ""},
+		{"StatusContinue", Const, 0, ""},
+		{"StatusCreated", Const, 0, ""},
+		{"StatusEarlyHints", Const, 13, ""},
+		{"StatusExpectationFailed", Const, 0, ""},
+		{"StatusFailedDependency", Const, 7, ""},
+		{"StatusForbidden", Const, 0, ""},
+		{"StatusFound", Const, 0, ""},
+		{"StatusGatewayTimeout", Const, 0, ""},
+		{"StatusGone", Const, 0, ""},
+		{"StatusHTTPVersionNotSupported", Const, 0, ""},
+		{"StatusIMUsed", Const, 7, ""},
+		{"StatusInsufficientStorage", Const, 7, ""},
+		{"StatusInternalServerError", Const, 0, ""},
+		{"StatusLengthRequired", Const, 0, ""},
+		{"StatusLocked", Const, 7, ""},
+		{"StatusLoopDetected", Const, 7, ""},
+		{"StatusMethodNotAllowed", Const, 0, ""},
+		{"StatusMisdirectedRequest", Const, 11, ""},
+		{"StatusMovedPermanently", Const, 0, ""},
+		{"StatusMultiStatus", Const, 7, ""},
+		{"StatusMultipleChoices", Const, 0, ""},
+		{"StatusNetworkAuthenticationRequired", Const, 6, ""},
+		{"StatusNoContent", Const, 0, ""},
+		{"StatusNonAuthoritativeInfo", Const, 0, ""},
+		{"StatusNotAcceptable", Const, 0, ""},
+		{"StatusNotExtended", Const, 7, ""},
+		{"StatusNotFound", Const, 0, ""},
+		{"StatusNotImplemented", Const, 0, ""},
+		{"StatusNotModified", Const, 0, ""},
+		{"StatusOK", Const, 0, ""},
+		{"StatusPartialContent", Const, 0, ""},
+		{"StatusPaymentRequired", Const, 0, ""},
+		{"StatusPermanentRedirect", Const, 7, ""},
+		{"StatusPreconditionFailed", Const, 0, ""},
+		{"StatusPreconditionRequired", Const, 6, ""},
+		{"StatusProcessing", Const, 7, ""},
+		{"StatusProxyAuthRequired", Const, 0, ""},
+		{"StatusRequestEntityTooLarge", Const, 0, ""},
+		{"StatusRequestHeaderFieldsTooLarge", Const, 6, ""},
+		{"StatusRequestTimeout", Const, 0, ""},
+		{"StatusRequestURITooLong", Const, 0, ""},
+		{"StatusRequestedRangeNotSatisfiable", Const, 0, ""},
+		{"StatusResetContent", Const, 0, ""},
+		{"StatusSeeOther", Const, 0, ""},
+		{"StatusServiceUnavailable", Const, 0, ""},
+		{"StatusSwitchingProtocols", Const, 0, ""},
+		{"StatusTeapot", Const, 0, ""},
+		{"StatusTemporaryRedirect", Const, 0, ""},
+		{"StatusText", Func, 0, "func(code int) string"},
+		{"StatusTooEarly", Const, 12, ""},
+		{"StatusTooManyRequests", Const, 6, ""},
+		{"StatusUnauthorized", Const, 0, ""},
+		{"StatusUnavailableForLegalReasons", Const, 6, ""},
+		{"StatusUnprocessableEntity", Const, 7, ""},
+		{"StatusUnsupportedMediaType", Const, 0, ""},
+		{"StatusUpgradeRequired", Const, 7, ""},
+		{"StatusUseProxy", Const, 0, ""},
+		{"StatusVariantAlsoNegotiates", Const, 7, ""},
+		{"StripPrefix", Func, 0, "func(prefix string, h Handler) Handler"},
+		{"TimeFormat", Const, 0, ""},
+		{"TimeoutHandler", Func, 0, "func(h Handler, dt time.Duration, msg string) Handler"},
+		{"TrailerPrefix", Const, 8, ""},
+		{"Transport", Type, 0, ""},
+		{"Transport.Dial", Field, 0, ""},
+		{"Transport.DialContext", Field, 7, ""},
+		{"Transport.DialTLS", Field, 4, ""},
+		{"Transport.DialTLSContext", Field, 14, ""},
+		{"Transport.DisableCompression", Field, 0, ""},
+		{"Transport.DisableKeepAlives", Field, 0, ""},
+		{"Transport.ExpectContinueTimeout", Field, 6, ""},
+		{"Transport.ForceAttemptHTTP2", Field, 13, ""},
+		{"Transport.GetProxyConnectHeader", Field, 16, ""},
+		{"Transport.HTTP2", Field, 24, ""},
+		{"Transport.IdleConnTimeout", Field, 7, ""},
+		{"Transport.MaxConnsPerHost", Field, 11, ""},
+		{"Transport.MaxIdleConns", Field, 7, ""},
+		{"Transport.MaxIdleConnsPerHost", Field, 0, ""},
+		{"Transport.MaxResponseHeaderBytes", Field, 7, ""},
+		{"Transport.OnProxyConnectResponse", Field, 20, ""},
+		{"Transport.Protocols", Field, 24, ""},
+		{"Transport.Proxy", Field, 0, ""},
+		{"Transport.ProxyConnectHeader", Field, 8, ""},
+		{"Transport.ReadBufferSize", Field, 13, ""},
+		{"Transport.ResponseHeaderTimeout", Field, 1, ""},
+		{"Transport.TLSClientConfig", Field, 0, ""},
+		{"Transport.TLSHandshakeTimeout", Field, 3, ""},
+		{"Transport.TLSNextProto", Field, 6, ""},
+		{"Transport.WriteBufferSize", Field, 13, ""},
+	},
+	"net/http/cgi": {
+		{"(*Handler).ServeHTTP", Method, 0, ""},
+		{"Handler", Type, 0, ""},
+		{"Handler.Args", Field, 0, ""},
+		{"Handler.Dir", Field, 0, ""},
+		{"Handler.Env", Field, 0, ""},
+		{"Handler.InheritEnv", Field, 0, ""},
+		{"Handler.Logger", Field, 0, ""},
+		{"Handler.Path", Field, 0, ""},
+		{"Handler.PathLocationHandler", Field, 0, ""},
+		{"Handler.Root", Field, 0, ""},
+		{"Handler.Stderr", Field, 7, ""},
+		{"Request", Func, 0, "func() (*http.Request, error)"},
+		{"RequestFromMap", Func, 0, "func(params map[string]string) (*http.Request, error)"},
+		{"Serve", Func, 0, "func(handler http.Handler) error"},
+	},
+	"net/http/cookiejar": {
+		{"(*Jar).Cookies", Method, 1, ""},
+		{"(*Jar).SetCookies", Method, 1, ""},
+		{"Jar", Type, 1, ""},
+		{"New", Func, 1, "func(o *Options) (*Jar, error)"},
+		{"Options", Type, 1, ""},
+		{"Options.PublicSuffixList", Field, 1, ""},
+		{"PublicSuffixList", Type, 1, ""},
+	},
+	"net/http/fcgi": {
+		{"ErrConnClosed", Var, 5, ""},
+		{"ErrRequestAborted", Var, 5, ""},
+		{"ProcessEnv", Func, 9, "func(r *http.Request) map[string]string"},
+		{"Serve", Func, 0, "func(l net.Listener, handler http.Handler) error"},
+	},
+	"net/http/httptest": {
+		{"(*ResponseRecorder).Flush", Method, 0, ""},
+		{"(*ResponseRecorder).Header", Method, 0, ""},
+		{"(*ResponseRecorder).Result", Method, 7, ""},
+		{"(*ResponseRecorder).Write", Method, 0, ""},
+		{"(*ResponseRecorder).WriteHeader", Method, 0, ""},
+		{"(*ResponseRecorder).WriteString", Method, 6, ""},
+		{"(*Server).Certificate", Method, 9, ""},
+		{"(*Server).Client", Method, 9, ""},
+		{"(*Server).Close", Method, 0, ""},
+		{"(*Server).CloseClientConnections", Method, 0, ""},
+		{"(*Server).Start", Method, 0, ""},
+		{"(*Server).StartTLS", Method, 0, ""},
+		{"DefaultRemoteAddr", Const, 0, ""},
+		{"NewRecorder", Func, 0, "func() *ResponseRecorder"},
+		{"NewRequest", Func, 7, "func(method string, target string, body io.Reader) *http.Request"},
+		{"NewRequestWithContext", Func, 23, "func(ctx context.Context, method string, target string, body io.Reader) *http.Request"},
+		{"NewServer", Func, 0, "func(handler http.Handler) *Server"},
+		{"NewTLSServer", Func, 0, "func(handler http.Handler) *Server"},
+		{"NewUnstartedServer", Func, 0, "func(handler http.Handler) *Server"},
+		{"ResponseRecorder", Type, 0, ""},
+		{"ResponseRecorder.Body", Field, 0, ""},
+		{"ResponseRecorder.Code", Field, 0, ""},
+		{"ResponseRecorder.Flushed", Field, 0, ""},
+		{"ResponseRecorder.HeaderMap", Field, 0, ""},
+		{"Server", Type, 0, ""},
+		{"Server.Config", Field, 0, ""},
+		{"Server.EnableHTTP2", Field, 14, ""},
+		{"Server.Listener", Field, 0, ""},
+		{"Server.TLS", Field, 0, ""},
+		{"Server.URL", Field, 0, ""},
+	},
+	"net/http/httptrace": {
+		{"ClientTrace", Type, 7, ""},
+		{"ClientTrace.ConnectDone", Field, 7, ""},
+		{"ClientTrace.ConnectStart", Field, 7, ""},
+		{"ClientTrace.DNSDone", Field, 7, ""},
+		{"ClientTrace.DNSStart", Field, 7, ""},
+		{"ClientTrace.GetConn", Field, 7, ""},
+		{"ClientTrace.Got100Continue", Field, 7, ""},
+		{"ClientTrace.Got1xxResponse", Field, 11, ""},
+		{"ClientTrace.GotConn", Field, 7, ""},
+		{"ClientTrace.GotFirstResponseByte", Field, 7, ""},
+		{"ClientTrace.PutIdleConn", Field, 7, ""},
+		{"ClientTrace.TLSHandshakeDone", Field, 8, ""},
+		{"ClientTrace.TLSHandshakeStart", Field, 8, ""},
+		{"ClientTrace.Wait100Continue", Field, 7, ""},
+		{"ClientTrace.WroteHeaderField", Field, 11, ""},
+		{"ClientTrace.WroteHeaders", Field, 7, ""},
+		{"ClientTrace.WroteRequest", Field, 7, ""},
+		{"ContextClientTrace", Func, 7, "func(ctx context.Context) *ClientTrace"},
+		{"DNSDoneInfo", Type, 7, ""},
+		{"DNSDoneInfo.Addrs", Field, 7, ""},
+		{"DNSDoneInfo.Coalesced", Field, 7, ""},
+		{"DNSDoneInfo.Err", Field, 7, ""},
+		{"DNSStartInfo", Type, 7, ""},
+		{"DNSStartInfo.Host", Field, 7, ""},
+		{"GotConnInfo", Type, 7, ""},
+		{"GotConnInfo.Conn", Field, 7, ""},
+		{"GotConnInfo.IdleTime", Field, 7, ""},
+		{"GotConnInfo.Reused", Field, 7, ""},
+		{"GotConnInfo.WasIdle", Field, 7, ""},
+		{"WithClientTrace", Func, 7, "func(ctx context.Context, trace *ClientTrace) context.Context"},
+		{"WroteRequestInfo", Type, 7, ""},
+		{"WroteRequestInfo.Err", Field, 7, ""},
+	},
+	"net/http/httputil": {
+		{"(*ClientConn).Close", Method, 0, ""},
+		{"(*ClientConn).Do", Method, 0, ""},
+		{"(*ClientConn).Hijack", Method, 0, ""},
+		{"(*ClientConn).Pending", Method, 0, ""},
+		{"(*ClientConn).Read", Method, 0, ""},
+		{"(*ClientConn).Write", Method, 0, ""},
+		{"(*ProxyRequest).SetURL", Method, 20, ""},
+		{"(*ProxyRequest).SetXForwarded", Method, 20, ""},
+		{"(*ReverseProxy).ServeHTTP", Method, 0, ""},
+		{"(*ServerConn).Close", Method, 0, ""},
+		{"(*ServerConn).Hijack", Method, 0, ""},
+		{"(*ServerConn).Pending", Method, 0, ""},
+		{"(*ServerConn).Read", Method, 0, ""},
+		{"(*ServerConn).Write", Method, 0, ""},
+		{"BufferPool", Type, 6, ""},
+		{"ClientConn", Type, 0, ""},
+		{"DumpRequest", Func, 0, "func(req *http.Request, body bool) ([]byte, error)"},
+		{"DumpRequestOut", Func, 0, "func(req *http.Request, body bool) ([]byte, error)"},
+		{"DumpResponse", Func, 0, "func(resp *http.Response, body bool) ([]byte, error)"},
+		{"ErrClosed", Var, 0, ""},
+		{"ErrLineTooLong", Var, 0, ""},
+		{"ErrPersistEOF", Var, 0, ""},
+		{"ErrPipeline", Var, 0, ""},
+		{"NewChunkedReader", Func, 0, "func(r io.Reader) io.Reader"},
+		{"NewChunkedWriter", Func, 0, "func(w io.Writer) io.WriteCloser"},
+		{"NewClientConn", Func, 0, "func(c net.Conn, r *bufio.Reader) *ClientConn"},
+		{"NewProxyClientConn", Func, 0, "func(c net.Conn, r *bufio.Reader) *ClientConn"},
+		{"NewServerConn", Func, 0, "func(c net.Conn, r *bufio.Reader) *ServerConn"},
+		{"NewSingleHostReverseProxy", Func, 0, "func(target *url.URL) *ReverseProxy"},
+		{"ProxyRequest", Type, 20, ""},
+		{"ProxyRequest.In", Field, 20, ""},
+		{"ProxyRequest.Out", Field, 20, ""},
+		{"ReverseProxy", Type, 0, ""},
+		{"ReverseProxy.BufferPool", Field, 6, ""},
+		{"ReverseProxy.Director", Field, 0, ""},
+		{"ReverseProxy.ErrorHandler", Field, 11, ""},
+		{"ReverseProxy.ErrorLog", Field, 4, ""},
+		{"ReverseProxy.FlushInterval", Field, 0, ""},
+		{"ReverseProxy.ModifyResponse", Field, 8, ""},
+		{"ReverseProxy.Rewrite", Field, 20, ""},
+		{"ReverseProxy.Transport", Field, 0, ""},
+		{"ServerConn", Type, 0, ""},
+	},
+	"net/http/pprof": {
+		{"Cmdline", Func, 0, "func(w http.ResponseWriter, r *http.Request)"},
+		{"Handler", Func, 0, "func(name string) http.Handler"},
+		{"Index", Func, 0, "func(w http.ResponseWriter, r *http.Request)"},
+		{"Profile", Func, 0, "func(w http.ResponseWriter, r *http.Request)"},
+		{"Symbol", Func, 0, "func(w http.ResponseWriter, r *http.Request)"},
+		{"Trace", Func, 5, "func(w http.ResponseWriter, r *http.Request)"},
+	},
+	"net/mail": {
+		{"(*Address).String", Method, 0, ""},
+		{"(*AddressParser).Parse", Method, 5, ""},
+		{"(*AddressParser).ParseList", Method, 5, ""},
+		{"(Header).AddressList", Method, 0, ""},
+		{"(Header).Date", Method, 0, ""},
+		{"(Header).Get", Method, 0, ""},
+		{"Address", Type, 0, ""},
+		{"Address.Address", Field, 0, ""},
+		{"Address.Name", Field, 0, ""},
+		{"AddressParser", Type, 5, ""},
+		{"AddressParser.WordDecoder", Field, 5, ""},
+		{"ErrHeaderNotPresent", Var, 0, ""},
+		{"Header", Type, 0, ""},
+		{"Message", Type, 0, ""},
+		{"Message.Body", Field, 0, ""},
+		{"Message.Header", Field, 0, ""},
+		{"ParseAddress", Func, 1, "func(address string) (*Address, error)"},
+		{"ParseAddressList", Func, 1, "func(list string) ([]*Address, error)"},
+		{"ParseDate", Func, 8, "func(date string) (time.Time, error)"},
+		{"ReadMessage", Func, 0, "func(r io.Reader) (msg *Message, err error)"},
+	},
+	"net/netip": {
+		{"(*Addr).UnmarshalBinary", Method, 18, ""},
+		{"(*Addr).UnmarshalText", Method, 18, ""},
+		{"(*AddrPort).UnmarshalBinary", Method, 18, ""},
+		{"(*AddrPort).UnmarshalText", Method, 18, ""},
+		{"(*Prefix).UnmarshalBinary", Method, 18, ""},
+		{"(*Prefix).UnmarshalText", Method, 18, ""},
+		{"(Addr).AppendBinary", Method, 24, ""},
+		{"(Addr).AppendText", Method, 24, ""},
+		{"(Addr).AppendTo", Method, 18, ""},
+		{"(Addr).As16", Method, 18, ""},
+		{"(Addr).As4", Method, 18, ""},
+		{"(Addr).AsSlice", Method, 18, ""},
+		{"(Addr).BitLen", Method, 18, ""},
+		{"(Addr).Compare", Method, 18, ""},
+		{"(Addr).Is4", Method, 18, ""},
+		{"(Addr).Is4In6", Method, 18, ""},
+		{"(Addr).Is6", Method, 18, ""},
+		{"(Addr).IsGlobalUnicast", Method, 18, ""},
+		{"(Addr).IsInterfaceLocalMulticast", Method, 18, ""},
+		{"(Addr).IsLinkLocalMulticast", Method, 18, ""},
+		{"(Addr).IsLinkLocalUnicast", Method, 18, ""},
+		{"(Addr).IsLoopback", Method, 18, ""},
+		{"(Addr).IsMulticast", Method, 18, ""},
+		{"(Addr).IsPrivate", Method, 18, ""},
+		{"(Addr).IsUnspecified", Method, 18, ""},
+		{"(Addr).IsValid", Method, 18, ""},
+		{"(Addr).Less", Method, 18, ""},
+		{"(Addr).MarshalBinary", Method, 18, ""},
+		{"(Addr).MarshalText", Method, 18, ""},
+		{"(Addr).Next", Method, 18, ""},
+		{"(Addr).Prefix", Method, 18, ""},
+		{"(Addr).Prev", Method, 18, ""},
+		{"(Addr).String", Method, 18, ""},
+		{"(Addr).StringExpanded", Method, 18, ""},
+		{"(Addr).Unmap", Method, 18, ""},
+		{"(Addr).WithZone", Method, 18, ""},
+		{"(Addr).Zone", Method, 18, ""},
+		{"(AddrPort).Addr", Method, 18, ""},
+		{"(AddrPort).AppendBinary", Method, 24, ""},
+		{"(AddrPort).AppendText", Method, 24, ""},
+		{"(AddrPort).AppendTo", Method, 18, ""},
+		{"(AddrPort).Compare", Method, 22, ""},
+		{"(AddrPort).IsValid", Method, 18, ""},
+		{"(AddrPort).MarshalBinary", Method, 18, ""},
+		{"(AddrPort).MarshalText", Method, 18, ""},
+		{"(AddrPort).Port", Method, 18, ""},
+		{"(AddrPort).String", Method, 18, ""},
+		{"(Prefix).Addr", Method, 18, ""},
+		{"(Prefix).AppendBinary", Method, 24, ""},
+		{"(Prefix).AppendText", Method, 24, ""},
+		{"(Prefix).AppendTo", Method, 18, ""},
+		{"(Prefix).Bits", Method, 18, ""},
+		{"(Prefix).Contains", Method, 18, ""},
+		{"(Prefix).IsSingleIP", Method, 18, ""},
+		{"(Prefix).IsValid", Method, 18, ""},
+		{"(Prefix).MarshalBinary", Method, 18, ""},
+		{"(Prefix).MarshalText", Method, 18, ""},
+		{"(Prefix).Masked", Method, 18, ""},
+		{"(Prefix).Overlaps", Method, 18, ""},
+		{"(Prefix).String", Method, 18, ""},
+		{"Addr", Type, 18, ""},
+		{"AddrFrom16", Func, 18, "func(addr [16]byte) Addr"},
+		{"AddrFrom4", Func, 18, "func(addr [4]byte) Addr"},
+		{"AddrFromSlice", Func, 18, "func(slice []byte) (ip Addr, ok bool)"},
+		{"AddrPort", Type, 18, ""},
+		{"AddrPortFrom", Func, 18, "func(ip Addr, port uint16) AddrPort"},
+		{"IPv4Unspecified", Func, 18, "func() Addr"},
+		{"IPv6LinkLocalAllNodes", Func, 18, "func() Addr"},
+		{"IPv6LinkLocalAllRouters", Func, 20, "func() Addr"},
+		{"IPv6Loopback", Func, 20, "func() Addr"},
+		{"IPv6Unspecified", Func, 18, "func() Addr"},
+		{"MustParseAddr", Func, 18, "func(s string) Addr"},
+		{"MustParseAddrPort", Func, 18, "func(s string) AddrPort"},
+		{"MustParsePrefix", Func, 18, "func(s string) Prefix"},
+		{"ParseAddr", Func, 18, "func(s string) (Addr, error)"},
+		{"ParseAddrPort", Func, 18, "func(s string) (AddrPort, error)"},
+		{"ParsePrefix", Func, 18, "func(s string) (Prefix, error)"},
+		{"Prefix", Type, 18, ""},
+		{"PrefixFrom", Func, 18, "func(ip Addr, bits int) Prefix"},
+	},
+	"net/rpc": {
+		{"(*Client).Call", Method, 0, ""},
+		{"(*Client).Close", Method, 0, ""},
+		{"(*Client).Go", Method, 0, ""},
+		{"(*Server).Accept", Method, 0, ""},
+		{"(*Server).HandleHTTP", Method, 0, ""},
+		{"(*Server).Register", Method, 0, ""},
+		{"(*Server).RegisterName", Method, 0, ""},
+		{"(*Server).ServeCodec", Method, 0, ""},
+		{"(*Server).ServeConn", Method, 0, ""},
+		{"(*Server).ServeHTTP", Method, 0, ""},
+		{"(*Server).ServeRequest", Method, 0, ""},
+		{"(ServerError).Error", Method, 0, ""},
+		{"Accept", Func, 0, "func(lis net.Listener)"},
+		{"Call", Type, 0, ""},
+		{"Call.Args", Field, 0, ""},
+		{"Call.Done", Field, 0, ""},
+		{"Call.Error", Field, 0, ""},
+		{"Call.Reply", Field, 0, ""},
+		{"Call.ServiceMethod", Field, 0, ""},
+		{"Client", Type, 0, ""},
+		{"ClientCodec", Type, 0, ""},
+		{"DefaultDebugPath", Const, 0, ""},
+		{"DefaultRPCPath", Const, 0, ""},
+		{"DefaultServer", Var, 0, ""},
+		{"Dial", Func, 0, "func(network string, address string) (*Client, error)"},
+		{"DialHTTP", Func, 0, "func(network string, address string) (*Client, error)"},
+		{"DialHTTPPath", Func, 0, "func(network string, address string, path string) (*Client, error)"},
+		{"ErrShutdown", Var, 0, ""},
+		{"HandleHTTP", Func, 0, "func()"},
+		{"NewClient", Func, 0, "func(conn io.ReadWriteCloser) *Client"},
+		{"NewClientWithCodec", Func, 0, "func(codec ClientCodec) *Client"},
+		{"NewServer", Func, 0, "func() *Server"},
+		{"Register", Func, 0, "func(rcvr any) error"},
+		{"RegisterName", Func, 0, "func(name string, rcvr any) error"},
+		{"Request", Type, 0, ""},
+		{"Request.Seq", Field, 0, ""},
+		{"Request.ServiceMethod", Field, 0, ""},
+		{"Response", Type, 0, ""},
+		{"Response.Error", Field, 0, ""},
+		{"Response.Seq", Field, 0, ""},
+		{"Response.ServiceMethod", Field, 0, ""},
+		{"ServeCodec", Func, 0, "func(codec ServerCodec)"},
+		{"ServeConn", Func, 0, "func(conn io.ReadWriteCloser)"},
+		{"ServeRequest", Func, 0, "func(codec ServerCodec) error"},
+		{"Server", Type, 0, ""},
+		{"ServerCodec", Type, 0, ""},
+		{"ServerError", Type, 0, ""},
+	},
+	"net/rpc/jsonrpc": {
+		{"Dial", Func, 0, "func(network string, address string) (*rpc.Client, error)"},
+		{"NewClient", Func, 0, "func(conn io.ReadWriteCloser) *rpc.Client"},
+		{"NewClientCodec", Func, 0, "func(conn io.ReadWriteCloser) rpc.ClientCodec"},
+		{"NewServerCodec", Func, 0, "func(conn io.ReadWriteCloser) rpc.ServerCodec"},
+		{"ServeConn", Func, 0, "func(conn io.ReadWriteCloser)"},
+	},
+	"net/smtp": {
+		{"(*Client).Auth", Method, 0, ""},
+		{"(*Client).Close", Method, 2, ""},
+		{"(*Client).Data", Method, 0, ""},
+		{"(*Client).Extension", Method, 0, ""},
+		{"(*Client).Hello", Method, 1, ""},
+		{"(*Client).Mail", Method, 0, ""},
+		{"(*Client).Noop", Method, 10, ""},
+		{"(*Client).Quit", Method, 0, ""},
+		{"(*Client).Rcpt", Method, 0, ""},
+		{"(*Client).Reset", Method, 0, ""},
+		{"(*Client).StartTLS", Method, 0, ""},
+		{"(*Client).TLSConnectionState", Method, 5, ""},
+		{"(*Client).Verify", Method, 0, ""},
+		{"Auth", Type, 0, ""},
+		{"CRAMMD5Auth", Func, 0, "func(username string, secret string) Auth"},
+		{"Client", Type, 0, ""},
+		{"Client.Text", Field, 0, ""},
+		{"Dial", Func, 0, "func(addr string) (*Client, error)"},
+		{"NewClient", Func, 0, "func(conn net.Conn, host string) (*Client, error)"},
+		{"PlainAuth", Func, 0, "func(identity string, username string, password string, host string) Auth"},
+		{"SendMail", Func, 0, "func(addr string, a Auth, from string, to []string, msg []byte) error"},
+		{"ServerInfo", Type, 0, ""},
+		{"ServerInfo.Auth", Field, 0, ""},
+		{"ServerInfo.Name", Field, 0, ""},
+		{"ServerInfo.TLS", Field, 0, ""},
+	},
+	"net/textproto": {
+		{"(*Conn).Close", Method, 0, ""},
+		{"(*Conn).Cmd", Method, 0, ""},
+		{"(*Conn).DotReader", Method, 0, ""},
+		{"(*Conn).DotWriter", Method, 0, ""},
+		{"(*Conn).EndRequest", Method, 0, ""},
+		{"(*Conn).EndResponse", Method, 0, ""},
+		{"(*Conn).Next", Method, 0, ""},
+		{"(*Conn).PrintfLine", Method, 0, ""},
+		{"(*Conn).ReadCodeLine", Method, 0, ""},
+		{"(*Conn).ReadContinuedLine", Method, 0, ""},
+		{"(*Conn).ReadContinuedLineBytes", Method, 0, ""},
+		{"(*Conn).ReadDotBytes", Method, 0, ""},
+		{"(*Conn).ReadDotLines", Method, 0, ""},
+		{"(*Conn).ReadLine", Method, 0, ""},
+		{"(*Conn).ReadLineBytes", Method, 0, ""},
+		{"(*Conn).ReadMIMEHeader", Method, 0, ""},
+		{"(*Conn).ReadResponse", Method, 0, ""},
+		{"(*Conn).StartRequest", Method, 0, ""},
+		{"(*Conn).StartResponse", Method, 0, ""},
+		{"(*Error).Error", Method, 0, ""},
+		{"(*Pipeline).EndRequest", Method, 0, ""},
+		{"(*Pipeline).EndResponse", Method, 0, ""},
+		{"(*Pipeline).Next", Method, 0, ""},
+		{"(*Pipeline).StartRequest", Method, 0, ""},
+		{"(*Pipeline).StartResponse", Method, 0, ""},
+		{"(*Reader).DotReader", Method, 0, ""},
+		{"(*Reader).ReadCodeLine", Method, 0, ""},
+		{"(*Reader).ReadContinuedLine", Method, 0, ""},
+		{"(*Reader).ReadContinuedLineBytes", Method, 0, ""},
+		{"(*Reader).ReadDotBytes", Method, 0, ""},
+		{"(*Reader).ReadDotLines", Method, 0, ""},
+		{"(*Reader).ReadLine", Method, 0, ""},
+		{"(*Reader).ReadLineBytes", Method, 0, ""},
+		{"(*Reader).ReadMIMEHeader", Method, 0, ""},
+		{"(*Reader).ReadResponse", Method, 0, ""},
+		{"(*Writer).DotWriter", Method, 0, ""},
+		{"(*Writer).PrintfLine", Method, 0, ""},
+		{"(MIMEHeader).Add", Method, 0, ""},
+		{"(MIMEHeader).Del", Method, 0, ""},
+		{"(MIMEHeader).Get", Method, 0, ""},
+		{"(MIMEHeader).Set", Method, 0, ""},
+		{"(MIMEHeader).Values", Method, 14, ""},
+		{"(ProtocolError).Error", Method, 0, ""},
+		{"CanonicalMIMEHeaderKey", Func, 0, "func(s string) string"},
+		{"Conn", Type, 0, ""},
+		{"Conn.Pipeline", Field, 0, ""},
+		{"Conn.Reader", Field, 0, ""},
+		{"Conn.Writer", Field, 0, ""},
+		{"Dial", Func, 0, "func(network string, addr string) (*Conn, error)"},
+		{"Error", Type, 0, ""},
+		{"Error.Code", Field, 0, ""},
+		{"Error.Msg", Field, 0, ""},
+		{"MIMEHeader", Type, 0, ""},
+		{"NewConn", Func, 0, "func(conn io.ReadWriteCloser) *Conn"},
+		{"NewReader", Func, 0, "func(r *bufio.Reader) *Reader"},
+		{"NewWriter", Func, 0, "func(w *bufio.Writer) *Writer"},
+		{"Pipeline", Type, 0, ""},
+		{"ProtocolError", Type, 0, ""},
+		{"Reader", Type, 0, ""},
+		{"Reader.R", Field, 0, ""},
+		{"TrimBytes", Func, 1, "func(b []byte) []byte"},
+		{"TrimString", Func, 1, "func(s string) string"},
+		{"Writer", Type, 0, ""},
+		{"Writer.W", Field, 0, ""},
+	},
+	"net/url": {
+		{"(*Error).Error", Method, 0, ""},
+		{"(*Error).Temporary", Method, 6, ""},
+		{"(*Error).Timeout", Method, 6, ""},
+		{"(*Error).Unwrap", Method, 13, ""},
+		{"(*URL).AppendBinary", Method, 24, ""},
+		{"(*URL).EscapedFragment", Method, 15, ""},
+		{"(*URL).EscapedPath", Method, 5, ""},
+		{"(*URL).Hostname", Method, 8, ""},
+		{"(*URL).IsAbs", Method, 0, ""},
+		{"(*URL).JoinPath", Method, 19, ""},
+		{"(*URL).MarshalBinary", Method, 8, ""},
+		{"(*URL).Parse", Method, 0, ""},
+		{"(*URL).Port", Method, 8, ""},
+		{"(*URL).Query", Method, 0, ""},
+		{"(*URL).Redacted", Method, 15, ""},
+		{"(*URL).RequestURI", Method, 0, ""},
+		{"(*URL).ResolveReference", Method, 0, ""},
+		{"(*URL).String", Method, 0, ""},
+		{"(*URL).UnmarshalBinary", Method, 8, ""},
+		{"(*Userinfo).Password", Method, 0, ""},
+		{"(*Userinfo).String", Method, 0, ""},
+		{"(*Userinfo).Username", Method, 0, ""},
+		{"(EscapeError).Error", Method, 0, ""},
+		{"(InvalidHostError).Error", Method, 6, ""},
+		{"(Values).Add", Method, 0, ""},
+		{"(Values).Del", Method, 0, ""},
+		{"(Values).Encode", Method, 0, ""},
+		{"(Values).Get", Method, 0, ""},
+		{"(Values).Has", Method, 17, ""},
+		{"(Values).Set", Method, 0, ""},
+		{"Error", Type, 0, ""},
+		{"Error.Err", Field, 0, ""},
+		{"Error.Op", Field, 0, ""},
+		{"Error.URL", Field, 0, ""},
+		{"EscapeError", Type, 0, ""},
+		{"InvalidHostError", Type, 6, ""},
+		{"JoinPath", Func, 19, "func(base string, elem ...string) (result string, err error)"},
+		{"Parse", Func, 0, "func(rawURL string) (*URL, error)"},
+		{"ParseQuery", Func, 0, "func(query string) (Values, error)"},
+		{"ParseRequestURI", Func, 0, "func(rawURL string) (*URL, error)"},
+		{"PathEscape", Func, 8, "func(s string) string"},
+		{"PathUnescape", Func, 8, "func(s string) (string, error)"},
+		{"QueryEscape", Func, 0, "func(s string) string"},
+		{"QueryUnescape", Func, 0, "func(s string) (string, error)"},
+		{"URL", Type, 0, ""},
+		{"URL.ForceQuery", Field, 7, ""},
+		{"URL.Fragment", Field, 0, ""},
+		{"URL.Host", Field, 0, ""},
+		{"URL.OmitHost", Field, 19, ""},
+		{"URL.Opaque", Field, 0, ""},
+		{"URL.Path", Field, 0, ""},
+		{"URL.RawFragment", Field, 15, ""},
+		{"URL.RawPath", Field, 5, ""},
+		{"URL.RawQuery", Field, 0, ""},
+		{"URL.Scheme", Field, 0, ""},
+		{"URL.User", Field, 0, ""},
+		{"User", Func, 0, "func(username string) *Userinfo"},
+		{"UserPassword", Func, 0, "func(username string, password string) *Userinfo"},
+		{"Userinfo", Type, 0, ""},
+		{"Values", Type, 0, ""},
+	},
+	"os": {
+		{"(*File).Chdir", Method, 0, ""},
+		{"(*File).Chmod", Method, 0, ""},
+		{"(*File).Chown", Method, 0, ""},
+		{"(*File).Close", Method, 0, ""},
+		{"(*File).Fd", Method, 0, ""},
+		{"(*File).Name", Method, 0, ""},
+		{"(*File).Read", Method, 0, ""},
+		{"(*File).ReadAt", Method, 0, ""},
+		{"(*File).ReadDir", Method, 16, ""},
+		{"(*File).ReadFrom", Method, 15, ""},
+		{"(*File).Readdir", Method, 0, ""},
+		{"(*File).Readdirnames", Method, 0, ""},
+		{"(*File).Seek", Method, 0, ""},
+		{"(*File).SetDeadline", Method, 10, ""},
+		{"(*File).SetReadDeadline", Method, 10, ""},
+		{"(*File).SetWriteDeadline", Method, 10, ""},
+		{"(*File).Stat", Method, 0, ""},
+		{"(*File).Sync", Method, 0, ""},
+		{"(*File).SyscallConn", Method, 12, ""},
+		{"(*File).Truncate", Method, 0, ""},
+		{"(*File).Write", Method, 0, ""},
+		{"(*File).WriteAt", Method, 0, ""},
+		{"(*File).WriteString", Method, 0, ""},
+		{"(*File).WriteTo", Method, 22, ""},
+		{"(*LinkError).Error", Method, 0, ""},
+		{"(*LinkError).Unwrap", Method, 13, ""},
+		{"(*PathError).Error", Method, 0, ""},
+		{"(*PathError).Timeout", Method, 10, ""},
+		{"(*PathError).Unwrap", Method, 13, ""},
+		{"(*Process).Kill", Method, 0, ""},
+		{"(*Process).Release", Method, 0, ""},
+		{"(*Process).Signal", Method, 0, ""},
+		{"(*Process).Wait", Method, 0, ""},
+		{"(*ProcessState).ExitCode", Method, 12, ""},
+		{"(*ProcessState).Exited", Method, 0, ""},
+		{"(*ProcessState).Pid", Method, 0, ""},
+		{"(*ProcessState).String", Method, 0, ""},
+		{"(*ProcessState).Success", Method, 0, ""},
+		{"(*ProcessState).Sys", Method, 0, ""},
+		{"(*ProcessState).SysUsage", Method, 0, ""},
+		{"(*ProcessState).SystemTime", Method, 0, ""},
+		{"(*ProcessState).UserTime", Method, 0, ""},
+		{"(*Root).Chmod", Method, 25, ""},
+		{"(*Root).Chown", Method, 25, ""},
+		{"(*Root).Chtimes", Method, 25, ""},
+		{"(*Root).Close", Method, 24, ""},
+		{"(*Root).Create", Method, 24, ""},
+		{"(*Root).FS", Method, 24, ""},
+		{"(*Root).Lchown", Method, 25, ""},
+		{"(*Root).Link", Method, 25, ""},
+		{"(*Root).Lstat", Method, 24, ""},
+		{"(*Root).Mkdir", Method, 24, ""},
+		{"(*Root).Name", Method, 24, ""},
+		{"(*Root).Open", Method, 24, ""},
+		{"(*Root).OpenFile", Method, 24, ""},
+		{"(*Root).OpenRoot", Method, 24, ""},
+		{"(*Root).Readlink", Method, 25, ""},
+		{"(*Root).Remove", Method, 24, ""},
+		{"(*Root).Rename", Method, 25, ""},
+		{"(*Root).Stat", Method, 24, ""},
+		{"(*Root).Symlink", Method, 25, ""},
+		{"(*SyscallError).Error", Method, 0, ""},
+		{"(*SyscallError).Timeout", Method, 10, ""},
+		{"(*SyscallError).Unwrap", Method, 13, ""},
+		{"(FileMode).IsDir", Method, 0, ""},
+		{"(FileMode).IsRegular", Method, 1, ""},
+		{"(FileMode).Perm", Method, 0, ""},
+		{"(FileMode).String", Method, 0, ""},
+		{"Args", Var, 0, ""},
+		{"Chdir", Func, 0, "func(dir string) error"},
+		{"Chmod", Func, 0, "func(name string, mode FileMode) error"},
+		{"Chown", Func, 0, "func(name string, uid int, gid int) error"},
+		{"Chtimes", Func, 0, "func(name string, atime time.Time, mtime time.Time) error"},
+		{"Clearenv", Func, 0, "func()"},
+		{"CopyFS", Func, 23, "func(dir string, fsys fs.FS) error"},
+		{"Create", Func, 0, "func(name string) (*File, error)"},
+		{"CreateTemp", Func, 16, "func(dir string, pattern string) (*File, error)"},
+		{"DevNull", Const, 0, ""},
+		{"DirEntry", Type, 16, ""},
+		{"DirFS", Func, 16, "func(dir string) fs.FS"},
+		{"Environ", Func, 0, "func() []string"},
+		{"ErrClosed", Var, 8, ""},
+		{"ErrDeadlineExceeded", Var, 15, ""},
+		{"ErrExist", Var, 0, ""},
+		{"ErrInvalid", Var, 0, ""},
+		{"ErrNoDeadline", Var, 10, ""},
+		{"ErrNotExist", Var, 0, ""},
+		{"ErrPermission", Var, 0, ""},
+		{"ErrProcessDone", Var, 16, ""},
+		{"Executable", Func, 8, "func() (string, error)"},
+		{"Exit", Func, 0, "func(code int)"},
+		{"Expand", Func, 0, "func(s string, mapping func(string) string) string"},
+		{"ExpandEnv", Func, 0, "func(s string) string"},
+		{"File", Type, 0, ""},
+		{"FileInfo", Type, 0, ""},
+		{"FileMode", Type, 0, ""},
+		{"FindProcess", Func, 0, "func(pid int) (*Process, error)"},
+		{"Getegid", Func, 0, "func() int"},
+		{"Getenv", Func, 0, "func(key string) string"},
+		{"Geteuid", Func, 0, "func() int"},
+		{"Getgid", Func, 0, "func() int"},
+		{"Getgroups", Func, 0, "func() ([]int, error)"},
+		{"Getpagesize", Func, 0, "func() int"},
+		{"Getpid", Func, 0, "func() int"},
+		{"Getppid", Func, 0, "func() int"},
+		{"Getuid", Func, 0, "func() int"},
+		{"Getwd", Func, 0, "func() (dir string, err error)"},
+		{"Hostname", Func, 0, "func() (name string, err error)"},
+		{"Interrupt", Var, 0, ""},
+		{"IsExist", Func, 0, "func(err error) bool"},
+		{"IsNotExist", Func, 0, "func(err error) bool"},
+		{"IsPathSeparator", Func, 0, "func(c uint8) bool"},
+		{"IsPermission", Func, 0, "func(err error) bool"},
+		{"IsTimeout", Func, 10, "func(err error) bool"},
+		{"Kill", Var, 0, ""},
+		{"Lchown", Func, 0, "func(name string, uid int, gid int) error"},
+		{"Link", Func, 0, "func(oldname string, newname string) error"},
+		{"LinkError", Type, 0, ""},
+		{"LinkError.Err", Field, 0, ""},
+		{"LinkError.New", Field, 0, ""},
+		{"LinkError.Old", Field, 0, ""},
+		{"LinkError.Op", Field, 0, ""},
+		{"LookupEnv", Func, 5, "func(key string) (string, bool)"},
+		{"Lstat", Func, 0, "func(name string) (FileInfo, error)"},
+		{"Mkdir", Func, 0, "func(name string, perm FileMode) error"},
+		{"MkdirAll", Func, 0, "func(path string, perm FileMode) error"},
+		{"MkdirTemp", Func, 16, "func(dir string, pattern string) (string, error)"},
+		{"ModeAppend", Const, 0, ""},
+		{"ModeCharDevice", Const, 0, ""},
+		{"ModeDevice", Const, 0, ""},
+		{"ModeDir", Const, 0, ""},
+		{"ModeExclusive", Const, 0, ""},
+		{"ModeIrregular", Const, 11, ""},
+		{"ModeNamedPipe", Const, 0, ""},
+		{"ModePerm", Const, 0, ""},
+		{"ModeSetgid", Const, 0, ""},
+		{"ModeSetuid", Const, 0, ""},
+		{"ModeSocket", Const, 0, ""},
+		{"ModeSticky", Const, 0, ""},
+		{"ModeSymlink", Const, 0, ""},
+		{"ModeTemporary", Const, 0, ""},
+		{"ModeType", Const, 0, ""},
+		{"NewFile", Func, 0, "func(fd uintptr, name string) *File"},
+		{"NewSyscallError", Func, 0, "func(syscall string, err error) error"},
+		{"O_APPEND", Const, 0, ""},
+		{"O_CREATE", Const, 0, ""},
+		{"O_EXCL", Const, 0, ""},
+		{"O_RDONLY", Const, 0, ""},
+		{"O_RDWR", Const, 0, ""},
+		{"O_SYNC", Const, 0, ""},
+		{"O_TRUNC", Const, 0, ""},
+		{"O_WRONLY", Const, 0, ""},
+		{"Open", Func, 0, "func(name string) (*File, error)"},
+		{"OpenFile", Func, 0, "func(name string, flag int, perm FileMode) (*File, error)"},
+		{"OpenInRoot", Func, 24, "func(dir string, name string) (*File, error)"},
+		{"OpenRoot", Func, 24, "func(name string) (*Root, error)"},
+		{"PathError", Type, 0, ""},
+		{"PathError.Err", Field, 0, ""},
+		{"PathError.Op", Field, 0, ""},
+		{"PathError.Path", Field, 0, ""},
+		{"PathListSeparator", Const, 0, ""},
+		{"PathSeparator", Const, 0, ""},
+		{"Pipe", Func, 0, "func() (r *File, w *File, err error)"},
+		{"ProcAttr", Type, 0, ""},
+		{"ProcAttr.Dir", Field, 0, ""},
+		{"ProcAttr.Env", Field, 0, ""},
+		{"ProcAttr.Files", Field, 0, ""},
+		{"ProcAttr.Sys", Field, 0, ""},
+		{"Process", Type, 0, ""},
+		{"Process.Pid", Field, 0, ""},
+		{"ProcessState", Type, 0, ""},
+		{"ReadDir", Func, 16, "func(name string) ([]DirEntry, error)"},
+		{"ReadFile", Func, 16, "func(name string) ([]byte, error)"},
+		{"Readlink", Func, 0, "func(name string) (string, error)"},
+		{"Remove", Func, 0, "func(name string) error"},
+		{"RemoveAll", Func, 0, "func(path string) error"},
+		{"Rename", Func, 0, "func(oldpath string, newpath string) error"},
+		{"Root", Type, 24, ""},
+		{"SEEK_CUR", Const, 0, ""},
+		{"SEEK_END", Const, 0, ""},
+		{"SEEK_SET", Const, 0, ""},
+		{"SameFile", Func, 0, "func(fi1 FileInfo, fi2 FileInfo) bool"},
+		{"Setenv", Func, 0, "func(key string, value string) error"},
+		{"Signal", Type, 0, ""},
+		{"StartProcess", Func, 0, "func(name string, argv []string, attr *ProcAttr) (*Process, error)"},
+		{"Stat", Func, 0, "func(name string) (FileInfo, error)"},
+		{"Stderr", Var, 0, ""},
+		{"Stdin", Var, 0, ""},
+		{"Stdout", Var, 0, ""},
+		{"Symlink", Func, 0, "func(oldname string, newname string) error"},
+		{"SyscallError", Type, 0, ""},
+		{"SyscallError.Err", Field, 0, ""},
+		{"SyscallError.Syscall", Field, 0, ""},
+		{"TempDir", Func, 0, "func() string"},
+		{"Truncate", Func, 0, "func(name string, size int64) error"},
+		{"Unsetenv", Func, 4, "func(key string) error"},
+		{"UserCacheDir", Func, 11, "func() (string, error)"},
+		{"UserConfigDir", Func, 13, "func() (string, error)"},
+		{"UserHomeDir", Func, 12, "func() (string, error)"},
+		{"WriteFile", Func, 16, "func(name string, data []byte, perm FileMode) error"},
+	},
+	"os/exec": {
+		{"(*Cmd).CombinedOutput", Method, 0, ""},
+		{"(*Cmd).Environ", Method, 19, ""},
+		{"(*Cmd).Output", Method, 0, ""},
+		{"(*Cmd).Run", Method, 0, ""},
+		{"(*Cmd).Start", Method, 0, ""},
+		{"(*Cmd).StderrPipe", Method, 0, ""},
+		{"(*Cmd).StdinPipe", Method, 0, ""},
+		{"(*Cmd).StdoutPipe", Method, 0, ""},
+		{"(*Cmd).String", Method, 13, ""},
+		{"(*Cmd).Wait", Method, 0, ""},
+		{"(*Error).Error", Method, 0, ""},
+		{"(*Error).Unwrap", Method, 13, ""},
+		{"(*ExitError).Error", Method, 0, ""},
+		{"(ExitError).ExitCode", Method, 12, ""},
+		{"(ExitError).Exited", Method, 0, ""},
+		{"(ExitError).Pid", Method, 0, ""},
+		{"(ExitError).String", Method, 0, ""},
+		{"(ExitError).Success", Method, 0, ""},
+		{"(ExitError).Sys", Method, 0, ""},
+		{"(ExitError).SysUsage", Method, 0, ""},
+		{"(ExitError).SystemTime", Method, 0, ""},
+		{"(ExitError).UserTime", Method, 0, ""},
+		{"Cmd", Type, 0, ""},
+		{"Cmd.Args", Field, 0, ""},
+		{"Cmd.Cancel", Field, 20, ""},
+		{"Cmd.Dir", Field, 0, ""},
+		{"Cmd.Env", Field, 0, ""},
+		{"Cmd.Err", Field, 19, ""},
+		{"Cmd.ExtraFiles", Field, 0, ""},
+		{"Cmd.Path", Field, 0, ""},
+		{"Cmd.Process", Field, 0, ""},
+		{"Cmd.ProcessState", Field, 0, ""},
+		{"Cmd.Stderr", Field, 0, ""},
+		{"Cmd.Stdin", Field, 0, ""},
+		{"Cmd.Stdout", Field, 0, ""},
+		{"Cmd.SysProcAttr", Field, 0, ""},
+		{"Cmd.WaitDelay", Field, 20, ""},
+		{"Command", Func, 0, "func(name string, arg ...string) *Cmd"},
+		{"CommandContext", Func, 7, "func(ctx context.Context, name string, arg ...string) *Cmd"},
+		{"ErrDot", Var, 19, ""},
+		{"ErrNotFound", Var, 0, ""},
+		{"ErrWaitDelay", Var, 20, ""},
+		{"Error", Type, 0, ""},
+		{"Error.Err", Field, 0, ""},
+		{"Error.Name", Field, 0, ""},
+		{"ExitError", Type, 0, ""},
+		{"ExitError.ProcessState", Field, 0, ""},
+		{"ExitError.Stderr", Field, 6, ""},
+		{"LookPath", Func, 0, "func(file string) (string, error)"},
+	},
+	"os/signal": {
+		{"Ignore", Func, 5, "func(sig ...os.Signal)"},
+		{"Ignored", Func, 11, "func(sig os.Signal) bool"},
+		{"Notify", Func, 0, "func(c chan<- os.Signal, sig ...os.Signal)"},
+		{"NotifyContext", Func, 16, "func(parent context.Context, signals ...os.Signal) (ctx context.Context, stop context.CancelFunc)"},
+		{"Reset", Func, 5, "func(sig ...os.Signal)"},
+		{"Stop", Func, 1, "func(c chan<- os.Signal)"},
+	},
+	"os/user": {
+		{"(*User).GroupIds", Method, 7, ""},
+		{"(UnknownGroupError).Error", Method, 7, ""},
+		{"(UnknownGroupIdError).Error", Method, 7, ""},
+		{"(UnknownUserError).Error", Method, 0, ""},
+		{"(UnknownUserIdError).Error", Method, 0, ""},
+		{"Current", Func, 0, "func() (*User, error)"},
+		{"Group", Type, 7, ""},
+		{"Group.Gid", Field, 7, ""},
+		{"Group.Name", Field, 7, ""},
+		{"Lookup", Func, 0, "func(username string) (*User, error)"},
+		{"LookupGroup", Func, 7, "func(name string) (*Group, error)"},
+		{"LookupGroupId", Func, 7, "func(gid string) (*Group, error)"},
+		{"LookupId", Func, 0, "func(uid string) (*User, error)"},
+		{"UnknownGroupError", Type, 7, ""},
+		{"UnknownGroupIdError", Type, 7, ""},
+		{"UnknownUserError", Type, 0, ""},
+		{"UnknownUserIdError", Type, 0, ""},
+		{"User", Type, 0, ""},
+		{"User.Gid", Field, 0, ""},
+		{"User.HomeDir", Field, 0, ""},
+		{"User.Name", Field, 0, ""},
+		{"User.Uid", Field, 0, ""},
+		{"User.Username", Field, 0, ""},
+	},
+	"path": {
+		{"Base", Func, 0, "func(path string) string"},
+		{"Clean", Func, 0, "func(path string) string"},
+		{"Dir", Func, 0, "func(path string) string"},
+		{"ErrBadPattern", Var, 0, ""},
+		{"Ext", Func, 0, "func(path string) string"},
+		{"IsAbs", Func, 0, "func(path string) bool"},
+		{"Join", Func, 0, "func(elem ...string) string"},
+		{"Match", Func, 0, "func(pattern string, name string) (matched bool, err error)"},
+		{"Split", Func, 0, "func(path string) (dir string, file string)"},
+	},
+	"path/filepath": {
+		{"Abs", Func, 0, "func(path string) (string, error)"},
+		{"Base", Func, 0, "func(path string) string"},
+		{"Clean", Func, 0, "func(path string) string"},
+		{"Dir", Func, 0, "func(path string) string"},
+		{"ErrBadPattern", Var, 0, ""},
+		{"EvalSymlinks", Func, 0, "func(path string) (string, error)"},
+		{"Ext", Func, 0, "func(path string) string"},
+		{"FromSlash", Func, 0, "func(path string) string"},
+		{"Glob", Func, 0, "func(pattern string) (matches []string, err error)"},
+		{"HasPrefix", Func, 0, "func(p string, prefix string) bool"},
+		{"IsAbs", Func, 0, "func(path string) bool"},
+		{"IsLocal", Func, 20, "func(path string) bool"},
+		{"Join", Func, 0, "func(elem ...string) string"},
+		{"ListSeparator", Const, 0, ""},
+		{"Localize", Func, 23, "func(path string) (string, error)"},
+		{"Match", Func, 0, "func(pattern string, name string) (matched bool, err error)"},
+		{"Rel", Func, 0, "func(basepath string, targpath string) (string, error)"},
+		{"Separator", Const, 0, ""},
+		{"SkipAll", Var, 20, ""},
+		{"SkipDir", Var, 0, ""},
+		{"Split", Func, 0, "func(path string) (dir string, file string)"},
+		{"SplitList", Func, 0, "func(path string) []string"},
+		{"ToSlash", Func, 0, "func(path string) string"},
+		{"VolumeName", Func, 0, "func(path string) string"},
+		{"Walk", Func, 0, "func(root string, fn WalkFunc) error"},
+		{"WalkDir", Func, 16, "func(root string, fn fs.WalkDirFunc) error"},
+		{"WalkFunc", Type, 0, ""},
+	},
+	"plugin": {
+		{"(*Plugin).Lookup", Method, 8, ""},
+		{"Open", Func, 8, "func(path string) (*Plugin, error)"},
+		{"Plugin", Type, 8, ""},
+		{"Symbol", Type, 8, ""},
+	},
+	"reflect": {
+		{"(*MapIter).Key", Method, 12, ""},
+		{"(*MapIter).Next", Method, 12, ""},
+		{"(*MapIter).Reset", Method, 18, ""},
+		{"(*MapIter).Value", Method, 12, ""},
+		{"(*ValueError).Error", Method, 0, ""},
+		{"(ChanDir).String", Method, 0, ""},
+		{"(Kind).String", Method, 0, ""},
+		{"(Method).IsExported", Method, 17, ""},
+		{"(StructField).IsExported", Method, 17, ""},
+		{"(StructTag).Get", Method, 0, ""},
+		{"(StructTag).Lookup", Method, 7, ""},
+		{"(Value).Addr", Method, 0, ""},
+		{"(Value).Bool", Method, 0, ""},
+		{"(Value).Bytes", Method, 0, ""},
+		{"(Value).Call", Method, 0, ""},
+		{"(Value).CallSlice", Method, 0, ""},
+		{"(Value).CanAddr", Method, 0, ""},
+		{"(Value).CanComplex", Method, 18, ""},
+		{"(Value).CanConvert", Method, 17, ""},
+		{"(Value).CanFloat", Method, 18, ""},
+		{"(Value).CanInt", Method, 18, ""},
+		{"(Value).CanInterface", Method, 0, ""},
+		{"(Value).CanSet", Method, 0, ""},
+		{"(Value).CanUint", Method, 18, ""},
+		{"(Value).Cap", Method, 0, ""},
+		{"(Value).Clear", Method, 21, ""},
+		{"(Value).Close", Method, 0, ""},
+		{"(Value).Comparable", Method, 20, ""},
+		{"(Value).Complex", Method, 0, ""},
+		{"(Value).Convert", Method, 1, ""},
+		{"(Value).Elem", Method, 0, ""},
+		{"(Value).Equal", Method, 20, ""},
+		{"(Value).Field", Method, 0, ""},
+		{"(Value).FieldByIndex", Method, 0, ""},
+		{"(Value).FieldByIndexErr", Method, 18, ""},
+		{"(Value).FieldByName", Method, 0, ""},
+		{"(Value).FieldByNameFunc", Method, 0, ""},
+		{"(Value).Float", Method, 0, ""},
+		{"(Value).Grow", Method, 20, ""},
+		{"(Value).Index", Method, 0, ""},
+		{"(Value).Int", Method, 0, ""},
+		{"(Value).Interface", Method, 0, ""},
+		{"(Value).InterfaceData", Method, 0, ""},
+		{"(Value).IsNil", Method, 0, ""},
+		{"(Value).IsValid", Method, 0, ""},
+		{"(Value).IsZero", Method, 13, ""},
+		{"(Value).Kind", Method, 0, ""},
+		{"(Value).Len", Method, 0, ""},
+		{"(Value).MapIndex", Method, 0, ""},
+		{"(Value).MapKeys", Method, 0, ""},
+		{"(Value).MapRange", Method, 12, ""},
+		{"(Value).Method", Method, 0, ""},
+		{"(Value).MethodByName", Method, 0, ""},
+		{"(Value).NumField", Method, 0, ""},
+		{"(Value).NumMethod", Method, 0, ""},
+		{"(Value).OverflowComplex", Method, 0, ""},
+		{"(Value).OverflowFloat", Method, 0, ""},
+		{"(Value).OverflowInt", Method, 0, ""},
+		{"(Value).OverflowUint", Method, 0, ""},
+		{"(Value).Pointer", Method, 0, ""},
+		{"(Value).Recv", Method, 0, ""},
+		{"(Value).Send", Method, 0, ""},
+		{"(Value).Seq", Method, 23, ""},
+		{"(Value).Seq2", Method, 23, ""},
+		{"(Value).Set", Method, 0, ""},
+		{"(Value).SetBool", Method, 0, ""},
+		{"(Value).SetBytes", Method, 0, ""},
+		{"(Value).SetCap", Method, 2, ""},
+		{"(Value).SetComplex", Method, 0, ""},
+		{"(Value).SetFloat", Method, 0, ""},
+		{"(Value).SetInt", Method, 0, ""},
+		{"(Value).SetIterKey", Method, 18, ""},
+		{"(Value).SetIterValue", Method, 18, ""},
+		{"(Value).SetLen", Method, 0, ""},
+		{"(Value).SetMapIndex", Method, 0, ""},
+		{"(Value).SetPointer", Method, 0, ""},
+		{"(Value).SetString", Method, 0, ""},
+		{"(Value).SetUint", Method, 0, ""},
+		{"(Value).SetZero", Method, 20, ""},
+		{"(Value).Slice", Method, 0, ""},
+		{"(Value).Slice3", Method, 2, ""},
+		{"(Value).String", Method, 0, ""},
+		{"(Value).TryRecv", Method, 0, ""},
+		{"(Value).TrySend", Method, 0, ""},
+		{"(Value).Type", Method, 0, ""},
+		{"(Value).Uint", Method, 0, ""},
+		{"(Value).UnsafeAddr", Method, 0, ""},
+		{"(Value).UnsafePointer", Method, 18, ""},
+		{"Append", Func, 0, "func(s Value, x ...Value) Value"},
+		{"AppendSlice", Func, 0, "func(s Value, t Value) Value"},
+		{"Array", Const, 0, ""},
+		{"ArrayOf", Func, 5, "func(length int, elem Type) Type"},
+		{"Bool", Const, 0, ""},
+		{"BothDir", Const, 0, ""},
+		{"Chan", Const, 0, ""},
+		{"ChanDir", Type, 0, ""},
+		{"ChanOf", Func, 1, "func(dir ChanDir, t Type) Type"},
+		{"Complex128", Const, 0, ""},
+		{"Complex64", Const, 0, ""},
+		{"Copy", Func, 0, "func(dst Value, src Value) int"},
+		{"DeepEqual", Func, 0, "func(x any, y any) bool"},
+		{"Float32", Const, 0, ""},
+		{"Float64", Const, 0, ""},
+		{"Func", Const, 0, ""},
+		{"FuncOf", Func, 5, "func(in []Type, out []Type, variadic bool) Type"},
+		{"Indirect", Func, 0, "func(v Value) Value"},
+		{"Int", Const, 0, ""},
+		{"Int16", Const, 0, ""},
+		{"Int32", Const, 0, ""},
+		{"Int64", Const, 0, ""},
+		{"Int8", Const, 0, ""},
+		{"Interface", Const, 0, ""},
+		{"Invalid", Const, 0, ""},
+		{"Kind", Type, 0, ""},
+		{"MakeChan", Func, 0, "func(typ Type, buffer int) Value"},
+		{"MakeFunc", Func, 1, "func(typ Type, fn func(args []Value) (results []Value)) Value"},
+		{"MakeMap", Func, 0, "func(typ Type) Value"},
+		{"MakeMapWithSize", Func, 9, "func(typ Type, n int) Value"},
+		{"MakeSlice", Func, 0, "func(typ Type, len int, cap int) Value"},
+		{"Map", Const, 0, ""},
+		{"MapIter", Type, 12, ""},
+		{"MapOf", Func, 1, "func(key Type, elem Type) Type"},
+		{"Method", Type, 0, ""},
+		{"Method.Func", Field, 0, ""},
+		{"Method.Index", Field, 0, ""},
+		{"Method.Name", Field, 0, ""},
+		{"Method.PkgPath", Field, 0, ""},
+		{"Method.Type", Field, 0, ""},
+		{"New", Func, 0, "func(typ Type) Value"},
+		{"NewAt", Func, 0, "func(typ Type, p unsafe.Pointer) Value"},
+		{"Pointer", Const, 18, ""},
+		{"PointerTo", Func, 18, "func(t Type) Type"},
+		{"Ptr", Const, 0, ""},
+		{"PtrTo", Func, 0, "func(t Type) Type"},
+		{"RecvDir", Const, 0, ""},
+		{"Select", Func, 1, "func(cases []SelectCase) (chosen int, recv Value, recvOK bool)"},
+		{"SelectCase", Type, 1, ""},
+		{"SelectCase.Chan", Field, 1, ""},
+		{"SelectCase.Dir", Field, 1, ""},
+		{"SelectCase.Send", Field, 1, ""},
+		{"SelectDefault", Const, 1, ""},
+		{"SelectDir", Type, 1, ""},
+		{"SelectRecv", Const, 1, ""},
+		{"SelectSend", Const, 1, ""},
+		{"SendDir", Const, 0, ""},
+		{"Slice", Const, 0, ""},
+		{"SliceAt", Func, 23, "func(typ Type, p unsafe.Pointer, n int) Value"},
+		{"SliceHeader", Type, 0, ""},
+		{"SliceHeader.Cap", Field, 0, ""},
+		{"SliceHeader.Data", Field, 0, ""},
+		{"SliceHeader.Len", Field, 0, ""},
+		{"SliceOf", Func, 1, "func(t Type) Type"},
+		{"String", Const, 0, ""},
+		{"StringHeader", Type, 0, ""},
+		{"StringHeader.Data", Field, 0, ""},
+		{"StringHeader.Len", Field, 0, ""},
+		{"Struct", Const, 0, ""},
+		{"StructField", Type, 0, ""},
+		{"StructField.Anonymous", Field, 0, ""},
+		{"StructField.Index", Field, 0, ""},
+		{"StructField.Name", Field, 0, ""},
+		{"StructField.Offset", Field, 0, ""},
+		{"StructField.PkgPath", Field, 0, ""},
+		{"StructField.Tag", Field, 0, ""},
+		{"StructField.Type", Field, 0, ""},
+		{"StructOf", Func, 7, "func(fields []StructField) Type"},
+		{"StructTag", Type, 0, ""},
+		{"Swapper", Func, 8, "func(slice any) func(i int, j int)"},
+		{"Type", Type, 0, ""},
+		{"TypeFor", Func, 22, "func[T any]() Type"},
+		{"TypeOf", Func, 0, "func(i any) Type"},
+		{"Uint", Const, 0, ""},
+		{"Uint16", Const, 0, ""},
+		{"Uint32", Const, 0, ""},
+		{"Uint64", Const, 0, ""},
+		{"Uint8", Const, 0, ""},
+		{"Uintptr", Const, 0, ""},
+		{"UnsafePointer", Const, 0, ""},
+		{"Value", Type, 0, ""},
+		{"ValueError", Type, 0, ""},
+		{"ValueError.Kind", Field, 0, ""},
+		{"ValueError.Method", Field, 0, ""},
+		{"ValueOf", Func, 0, "func(i any) Value"},
+		{"VisibleFields", Func, 17, "func(t Type) []StructField"},
+		{"Zero", Func, 0, "func(typ Type) Value"},
+	},
+	"regexp": {
+		{"(*Regexp).AppendText", Method, 24, ""},
+		{"(*Regexp).Copy", Method, 6, ""},
+		{"(*Regexp).Expand", Method, 0, ""},
+		{"(*Regexp).ExpandString", Method, 0, ""},
+		{"(*Regexp).Find", Method, 0, ""},
+		{"(*Regexp).FindAll", Method, 0, ""},
+		{"(*Regexp).FindAllIndex", Method, 0, ""},
+		{"(*Regexp).FindAllString", Method, 0, ""},
+		{"(*Regexp).FindAllStringIndex", Method, 0, ""},
+		{"(*Regexp).FindAllStringSubmatch", Method, 0, ""},
+		{"(*Regexp).FindAllStringSubmatchIndex", Method, 0, ""},
+		{"(*Regexp).FindAllSubmatch", Method, 0, ""},
+		{"(*Regexp).FindAllSubmatchIndex", Method, 0, ""},
+		{"(*Regexp).FindIndex", Method, 0, ""},
+		{"(*Regexp).FindReaderIndex", Method, 0, ""},
+		{"(*Regexp).FindReaderSubmatchIndex", Method, 0, ""},
+		{"(*Regexp).FindString", Method, 0, ""},
+		{"(*Regexp).FindStringIndex", Method, 0, ""},
+		{"(*Regexp).FindStringSubmatch", Method, 0, ""},
+		{"(*Regexp).FindStringSubmatchIndex", Method, 0, ""},
+		{"(*Regexp).FindSubmatch", Method, 0, ""},
+		{"(*Regexp).FindSubmatchIndex", Method, 0, ""},
+		{"(*Regexp).LiteralPrefix", Method, 0, ""},
+		{"(*Regexp).Longest", Method, 1, ""},
+		{"(*Regexp).MarshalText", Method, 21, ""},
+		{"(*Regexp).Match", Method, 0, ""},
+		{"(*Regexp).MatchReader", Method, 0, ""},
+		{"(*Regexp).MatchString", Method, 0, ""},
+		{"(*Regexp).NumSubexp", Method, 0, ""},
+		{"(*Regexp).ReplaceAll", Method, 0, ""},
+		{"(*Regexp).ReplaceAllFunc", Method, 0, ""},
+		{"(*Regexp).ReplaceAllLiteral", Method, 0, ""},
+		{"(*Regexp).ReplaceAllLiteralString", Method, 0, ""},
+		{"(*Regexp).ReplaceAllString", Method, 0, ""},
+		{"(*Regexp).ReplaceAllStringFunc", Method, 0, ""},
+		{"(*Regexp).Split", Method, 1, ""},
+		{"(*Regexp).String", Method, 0, ""},
+		{"(*Regexp).SubexpIndex", Method, 15, ""},
+		{"(*Regexp).SubexpNames", Method, 0, ""},
+		{"(*Regexp).UnmarshalText", Method, 21, ""},
+		{"Compile", Func, 0, "func(expr string) (*Regexp, error)"},
+		{"CompilePOSIX", Func, 0, "func(expr string) (*Regexp, error)"},
+		{"Match", Func, 0, "func(pattern string, b []byte) (matched bool, err error)"},
+		{"MatchReader", Func, 0, "func(pattern string, r io.RuneReader) (matched bool, err error)"},
+		{"MatchString", Func, 0, "func(pattern string, s string) (matched bool, err error)"},
+		{"MustCompile", Func, 0, "func(str string) *Regexp"},
+		{"MustCompilePOSIX", Func, 0, "func(str string) *Regexp"},
+		{"QuoteMeta", Func, 0, "func(s string) string"},
+		{"Regexp", Type, 0, ""},
+	},
+	"regexp/syntax": {
+		{"(*Error).Error", Method, 0, ""},
+		{"(*Inst).MatchEmptyWidth", Method, 0, ""},
+		{"(*Inst).MatchRune", Method, 0, ""},
+		{"(*Inst).MatchRunePos", Method, 3, ""},
+		{"(*Inst).String", Method, 0, ""},
+		{"(*Prog).Prefix", Method, 0, ""},
+		{"(*Prog).StartCond", Method, 0, ""},
+		{"(*Prog).String", Method, 0, ""},
+		{"(*Regexp).CapNames", Method, 0, ""},
+		{"(*Regexp).Equal", Method, 0, ""},
+		{"(*Regexp).MaxCap", Method, 0, ""},
+		{"(*Regexp).Simplify", Method, 0, ""},
+		{"(*Regexp).String", Method, 0, ""},
+		{"(ErrorCode).String", Method, 0, ""},
+		{"(InstOp).String", Method, 3, ""},
+		{"(Op).String", Method, 11, ""},
+		{"ClassNL", Const, 0, ""},
+		{"Compile", Func, 0, "func(re *Regexp) (*Prog, error)"},
+		{"DotNL", Const, 0, ""},
+		{"EmptyBeginLine", Const, 0, ""},
+		{"EmptyBeginText", Const, 0, ""},
+		{"EmptyEndLine", Const, 0, ""},
+		{"EmptyEndText", Const, 0, ""},
+		{"EmptyNoWordBoundary", Const, 0, ""},
+		{"EmptyOp", Type, 0, ""},
+		{"EmptyOpContext", Func, 0, "func(r1 rune, r2 rune) EmptyOp"},
+		{"EmptyWordBoundary", Const, 0, ""},
+		{"ErrInternalError", Const, 0, ""},
+		{"ErrInvalidCharClass", Const, 0, ""},
+		{"ErrInvalidCharRange", Const, 0, ""},
+		{"ErrInvalidEscape", Const, 0, ""},
+		{"ErrInvalidNamedCapture", Const, 0, ""},
+		{"ErrInvalidPerlOp", Const, 0, ""},
+		{"ErrInvalidRepeatOp", Const, 0, ""},
+		{"ErrInvalidRepeatSize", Const, 0, ""},
+		{"ErrInvalidUTF8", Const, 0, ""},
+		{"ErrLarge", Const, 20, ""},
+		{"ErrMissingBracket", Const, 0, ""},
+		{"ErrMissingParen", Const, 0, ""},
+		{"ErrMissingRepeatArgument", Const, 0, ""},
+		{"ErrNestingDepth", Const, 19, ""},
+		{"ErrTrailingBackslash", Const, 0, ""},
+		{"ErrUnexpectedParen", Const, 1, ""},
+		{"Error", Type, 0, ""},
+		{"Error.Code", Field, 0, ""},
+		{"Error.Expr", Field, 0, ""},
+		{"ErrorCode", Type, 0, ""},
+		{"Flags", Type, 0, ""},
+		{"FoldCase", Const, 0, ""},
+		{"Inst", Type, 0, ""},
+		{"Inst.Arg", Field, 0, ""},
+		{"Inst.Op", Field, 0, ""},
+		{"Inst.Out", Field, 0, ""},
+		{"Inst.Rune", Field, 0, ""},
+		{"InstAlt", Const, 0, ""},
+		{"InstAltMatch", Const, 0, ""},
+		{"InstCapture", Const, 0, ""},
+		{"InstEmptyWidth", Const, 0, ""},
+		{"InstFail", Const, 0, ""},
+		{"InstMatch", Const, 0, ""},
+		{"InstNop", Const, 0, ""},
+		{"InstOp", Type, 0, ""},
+		{"InstRune", Const, 0, ""},
+		{"InstRune1", Const, 0, ""},
+		{"InstRuneAny", Const, 0, ""},
+		{"InstRuneAnyNotNL", Const, 0, ""},
+		{"IsWordChar", Func, 0, "func(r rune) bool"},
+		{"Literal", Const, 0, ""},
+		{"MatchNL", Const, 0, ""},
+		{"NonGreedy", Const, 0, ""},
+		{"OneLine", Const, 0, ""},
+		{"Op", Type, 0, ""},
+		{"OpAlternate", Const, 0, ""},
+		{"OpAnyChar", Const, 0, ""},
+		{"OpAnyCharNotNL", Const, 0, ""},
+		{"OpBeginLine", Const, 0, ""},
+		{"OpBeginText", Const, 0, ""},
+		{"OpCapture", Const, 0, ""},
+		{"OpCharClass", Const, 0, ""},
+		{"OpConcat", Const, 0, ""},
+		{"OpEmptyMatch", Const, 0, ""},
+		{"OpEndLine", Const, 0, ""},
+		{"OpEndText", Const, 0, ""},
+		{"OpLiteral", Const, 0, ""},
+		{"OpNoMatch", Const, 0, ""},
+		{"OpNoWordBoundary", Const, 0, ""},
+		{"OpPlus", Const, 0, ""},
+		{"OpQuest", Const, 0, ""},
+		{"OpRepeat", Const, 0, ""},
+		{"OpStar", Const, 0, ""},
+		{"OpWordBoundary", Const, 0, ""},
+		{"POSIX", Const, 0, ""},
+		{"Parse", Func, 0, "func(s string, flags Flags) (*Regexp, error)"},
+		{"Perl", Const, 0, ""},
+		{"PerlX", Const, 0, ""},
+		{"Prog", Type, 0, ""},
+		{"Prog.Inst", Field, 0, ""},
+		{"Prog.NumCap", Field, 0, ""},
+		{"Prog.Start", Field, 0, ""},
+		{"Regexp", Type, 0, ""},
+		{"Regexp.Cap", Field, 0, ""},
+		{"Regexp.Flags", Field, 0, ""},
+		{"Regexp.Max", Field, 0, ""},
+		{"Regexp.Min", Field, 0, ""},
+		{"Regexp.Name", Field, 0, ""},
+		{"Regexp.Op", Field, 0, ""},
+		{"Regexp.Rune", Field, 0, ""},
+		{"Regexp.Rune0", Field, 0, ""},
+		{"Regexp.Sub", Field, 0, ""},
+		{"Regexp.Sub0", Field, 0, ""},
+		{"Simple", Const, 0, ""},
+		{"UnicodeGroups", Const, 0, ""},
+		{"WasDollar", Const, 0, ""},
+	},
+	"runtime": {
+		{"(*BlockProfileRecord).Stack", Method, 1, ""},
+		{"(*Frames).Next", Method, 7, ""},
+		{"(*Func).Entry", Method, 0, ""},
+		{"(*Func).FileLine", Method, 0, ""},
+		{"(*Func).Name", Method, 0, ""},
+		{"(*MemProfileRecord).InUseBytes", Method, 0, ""},
+		{"(*MemProfileRecord).InUseObjects", Method, 0, ""},
+		{"(*MemProfileRecord).Stack", Method, 0, ""},
+		{"(*PanicNilError).Error", Method, 21, ""},
+		{"(*PanicNilError).RuntimeError", Method, 21, ""},
+		{"(*Pinner).Pin", Method, 21, ""},
+		{"(*Pinner).Unpin", Method, 21, ""},
+		{"(*StackRecord).Stack", Method, 0, ""},
+		{"(*TypeAssertionError).Error", Method, 0, ""},
+		{"(*TypeAssertionError).RuntimeError", Method, 0, ""},
+		{"(Cleanup).Stop", Method, 24, ""},
+		{"AddCleanup", Func, 24, "func[T, S any](ptr *T, cleanup func(S), arg S) Cleanup"},
+		{"BlockProfile", Func, 1, "func(p []BlockProfileRecord) (n int, ok bool)"},
+		{"BlockProfileRecord", Type, 1, ""},
+		{"BlockProfileRecord.Count", Field, 1, ""},
+		{"BlockProfileRecord.Cycles", Field, 1, ""},
+		{"BlockProfileRecord.StackRecord", Field, 1, ""},
+		{"Breakpoint", Func, 0, "func()"},
+		{"CPUProfile", Func, 0, "func() []byte"},
+		{"Caller", Func, 0, "func(skip int) (pc uintptr, file string, line int, ok bool)"},
+		{"Callers", Func, 0, "func(skip int, pc []uintptr) int"},
+		{"CallersFrames", Func, 7, "func(callers []uintptr) *Frames"},
+		{"Cleanup", Type, 24, ""},
+		{"Compiler", Const, 0, ""},
+		{"Error", Type, 0, ""},
+		{"Frame", Type, 7, ""},
+		{"Frame.Entry", Field, 7, ""},
+		{"Frame.File", Field, 7, ""},
+		{"Frame.Func", Field, 7, ""},
+		{"Frame.Function", Field, 7, ""},
+		{"Frame.Line", Field, 7, ""},
+		{"Frame.PC", Field, 7, ""},
+		{"Frames", Type, 7, ""},
+		{"Func", Type, 0, ""},
+		{"FuncForPC", Func, 0, "func(pc uintptr) *Func"},
+		{"GC", Func, 0, "func()"},
+		{"GOARCH", Const, 0, ""},
+		{"GOMAXPROCS", Func, 0, "func(n int) int"},
+		{"GOOS", Const, 0, ""},
+		{"GOROOT", Func, 0, "func() string"},
+		{"Goexit", Func, 0, "func()"},
+		{"GoroutineProfile", Func, 0, "func(p []StackRecord) (n int, ok bool)"},
+		{"Gosched", Func, 0, "func()"},
+		{"KeepAlive", Func, 7, "func(x any)"},
+		{"LockOSThread", Func, 0, "func()"},
+		{"MemProfile", Func, 0, "func(p []MemProfileRecord, inuseZero bool) (n int, ok bool)"},
+		{"MemProfileRate", Var, 0, ""},
+		{"MemProfileRecord", Type, 0, ""},
+		{"MemProfileRecord.AllocBytes", Field, 0, ""},
+		{"MemProfileRecord.AllocObjects", Field, 0, ""},
+		{"MemProfileRecord.FreeBytes", Field, 0, ""},
+		{"MemProfileRecord.FreeObjects", Field, 0, ""},
+		{"MemProfileRecord.Stack0", Field, 0, ""},
+		{"MemStats", Type, 0, ""},
+		{"MemStats.Alloc", Field, 0, ""},
+		{"MemStats.BuckHashSys", Field, 0, ""},
+		{"MemStats.BySize", Field, 0, ""},
+		{"MemStats.DebugGC", Field, 0, ""},
+		{"MemStats.EnableGC", Field, 0, ""},
+		{"MemStats.Frees", Field, 0, ""},
+		{"MemStats.GCCPUFraction", Field, 5, ""},
+		{"MemStats.GCSys", Field, 2, ""},
+		{"MemStats.HeapAlloc", Field, 0, ""},
+		{"MemStats.HeapIdle", Field, 0, ""},
+		{"MemStats.HeapInuse", Field, 0, ""},
+		{"MemStats.HeapObjects", Field, 0, ""},
+		{"MemStats.HeapReleased", Field, 0, ""},
+		{"MemStats.HeapSys", Field, 0, ""},
+		{"MemStats.LastGC", Field, 0, ""},
+		{"MemStats.Lookups", Field, 0, ""},
+		{"MemStats.MCacheInuse", Field, 0, ""},
+		{"MemStats.MCacheSys", Field, 0, ""},
+		{"MemStats.MSpanInuse", Field, 0, ""},
+		{"MemStats.MSpanSys", Field, 0, ""},
+		{"MemStats.Mallocs", Field, 0, ""},
+		{"MemStats.NextGC", Field, 0, ""},
+		{"MemStats.NumForcedGC", Field, 8, ""},
+		{"MemStats.NumGC", Field, 0, ""},
+		{"MemStats.OtherSys", Field, 2, ""},
+		{"MemStats.PauseEnd", Field, 4, ""},
+		{"MemStats.PauseNs", Field, 0, ""},
+		{"MemStats.PauseTotalNs", Field, 0, ""},
+		{"MemStats.StackInuse", Field, 0, ""},
+		{"MemStats.StackSys", Field, 0, ""},
+		{"MemStats.Sys", Field, 0, ""},
+		{"MemStats.TotalAlloc", Field, 0, ""},
+		{"MutexProfile", Func, 8, "func(p []BlockProfileRecord) (n int, ok bool)"},
+		{"NumCPU", Func, 0, "func() int"},
+		{"NumCgoCall", Func, 0, "func() int64"},
+		{"NumGoroutine", Func, 0, "func() int"},
+		{"PanicNilError", Type, 21, ""},
+		{"Pinner", Type, 21, ""},
+		{"ReadMemStats", Func, 0, "func(m *MemStats)"},
+		{"ReadTrace", Func, 5, "func() []byte"},
+		{"SetBlockProfileRate", Func, 1, "func(rate int)"},
+		{"SetCPUProfileRate", Func, 0, "func(hz int)"},
+		{"SetCgoTraceback", Func, 7, "func(version int, traceback unsafe.Pointer, context unsafe.Pointer, symbolizer unsafe.Pointer)"},
+		{"SetFinalizer", Func, 0, "func(obj any, finalizer any)"},
+		{"SetMutexProfileFraction", Func, 8, "func(rate int) int"},
+		{"Stack", Func, 0, "func(buf []byte, all bool) int"},
+		{"StackRecord", Type, 0, ""},
+		{"StackRecord.Stack0", Field, 0, ""},
+		{"StartTrace", Func, 5, "func() error"},
+		{"StopTrace", Func, 5, "func()"},
+		{"ThreadCreateProfile", Func, 0, "func(p []StackRecord) (n int, ok bool)"},
+		{"TypeAssertionError", Type, 0, ""},
+		{"UnlockOSThread", Func, 0, "func()"},
+		{"Version", Func, 0, "func() string"},
+	},
+	"runtime/cgo": {
+		{"(Handle).Delete", Method, 17, ""},
+		{"(Handle).Value", Method, 17, ""},
+		{"Handle", Type, 17, ""},
+		{"Incomplete", Type, 20, ""},
+		{"NewHandle", Func, 17, ""},
+	},
+	"runtime/coverage": {
+		{"ClearCounters", Func, 20, "func() error"},
+		{"WriteCounters", Func, 20, "func(w io.Writer) error"},
+		{"WriteCountersDir", Func, 20, "func(dir string) error"},
+		{"WriteMeta", Func, 20, "func(w io.Writer) error"},
+		{"WriteMetaDir", Func, 20, "func(dir string) error"},
+	},
+	"runtime/debug": {
+		{"(*BuildInfo).String", Method, 18, ""},
+		{"BuildInfo", Type, 12, ""},
+		{"BuildInfo.Deps", Field, 12, ""},
+		{"BuildInfo.GoVersion", Field, 18, ""},
+		{"BuildInfo.Main", Field, 12, ""},
+		{"BuildInfo.Path", Field, 12, ""},
+		{"BuildInfo.Settings", Field, 18, ""},
+		{"BuildSetting", Type, 18, ""},
+		{"BuildSetting.Key", Field, 18, ""},
+		{"BuildSetting.Value", Field, 18, ""},
+		{"CrashOptions", Type, 23, ""},
+		{"FreeOSMemory", Func, 1, "func()"},
+		{"GCStats", Type, 1, ""},
+		{"GCStats.LastGC", Field, 1, ""},
+		{"GCStats.NumGC", Field, 1, ""},
+		{"GCStats.Pause", Field, 1, ""},
+		{"GCStats.PauseEnd", Field, 4, ""},
+		{"GCStats.PauseQuantiles", Field, 1, ""},
+		{"GCStats.PauseTotal", Field, 1, ""},
+		{"Module", Type, 12, ""},
+		{"Module.Path", Field, 12, ""},
+		{"Module.Replace", Field, 12, ""},
+		{"Module.Sum", Field, 12, ""},
+		{"Module.Version", Field, 12, ""},
+		{"ParseBuildInfo", Func, 18, "func(data string) (bi *BuildInfo, err error)"},
+		{"PrintStack", Func, 0, "func()"},
+		{"ReadBuildInfo", Func, 12, "func() (info *BuildInfo, ok bool)"},
+		{"ReadGCStats", Func, 1, "func(stats *GCStats)"},
+		{"SetCrashOutput", Func, 23, "func(f *os.File, opts CrashOptions) error"},
+		{"SetGCPercent", Func, 1, "func(percent int) int"},
+		{"SetMaxStack", Func, 2, "func(bytes int) int"},
+		{"SetMaxThreads", Func, 2, "func(threads int) int"},
+		{"SetMemoryLimit", Func, 19, "func(limit int64) int64"},
+		{"SetPanicOnFault", Func, 3, "func(enabled bool) bool"},
+		{"SetTraceback", Func, 6, "func(level string)"},
+		{"Stack", Func, 0, "func() []byte"},
+		{"WriteHeapDump", Func, 3, "func(fd uintptr)"},
+	},
+	"runtime/metrics": {
+		{"(Value).Float64", Method, 16, ""},
+		{"(Value).Float64Histogram", Method, 16, ""},
+		{"(Value).Kind", Method, 16, ""},
+		{"(Value).Uint64", Method, 16, ""},
+		{"All", Func, 16, "func() []Description"},
+		{"Description", Type, 16, ""},
+		{"Description.Cumulative", Field, 16, ""},
+		{"Description.Description", Field, 16, ""},
+		{"Description.Kind", Field, 16, ""},
+		{"Description.Name", Field, 16, ""},
+		{"Float64Histogram", Type, 16, ""},
+		{"Float64Histogram.Buckets", Field, 16, ""},
+		{"Float64Histogram.Counts", Field, 16, ""},
+		{"KindBad", Const, 16, ""},
+		{"KindFloat64", Const, 16, ""},
+		{"KindFloat64Histogram", Const, 16, ""},
+		{"KindUint64", Const, 16, ""},
+		{"Read", Func, 16, "func(m []Sample)"},
+		{"Sample", Type, 16, ""},
+		{"Sample.Name", Field, 16, ""},
+		{"Sample.Value", Field, 16, ""},
+		{"Value", Type, 16, ""},
+		{"ValueKind", Type, 16, ""},
+	},
+	"runtime/pprof": {
+		{"(*Profile).Add", Method, 0, ""},
+		{"(*Profile).Count", Method, 0, ""},
+		{"(*Profile).Name", Method, 0, ""},
+		{"(*Profile).Remove", Method, 0, ""},
+		{"(*Profile).WriteTo", Method, 0, ""},
+		{"Do", Func, 9, "func(ctx context.Context, labels LabelSet, f func(context.Context))"},
+		{"ForLabels", Func, 9, "func(ctx context.Context, f func(key string, value string) bool)"},
+		{"Label", Func, 9, "func(ctx context.Context, key string) (string, bool)"},
+		{"LabelSet", Type, 9, ""},
+		{"Labels", Func, 9, "func(args ...string) LabelSet"},
+		{"Lookup", Func, 0, "func(name string) *Profile"},
+		{"NewProfile", Func, 0, "func(name string) *Profile"},
+		{"Profile", Type, 0, ""},
+		{"Profiles", Func, 0, "func() []*Profile"},
+		{"SetGoroutineLabels", Func, 9, "func(ctx context.Context)"},
+		{"StartCPUProfile", Func, 0, "func(w io.Writer) error"},
+		{"StopCPUProfile", Func, 0, "func()"},
+		{"WithLabels", Func, 9, "func(ctx context.Context, labels LabelSet) context.Context"},
+		{"WriteHeapProfile", Func, 0, "func(w io.Writer) error"},
+	},
+	"runtime/trace": {
+		{"(*Region).End", Method, 11, ""},
+		{"(*Task).End", Method, 11, ""},
+		{"IsEnabled", Func, 11, "func() bool"},
+		{"Log", Func, 11, "func(ctx context.Context, category string, message string)"},
+		{"Logf", Func, 11, "func(ctx context.Context, category string, format string, args ...any)"},
+		{"NewTask", Func, 11, "func(pctx context.Context, taskType string) (ctx context.Context, task *Task)"},
+		{"Region", Type, 11, ""},
+		{"Start", Func, 5, "func(w io.Writer) error"},
+		{"StartRegion", Func, 11, "func(ctx context.Context, regionType string) *Region"},
+		{"Stop", Func, 5, "func()"},
+		{"Task", Type, 11, ""},
+		{"WithRegion", Func, 11, "func(ctx context.Context, regionType string, fn func())"},
+	},
+	"slices": {
+		{"All", Func, 23, "func[Slice ~[]E, E any](s Slice) iter.Seq2[int, E]"},
+		{"AppendSeq", Func, 23, "func[Slice ~[]E, E any](s Slice, seq iter.Seq[E]) Slice"},
+		{"Backward", Func, 23, "func[Slice ~[]E, E any](s Slice) iter.Seq2[int, E]"},
+		{"BinarySearch", Func, 21, "func[S ~[]E, E cmp.Ordered](x S, target E) (int, bool)"},
+		{"BinarySearchFunc", Func, 21, "func[S ~[]E, E, T any](x S, target T, cmp func(E, T) int) (int, bool)"},
+		{"Chunk", Func, 23, "func[Slice ~[]E, E any](s Slice, n int) iter.Seq[Slice]"},
+		{"Clip", Func, 21, "func[S ~[]E, E any](s S) S"},
+		{"Clone", Func, 21, "func[S ~[]E, E any](s S) S"},
+		{"Collect", Func, 23, "func[E any](seq iter.Seq[E]) []E"},
+		{"Compact", Func, 21, "func[S ~[]E, E comparable](s S) S"},
+		{"CompactFunc", Func, 21, "func[S ~[]E, E any](s S, eq func(E, E) bool) S"},
+		{"Compare", Func, 21, "func[S ~[]E, E cmp.Ordered](s1 S, s2 S) int"},
+		{"CompareFunc", Func, 21, "func[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, cmp func(E1, E2) int) int"},
+		{"Concat", Func, 22, "func[S ~[]E, E any](slices ...S) S"},
+		{"Contains", Func, 21, "func[S ~[]E, E comparable](s S, v E) bool"},
+		{"ContainsFunc", Func, 21, "func[S ~[]E, E any](s S, f func(E) bool) bool"},
+		{"Delete", Func, 21, "func[S ~[]E, E any](s S, i int, j int) S"},
+		{"DeleteFunc", Func, 21, "func[S ~[]E, E any](s S, del func(E) bool) S"},
+		{"Equal", Func, 21, "func[S ~[]E, E comparable](s1 S, s2 S) bool"},
+		{"EqualFunc", Func, 21, "func[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, eq func(E1, E2) bool) bool"},
+		{"Grow", Func, 21, "func[S ~[]E, E any](s S, n int) S"},
+		{"Index", Func, 21, "func[S ~[]E, E comparable](s S, v E) int"},
+		{"IndexFunc", Func, 21, "func[S ~[]E, E any](s S, f func(E) bool) int"},
+		{"Insert", Func, 21, "func[S ~[]E, E any](s S, i int, v ...E) S"},
+		{"IsSorted", Func, 21, "func[S ~[]E, E cmp.Ordered](x S) bool"},
+		{"IsSortedFunc", Func, 21, "func[S ~[]E, E any](x S, cmp func(a E, b E) int) bool"},
+		{"Max", Func, 21, "func[S ~[]E, E cmp.Ordered](x S) E"},
+		{"MaxFunc", Func, 21, "func[S ~[]E, E any](x S, cmp func(a E, b E) int) E"},
+		{"Min", Func, 21, "func[S ~[]E, E cmp.Ordered](x S) E"},
+		{"MinFunc", Func, 21, "func[S ~[]E, E any](x S, cmp func(a E, b E) int) E"},
+		{"Repeat", Func, 23, "func[S ~[]E, E any](x S, count int) S"},
+		{"Replace", Func, 21, "func[S ~[]E, E any](s S, i int, j int, v ...E) S"},
+		{"Reverse", Func, 21, "func[S ~[]E, E any](s S)"},
+		{"Sort", Func, 21, "func[S ~[]E, E cmp.Ordered](x S)"},
+		{"SortFunc", Func, 21, "func[S ~[]E, E any](x S, cmp func(a E, b E) int)"},
+		{"SortStableFunc", Func, 21, "func[S ~[]E, E any](x S, cmp func(a E, b E) int)"},
+		{"Sorted", Func, 23, "func[E cmp.Ordered](seq iter.Seq[E]) []E"},
+		{"SortedFunc", Func, 23, "func[E any](seq iter.Seq[E], cmp func(E, E) int) []E"},
+		{"SortedStableFunc", Func, 23, "func[E any](seq iter.Seq[E], cmp func(E, E) int) []E"},
+		{"Values", Func, 23, "func[Slice ~[]E, E any](s Slice) iter.Seq[E]"},
+	},
+	"sort": {
+		{"(Float64Slice).Len", Method, 0, ""},
+		{"(Float64Slice).Less", Method, 0, ""},
+		{"(Float64Slice).Search", Method, 0, ""},
+		{"(Float64Slice).Sort", Method, 0, ""},
+		{"(Float64Slice).Swap", Method, 0, ""},
+		{"(IntSlice).Len", Method, 0, ""},
+		{"(IntSlice).Less", Method, 0, ""},
+		{"(IntSlice).Search", Method, 0, ""},
+		{"(IntSlice).Sort", Method, 0, ""},
+		{"(IntSlice).Swap", Method, 0, ""},
+		{"(StringSlice).Len", Method, 0, ""},
+		{"(StringSlice).Less", Method, 0, ""},
+		{"(StringSlice).Search", Method, 0, ""},
+		{"(StringSlice).Sort", Method, 0, ""},
+		{"(StringSlice).Swap", Method, 0, ""},
+		{"Find", Func, 19, "func(n int, cmp func(int) int) (i int, found bool)"},
+		{"Float64Slice", Type, 0, ""},
+		{"Float64s", Func, 0, "func(x []float64)"},
+		{"Float64sAreSorted", Func, 0, "func(x []float64) bool"},
+		{"IntSlice", Type, 0, ""},
+		{"Interface", Type, 0, ""},
+		{"Ints", Func, 0, "func(x []int)"},
+		{"IntsAreSorted", Func, 0, "func(x []int) bool"},
+		{"IsSorted", Func, 0, "func(data Interface) bool"},
+		{"Reverse", Func, 1, "func(data Interface) Interface"},
+		{"Search", Func, 0, "func(n int, f func(int) bool) int"},
+		{"SearchFloat64s", Func, 0, "func(a []float64, x float64) int"},
+		{"SearchInts", Func, 0, "func(a []int, x int) int"},
+		{"SearchStrings", Func, 0, "func(a []string, x string) int"},
+		{"Slice", Func, 8, "func(x any, less func(i int, j int) bool)"},
+		{"SliceIsSorted", Func, 8, "func(x any, less func(i int, j int) bool) bool"},
+		{"SliceStable", Func, 8, "func(x any, less func(i int, j int) bool)"},
+		{"Sort", Func, 0, "func(data Interface)"},
+		{"Stable", Func, 2, "func(data Interface)"},
+		{"StringSlice", Type, 0, ""},
+		{"Strings", Func, 0, "func(x []string)"},
+		{"StringsAreSorted", Func, 0, "func(x []string) bool"},
+	},
+	"strconv": {
+		{"(*NumError).Error", Method, 0, ""},
+		{"(*NumError).Unwrap", Method, 14, ""},
+		{"AppendBool", Func, 0, "func(dst []byte, b bool) []byte"},
+		{"AppendFloat", Func, 0, "func(dst []byte, f float64, fmt byte, prec int, bitSize int) []byte"},
+		{"AppendInt", Func, 0, "func(dst []byte, i int64, base int) []byte"},
+		{"AppendQuote", Func, 0, "func(dst []byte, s string) []byte"},
+		{"AppendQuoteRune", Func, 0, "func(dst []byte, r rune) []byte"},
+		{"AppendQuoteRuneToASCII", Func, 0, "func(dst []byte, r rune) []byte"},
+		{"AppendQuoteRuneToGraphic", Func, 6, "func(dst []byte, r rune) []byte"},
+		{"AppendQuoteToASCII", Func, 0, "func(dst []byte, s string) []byte"},
+		{"AppendQuoteToGraphic", Func, 6, "func(dst []byte, s string) []byte"},
+		{"AppendUint", Func, 0, "func(dst []byte, i uint64, base int) []byte"},
+		{"Atoi", Func, 0, "func(s string) (int, error)"},
+		{"CanBackquote", Func, 0, "func(s string) bool"},
+		{"ErrRange", Var, 0, ""},
+		{"ErrSyntax", Var, 0, ""},
+		{"FormatBool", Func, 0, "func(b bool) string"},
+		{"FormatComplex", Func, 15, "func(c complex128, fmt byte, prec int, bitSize int) string"},
+		{"FormatFloat", Func, 0, "func(f float64, fmt byte, prec int, bitSize int) string"},
+		{"FormatInt", Func, 0, "func(i int64, base int) string"},
+		{"FormatUint", Func, 0, "func(i uint64, base int) string"},
+		{"IntSize", Const, 0, ""},
+		{"IsGraphic", Func, 6, "func(r rune) bool"},
+		{"IsPrint", Func, 0, "func(r rune) bool"},
+		{"Itoa", Func, 0, "func(i int) string"},
+		{"NumError", Type, 0, ""},
+		{"NumError.Err", Field, 0, ""},
+		{"NumError.Func", Field, 0, ""},
+		{"NumError.Num", Field, 0, ""},
+		{"ParseBool", Func, 0, "func(str string) (bool, error)"},
+		{"ParseComplex", Func, 15, "func(s string, bitSize int) (complex128, error)"},
+		{"ParseFloat", Func, 0, "func(s string, bitSize int) (float64, error)"},
+		{"ParseInt", Func, 0, "func(s string, base int, bitSize int) (i int64, err error)"},
+		{"ParseUint", Func, 0, "func(s string, base int, bitSize int) (uint64, error)"},
+		{"Quote", Func, 0, "func(s string) string"},
+		{"QuoteRune", Func, 0, "func(r rune) string"},
+		{"QuoteRuneToASCII", Func, 0, "func(r rune) string"},
+		{"QuoteRuneToGraphic", Func, 6, "func(r rune) string"},
+		{"QuoteToASCII", Func, 0, "func(s string) string"},
+		{"QuoteToGraphic", Func, 6, "func(s string) string"},
+		{"QuotedPrefix", Func, 17, "func(s string) (string, error)"},
+		{"Unquote", Func, 0, "func(s string) (string, error)"},
+		{"UnquoteChar", Func, 0, "func(s string, quote byte) (value rune, multibyte bool, tail string, err error)"},
+	},
+	"strings": {
+		{"(*Builder).Cap", Method, 12, ""},
+		{"(*Builder).Grow", Method, 10, ""},
+		{"(*Builder).Len", Method, 10, ""},
+		{"(*Builder).Reset", Method, 10, ""},
+		{"(*Builder).String", Method, 10, ""},
+		{"(*Builder).Write", Method, 10, ""},
+		{"(*Builder).WriteByte", Method, 10, ""},
+		{"(*Builder).WriteRune", Method, 10, ""},
+		{"(*Builder).WriteString", Method, 10, ""},
+		{"(*Reader).Len", Method, 0, ""},
+		{"(*Reader).Read", Method, 0, ""},
+		{"(*Reader).ReadAt", Method, 0, ""},
+		{"(*Reader).ReadByte", Method, 0, ""},
+		{"(*Reader).ReadRune", Method, 0, ""},
+		{"(*Reader).Reset", Method, 7, ""},
+		{"(*Reader).Seek", Method, 0, ""},
+		{"(*Reader).Size", Method, 5, ""},
+		{"(*Reader).UnreadByte", Method, 0, ""},
+		{"(*Reader).UnreadRune", Method, 0, ""},
+		{"(*Reader).WriteTo", Method, 1, ""},
+		{"(*Replacer).Replace", Method, 0, ""},
+		{"(*Replacer).WriteString", Method, 0, ""},
+		{"Builder", Type, 10, ""},
+		{"Clone", Func, 18, "func(s string) string"},
+		{"Compare", Func, 5, "func(a string, b string) int"},
+		{"Contains", Func, 0, "func(s string, substr string) bool"},
+		{"ContainsAny", Func, 0, "func(s string, chars string) bool"},
+		{"ContainsFunc", Func, 21, "func(s string, f func(rune) bool) bool"},
+		{"ContainsRune", Func, 0, "func(s string, r rune) bool"},
+		{"Count", Func, 0, "func(s string, substr string) int"},
+		{"Cut", Func, 18, "func(s string, sep string) (before string, after string, found bool)"},
+		{"CutPrefix", Func, 20, "func(s string, prefix string) (after string, found bool)"},
+		{"CutSuffix", Func, 20, "func(s string, suffix string) (before string, found bool)"},
+		{"EqualFold", Func, 0, "func(s string, t string) bool"},
+		{"Fields", Func, 0, "func(s string) []string"},
+		{"FieldsFunc", Func, 0, "func(s string, f func(rune) bool) []string"},
+		{"FieldsFuncSeq", Func, 24, "func(s string, f func(rune) bool) iter.Seq[string]"},
+		{"FieldsSeq", Func, 24, "func(s string) iter.Seq[string]"},
+		{"HasPrefix", Func, 0, "func(s string, prefix string) bool"},
+		{"HasSuffix", Func, 0, "func(s string, suffix string) bool"},
+		{"Index", Func, 0, "func(s string, substr string) int"},
+		{"IndexAny", Func, 0, "func(s string, chars string) int"},
+		{"IndexByte", Func, 2, "func(s string, c byte) int"},
+		{"IndexFunc", Func, 0, "func(s string, f func(rune) bool) int"},
+		{"IndexRune", Func, 0, "func(s string, r rune) int"},
+		{"Join", Func, 0, "func(elems []string, sep string) string"},
+		{"LastIndex", Func, 0, "func(s string, substr string) int"},
+		{"LastIndexAny", Func, 0, "func(s string, chars string) int"},
+		{"LastIndexByte", Func, 5, "func(s string, c byte) int"},
+		{"LastIndexFunc", Func, 0, "func(s string, f func(rune) bool) int"},
+		{"Lines", Func, 24, "func(s string) iter.Seq[string]"},
+		{"Map", Func, 0, "func(mapping func(rune) rune, s string) string"},
+		{"NewReader", Func, 0, "func(s string) *Reader"},
+		{"NewReplacer", Func, 0, "func(oldnew ...string) *Replacer"},
+		{"Reader", Type, 0, ""},
+		{"Repeat", Func, 0, "func(s string, count int) string"},
+		{"Replace", Func, 0, "func(s string, old string, new string, n int) string"},
+		{"ReplaceAll", Func, 12, "func(s string, old string, new string) string"},
+		{"Replacer", Type, 0, ""},
+		{"Split", Func, 0, "func(s string, sep string) []string"},
+		{"SplitAfter", Func, 0, "func(s string, sep string) []string"},
+		{"SplitAfterN", Func, 0, "func(s string, sep string, n int) []string"},
+		{"SplitAfterSeq", Func, 24, "func(s string, sep string) iter.Seq[string]"},
+		{"SplitN", Func, 0, "func(s string, sep string, n int) []string"},
+		{"SplitSeq", Func, 24, "func(s string, sep string) iter.Seq[string]"},
+		{"Title", Func, 0, "func(s string) string"},
+		{"ToLower", Func, 0, "func(s string) string"},
+		{"ToLowerSpecial", Func, 0, "func(c unicode.SpecialCase, s string) string"},
+		{"ToTitle", Func, 0, "func(s string) string"},
+		{"ToTitleSpecial", Func, 0, "func(c unicode.SpecialCase, s string) string"},
+		{"ToUpper", Func, 0, "func(s string) string"},
+		{"ToUpperSpecial", Func, 0, "func(c unicode.SpecialCase, s string) string"},
+		{"ToValidUTF8", Func, 13, "func(s string, replacement string) string"},
+		{"Trim", Func, 0, "func(s string, cutset string) string"},
+		{"TrimFunc", Func, 0, "func(s string, f func(rune) bool) string"},
+		{"TrimLeft", Func, 0, "func(s string, cutset string) string"},
+		{"TrimLeftFunc", Func, 0, "func(s string, f func(rune) bool) string"},
+		{"TrimPrefix", Func, 1, "func(s string, prefix string) string"},
+		{"TrimRight", Func, 0, "func(s string, cutset string) string"},
+		{"TrimRightFunc", Func, 0, "func(s string, f func(rune) bool) string"},
+		{"TrimSpace", Func, 0, "func(s string) string"},
+		{"TrimSuffix", Func, 1, "func(s string, suffix string) string"},
+	},
+	"structs": {
+		{"HostLayout", Type, 23, ""},
+	},
+	"sync": {
+		{"(*Cond).Broadcast", Method, 0, ""},
+		{"(*Cond).Signal", Method, 0, ""},
+		{"(*Cond).Wait", Method, 0, ""},
+		{"(*Map).Clear", Method, 23, ""},
+		{"(*Map).CompareAndDelete", Method, 20, ""},
+		{"(*Map).CompareAndSwap", Method, 20, ""},
+		{"(*Map).Delete", Method, 9, ""},
+		{"(*Map).Load", Method, 9, ""},
+		{"(*Map).LoadAndDelete", Method, 15, ""},
+		{"(*Map).LoadOrStore", Method, 9, ""},
+		{"(*Map).Range", Method, 9, ""},
+		{"(*Map).Store", Method, 9, ""},
+		{"(*Map).Swap", Method, 20, ""},
+		{"(*Mutex).Lock", Method, 0, ""},
+		{"(*Mutex).TryLock", Method, 18, ""},
+		{"(*Mutex).Unlock", Method, 0, ""},
+		{"(*Once).Do", Method, 0, ""},
+		{"(*Pool).Get", Method, 3, ""},
+		{"(*Pool).Put", Method, 3, ""},
+		{"(*RWMutex).Lock", Method, 0, ""},
+		{"(*RWMutex).RLock", Method, 0, ""},
+		{"(*RWMutex).RLocker", Method, 0, ""},
+		{"(*RWMutex).RUnlock", Method, 0, ""},
+		{"(*RWMutex).TryLock", Method, 18, ""},
+		{"(*RWMutex).TryRLock", Method, 18, ""},
+		{"(*RWMutex).Unlock", Method, 0, ""},
+		{"(*WaitGroup).Add", Method, 0, ""},
+		{"(*WaitGroup).Done", Method, 0, ""},
+		{"(*WaitGroup).Go", Method, 25, ""},
+		{"(*WaitGroup).Wait", Method, 0, ""},
+		{"Cond", Type, 0, ""},
+		{"Cond.L", Field, 0, ""},
+		{"Locker", Type, 0, ""},
+		{"Map", Type, 9, ""},
+		{"Mutex", Type, 0, ""},
+		{"NewCond", Func, 0, "func(l Locker) *Cond"},
+		{"Once", Type, 0, ""},
+		{"OnceFunc", Func, 21, "func(f func()) func()"},
+		{"OnceValue", Func, 21, "func[T any](f func() T) func() T"},
+		{"OnceValues", Func, 21, "func[T1, T2 any](f func() (T1, T2)) func() (T1, T2)"},
+		{"Pool", Type, 3, ""},
+		{"Pool.New", Field, 3, ""},
+		{"RWMutex", Type, 0, ""},
+		{"WaitGroup", Type, 0, ""},
+	},
+	"sync/atomic": {
+		{"(*Bool).CompareAndSwap", Method, 19, ""},
+		{"(*Bool).Load", Method, 19, ""},
+		{"(*Bool).Store", Method, 19, ""},
+		{"(*Bool).Swap", Method, 19, ""},
+		{"(*Int32).Add", Method, 19, ""},
+		{"(*Int32).And", Method, 23, ""},
+		{"(*Int32).CompareAndSwap", Method, 19, ""},
+		{"(*Int32).Load", Method, 19, ""},
+		{"(*Int32).Or", Method, 23, ""},
+		{"(*Int32).Store", Method, 19, ""},
+		{"(*Int32).Swap", Method, 19, ""},
+		{"(*Int64).Add", Method, 19, ""},
+		{"(*Int64).And", Method, 23, ""},
+		{"(*Int64).CompareAndSwap", Method, 19, ""},
+		{"(*Int64).Load", Method, 19, ""},
+		{"(*Int64).Or", Method, 23, ""},
+		{"(*Int64).Store", Method, 19, ""},
+		{"(*Int64).Swap", Method, 19, ""},
+		{"(*Pointer).CompareAndSwap", Method, 19, ""},
+		{"(*Pointer).Load", Method, 19, ""},
+		{"(*Pointer).Store", Method, 19, ""},
+		{"(*Pointer).Swap", Method, 19, ""},
+		{"(*Uint32).Add", Method, 19, ""},
+		{"(*Uint32).And", Method, 23, ""},
+		{"(*Uint32).CompareAndSwap", Method, 19, ""},
+		{"(*Uint32).Load", Method, 19, ""},
+		{"(*Uint32).Or", Method, 23, ""},
+		{"(*Uint32).Store", Method, 19, ""},
+		{"(*Uint32).Swap", Method, 19, ""},
+		{"(*Uint64).Add", Method, 19, ""},
+		{"(*Uint64).And", Method, 23, ""},
+		{"(*Uint64).CompareAndSwap", Method, 19, ""},
+		{"(*Uint64).Load", Method, 19, ""},
+		{"(*Uint64).Or", Method, 23, ""},
+		{"(*Uint64).Store", Method, 19, ""},
+		{"(*Uint64).Swap", Method, 19, ""},
+		{"(*Uintptr).Add", Method, 19, ""},
+		{"(*Uintptr).And", Method, 23, ""},
+		{"(*Uintptr).CompareAndSwap", Method, 19, ""},
+		{"(*Uintptr).Load", Method, 19, ""},
+		{"(*Uintptr).Or", Method, 23, ""},
+		{"(*Uintptr).Store", Method, 19, ""},
+		{"(*Uintptr).Swap", Method, 19, ""},
+		{"(*Value).CompareAndSwap", Method, 17, ""},
+		{"(*Value).Load", Method, 4, ""},
+		{"(*Value).Store", Method, 4, ""},
+		{"(*Value).Swap", Method, 17, ""},
+		{"AddInt32", Func, 0, "func(addr *int32, delta int32) (new int32)"},
+		{"AddInt64", Func, 0, "func(addr *int64, delta int64) (new int64)"},
+		{"AddUint32", Func, 0, "func(addr *uint32, delta uint32) (new uint32)"},
+		{"AddUint64", Func, 0, "func(addr *uint64, delta uint64) (new uint64)"},
+		{"AddUintptr", Func, 0, "func(addr *uintptr, delta uintptr) (new uintptr)"},
+		{"AndInt32", Func, 23, "func(addr *int32, mask int32) (old int32)"},
+		{"AndInt64", Func, 23, "func(addr *int64, mask int64) (old int64)"},
+		{"AndUint32", Func, 23, "func(addr *uint32, mask uint32) (old uint32)"},
+		{"AndUint64", Func, 23, "func(addr *uint64, mask uint64) (old uint64)"},
+		{"AndUintptr", Func, 23, "func(addr *uintptr, mask uintptr) (old uintptr)"},
+		{"Bool", Type, 19, ""},
+		{"CompareAndSwapInt32", Func, 0, "func(addr *int32, old int32, new int32) (swapped bool)"},
+		{"CompareAndSwapInt64", Func, 0, "func(addr *int64, old int64, new int64) (swapped bool)"},
+		{"CompareAndSwapPointer", Func, 0, "func(addr *unsafe.Pointer, old unsafe.Pointer, new unsafe.Pointer) (swapped bool)"},
+		{"CompareAndSwapUint32", Func, 0, "func(addr *uint32, old uint32, new uint32) (swapped bool)"},
+		{"CompareAndSwapUint64", Func, 0, "func(addr *uint64, old uint64, new uint64) (swapped bool)"},
+		{"CompareAndSwapUintptr", Func, 0, "func(addr *uintptr, old uintptr, new uintptr) (swapped bool)"},
+		{"Int32", Type, 19, ""},
+		{"Int64", Type, 19, ""},
+		{"LoadInt32", Func, 0, "func(addr *int32) (val int32)"},
+		{"LoadInt64", Func, 0, "func(addr *int64) (val int64)"},
+		{"LoadPointer", Func, 0, "func(addr *unsafe.Pointer) (val unsafe.Pointer)"},
+		{"LoadUint32", Func, 0, "func(addr *uint32) (val uint32)"},
+		{"LoadUint64", Func, 0, "func(addr *uint64) (val uint64)"},
+		{"LoadUintptr", Func, 0, "func(addr *uintptr) (val uintptr)"},
+		{"OrInt32", Func, 23, "func(addr *int32, mask int32) (old int32)"},
+		{"OrInt64", Func, 23, "func(addr *int64, mask int64) (old int64)"},
+		{"OrUint32", Func, 23, "func(addr *uint32, mask uint32) (old uint32)"},
+		{"OrUint64", Func, 23, "func(addr *uint64, mask uint64) (old uint64)"},
+		{"OrUintptr", Func, 23, "func(addr *uintptr, mask uintptr) (old uintptr)"},
+		{"Pointer", Type, 19, ""},
+		{"StoreInt32", Func, 0, "func(addr *int32, val int32)"},
+		{"StoreInt64", Func, 0, "func(addr *int64, val int64)"},
+		{"StorePointer", Func, 0, "func(addr *unsafe.Pointer, val unsafe.Pointer)"},
+		{"StoreUint32", Func, 0, "func(addr *uint32, val uint32)"},
+		{"StoreUint64", Func, 0, "func(addr *uint64, val uint64)"},
+		{"StoreUintptr", Func, 0, "func(addr *uintptr, val uintptr)"},
+		{"SwapInt32", Func, 2, "func(addr *int32, new int32) (old int32)"},
+		{"SwapInt64", Func, 2, "func(addr *int64, new int64) (old int64)"},
+		{"SwapPointer", Func, 2, "func(addr *unsafe.Pointer, new unsafe.Pointer) (old unsafe.Pointer)"},
+		{"SwapUint32", Func, 2, "func(addr *uint32, new uint32) (old uint32)"},
+		{"SwapUint64", Func, 2, "func(addr *uint64, new uint64) (old uint64)"},
+		{"SwapUintptr", Func, 2, "func(addr *uintptr, new uintptr) (old uintptr)"},
+		{"Uint32", Type, 19, ""},
+		{"Uint64", Type, 19, ""},
+		{"Uintptr", Type, 19, ""},
+		{"Value", Type, 4, ""},
+	},
+	"syscall": {
+		{"(*Cmsghdr).SetLen", Method, 0, ""},
+		{"(*DLL).FindProc", Method, 0, ""},
+		{"(*DLL).MustFindProc", Method, 0, ""},
+		{"(*DLL).Release", Method, 0, ""},
+		{"(*DLLError).Error", Method, 0, ""},
+		{"(*DLLError).Unwrap", Method, 16, ""},
+		{"(*Filetime).Nanoseconds", Method, 0, ""},
+		{"(*Iovec).SetLen", Method, 0, ""},
+		{"(*LazyDLL).Handle", Method, 0, ""},
+		{"(*LazyDLL).Load", Method, 0, ""},
+		{"(*LazyDLL).NewProc", Method, 0, ""},
+		{"(*LazyProc).Addr", Method, 0, ""},
+		{"(*LazyProc).Call", Method, 0, ""},
+		{"(*LazyProc).Find", Method, 0, ""},
+		{"(*Msghdr).SetControllen", Method, 0, ""},
+		{"(*Proc).Addr", Method, 0, ""},
+		{"(*Proc).Call", Method, 0, ""},
+		{"(*PtraceRegs).PC", Method, 0, ""},
+		{"(*PtraceRegs).SetPC", Method, 0, ""},
+		{"(*RawSockaddrAny).Sockaddr", Method, 0, ""},
+		{"(*SID).Copy", Method, 0, ""},
+		{"(*SID).Len", Method, 0, ""},
+		{"(*SID).LookupAccount", Method, 0, ""},
+		{"(*SID).String", Method, 0, ""},
+		{"(*Timespec).Nano", Method, 0, ""},
+		{"(*Timespec).Unix", Method, 0, ""},
+		{"(*Timeval).Nano", Method, 0, ""},
+		{"(*Timeval).Nanoseconds", Method, 0, ""},
+		{"(*Timeval).Unix", Method, 0, ""},
+		{"(Errno).Error", Method, 0, ""},
+		{"(Errno).Is", Method, 13, ""},
+		{"(Errno).Temporary", Method, 0, ""},
+		{"(Errno).Timeout", Method, 0, ""},
+		{"(Signal).Signal", Method, 0, ""},
+		{"(Signal).String", Method, 0, ""},
+		{"(Token).Close", Method, 0, ""},
+		{"(Token).GetTokenPrimaryGroup", Method, 0, ""},
+		{"(Token).GetTokenUser", Method, 0, ""},
+		{"(Token).GetUserProfileDirectory", Method, 0, ""},
+		{"(WaitStatus).Continued", Method, 0, ""},
+		{"(WaitStatus).CoreDump", Method, 0, ""},
+		{"(WaitStatus).ExitStatus", Method, 0, ""},
+		{"(WaitStatus).Exited", Method, 0, ""},
+		{"(WaitStatus).Signal", Method, 0, ""},
+		{"(WaitStatus).Signaled", Method, 0, ""},
+		{"(WaitStatus).StopSignal", Method, 0, ""},
+		{"(WaitStatus).Stopped", Method, 0, ""},
+		{"(WaitStatus).TrapCause", Method, 0, ""},
+		{"AF_ALG", Const, 0, ""},
+		{"AF_APPLETALK", Const, 0, ""},
+		{"AF_ARP", Const, 0, ""},
+		{"AF_ASH", Const, 0, ""},
+		{"AF_ATM", Const, 0, ""},
+		{"AF_ATMPVC", Const, 0, ""},
+		{"AF_ATMSVC", Const, 0, ""},
+		{"AF_AX25", Const, 0, ""},
+		{"AF_BLUETOOTH", Const, 0, ""},
+		{"AF_BRIDGE", Const, 0, ""},
+		{"AF_CAIF", Const, 0, ""},
+		{"AF_CAN", Const, 0, ""},
+		{"AF_CCITT", Const, 0, ""},
+		{"AF_CHAOS", Const, 0, ""},
+		{"AF_CNT", Const, 0, ""},
+		{"AF_COIP", Const, 0, ""},
+		{"AF_DATAKIT", Const, 0, ""},
+		{"AF_DECnet", Const, 0, ""},
+		{"AF_DLI", Const, 0, ""},
+		{"AF_E164", Const, 0, ""},
+		{"AF_ECMA", Const, 0, ""},
+		{"AF_ECONET", Const, 0, ""},
+		{"AF_ENCAP", Const, 1, ""},
+		{"AF_FILE", Const, 0, ""},
+		{"AF_HYLINK", Const, 0, ""},
+		{"AF_IEEE80211", Const, 0, ""},
+		{"AF_IEEE802154", Const, 0, ""},
+		{"AF_IMPLINK", Const, 0, ""},
+		{"AF_INET", Const, 0, ""},
+		{"AF_INET6", Const, 0, ""},
+		{"AF_INET6_SDP", Const, 3, ""},
+		{"AF_INET_SDP", Const, 3, ""},
+		{"AF_IPX", Const, 0, ""},
+		{"AF_IRDA", Const, 0, ""},
+		{"AF_ISDN", Const, 0, ""},
+		{"AF_ISO", Const, 0, ""},
+		{"AF_IUCV", Const, 0, ""},
+		{"AF_KEY", Const, 0, ""},
+		{"AF_LAT", Const, 0, ""},
+		{"AF_LINK", Const, 0, ""},
+		{"AF_LLC", Const, 0, ""},
+		{"AF_LOCAL", Const, 0, ""},
+		{"AF_MAX", Const, 0, ""},
+		{"AF_MPLS", Const, 1, ""},
+		{"AF_NATM", Const, 0, ""},
+		{"AF_NDRV", Const, 0, ""},
+		{"AF_NETBEUI", Const, 0, ""},
+		{"AF_NETBIOS", Const, 0, ""},
+		{"AF_NETGRAPH", Const, 0, ""},
+		{"AF_NETLINK", Const, 0, ""},
+		{"AF_NETROM", Const, 0, ""},
+		{"AF_NS", Const, 0, ""},
+		{"AF_OROUTE", Const, 1, ""},
+		{"AF_OSI", Const, 0, ""},
+		{"AF_PACKET", Const, 0, ""},
+		{"AF_PHONET", Const, 0, ""},
+		{"AF_PPP", Const, 0, ""},
+		{"AF_PPPOX", Const, 0, ""},
+		{"AF_PUP", Const, 0, ""},
+		{"AF_RDS", Const, 0, ""},
+		{"AF_RESERVED_36", Const, 0, ""},
+		{"AF_ROSE", Const, 0, ""},
+		{"AF_ROUTE", Const, 0, ""},
+		{"AF_RXRPC", Const, 0, ""},
+		{"AF_SCLUSTER", Const, 0, ""},
+		{"AF_SECURITY", Const, 0, ""},
+		{"AF_SIP", Const, 0, ""},
+		{"AF_SLOW", Const, 0, ""},
+		{"AF_SNA", Const, 0, ""},
+		{"AF_SYSTEM", Const, 0, ""},
+		{"AF_TIPC", Const, 0, ""},
+		{"AF_UNIX", Const, 0, ""},
+		{"AF_UNSPEC", Const, 0, ""},
+		{"AF_UTUN", Const, 16, ""},
+		{"AF_VENDOR00", Const, 0, ""},
+		{"AF_VENDOR01", Const, 0, ""},
+		{"AF_VENDOR02", Const, 0, ""},
+		{"AF_VENDOR03", Const, 0, ""},
+		{"AF_VENDOR04", Const, 0, ""},
+		{"AF_VENDOR05", Const, 0, ""},
+		{"AF_VENDOR06", Const, 0, ""},
+		{"AF_VENDOR07", Const, 0, ""},
+		{"AF_VENDOR08", Const, 0, ""},
+		{"AF_VENDOR09", Const, 0, ""},
+		{"AF_VENDOR10", Const, 0, ""},
+		{"AF_VENDOR11", Const, 0, ""},
+		{"AF_VENDOR12", Const, 0, ""},
+		{"AF_VENDOR13", Const, 0, ""},
+		{"AF_VENDOR14", Const, 0, ""},
+		{"AF_VENDOR15", Const, 0, ""},
+		{"AF_VENDOR16", Const, 0, ""},
+		{"AF_VENDOR17", Const, 0, ""},
+		{"AF_VENDOR18", Const, 0, ""},
+		{"AF_VENDOR19", Const, 0, ""},
+		{"AF_VENDOR20", Const, 0, ""},
+		{"AF_VENDOR21", Const, 0, ""},
+		{"AF_VENDOR22", Const, 0, ""},
+		{"AF_VENDOR23", Const, 0, ""},
+		{"AF_VENDOR24", Const, 0, ""},
+		{"AF_VENDOR25", Const, 0, ""},
+		{"AF_VENDOR26", Const, 0, ""},
+		{"AF_VENDOR27", Const, 0, ""},
+		{"AF_VENDOR28", Const, 0, ""},
+		{"AF_VENDOR29", Const, 0, ""},
+		{"AF_VENDOR30", Const, 0, ""},
+		{"AF_VENDOR31", Const, 0, ""},
+		{"AF_VENDOR32", Const, 0, ""},
+		{"AF_VENDOR33", Const, 0, ""},
+		{"AF_VENDOR34", Const, 0, ""},
+		{"AF_VENDOR35", Const, 0, ""},
+		{"AF_VENDOR36", Const, 0, ""},
+		{"AF_VENDOR37", Const, 0, ""},
+		{"AF_VENDOR38", Const, 0, ""},
+		{"AF_VENDOR39", Const, 0, ""},
+		{"AF_VENDOR40", Const, 0, ""},
+		{"AF_VENDOR41", Const, 0, ""},
+		{"AF_VENDOR42", Const, 0, ""},
+		{"AF_VENDOR43", Const, 0, ""},
+		{"AF_VENDOR44", Const, 0, ""},
+		{"AF_VENDOR45", Const, 0, ""},
+		{"AF_VENDOR46", Const, 0, ""},
+		{"AF_VENDOR47", Const, 0, ""},
+		{"AF_WANPIPE", Const, 0, ""},
+		{"AF_X25", Const, 0, ""},
+		{"AI_CANONNAME", Const, 1, ""},
+		{"AI_NUMERICHOST", Const, 1, ""},
+		{"AI_PASSIVE", Const, 1, ""},
+		{"APPLICATION_ERROR", Const, 0, ""},
+		{"ARPHRD_ADAPT", Const, 0, ""},
+		{"ARPHRD_APPLETLK", Const, 0, ""},
+		{"ARPHRD_ARCNET", Const, 0, ""},
+		{"ARPHRD_ASH", Const, 0, ""},
+		{"ARPHRD_ATM", Const, 0, ""},
+		{"ARPHRD_AX25", Const, 0, ""},
+		{"ARPHRD_BIF", Const, 0, ""},
+		{"ARPHRD_CHAOS", Const, 0, ""},
+		{"ARPHRD_CISCO", Const, 0, ""},
+		{"ARPHRD_CSLIP", Const, 0, ""},
+		{"ARPHRD_CSLIP6", Const, 0, ""},
+		{"ARPHRD_DDCMP", Const, 0, ""},
+		{"ARPHRD_DLCI", Const, 0, ""},
+		{"ARPHRD_ECONET", Const, 0, ""},
+		{"ARPHRD_EETHER", Const, 0, ""},
+		{"ARPHRD_ETHER", Const, 0, ""},
+		{"ARPHRD_EUI64", Const, 0, ""},
+		{"ARPHRD_FCAL", Const, 0, ""},
+		{"ARPHRD_FCFABRIC", Const, 0, ""},
+		{"ARPHRD_FCPL", Const, 0, ""},
+		{"ARPHRD_FCPP", Const, 0, ""},
+		{"ARPHRD_FDDI", Const, 0, ""},
+		{"ARPHRD_FRAD", Const, 0, ""},
+		{"ARPHRD_FRELAY", Const, 1, ""},
+		{"ARPHRD_HDLC", Const, 0, ""},
+		{"ARPHRD_HIPPI", Const, 0, ""},
+		{"ARPHRD_HWX25", Const, 0, ""},
+		{"ARPHRD_IEEE1394", Const, 0, ""},
+		{"ARPHRD_IEEE802", Const, 0, ""},
+		{"ARPHRD_IEEE80211", Const, 0, ""},
+		{"ARPHRD_IEEE80211_PRISM", Const, 0, ""},
+		{"ARPHRD_IEEE80211_RADIOTAP", Const, 0, ""},
+		{"ARPHRD_IEEE802154", Const, 0, ""},
+		{"ARPHRD_IEEE802154_PHY", Const, 0, ""},
+		{"ARPHRD_IEEE802_TR", Const, 0, ""},
+		{"ARPHRD_INFINIBAND", Const, 0, ""},
+		{"ARPHRD_IPDDP", Const, 0, ""},
+		{"ARPHRD_IPGRE", Const, 0, ""},
+		{"ARPHRD_IRDA", Const, 0, ""},
+		{"ARPHRD_LAPB", Const, 0, ""},
+		{"ARPHRD_LOCALTLK", Const, 0, ""},
+		{"ARPHRD_LOOPBACK", Const, 0, ""},
+		{"ARPHRD_METRICOM", Const, 0, ""},
+		{"ARPHRD_NETROM", Const, 0, ""},
+		{"ARPHRD_NONE", Const, 0, ""},
+		{"ARPHRD_PIMREG", Const, 0, ""},
+		{"ARPHRD_PPP", Const, 0, ""},
+		{"ARPHRD_PRONET", Const, 0, ""},
+		{"ARPHRD_RAWHDLC", Const, 0, ""},
+		{"ARPHRD_ROSE", Const, 0, ""},
+		{"ARPHRD_RSRVD", Const, 0, ""},
+		{"ARPHRD_SIT", Const, 0, ""},
+		{"ARPHRD_SKIP", Const, 0, ""},
+		{"ARPHRD_SLIP", Const, 0, ""},
+		{"ARPHRD_SLIP6", Const, 0, ""},
+		{"ARPHRD_STRIP", Const, 1, ""},
+		{"ARPHRD_TUNNEL", Const, 0, ""},
+		{"ARPHRD_TUNNEL6", Const, 0, ""},
+		{"ARPHRD_VOID", Const, 0, ""},
+		{"ARPHRD_X25", Const, 0, ""},
+		{"AUTHTYPE_CLIENT", Const, 0, ""},
+		{"AUTHTYPE_SERVER", Const, 0, ""},
+		{"Accept", Func, 0, "func(fd int) (nfd int, sa Sockaddr, err error)"},
+		{"Accept4", Func, 1, "func(fd int, flags int) (nfd int, sa Sockaddr, err error)"},
+		{"AcceptEx", Func, 0, ""},
+		{"Access", Func, 0, "func(path string, mode uint32) (err error)"},
+		{"Acct", Func, 0, "func(path string) (err error)"},
+		{"AddrinfoW", Type, 1, ""},
+		{"AddrinfoW.Addr", Field, 1, ""},
+		{"AddrinfoW.Addrlen", Field, 1, ""},
+		{"AddrinfoW.Canonname", Field, 1, ""},
+		{"AddrinfoW.Family", Field, 1, ""},
+		{"AddrinfoW.Flags", Field, 1, ""},
+		{"AddrinfoW.Next", Field, 1, ""},
+		{"AddrinfoW.Protocol", Field, 1, ""},
+		{"AddrinfoW.Socktype", Field, 1, ""},
+		{"Adjtime", Func, 0, ""},
+		{"Adjtimex", Func, 0, "func(buf *Timex) (state int, err error)"},
+		{"AllThreadsSyscall", Func, 16, "func(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr) (r1 uintptr, r2 uintptr, err Errno)"},
+		{"AllThreadsSyscall6", Func, 16, "func(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr, a4 uintptr, a5 uintptr, a6 uintptr) (r1 uintptr, r2 uintptr, err Errno)"},
+		{"AttachLsf", Func, 0, "func(fd int, i []SockFilter) error"},
+		{"B0", Const, 0, ""},
+		{"B1000000", Const, 0, ""},
+		{"B110", Const, 0, ""},
+		{"B115200", Const, 0, ""},
+		{"B1152000", Const, 0, ""},
+		{"B1200", Const, 0, ""},
+		{"B134", Const, 0, ""},
+		{"B14400", Const, 1, ""},
+		{"B150", Const, 0, ""},
+		{"B1500000", Const, 0, ""},
+		{"B1800", Const, 0, ""},
+		{"B19200", Const, 0, ""},
+		{"B200", Const, 0, ""},
+		{"B2000000", Const, 0, ""},
+		{"B230400", Const, 0, ""},
+		{"B2400", Const, 0, ""},
+		{"B2500000", Const, 0, ""},
+		{"B28800", Const, 1, ""},
+		{"B300", Const, 0, ""},
+		{"B3000000", Const, 0, ""},
+		{"B3500000", Const, 0, ""},
+		{"B38400", Const, 0, ""},
+		{"B4000000", Const, 0, ""},
+		{"B460800", Const, 0, ""},
+		{"B4800", Const, 0, ""},
+		{"B50", Const, 0, ""},
+		{"B500000", Const, 0, ""},
+		{"B57600", Const, 0, ""},
+		{"B576000", Const, 0, ""},
+		{"B600", Const, 0, ""},
+		{"B7200", Const, 1, ""},
+		{"B75", Const, 0, ""},
+		{"B76800", Const, 1, ""},
+		{"B921600", Const, 0, ""},
+		{"B9600", Const, 0, ""},
+		{"BASE_PROTOCOL", Const, 2, ""},
+		{"BIOCFEEDBACK", Const, 0, ""},
+		{"BIOCFLUSH", Const, 0, ""},
+		{"BIOCGBLEN", Const, 0, ""},
+		{"BIOCGDIRECTION", Const, 0, ""},
+		{"BIOCGDIRFILT", Const, 1, ""},
+		{"BIOCGDLT", Const, 0, ""},
+		{"BIOCGDLTLIST", Const, 0, ""},
+		{"BIOCGETBUFMODE", Const, 0, ""},
+		{"BIOCGETIF", Const, 0, ""},
+		{"BIOCGETZMAX", Const, 0, ""},
+		{"BIOCGFEEDBACK", Const, 1, ""},
+		{"BIOCGFILDROP", Const, 1, ""},
+		{"BIOCGHDRCMPLT", Const, 0, ""},
+		{"BIOCGRSIG", Const, 0, ""},
+		{"BIOCGRTIMEOUT", Const, 0, ""},
+		{"BIOCGSEESENT", Const, 0, ""},
+		{"BIOCGSTATS", Const, 0, ""},
+		{"BIOCGSTATSOLD", Const, 1, ""},
+		{"BIOCGTSTAMP", Const, 1, ""},
+		{"BIOCIMMEDIATE", Const, 0, ""},
+		{"BIOCLOCK", Const, 0, ""},
+		{"BIOCPROMISC", Const, 0, ""},
+		{"BIOCROTZBUF", Const, 0, ""},
+		{"BIOCSBLEN", Const, 0, ""},
+		{"BIOCSDIRECTION", Const, 0, ""},
+		{"BIOCSDIRFILT", Const, 1, ""},
+		{"BIOCSDLT", Const, 0, ""},
+		{"BIOCSETBUFMODE", Const, 0, ""},
+		{"BIOCSETF", Const, 0, ""},
+		{"BIOCSETFNR", Const, 0, ""},
+		{"BIOCSETIF", Const, 0, ""},
+		{"BIOCSETWF", Const, 0, ""},
+		{"BIOCSETZBUF", Const, 0, ""},
+		{"BIOCSFEEDBACK", Const, 1, ""},
+		{"BIOCSFILDROP", Const, 1, ""},
+		{"BIOCSHDRCMPLT", Const, 0, ""},
+		{"BIOCSRSIG", Const, 0, ""},
+		{"BIOCSRTIMEOUT", Const, 0, ""},
+		{"BIOCSSEESENT", Const, 0, ""},
+		{"BIOCSTCPF", Const, 1, ""},
+		{"BIOCSTSTAMP", Const, 1, ""},
+		{"BIOCSUDPF", Const, 1, ""},
+		{"BIOCVERSION", Const, 0, ""},
+		{"BPF_A", Const, 0, ""},
+		{"BPF_ABS", Const, 0, ""},
+		{"BPF_ADD", Const, 0, ""},
+		{"BPF_ALIGNMENT", Const, 0, ""},
+		{"BPF_ALIGNMENT32", Const, 1, ""},
+		{"BPF_ALU", Const, 0, ""},
+		{"BPF_AND", Const, 0, ""},
+		{"BPF_B", Const, 0, ""},
+		{"BPF_BUFMODE_BUFFER", Const, 0, ""},
+		{"BPF_BUFMODE_ZBUF", Const, 0, ""},
+		{"BPF_DFLTBUFSIZE", Const, 1, ""},
+		{"BPF_DIRECTION_IN", Const, 1, ""},
+		{"BPF_DIRECTION_OUT", Const, 1, ""},
+		{"BPF_DIV", Const, 0, ""},
+		{"BPF_H", Const, 0, ""},
+		{"BPF_IMM", Const, 0, ""},
+		{"BPF_IND", Const, 0, ""},
+		{"BPF_JA", Const, 0, ""},
+		{"BPF_JEQ", Const, 0, ""},
+		{"BPF_JGE", Const, 0, ""},
+		{"BPF_JGT", Const, 0, ""},
+		{"BPF_JMP", Const, 0, ""},
+		{"BPF_JSET", Const, 0, ""},
+		{"BPF_K", Const, 0, ""},
+		{"BPF_LD", Const, 0, ""},
+		{"BPF_LDX", Const, 0, ""},
+		{"BPF_LEN", Const, 0, ""},
+		{"BPF_LSH", Const, 0, ""},
+		{"BPF_MAJOR_VERSION", Const, 0, ""},
+		{"BPF_MAXBUFSIZE", Const, 0, ""},
+		{"BPF_MAXINSNS", Const, 0, ""},
+		{"BPF_MEM", Const, 0, ""},
+		{"BPF_MEMWORDS", Const, 0, ""},
+		{"BPF_MINBUFSIZE", Const, 0, ""},
+		{"BPF_MINOR_VERSION", Const, 0, ""},
+		{"BPF_MISC", Const, 0, ""},
+		{"BPF_MSH", Const, 0, ""},
+		{"BPF_MUL", Const, 0, ""},
+		{"BPF_NEG", Const, 0, ""},
+		{"BPF_OR", Const, 0, ""},
+		{"BPF_RELEASE", Const, 0, ""},
+		{"BPF_RET", Const, 0, ""},
+		{"BPF_RSH", Const, 0, ""},
+		{"BPF_ST", Const, 0, ""},
+		{"BPF_STX", Const, 0, ""},
+		{"BPF_SUB", Const, 0, ""},
+		{"BPF_TAX", Const, 0, ""},
+		{"BPF_TXA", Const, 0, ""},
+		{"BPF_T_BINTIME", Const, 1, ""},
+		{"BPF_T_BINTIME_FAST", Const, 1, ""},
+		{"BPF_T_BINTIME_MONOTONIC", Const, 1, ""},
+		{"BPF_T_BINTIME_MONOTONIC_FAST", Const, 1, ""},
+		{"BPF_T_FAST", Const, 1, ""},
+		{"BPF_T_FLAG_MASK", Const, 1, ""},
+		{"BPF_T_FORMAT_MASK", Const, 1, ""},
+		{"BPF_T_MICROTIME", Const, 1, ""},
+		{"BPF_T_MICROTIME_FAST", Const, 1, ""},
+		{"BPF_T_MICROTIME_MONOTONIC", Const, 1, ""},
+		{"BPF_T_MICROTIME_MONOTONIC_FAST", Const, 1, ""},
+		{"BPF_T_MONOTONIC", Const, 1, ""},
+		{"BPF_T_MONOTONIC_FAST", Const, 1, ""},
+		{"BPF_T_NANOTIME", Const, 1, ""},
+		{"BPF_T_NANOTIME_FAST", Const, 1, ""},
+		{"BPF_T_NANOTIME_MONOTONIC", Const, 1, ""},
+		{"BPF_T_NANOTIME_MONOTONIC_FAST", Const, 1, ""},
+		{"BPF_T_NONE", Const, 1, ""},
+		{"BPF_T_NORMAL", Const, 1, ""},
+		{"BPF_W", Const, 0, ""},
+		{"BPF_X", Const, 0, ""},
+		{"BRKINT", Const, 0, ""},
+		{"Bind", Func, 0, "func(fd int, sa Sockaddr) (err error)"},
+		{"BindToDevice", Func, 0, "func(fd int, device string) (err error)"},
+		{"BpfBuflen", Func, 0, ""},
+		{"BpfDatalink", Func, 0, ""},
+		{"BpfHdr", Type, 0, ""},
+		{"BpfHdr.Caplen", Field, 0, ""},
+		{"BpfHdr.Datalen", Field, 0, ""},
+		{"BpfHdr.Hdrlen", Field, 0, ""},
+		{"BpfHdr.Pad_cgo_0", Field, 0, ""},
+		{"BpfHdr.Tstamp", Field, 0, ""},
+		{"BpfHeadercmpl", Func, 0, ""},
+		{"BpfInsn", Type, 0, ""},
+		{"BpfInsn.Code", Field, 0, ""},
+		{"BpfInsn.Jf", Field, 0, ""},
+		{"BpfInsn.Jt", Field, 0, ""},
+		{"BpfInsn.K", Field, 0, ""},
+		{"BpfInterface", Func, 0, ""},
+		{"BpfJump", Func, 0, ""},
+		{"BpfProgram", Type, 0, ""},
+		{"BpfProgram.Insns", Field, 0, ""},
+		{"BpfProgram.Len", Field, 0, ""},
+		{"BpfProgram.Pad_cgo_0", Field, 0, ""},
+		{"BpfStat", Type, 0, ""},
+		{"BpfStat.Capt", Field, 2, ""},
+		{"BpfStat.Drop", Field, 0, ""},
+		{"BpfStat.Padding", Field, 2, ""},
+		{"BpfStat.Recv", Field, 0, ""},
+		{"BpfStats", Func, 0, ""},
+		{"BpfStmt", Func, 0, ""},
+		{"BpfTimeout", Func, 0, ""},
+		{"BpfTimeval", Type, 2, ""},
+		{"BpfTimeval.Sec", Field, 2, ""},
+		{"BpfTimeval.Usec", Field, 2, ""},
+		{"BpfVersion", Type, 0, ""},
+		{"BpfVersion.Major", Field, 0, ""},
+		{"BpfVersion.Minor", Field, 0, ""},
+		{"BpfZbuf", Type, 0, ""},
+		{"BpfZbuf.Bufa", Field, 0, ""},
+		{"BpfZbuf.Bufb", Field, 0, ""},
+		{"BpfZbuf.Buflen", Field, 0, ""},
+		{"BpfZbufHeader", Type, 0, ""},
+		{"BpfZbufHeader.Kernel_gen", Field, 0, ""},
+		{"BpfZbufHeader.Kernel_len", Field, 0, ""},
+		{"BpfZbufHeader.User_gen", Field, 0, ""},
+		{"BpfZbufHeader.X_bzh_pad", Field, 0, ""},
+		{"ByHandleFileInformation", Type, 0, ""},
+		{"ByHandleFileInformation.CreationTime", Field, 0, ""},
+		{"ByHandleFileInformation.FileAttributes", Field, 0, ""},
+		{"ByHandleFileInformation.FileIndexHigh", Field, 0, ""},
+		{"ByHandleFileInformation.FileIndexLow", Field, 0, ""},
+		{"ByHandleFileInformation.FileSizeHigh", Field, 0, ""},
+		{"ByHandleFileInformation.FileSizeLow", Field, 0, ""},
+		{"ByHandleFileInformation.LastAccessTime", Field, 0, ""},
+		{"ByHandleFileInformation.LastWriteTime", Field, 0, ""},
+		{"ByHandleFileInformation.NumberOfLinks", Field, 0, ""},
+		{"ByHandleFileInformation.VolumeSerialNumber", Field, 0, ""},
+		{"BytePtrFromString", Func, 1, "func(s string) (*byte, error)"},
+		{"ByteSliceFromString", Func, 1, "func(s string) ([]byte, error)"},
+		{"CCR0_FLUSH", Const, 1, ""},
+		{"CERT_CHAIN_POLICY_AUTHENTICODE", Const, 0, ""},
+		{"CERT_CHAIN_POLICY_AUTHENTICODE_TS", Const, 0, ""},
+		{"CERT_CHAIN_POLICY_BASE", Const, 0, ""},
+		{"CERT_CHAIN_POLICY_BASIC_CONSTRAINTS", Const, 0, ""},
+		{"CERT_CHAIN_POLICY_EV", Const, 0, ""},
+		{"CERT_CHAIN_POLICY_MICROSOFT_ROOT", Const, 0, ""},
+		{"CERT_CHAIN_POLICY_NT_AUTH", Const, 0, ""},
+		{"CERT_CHAIN_POLICY_SSL", Const, 0, ""},
+		{"CERT_E_CN_NO_MATCH", Const, 0, ""},
+		{"CERT_E_EXPIRED", Const, 0, ""},
+		{"CERT_E_PURPOSE", Const, 0, ""},
+		{"CERT_E_ROLE", Const, 0, ""},
+		{"CERT_E_UNTRUSTEDROOT", Const, 0, ""},
+		{"CERT_STORE_ADD_ALWAYS", Const, 0, ""},
+		{"CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG", Const, 0, ""},
+		{"CERT_STORE_PROV_MEMORY", Const, 0, ""},
+		{"CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT", Const, 0, ""},
+		{"CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT", Const, 0, ""},
+		{"CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT", Const, 0, ""},
+		{"CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT", Const, 0, ""},
+		{"CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT", Const, 0, ""},
+		{"CERT_TRUST_INVALID_BASIC_CONSTRAINTS", Const, 0, ""},
+		{"CERT_TRUST_INVALID_EXTENSION", Const, 0, ""},
+		{"CERT_TRUST_INVALID_NAME_CONSTRAINTS", Const, 0, ""},
+		{"CERT_TRUST_INVALID_POLICY_CONSTRAINTS", Const, 0, ""},
+		{"CERT_TRUST_IS_CYCLIC", Const, 0, ""},
+		{"CERT_TRUST_IS_EXPLICIT_DISTRUST", Const, 0, ""},
+		{"CERT_TRUST_IS_NOT_SIGNATURE_VALID", Const, 0, ""},
+		{"CERT_TRUST_IS_NOT_TIME_VALID", Const, 0, ""},
+		{"CERT_TRUST_IS_NOT_VALID_FOR_USAGE", Const, 0, ""},
+		{"CERT_TRUST_IS_OFFLINE_REVOCATION", Const, 0, ""},
+		{"CERT_TRUST_IS_REVOKED", Const, 0, ""},
+		{"CERT_TRUST_IS_UNTRUSTED_ROOT", Const, 0, ""},
+		{"CERT_TRUST_NO_ERROR", Const, 0, ""},
+		{"CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY", Const, 0, ""},
+		{"CERT_TRUST_REVOCATION_STATUS_UNKNOWN", Const, 0, ""},
+		{"CFLUSH", Const, 1, ""},
+		{"CLOCAL", Const, 0, ""},
+		{"CLONE_CHILD_CLEARTID", Const, 2, ""},
+		{"CLONE_CHILD_SETTID", Const, 2, ""},
+		{"CLONE_CLEAR_SIGHAND", Const, 20, ""},
+		{"CLONE_CSIGNAL", Const, 3, ""},
+		{"CLONE_DETACHED", Const, 2, ""},
+		{"CLONE_FILES", Const, 2, ""},
+		{"CLONE_FS", Const, 2, ""},
+		{"CLONE_INTO_CGROUP", Const, 20, ""},
+		{"CLONE_IO", Const, 2, ""},
+		{"CLONE_NEWCGROUP", Const, 20, ""},
+		{"CLONE_NEWIPC", Const, 2, ""},
+		{"CLONE_NEWNET", Const, 2, ""},
+		{"CLONE_NEWNS", Const, 2, ""},
+		{"CLONE_NEWPID", Const, 2, ""},
+		{"CLONE_NEWTIME", Const, 20, ""},
+		{"CLONE_NEWUSER", Const, 2, ""},
+		{"CLONE_NEWUTS", Const, 2, ""},
+		{"CLONE_PARENT", Const, 2, ""},
+		{"CLONE_PARENT_SETTID", Const, 2, ""},
+		{"CLONE_PID", Const, 3, ""},
+		{"CLONE_PIDFD", Const, 20, ""},
+		{"CLONE_PTRACE", Const, 2, ""},
+		{"CLONE_SETTLS", Const, 2, ""},
+		{"CLONE_SIGHAND", Const, 2, ""},
+		{"CLONE_SYSVSEM", Const, 2, ""},
+		{"CLONE_THREAD", Const, 2, ""},
+		{"CLONE_UNTRACED", Const, 2, ""},
+		{"CLONE_VFORK", Const, 2, ""},
+		{"CLONE_VM", Const, 2, ""},
+		{"CPUID_CFLUSH", Const, 1, ""},
+		{"CREAD", Const, 0, ""},
+		{"CREATE_ALWAYS", Const, 0, ""},
+		{"CREATE_NEW", Const, 0, ""},
+		{"CREATE_NEW_PROCESS_GROUP", Const, 1, ""},
+		{"CREATE_UNICODE_ENVIRONMENT", Const, 0, ""},
+		{"CRYPT_DEFAULT_CONTAINER_OPTIONAL", Const, 0, ""},
+		{"CRYPT_DELETEKEYSET", Const, 0, ""},
+		{"CRYPT_MACHINE_KEYSET", Const, 0, ""},
+		{"CRYPT_NEWKEYSET", Const, 0, ""},
+		{"CRYPT_SILENT", Const, 0, ""},
+		{"CRYPT_VERIFYCONTEXT", Const, 0, ""},
+		{"CS5", Const, 0, ""},
+		{"CS6", Const, 0, ""},
+		{"CS7", Const, 0, ""},
+		{"CS8", Const, 0, ""},
+		{"CSIZE", Const, 0, ""},
+		{"CSTART", Const, 1, ""},
+		{"CSTATUS", Const, 1, ""},
+		{"CSTOP", Const, 1, ""},
+		{"CSTOPB", Const, 0, ""},
+		{"CSUSP", Const, 1, ""},
+		{"CTL_MAXNAME", Const, 0, ""},
+		{"CTL_NET", Const, 0, ""},
+		{"CTL_QUERY", Const, 1, ""},
+		{"CTRL_BREAK_EVENT", Const, 1, ""},
+		{"CTRL_CLOSE_EVENT", Const, 14, ""},
+		{"CTRL_C_EVENT", Const, 1, ""},
+		{"CTRL_LOGOFF_EVENT", Const, 14, ""},
+		{"CTRL_SHUTDOWN_EVENT", Const, 14, ""},
+		{"CancelIo", Func, 0, ""},
+		{"CancelIoEx", Func, 1, ""},
+		{"CertAddCertificateContextToStore", Func, 0, ""},
+		{"CertChainContext", Type, 0, ""},
+		{"CertChainContext.ChainCount", Field, 0, ""},
+		{"CertChainContext.Chains", Field, 0, ""},
+		{"CertChainContext.HasRevocationFreshnessTime", Field, 0, ""},
+		{"CertChainContext.LowerQualityChainCount", Field, 0, ""},
+		{"CertChainContext.LowerQualityChains", Field, 0, ""},
+		{"CertChainContext.RevocationFreshnessTime", Field, 0, ""},
+		{"CertChainContext.Size", Field, 0, ""},
+		{"CertChainContext.TrustStatus", Field, 0, ""},
+		{"CertChainElement", Type, 0, ""},
+		{"CertChainElement.ApplicationUsage", Field, 0, ""},
+		{"CertChainElement.CertContext", Field, 0, ""},
+		{"CertChainElement.ExtendedErrorInfo", Field, 0, ""},
+		{"CertChainElement.IssuanceUsage", Field, 0, ""},
+		{"CertChainElement.RevocationInfo", Field, 0, ""},
+		{"CertChainElement.Size", Field, 0, ""},
+		{"CertChainElement.TrustStatus", Field, 0, ""},
+		{"CertChainPara", Type, 0, ""},
+		{"CertChainPara.CacheResync", Field, 0, ""},
+		{"CertChainPara.CheckRevocationFreshnessTime", Field, 0, ""},
+		{"CertChainPara.RequestedUsage", Field, 0, ""},
+		{"CertChainPara.RequstedIssuancePolicy", Field, 0, ""},
+		{"CertChainPara.RevocationFreshnessTime", Field, 0, ""},
+		{"CertChainPara.Size", Field, 0, ""},
+		{"CertChainPara.URLRetrievalTimeout", Field, 0, ""},
+		{"CertChainPolicyPara", Type, 0, ""},
+		{"CertChainPolicyPara.ExtraPolicyPara", Field, 0, ""},
+		{"CertChainPolicyPara.Flags", Field, 0, ""},
+		{"CertChainPolicyPara.Size", Field, 0, ""},
+		{"CertChainPolicyStatus", Type, 0, ""},
+		{"CertChainPolicyStatus.ChainIndex", Field, 0, ""},
+		{"CertChainPolicyStatus.ElementIndex", Field, 0, ""},
+		{"CertChainPolicyStatus.Error", Field, 0, ""},
+		{"CertChainPolicyStatus.ExtraPolicyStatus", Field, 0, ""},
+		{"CertChainPolicyStatus.Size", Field, 0, ""},
+		{"CertCloseStore", Func, 0, ""},
+		{"CertContext", Type, 0, ""},
+		{"CertContext.CertInfo", Field, 0, ""},
+		{"CertContext.EncodedCert", Field, 0, ""},
+		{"CertContext.EncodingType", Field, 0, ""},
+		{"CertContext.Length", Field, 0, ""},
+		{"CertContext.Store", Field, 0, ""},
+		{"CertCreateCertificateContext", Func, 0, ""},
+		{"CertEnhKeyUsage", Type, 0, ""},
+		{"CertEnhKeyUsage.Length", Field, 0, ""},
+		{"CertEnhKeyUsage.UsageIdentifiers", Field, 0, ""},
+		{"CertEnumCertificatesInStore", Func, 0, ""},
+		{"CertFreeCertificateChain", Func, 0, ""},
+		{"CertFreeCertificateContext", Func, 0, ""},
+		{"CertGetCertificateChain", Func, 0, ""},
+		{"CertInfo", Type, 11, ""},
+		{"CertOpenStore", Func, 0, ""},
+		{"CertOpenSystemStore", Func, 0, ""},
+		{"CertRevocationCrlInfo", Type, 11, ""},
+		{"CertRevocationInfo", Type, 0, ""},
+		{"CertRevocationInfo.CrlInfo", Field, 0, ""},
+		{"CertRevocationInfo.FreshnessTime", Field, 0, ""},
+		{"CertRevocationInfo.HasFreshnessTime", Field, 0, ""},
+		{"CertRevocationInfo.OidSpecificInfo", Field, 0, ""},
+		{"CertRevocationInfo.RevocationOid", Field, 0, ""},
+		{"CertRevocationInfo.RevocationResult", Field, 0, ""},
+		{"CertRevocationInfo.Size", Field, 0, ""},
+		{"CertSimpleChain", Type, 0, ""},
+		{"CertSimpleChain.Elements", Field, 0, ""},
+		{"CertSimpleChain.HasRevocationFreshnessTime", Field, 0, ""},
+		{"CertSimpleChain.NumElements", Field, 0, ""},
+		{"CertSimpleChain.RevocationFreshnessTime", Field, 0, ""},
+		{"CertSimpleChain.Size", Field, 0, ""},
+		{"CertSimpleChain.TrustListInfo", Field, 0, ""},
+		{"CertSimpleChain.TrustStatus", Field, 0, ""},
+		{"CertTrustListInfo", Type, 11, ""},
+		{"CertTrustStatus", Type, 0, ""},
+		{"CertTrustStatus.ErrorStatus", Field, 0, ""},
+		{"CertTrustStatus.InfoStatus", Field, 0, ""},
+		{"CertUsageMatch", Type, 0, ""},
+		{"CertUsageMatch.Type", Field, 0, ""},
+		{"CertUsageMatch.Usage", Field, 0, ""},
+		{"CertVerifyCertificateChainPolicy", Func, 0, ""},
+		{"Chdir", Func, 0, "func(path string) (err error)"},
+		{"CheckBpfVersion", Func, 0, ""},
+		{"Chflags", Func, 0, ""},
+		{"Chmod", Func, 0, "func(path string, mode uint32) (err error)"},
+		{"Chown", Func, 0, "func(path string, uid int, gid int) (err error)"},
+		{"Chroot", Func, 0, "func(path string) (err error)"},
+		{"Clearenv", Func, 0, "func()"},
+		{"Close", Func, 0, "func(fd int) (err error)"},
+		{"CloseHandle", Func, 0, ""},
+		{"CloseOnExec", Func, 0, "func(fd int)"},
+		{"Closesocket", Func, 0, ""},
+		{"CmsgLen", Func, 0, "func(datalen int) int"},
+		{"CmsgSpace", Func, 0, "func(datalen int) int"},
+		{"Cmsghdr", Type, 0, ""},
+		{"Cmsghdr.Len", Field, 0, ""},
+		{"Cmsghdr.Level", Field, 0, ""},
+		{"Cmsghdr.Type", Field, 0, ""},
+		{"Cmsghdr.X__cmsg_data", Field, 0, ""},
+		{"CommandLineToArgv", Func, 0, ""},
+		{"ComputerName", Func, 0, ""},
+		{"Conn", Type, 9, ""},
+		{"Connect", Func, 0, "func(fd int, sa Sockaddr) (err error)"},
+		{"ConnectEx", Func, 1, ""},
+		{"ConvertSidToStringSid", Func, 0, ""},
+		{"ConvertStringSidToSid", Func, 0, ""},
+		{"CopySid", Func, 0, ""},
+		{"Creat", Func, 0, "func(path string, mode uint32) (fd int, err error)"},
+		{"CreateDirectory", Func, 0, ""},
+		{"CreateFile", Func, 0, ""},
+		{"CreateFileMapping", Func, 0, ""},
+		{"CreateHardLink", Func, 4, ""},
+		{"CreateIoCompletionPort", Func, 0, ""},
+		{"CreatePipe", Func, 0, ""},
+		{"CreateProcess", Func, 0, ""},
+		{"CreateProcessAsUser", Func, 10, ""},
+		{"CreateSymbolicLink", Func, 4, ""},
+		{"CreateToolhelp32Snapshot", Func, 4, ""},
+		{"Credential", Type, 0, ""},
+		{"Credential.Gid", Field, 0, ""},
+		{"Credential.Groups", Field, 0, ""},
+		{"Credential.NoSetGroups", Field, 9, ""},
+		{"Credential.Uid", Field, 0, ""},
+		{"CryptAcquireContext", Func, 0, ""},
+		{"CryptGenRandom", Func, 0, ""},
+		{"CryptReleaseContext", Func, 0, ""},
+		{"DIOCBSFLUSH", Const, 1, ""},
+		{"DIOCOSFPFLUSH", Const, 1, ""},
+		{"DLL", Type, 0, ""},
+		{"DLL.Handle", Field, 0, ""},
+		{"DLL.Name", Field, 0, ""},
+		{"DLLError", Type, 0, ""},
+		{"DLLError.Err", Field, 0, ""},
+		{"DLLError.Msg", Field, 0, ""},
+		{"DLLError.ObjName", Field, 0, ""},
+		{"DLT_A429", Const, 0, ""},
+		{"DLT_A653_ICM", Const, 0, ""},
+		{"DLT_AIRONET_HEADER", Const, 0, ""},
+		{"DLT_AOS", Const, 1, ""},
+		{"DLT_APPLE_IP_OVER_IEEE1394", Const, 0, ""},
+		{"DLT_ARCNET", Const, 0, ""},
+		{"DLT_ARCNET_LINUX", Const, 0, ""},
+		{"DLT_ATM_CLIP", Const, 0, ""},
+		{"DLT_ATM_RFC1483", Const, 0, ""},
+		{"DLT_AURORA", Const, 0, ""},
+		{"DLT_AX25", Const, 0, ""},
+		{"DLT_AX25_KISS", Const, 0, ""},
+		{"DLT_BACNET_MS_TP", Const, 0, ""},
+		{"DLT_BLUETOOTH_HCI_H4", Const, 0, ""},
+		{"DLT_BLUETOOTH_HCI_H4_WITH_PHDR", Const, 0, ""},
+		{"DLT_CAN20B", Const, 0, ""},
+		{"DLT_CAN_SOCKETCAN", Const, 1, ""},
+		{"DLT_CHAOS", Const, 0, ""},
+		{"DLT_CHDLC", Const, 0, ""},
+		{"DLT_CISCO_IOS", Const, 0, ""},
+		{"DLT_C_HDLC", Const, 0, ""},
+		{"DLT_C_HDLC_WITH_DIR", Const, 0, ""},
+		{"DLT_DBUS", Const, 1, ""},
+		{"DLT_DECT", Const, 1, ""},
+		{"DLT_DOCSIS", Const, 0, ""},
+		{"DLT_DVB_CI", Const, 1, ""},
+		{"DLT_ECONET", Const, 0, ""},
+		{"DLT_EN10MB", Const, 0, ""},
+		{"DLT_EN3MB", Const, 0, ""},
+		{"DLT_ENC", Const, 0, ""},
+		{"DLT_ERF", Const, 0, ""},
+		{"DLT_ERF_ETH", Const, 0, ""},
+		{"DLT_ERF_POS", Const, 0, ""},
+		{"DLT_FC_2", Const, 1, ""},
+		{"DLT_FC_2_WITH_FRAME_DELIMS", Const, 1, ""},
+		{"DLT_FDDI", Const, 0, ""},
+		{"DLT_FLEXRAY", Const, 0, ""},
+		{"DLT_FRELAY", Const, 0, ""},
+		{"DLT_FRELAY_WITH_DIR", Const, 0, ""},
+		{"DLT_GCOM_SERIAL", Const, 0, ""},
+		{"DLT_GCOM_T1E1", Const, 0, ""},
+		{"DLT_GPF_F", Const, 0, ""},
+		{"DLT_GPF_T", Const, 0, ""},
+		{"DLT_GPRS_LLC", Const, 0, ""},
+		{"DLT_GSMTAP_ABIS", Const, 1, ""},
+		{"DLT_GSMTAP_UM", Const, 1, ""},
+		{"DLT_HDLC", Const, 1, ""},
+		{"DLT_HHDLC", Const, 0, ""},
+		{"DLT_HIPPI", Const, 1, ""},
+		{"DLT_IBM_SN", Const, 0, ""},
+		{"DLT_IBM_SP", Const, 0, ""},
+		{"DLT_IEEE802", Const, 0, ""},
+		{"DLT_IEEE802_11", Const, 0, ""},
+		{"DLT_IEEE802_11_RADIO", Const, 0, ""},
+		{"DLT_IEEE802_11_RADIO_AVS", Const, 0, ""},
+		{"DLT_IEEE802_15_4", Const, 0, ""},
+		{"DLT_IEEE802_15_4_LINUX", Const, 0, ""},
+		{"DLT_IEEE802_15_4_NOFCS", Const, 1, ""},
+		{"DLT_IEEE802_15_4_NONASK_PHY", Const, 0, ""},
+		{"DLT_IEEE802_16_MAC_CPS", Const, 0, ""},
+		{"DLT_IEEE802_16_MAC_CPS_RADIO", Const, 0, ""},
+		{"DLT_IPFILTER", Const, 0, ""},
+		{"DLT_IPMB", Const, 0, ""},
+		{"DLT_IPMB_LINUX", Const, 0, ""},
+		{"DLT_IPNET", Const, 1, ""},
+		{"DLT_IPOIB", Const, 1, ""},
+		{"DLT_IPV4", Const, 1, ""},
+		{"DLT_IPV6", Const, 1, ""},
+		{"DLT_IP_OVER_FC", Const, 0, ""},
+		{"DLT_JUNIPER_ATM1", Const, 0, ""},
+		{"DLT_JUNIPER_ATM2", Const, 0, ""},
+		{"DLT_JUNIPER_ATM_CEMIC", Const, 1, ""},
+		{"DLT_JUNIPER_CHDLC", Const, 0, ""},
+		{"DLT_JUNIPER_ES", Const, 0, ""},
+		{"DLT_JUNIPER_ETHER", Const, 0, ""},
+		{"DLT_JUNIPER_FIBRECHANNEL", Const, 1, ""},
+		{"DLT_JUNIPER_FRELAY", Const, 0, ""},
+		{"DLT_JUNIPER_GGSN", Const, 0, ""},
+		{"DLT_JUNIPER_ISM", Const, 0, ""},
+		{"DLT_JUNIPER_MFR", Const, 0, ""},
+		{"DLT_JUNIPER_MLFR", Const, 0, ""},
+		{"DLT_JUNIPER_MLPPP", Const, 0, ""},
+		{"DLT_JUNIPER_MONITOR", Const, 0, ""},
+		{"DLT_JUNIPER_PIC_PEER", Const, 0, ""},
+		{"DLT_JUNIPER_PPP", Const, 0, ""},
+		{"DLT_JUNIPER_PPPOE", Const, 0, ""},
+		{"DLT_JUNIPER_PPPOE_ATM", Const, 0, ""},
+		{"DLT_JUNIPER_SERVICES", Const, 0, ""},
+		{"DLT_JUNIPER_SRX_E2E", Const, 1, ""},
+		{"DLT_JUNIPER_ST", Const, 0, ""},
+		{"DLT_JUNIPER_VP", Const, 0, ""},
+		{"DLT_JUNIPER_VS", Const, 1, ""},
+		{"DLT_LAPB_WITH_DIR", Const, 0, ""},
+		{"DLT_LAPD", Const, 0, ""},
+		{"DLT_LIN", Const, 0, ""},
+		{"DLT_LINUX_EVDEV", Const, 1, ""},
+		{"DLT_LINUX_IRDA", Const, 0, ""},
+		{"DLT_LINUX_LAPD", Const, 0, ""},
+		{"DLT_LINUX_PPP_WITHDIRECTION", Const, 0, ""},
+		{"DLT_LINUX_SLL", Const, 0, ""},
+		{"DLT_LOOP", Const, 0, ""},
+		{"DLT_LTALK", Const, 0, ""},
+		{"DLT_MATCHING_MAX", Const, 1, ""},
+		{"DLT_MATCHING_MIN", Const, 1, ""},
+		{"DLT_MFR", Const, 0, ""},
+		{"DLT_MOST", Const, 0, ""},
+		{"DLT_MPEG_2_TS", Const, 1, ""},
+		{"DLT_MPLS", Const, 1, ""},
+		{"DLT_MTP2", Const, 0, ""},
+		{"DLT_MTP2_WITH_PHDR", Const, 0, ""},
+		{"DLT_MTP3", Const, 0, ""},
+		{"DLT_MUX27010", Const, 1, ""},
+		{"DLT_NETANALYZER", Const, 1, ""},
+		{"DLT_NETANALYZER_TRANSPARENT", Const, 1, ""},
+		{"DLT_NFC_LLCP", Const, 1, ""},
+		{"DLT_NFLOG", Const, 1, ""},
+		{"DLT_NG40", Const, 1, ""},
+		{"DLT_NULL", Const, 0, ""},
+		{"DLT_PCI_EXP", Const, 0, ""},
+		{"DLT_PFLOG", Const, 0, ""},
+		{"DLT_PFSYNC", Const, 0, ""},
+		{"DLT_PPI", Const, 0, ""},
+		{"DLT_PPP", Const, 0, ""},
+		{"DLT_PPP_BSDOS", Const, 0, ""},
+		{"DLT_PPP_ETHER", Const, 0, ""},
+		{"DLT_PPP_PPPD", Const, 0, ""},
+		{"DLT_PPP_SERIAL", Const, 0, ""},
+		{"DLT_PPP_WITH_DIR", Const, 0, ""},
+		{"DLT_PPP_WITH_DIRECTION", Const, 0, ""},
+		{"DLT_PRISM_HEADER", Const, 0, ""},
+		{"DLT_PRONET", Const, 0, ""},
+		{"DLT_RAIF1", Const, 0, ""},
+		{"DLT_RAW", Const, 0, ""},
+		{"DLT_RAWAF_MASK", Const, 1, ""},
+		{"DLT_RIO", Const, 0, ""},
+		{"DLT_SCCP", Const, 0, ""},
+		{"DLT_SITA", Const, 0, ""},
+		{"DLT_SLIP", Const, 0, ""},
+		{"DLT_SLIP_BSDOS", Const, 0, ""},
+		{"DLT_STANAG_5066_D_PDU", Const, 1, ""},
+		{"DLT_SUNATM", Const, 0, ""},
+		{"DLT_SYMANTEC_FIREWALL", Const, 0, ""},
+		{"DLT_TZSP", Const, 0, ""},
+		{"DLT_USB", Const, 0, ""},
+		{"DLT_USB_LINUX", Const, 0, ""},
+		{"DLT_USB_LINUX_MMAPPED", Const, 1, ""},
+		{"DLT_USER0", Const, 0, ""},
+		{"DLT_USER1", Const, 0, ""},
+		{"DLT_USER10", Const, 0, ""},
+		{"DLT_USER11", Const, 0, ""},
+		{"DLT_USER12", Const, 0, ""},
+		{"DLT_USER13", Const, 0, ""},
+		{"DLT_USER14", Const, 0, ""},
+		{"DLT_USER15", Const, 0, ""},
+		{"DLT_USER2", Const, 0, ""},
+		{"DLT_USER3", Const, 0, ""},
+		{"DLT_USER4", Const, 0, ""},
+		{"DLT_USER5", Const, 0, ""},
+		{"DLT_USER6", Const, 0, ""},
+		{"DLT_USER7", Const, 0, ""},
+		{"DLT_USER8", Const, 0, ""},
+		{"DLT_USER9", Const, 0, ""},
+		{"DLT_WIHART", Const, 1, ""},
+		{"DLT_X2E_SERIAL", Const, 0, ""},
+		{"DLT_X2E_XORAYA", Const, 0, ""},
+		{"DNSMXData", Type, 0, ""},
+		{"DNSMXData.NameExchange", Field, 0, ""},
+		{"DNSMXData.Pad", Field, 0, ""},
+		{"DNSMXData.Preference", Field, 0, ""},
+		{"DNSPTRData", Type, 0, ""},
+		{"DNSPTRData.Host", Field, 0, ""},
+		{"DNSRecord", Type, 0, ""},
+		{"DNSRecord.Data", Field, 0, ""},
+		{"DNSRecord.Dw", Field, 0, ""},
+		{"DNSRecord.Length", Field, 0, ""},
+		{"DNSRecord.Name", Field, 0, ""},
+		{"DNSRecord.Next", Field, 0, ""},
+		{"DNSRecord.Reserved", Field, 0, ""},
+		{"DNSRecord.Ttl", Field, 0, ""},
+		{"DNSRecord.Type", Field, 0, ""},
+		{"DNSSRVData", Type, 0, ""},
+		{"DNSSRVData.Pad", Field, 0, ""},
+		{"DNSSRVData.Port", Field, 0, ""},
+		{"DNSSRVData.Priority", Field, 0, ""},
+		{"DNSSRVData.Target", Field, 0, ""},
+		{"DNSSRVData.Weight", Field, 0, ""},
+		{"DNSTXTData", Type, 0, ""},
+		{"DNSTXTData.StringArray", Field, 0, ""},
+		{"DNSTXTData.StringCount", Field, 0, ""},
+		{"DNS_INFO_NO_RECORDS", Const, 4, ""},
+		{"DNS_TYPE_A", Const, 0, ""},
+		{"DNS_TYPE_A6", Const, 0, ""},
+		{"DNS_TYPE_AAAA", Const, 0, ""},
+		{"DNS_TYPE_ADDRS", Const, 0, ""},
+		{"DNS_TYPE_AFSDB", Const, 0, ""},
+		{"DNS_TYPE_ALL", Const, 0, ""},
+		{"DNS_TYPE_ANY", Const, 0, ""},
+		{"DNS_TYPE_ATMA", Const, 0, ""},
+		{"DNS_TYPE_AXFR", Const, 0, ""},
+		{"DNS_TYPE_CERT", Const, 0, ""},
+		{"DNS_TYPE_CNAME", Const, 0, ""},
+		{"DNS_TYPE_DHCID", Const, 0, ""},
+		{"DNS_TYPE_DNAME", Const, 0, ""},
+		{"DNS_TYPE_DNSKEY", Const, 0, ""},
+		{"DNS_TYPE_DS", Const, 0, ""},
+		{"DNS_TYPE_EID", Const, 0, ""},
+		{"DNS_TYPE_GID", Const, 0, ""},
+		{"DNS_TYPE_GPOS", Const, 0, ""},
+		{"DNS_TYPE_HINFO", Const, 0, ""},
+		{"DNS_TYPE_ISDN", Const, 0, ""},
+		{"DNS_TYPE_IXFR", Const, 0, ""},
+		{"DNS_TYPE_KEY", Const, 0, ""},
+		{"DNS_TYPE_KX", Const, 0, ""},
+		{"DNS_TYPE_LOC", Const, 0, ""},
+		{"DNS_TYPE_MAILA", Const, 0, ""},
+		{"DNS_TYPE_MAILB", Const, 0, ""},
+		{"DNS_TYPE_MB", Const, 0, ""},
+		{"DNS_TYPE_MD", Const, 0, ""},
+		{"DNS_TYPE_MF", Const, 0, ""},
+		{"DNS_TYPE_MG", Const, 0, ""},
+		{"DNS_TYPE_MINFO", Const, 0, ""},
+		{"DNS_TYPE_MR", Const, 0, ""},
+		{"DNS_TYPE_MX", Const, 0, ""},
+		{"DNS_TYPE_NAPTR", Const, 0, ""},
+		{"DNS_TYPE_NBSTAT", Const, 0, ""},
+		{"DNS_TYPE_NIMLOC", Const, 0, ""},
+		{"DNS_TYPE_NS", Const, 0, ""},
+		{"DNS_TYPE_NSAP", Const, 0, ""},
+		{"DNS_TYPE_NSAPPTR", Const, 0, ""},
+		{"DNS_TYPE_NSEC", Const, 0, ""},
+		{"DNS_TYPE_NULL", Const, 0, ""},
+		{"DNS_TYPE_NXT", Const, 0, ""},
+		{"DNS_TYPE_OPT", Const, 0, ""},
+		{"DNS_TYPE_PTR", Const, 0, ""},
+		{"DNS_TYPE_PX", Const, 0, ""},
+		{"DNS_TYPE_RP", Const, 0, ""},
+		{"DNS_TYPE_RRSIG", Const, 0, ""},
+		{"DNS_TYPE_RT", Const, 0, ""},
+		{"DNS_TYPE_SIG", Const, 0, ""},
+		{"DNS_TYPE_SINK", Const, 0, ""},
+		{"DNS_TYPE_SOA", Const, 0, ""},
+		{"DNS_TYPE_SRV", Const, 0, ""},
+		{"DNS_TYPE_TEXT", Const, 0, ""},
+		{"DNS_TYPE_TKEY", Const, 0, ""},
+		{"DNS_TYPE_TSIG", Const, 0, ""},
+		{"DNS_TYPE_UID", Const, 0, ""},
+		{"DNS_TYPE_UINFO", Const, 0, ""},
+		{"DNS_TYPE_UNSPEC", Const, 0, ""},
+		{"DNS_TYPE_WINS", Const, 0, ""},
+		{"DNS_TYPE_WINSR", Const, 0, ""},
+		{"DNS_TYPE_WKS", Const, 0, ""},
+		{"DNS_TYPE_X25", Const, 0, ""},
+		{"DT_BLK", Const, 0, ""},
+		{"DT_CHR", Const, 0, ""},
+		{"DT_DIR", Const, 0, ""},
+		{"DT_FIFO", Const, 0, ""},
+		{"DT_LNK", Const, 0, ""},
+		{"DT_REG", Const, 0, ""},
+		{"DT_SOCK", Const, 0, ""},
+		{"DT_UNKNOWN", Const, 0, ""},
+		{"DT_WHT", Const, 0, ""},
+		{"DUPLICATE_CLOSE_SOURCE", Const, 0, ""},
+		{"DUPLICATE_SAME_ACCESS", Const, 0, ""},
+		{"DeleteFile", Func, 0, ""},
+		{"DetachLsf", Func, 0, "func(fd int) error"},
+		{"DeviceIoControl", Func, 4, ""},
+		{"Dirent", Type, 0, ""},
+		{"Dirent.Fileno", Field, 0, ""},
+		{"Dirent.Ino", Field, 0, ""},
+		{"Dirent.Name", Field, 0, ""},
+		{"Dirent.Namlen", Field, 0, ""},
+		{"Dirent.Off", Field, 0, ""},
+		{"Dirent.Pad0", Field, 12, ""},
+		{"Dirent.Pad1", Field, 12, ""},
+		{"Dirent.Pad_cgo_0", Field, 0, ""},
+		{"Dirent.Reclen", Field, 0, ""},
+		{"Dirent.Seekoff", Field, 0, ""},
+		{"Dirent.Type", Field, 0, ""},
+		{"Dirent.X__d_padding", Field, 3, ""},
+		{"DnsNameCompare", Func, 4, ""},
+		{"DnsQuery", Func, 0, ""},
+		{"DnsRecordListFree", Func, 0, ""},
+		{"DnsSectionAdditional", Const, 4, ""},
+		{"DnsSectionAnswer", Const, 4, ""},
+		{"DnsSectionAuthority", Const, 4, ""},
+		{"DnsSectionQuestion", Const, 4, ""},
+		{"Dup", Func, 0, "func(oldfd int) (fd int, err error)"},
+		{"Dup2", Func, 0, "func(oldfd int, newfd int) (err error)"},
+		{"Dup3", Func, 2, "func(oldfd int, newfd int, flags int) (err error)"},
+		{"DuplicateHandle", Func, 0, ""},
+		{"E2BIG", Const, 0, ""},
+		{"EACCES", Const, 0, ""},
+		{"EADDRINUSE", Const, 0, ""},
+		{"EADDRNOTAVAIL", Const, 0, ""},
+		{"EADV", Const, 0, ""},
+		{"EAFNOSUPPORT", Const, 0, ""},
+		{"EAGAIN", Const, 0, ""},
+		{"EALREADY", Const, 0, ""},
+		{"EAUTH", Const, 0, ""},
+		{"EBADARCH", Const, 0, ""},
+		{"EBADE", Const, 0, ""},
+		{"EBADEXEC", Const, 0, ""},
+		{"EBADF", Const, 0, ""},
+		{"EBADFD", Const, 0, ""},
+		{"EBADMACHO", Const, 0, ""},
+		{"EBADMSG", Const, 0, ""},
+		{"EBADR", Const, 0, ""},
+		{"EBADRPC", Const, 0, ""},
+		{"EBADRQC", Const, 0, ""},
+		{"EBADSLT", Const, 0, ""},
+		{"EBFONT", Const, 0, ""},
+		{"EBUSY", Const, 0, ""},
+		{"ECANCELED", Const, 0, ""},
+		{"ECAPMODE", Const, 1, ""},
+		{"ECHILD", Const, 0, ""},
+		{"ECHO", Const, 0, ""},
+		{"ECHOCTL", Const, 0, ""},
+		{"ECHOE", Const, 0, ""},
+		{"ECHOK", Const, 0, ""},
+		{"ECHOKE", Const, 0, ""},
+		{"ECHONL", Const, 0, ""},
+		{"ECHOPRT", Const, 0, ""},
+		{"ECHRNG", Const, 0, ""},
+		{"ECOMM", Const, 0, ""},
+		{"ECONNABORTED", Const, 0, ""},
+		{"ECONNREFUSED", Const, 0, ""},
+		{"ECONNRESET", Const, 0, ""},
+		{"EDEADLK", Const, 0, ""},
+		{"EDEADLOCK", Const, 0, ""},
+		{"EDESTADDRREQ", Const, 0, ""},
+		{"EDEVERR", Const, 0, ""},
+		{"EDOM", Const, 0, ""},
+		{"EDOOFUS", Const, 0, ""},
+		{"EDOTDOT", Const, 0, ""},
+		{"EDQUOT", Const, 0, ""},
+		{"EEXIST", Const, 0, ""},
+		{"EFAULT", Const, 0, ""},
+		{"EFBIG", Const, 0, ""},
+		{"EFER_LMA", Const, 1, ""},
+		{"EFER_LME", Const, 1, ""},
+		{"EFER_NXE", Const, 1, ""},
+		{"EFER_SCE", Const, 1, ""},
+		{"EFTYPE", Const, 0, ""},
+		{"EHOSTDOWN", Const, 0, ""},
+		{"EHOSTUNREACH", Const, 0, ""},
+		{"EHWPOISON", Const, 0, ""},
+		{"EIDRM", Const, 0, ""},
+		{"EILSEQ", Const, 0, ""},
+		{"EINPROGRESS", Const, 0, ""},
+		{"EINTR", Const, 0, ""},
+		{"EINVAL", Const, 0, ""},
+		{"EIO", Const, 0, ""},
+		{"EIPSEC", Const, 1, ""},
+		{"EISCONN", Const, 0, ""},
+		{"EISDIR", Const, 0, ""},
+		{"EISNAM", Const, 0, ""},
+		{"EKEYEXPIRED", Const, 0, ""},
+		{"EKEYREJECTED", Const, 0, ""},
+		{"EKEYREVOKED", Const, 0, ""},
+		{"EL2HLT", Const, 0, ""},
+		{"EL2NSYNC", Const, 0, ""},
+		{"EL3HLT", Const, 0, ""},
+		{"EL3RST", Const, 0, ""},
+		{"ELAST", Const, 0, ""},
+		{"ELF_NGREG", Const, 0, ""},
+		{"ELF_PRARGSZ", Const, 0, ""},
+		{"ELIBACC", Const, 0, ""},
+		{"ELIBBAD", Const, 0, ""},
+		{"ELIBEXEC", Const, 0, ""},
+		{"ELIBMAX", Const, 0, ""},
+		{"ELIBSCN", Const, 0, ""},
+		{"ELNRNG", Const, 0, ""},
+		{"ELOOP", Const, 0, ""},
+		{"EMEDIUMTYPE", Const, 0, ""},
+		{"EMFILE", Const, 0, ""},
+		{"EMLINK", Const, 0, ""},
+		{"EMSGSIZE", Const, 0, ""},
+		{"EMT_TAGOVF", Const, 1, ""},
+		{"EMULTIHOP", Const, 0, ""},
+		{"EMUL_ENABLED", Const, 1, ""},
+		{"EMUL_LINUX", Const, 1, ""},
+		{"EMUL_LINUX32", Const, 1, ""},
+		{"EMUL_MAXID", Const, 1, ""},
+		{"EMUL_NATIVE", Const, 1, ""},
+		{"ENAMETOOLONG", Const, 0, ""},
+		{"ENAVAIL", Const, 0, ""},
+		{"ENDRUNDISC", Const, 1, ""},
+		{"ENEEDAUTH", Const, 0, ""},
+		{"ENETDOWN", Const, 0, ""},
+		{"ENETRESET", Const, 0, ""},
+		{"ENETUNREACH", Const, 0, ""},
+		{"ENFILE", Const, 0, ""},
+		{"ENOANO", Const, 0, ""},
+		{"ENOATTR", Const, 0, ""},
+		{"ENOBUFS", Const, 0, ""},
+		{"ENOCSI", Const, 0, ""},
+		{"ENODATA", Const, 0, ""},
+		{"ENODEV", Const, 0, ""},
+		{"ENOENT", Const, 0, ""},
+		{"ENOEXEC", Const, 0, ""},
+		{"ENOKEY", Const, 0, ""},
+		{"ENOLCK", Const, 0, ""},
+		{"ENOLINK", Const, 0, ""},
+		{"ENOMEDIUM", Const, 0, ""},
+		{"ENOMEM", Const, 0, ""},
+		{"ENOMSG", Const, 0, ""},
+		{"ENONET", Const, 0, ""},
+		{"ENOPKG", Const, 0, ""},
+		{"ENOPOLICY", Const, 0, ""},
+		{"ENOPROTOOPT", Const, 0, ""},
+		{"ENOSPC", Const, 0, ""},
+		{"ENOSR", Const, 0, ""},
+		{"ENOSTR", Const, 0, ""},
+		{"ENOSYS", Const, 0, ""},
+		{"ENOTBLK", Const, 0, ""},
+		{"ENOTCAPABLE", Const, 0, ""},
+		{"ENOTCONN", Const, 0, ""},
+		{"ENOTDIR", Const, 0, ""},
+		{"ENOTEMPTY", Const, 0, ""},
+		{"ENOTNAM", Const, 0, ""},
+		{"ENOTRECOVERABLE", Const, 0, ""},
+		{"ENOTSOCK", Const, 0, ""},
+		{"ENOTSUP", Const, 0, ""},
+		{"ENOTTY", Const, 0, ""},
+		{"ENOTUNIQ", Const, 0, ""},
+		{"ENXIO", Const, 0, ""},
+		{"EN_SW_CTL_INF", Const, 1, ""},
+		{"EN_SW_CTL_PREC", Const, 1, ""},
+		{"EN_SW_CTL_ROUND", Const, 1, ""},
+		{"EN_SW_DATACHAIN", Const, 1, ""},
+		{"EN_SW_DENORM", Const, 1, ""},
+		{"EN_SW_INVOP", Const, 1, ""},
+		{"EN_SW_OVERFLOW", Const, 1, ""},
+		{"EN_SW_PRECLOSS", Const, 1, ""},
+		{"EN_SW_UNDERFLOW", Const, 1, ""},
+		{"EN_SW_ZERODIV", Const, 1, ""},
+		{"EOPNOTSUPP", Const, 0, ""},
+		{"EOVERFLOW", Const, 0, ""},
+		{"EOWNERDEAD", Const, 0, ""},
+		{"EPERM", Const, 0, ""},
+		{"EPFNOSUPPORT", Const, 0, ""},
+		{"EPIPE", Const, 0, ""},
+		{"EPOLLERR", Const, 0, ""},
+		{"EPOLLET", Const, 0, ""},
+		{"EPOLLHUP", Const, 0, ""},
+		{"EPOLLIN", Const, 0, ""},
+		{"EPOLLMSG", Const, 0, ""},
+		{"EPOLLONESHOT", Const, 0, ""},
+		{"EPOLLOUT", Const, 0, ""},
+		{"EPOLLPRI", Const, 0, ""},
+		{"EPOLLRDBAND", Const, 0, ""},
+		{"EPOLLRDHUP", Const, 0, ""},
+		{"EPOLLRDNORM", Const, 0, ""},
+		{"EPOLLWRBAND", Const, 0, ""},
+		{"EPOLLWRNORM", Const, 0, ""},
+		{"EPOLL_CLOEXEC", Const, 0, ""},
+		{"EPOLL_CTL_ADD", Const, 0, ""},
+		{"EPOLL_CTL_DEL", Const, 0, ""},
+		{"EPOLL_CTL_MOD", Const, 0, ""},
+		{"EPOLL_NONBLOCK", Const, 0, ""},
+		{"EPROCLIM", Const, 0, ""},
+		{"EPROCUNAVAIL", Const, 0, ""},
+		{"EPROGMISMATCH", Const, 0, ""},
+		{"EPROGUNAVAIL", Const, 0, ""},
+		{"EPROTO", Const, 0, ""},
+		{"EPROTONOSUPPORT", Const, 0, ""},
+		{"EPROTOTYPE", Const, 0, ""},
+		{"EPWROFF", Const, 0, ""},
+		{"EQFULL", Const, 16, ""},
+		{"ERANGE", Const, 0, ""},
+		{"EREMCHG", Const, 0, ""},
+		{"EREMOTE", Const, 0, ""},
+		{"EREMOTEIO", Const, 0, ""},
+		{"ERESTART", Const, 0, ""},
+		{"ERFKILL", Const, 0, ""},
+		{"EROFS", Const, 0, ""},
+		{"ERPCMISMATCH", Const, 0, ""},
+		{"ERROR_ACCESS_DENIED", Const, 0, ""},
+		{"ERROR_ALREADY_EXISTS", Const, 0, ""},
+		{"ERROR_BROKEN_PIPE", Const, 0, ""},
+		{"ERROR_BUFFER_OVERFLOW", Const, 0, ""},
+		{"ERROR_DIR_NOT_EMPTY", Const, 8, ""},
+		{"ERROR_ENVVAR_NOT_FOUND", Const, 0, ""},
+		{"ERROR_FILE_EXISTS", Const, 0, ""},
+		{"ERROR_FILE_NOT_FOUND", Const, 0, ""},
+		{"ERROR_HANDLE_EOF", Const, 2, ""},
+		{"ERROR_INSUFFICIENT_BUFFER", Const, 0, ""},
+		{"ERROR_IO_PENDING", Const, 0, ""},
+		{"ERROR_MOD_NOT_FOUND", Const, 0, ""},
+		{"ERROR_MORE_DATA", Const, 3, ""},
+		{"ERROR_NETNAME_DELETED", Const, 3, ""},
+		{"ERROR_NOT_FOUND", Const, 1, ""},
+		{"ERROR_NO_MORE_FILES", Const, 0, ""},
+		{"ERROR_OPERATION_ABORTED", Const, 0, ""},
+		{"ERROR_PATH_NOT_FOUND", Const, 0, ""},
+		{"ERROR_PRIVILEGE_NOT_HELD", Const, 4, ""},
+		{"ERROR_PROC_NOT_FOUND", Const, 0, ""},
+		{"ESHLIBVERS", Const, 0, ""},
+		{"ESHUTDOWN", Const, 0, ""},
+		{"ESOCKTNOSUPPORT", Const, 0, ""},
+		{"ESPIPE", Const, 0, ""},
+		{"ESRCH", Const, 0, ""},
+		{"ESRMNT", Const, 0, ""},
+		{"ESTALE", Const, 0, ""},
+		{"ESTRPIPE", Const, 0, ""},
+		{"ETHERCAP_JUMBO_MTU", Const, 1, ""},
+		{"ETHERCAP_VLAN_HWTAGGING", Const, 1, ""},
+		{"ETHERCAP_VLAN_MTU", Const, 1, ""},
+		{"ETHERMIN", Const, 1, ""},
+		{"ETHERMTU", Const, 1, ""},
+		{"ETHERMTU_JUMBO", Const, 1, ""},
+		{"ETHERTYPE_8023", Const, 1, ""},
+		{"ETHERTYPE_AARP", Const, 1, ""},
+		{"ETHERTYPE_ACCTON", Const, 1, ""},
+		{"ETHERTYPE_AEONIC", Const, 1, ""},
+		{"ETHERTYPE_ALPHA", Const, 1, ""},
+		{"ETHERTYPE_AMBER", Const, 1, ""},
+		{"ETHERTYPE_AMOEBA", Const, 1, ""},
+		{"ETHERTYPE_AOE", Const, 1, ""},
+		{"ETHERTYPE_APOLLO", Const, 1, ""},
+		{"ETHERTYPE_APOLLODOMAIN", Const, 1, ""},
+		{"ETHERTYPE_APPLETALK", Const, 1, ""},
+		{"ETHERTYPE_APPLITEK", Const, 1, ""},
+		{"ETHERTYPE_ARGONAUT", Const, 1, ""},
+		{"ETHERTYPE_ARP", Const, 1, ""},
+		{"ETHERTYPE_AT", Const, 1, ""},
+		{"ETHERTYPE_ATALK", Const, 1, ""},
+		{"ETHERTYPE_ATOMIC", Const, 1, ""},
+		{"ETHERTYPE_ATT", Const, 1, ""},
+		{"ETHERTYPE_ATTSTANFORD", Const, 1, ""},
+		{"ETHERTYPE_AUTOPHON", Const, 1, ""},
+		{"ETHERTYPE_AXIS", Const, 1, ""},
+		{"ETHERTYPE_BCLOOP", Const, 1, ""},
+		{"ETHERTYPE_BOFL", Const, 1, ""},
+		{"ETHERTYPE_CABLETRON", Const, 1, ""},
+		{"ETHERTYPE_CHAOS", Const, 1, ""},
+		{"ETHERTYPE_COMDESIGN", Const, 1, ""},
+		{"ETHERTYPE_COMPUGRAPHIC", Const, 1, ""},
+		{"ETHERTYPE_COUNTERPOINT", Const, 1, ""},
+		{"ETHERTYPE_CRONUS", Const, 1, ""},
+		{"ETHERTYPE_CRONUSVLN", Const, 1, ""},
+		{"ETHERTYPE_DCA", Const, 1, ""},
+		{"ETHERTYPE_DDE", Const, 1, ""},
+		{"ETHERTYPE_DEBNI", Const, 1, ""},
+		{"ETHERTYPE_DECAM", Const, 1, ""},
+		{"ETHERTYPE_DECCUST", Const, 1, ""},
+		{"ETHERTYPE_DECDIAG", Const, 1, ""},
+		{"ETHERTYPE_DECDNS", Const, 1, ""},
+		{"ETHERTYPE_DECDTS", Const, 1, ""},
+		{"ETHERTYPE_DECEXPER", Const, 1, ""},
+		{"ETHERTYPE_DECLAST", Const, 1, ""},
+		{"ETHERTYPE_DECLTM", Const, 1, ""},
+		{"ETHERTYPE_DECMUMPS", Const, 1, ""},
+		{"ETHERTYPE_DECNETBIOS", Const, 1, ""},
+		{"ETHERTYPE_DELTACON", Const, 1, ""},
+		{"ETHERTYPE_DIDDLE", Const, 1, ""},
+		{"ETHERTYPE_DLOG1", Const, 1, ""},
+		{"ETHERTYPE_DLOG2", Const, 1, ""},
+		{"ETHERTYPE_DN", Const, 1, ""},
+		{"ETHERTYPE_DOGFIGHT", Const, 1, ""},
+		{"ETHERTYPE_DSMD", Const, 1, ""},
+		{"ETHERTYPE_ECMA", Const, 1, ""},
+		{"ETHERTYPE_ENCRYPT", Const, 1, ""},
+		{"ETHERTYPE_ES", Const, 1, ""},
+		{"ETHERTYPE_EXCELAN", Const, 1, ""},
+		{"ETHERTYPE_EXPERDATA", Const, 1, ""},
+		{"ETHERTYPE_FLIP", Const, 1, ""},
+		{"ETHERTYPE_FLOWCONTROL", Const, 1, ""},
+		{"ETHERTYPE_FRARP", Const, 1, ""},
+		{"ETHERTYPE_GENDYN", Const, 1, ""},
+		{"ETHERTYPE_HAYES", Const, 1, ""},
+		{"ETHERTYPE_HIPPI_FP", Const, 1, ""},
+		{"ETHERTYPE_HITACHI", Const, 1, ""},
+		{"ETHERTYPE_HP", Const, 1, ""},
+		{"ETHERTYPE_IEEEPUP", Const, 1, ""},
+		{"ETHERTYPE_IEEEPUPAT", Const, 1, ""},
+		{"ETHERTYPE_IMLBL", Const, 1, ""},
+		{"ETHERTYPE_IMLBLDIAG", Const, 1, ""},
+		{"ETHERTYPE_IP", Const, 1, ""},
+		{"ETHERTYPE_IPAS", Const, 1, ""},
+		{"ETHERTYPE_IPV6", Const, 1, ""},
+		{"ETHERTYPE_IPX", Const, 1, ""},
+		{"ETHERTYPE_IPXNEW", Const, 1, ""},
+		{"ETHERTYPE_KALPANA", Const, 1, ""},
+		{"ETHERTYPE_LANBRIDGE", Const, 1, ""},
+		{"ETHERTYPE_LANPROBE", Const, 1, ""},
+		{"ETHERTYPE_LAT", Const, 1, ""},
+		{"ETHERTYPE_LBACK", Const, 1, ""},
+		{"ETHERTYPE_LITTLE", Const, 1, ""},
+		{"ETHERTYPE_LLDP", Const, 1, ""},
+		{"ETHERTYPE_LOGICRAFT", Const, 1, ""},
+		{"ETHERTYPE_LOOPBACK", Const, 1, ""},
+		{"ETHERTYPE_MATRA", Const, 1, ""},
+		{"ETHERTYPE_MAX", Const, 1, ""},
+		{"ETHERTYPE_MERIT", Const, 1, ""},
+		{"ETHERTYPE_MICP", Const, 1, ""},
+		{"ETHERTYPE_MOPDL", Const, 1, ""},
+		{"ETHERTYPE_MOPRC", Const, 1, ""},
+		{"ETHERTYPE_MOTOROLA", Const, 1, ""},
+		{"ETHERTYPE_MPLS", Const, 1, ""},
+		{"ETHERTYPE_MPLS_MCAST", Const, 1, ""},
+		{"ETHERTYPE_MUMPS", Const, 1, ""},
+		{"ETHERTYPE_NBPCC", Const, 1, ""},
+		{"ETHERTYPE_NBPCLAIM", Const, 1, ""},
+		{"ETHERTYPE_NBPCLREQ", Const, 1, ""},
+		{"ETHERTYPE_NBPCLRSP", Const, 1, ""},
+		{"ETHERTYPE_NBPCREQ", Const, 1, ""},
+		{"ETHERTYPE_NBPCRSP", Const, 1, ""},
+		{"ETHERTYPE_NBPDG", Const, 1, ""},
+		{"ETHERTYPE_NBPDGB", Const, 1, ""},
+		{"ETHERTYPE_NBPDLTE", Const, 1, ""},
+		{"ETHERTYPE_NBPRAR", Const, 1, ""},
+		{"ETHERTYPE_NBPRAS", Const, 1, ""},
+		{"ETHERTYPE_NBPRST", Const, 1, ""},
+		{"ETHERTYPE_NBPSCD", Const, 1, ""},
+		{"ETHERTYPE_NBPVCD", Const, 1, ""},
+		{"ETHERTYPE_NBS", Const, 1, ""},
+		{"ETHERTYPE_NCD", Const, 1, ""},
+		{"ETHERTYPE_NESTAR", Const, 1, ""},
+		{"ETHERTYPE_NETBEUI", Const, 1, ""},
+		{"ETHERTYPE_NOVELL", Const, 1, ""},
+		{"ETHERTYPE_NS", Const, 1, ""},
+		{"ETHERTYPE_NSAT", Const, 1, ""},
+		{"ETHERTYPE_NSCOMPAT", Const, 1, ""},
+		{"ETHERTYPE_NTRAILER", Const, 1, ""},
+		{"ETHERTYPE_OS9", Const, 1, ""},
+		{"ETHERTYPE_OS9NET", Const, 1, ""},
+		{"ETHERTYPE_PACER", Const, 1, ""},
+		{"ETHERTYPE_PAE", Const, 1, ""},
+		{"ETHERTYPE_PCS", Const, 1, ""},
+		{"ETHERTYPE_PLANNING", Const, 1, ""},
+		{"ETHERTYPE_PPP", Const, 1, ""},
+		{"ETHERTYPE_PPPOE", Const, 1, ""},
+		{"ETHERTYPE_PPPOEDISC", Const, 1, ""},
+		{"ETHERTYPE_PRIMENTS", Const, 1, ""},
+		{"ETHERTYPE_PUP", Const, 1, ""},
+		{"ETHERTYPE_PUPAT", Const, 1, ""},
+		{"ETHERTYPE_QINQ", Const, 1, ""},
+		{"ETHERTYPE_RACAL", Const, 1, ""},
+		{"ETHERTYPE_RATIONAL", Const, 1, ""},
+		{"ETHERTYPE_RAWFR", Const, 1, ""},
+		{"ETHERTYPE_RCL", Const, 1, ""},
+		{"ETHERTYPE_RDP", Const, 1, ""},
+		{"ETHERTYPE_RETIX", Const, 1, ""},
+		{"ETHERTYPE_REVARP", Const, 1, ""},
+		{"ETHERTYPE_SCA", Const, 1, ""},
+		{"ETHERTYPE_SECTRA", Const, 1, ""},
+		{"ETHERTYPE_SECUREDATA", Const, 1, ""},
+		{"ETHERTYPE_SGITW", Const, 1, ""},
+		{"ETHERTYPE_SG_BOUNCE", Const, 1, ""},
+		{"ETHERTYPE_SG_DIAG", Const, 1, ""},
+		{"ETHERTYPE_SG_NETGAMES", Const, 1, ""},
+		{"ETHERTYPE_SG_RESV", Const, 1, ""},
+		{"ETHERTYPE_SIMNET", Const, 1, ""},
+		{"ETHERTYPE_SLOW", Const, 1, ""},
+		{"ETHERTYPE_SLOWPROTOCOLS", Const, 1, ""},
+		{"ETHERTYPE_SNA", Const, 1, ""},
+		{"ETHERTYPE_SNMP", Const, 1, ""},
+		{"ETHERTYPE_SONIX", Const, 1, ""},
+		{"ETHERTYPE_SPIDER", Const, 1, ""},
+		{"ETHERTYPE_SPRITE", Const, 1, ""},
+		{"ETHERTYPE_STP", Const, 1, ""},
+		{"ETHERTYPE_TALARIS", Const, 1, ""},
+		{"ETHERTYPE_TALARISMC", Const, 1, ""},
+		{"ETHERTYPE_TCPCOMP", Const, 1, ""},
+		{"ETHERTYPE_TCPSM", Const, 1, ""},
+		{"ETHERTYPE_TEC", Const, 1, ""},
+		{"ETHERTYPE_TIGAN", Const, 1, ""},
+		{"ETHERTYPE_TRAIL", Const, 1, ""},
+		{"ETHERTYPE_TRANSETHER", Const, 1, ""},
+		{"ETHERTYPE_TYMSHARE", Const, 1, ""},
+		{"ETHERTYPE_UBBST", Const, 1, ""},
+		{"ETHERTYPE_UBDEBUG", Const, 1, ""},
+		{"ETHERTYPE_UBDIAGLOOP", Const, 1, ""},
+		{"ETHERTYPE_UBDL", Const, 1, ""},
+		{"ETHERTYPE_UBNIU", Const, 1, ""},
+		{"ETHERTYPE_UBNMC", Const, 1, ""},
+		{"ETHERTYPE_VALID", Const, 1, ""},
+		{"ETHERTYPE_VARIAN", Const, 1, ""},
+		{"ETHERTYPE_VAXELN", Const, 1, ""},
+		{"ETHERTYPE_VEECO", Const, 1, ""},
+		{"ETHERTYPE_VEXP", Const, 1, ""},
+		{"ETHERTYPE_VGLAB", Const, 1, ""},
+		{"ETHERTYPE_VINES", Const, 1, ""},
+		{"ETHERTYPE_VINESECHO", Const, 1, ""},
+		{"ETHERTYPE_VINESLOOP", Const, 1, ""},
+		{"ETHERTYPE_VITAL", Const, 1, ""},
+		{"ETHERTYPE_VLAN", Const, 1, ""},
+		{"ETHERTYPE_VLTLMAN", Const, 1, ""},
+		{"ETHERTYPE_VPROD", Const, 1, ""},
+		{"ETHERTYPE_VURESERVED", Const, 1, ""},
+		{"ETHERTYPE_WATERLOO", Const, 1, ""},
+		{"ETHERTYPE_WELLFLEET", Const, 1, ""},
+		{"ETHERTYPE_X25", Const, 1, ""},
+		{"ETHERTYPE_X75", Const, 1, ""},
+		{"ETHERTYPE_XNSSM", Const, 1, ""},
+		{"ETHERTYPE_XTP", Const, 1, ""},
+		{"ETHER_ADDR_LEN", Const, 1, ""},
+		{"ETHER_ALIGN", Const, 1, ""},
+		{"ETHER_CRC_LEN", Const, 1, ""},
+		{"ETHER_CRC_POLY_BE", Const, 1, ""},
+		{"ETHER_CRC_POLY_LE", Const, 1, ""},
+		{"ETHER_HDR_LEN", Const, 1, ""},
+		{"ETHER_MAX_DIX_LEN", Const, 1, ""},
+		{"ETHER_MAX_LEN", Const, 1, ""},
+		{"ETHER_MAX_LEN_JUMBO", Const, 1, ""},
+		{"ETHER_MIN_LEN", Const, 1, ""},
+		{"ETHER_PPPOE_ENCAP_LEN", Const, 1, ""},
+		{"ETHER_TYPE_LEN", Const, 1, ""},
+		{"ETHER_VLAN_ENCAP_LEN", Const, 1, ""},
+		{"ETH_P_1588", Const, 0, ""},
+		{"ETH_P_8021Q", Const, 0, ""},
+		{"ETH_P_802_2", Const, 0, ""},
+		{"ETH_P_802_3", Const, 0, ""},
+		{"ETH_P_AARP", Const, 0, ""},
+		{"ETH_P_ALL", Const, 0, ""},
+		{"ETH_P_AOE", Const, 0, ""},
+		{"ETH_P_ARCNET", Const, 0, ""},
+		{"ETH_P_ARP", Const, 0, ""},
+		{"ETH_P_ATALK", Const, 0, ""},
+		{"ETH_P_ATMFATE", Const, 0, ""},
+		{"ETH_P_ATMMPOA", Const, 0, ""},
+		{"ETH_P_AX25", Const, 0, ""},
+		{"ETH_P_BPQ", Const, 0, ""},
+		{"ETH_P_CAIF", Const, 0, ""},
+		{"ETH_P_CAN", Const, 0, ""},
+		{"ETH_P_CONTROL", Const, 0, ""},
+		{"ETH_P_CUST", Const, 0, ""},
+		{"ETH_P_DDCMP", Const, 0, ""},
+		{"ETH_P_DEC", Const, 0, ""},
+		{"ETH_P_DIAG", Const, 0, ""},
+		{"ETH_P_DNA_DL", Const, 0, ""},
+		{"ETH_P_DNA_RC", Const, 0, ""},
+		{"ETH_P_DNA_RT", Const, 0, ""},
+		{"ETH_P_DSA", Const, 0, ""},
+		{"ETH_P_ECONET", Const, 0, ""},
+		{"ETH_P_EDSA", Const, 0, ""},
+		{"ETH_P_FCOE", Const, 0, ""},
+		{"ETH_P_FIP", Const, 0, ""},
+		{"ETH_P_HDLC", Const, 0, ""},
+		{"ETH_P_IEEE802154", Const, 0, ""},
+		{"ETH_P_IEEEPUP", Const, 0, ""},
+		{"ETH_P_IEEEPUPAT", Const, 0, ""},
+		{"ETH_P_IP", Const, 0, ""},
+		{"ETH_P_IPV6", Const, 0, ""},
+		{"ETH_P_IPX", Const, 0, ""},
+		{"ETH_P_IRDA", Const, 0, ""},
+		{"ETH_P_LAT", Const, 0, ""},
+		{"ETH_P_LINK_CTL", Const, 0, ""},
+		{"ETH_P_LOCALTALK", Const, 0, ""},
+		{"ETH_P_LOOP", Const, 0, ""},
+		{"ETH_P_MOBITEX", Const, 0, ""},
+		{"ETH_P_MPLS_MC", Const, 0, ""},
+		{"ETH_P_MPLS_UC", Const, 0, ""},
+		{"ETH_P_PAE", Const, 0, ""},
+		{"ETH_P_PAUSE", Const, 0, ""},
+		{"ETH_P_PHONET", Const, 0, ""},
+		{"ETH_P_PPPTALK", Const, 0, ""},
+		{"ETH_P_PPP_DISC", Const, 0, ""},
+		{"ETH_P_PPP_MP", Const, 0, ""},
+		{"ETH_P_PPP_SES", Const, 0, ""},
+		{"ETH_P_PUP", Const, 0, ""},
+		{"ETH_P_PUPAT", Const, 0, ""},
+		{"ETH_P_RARP", Const, 0, ""},
+		{"ETH_P_SCA", Const, 0, ""},
+		{"ETH_P_SLOW", Const, 0, ""},
+		{"ETH_P_SNAP", Const, 0, ""},
+		{"ETH_P_TEB", Const, 0, ""},
+		{"ETH_P_TIPC", Const, 0, ""},
+		{"ETH_P_TRAILER", Const, 0, ""},
+		{"ETH_P_TR_802_2", Const, 0, ""},
+		{"ETH_P_WAN_PPP", Const, 0, ""},
+		{"ETH_P_WCCP", Const, 0, ""},
+		{"ETH_P_X25", Const, 0, ""},
+		{"ETIME", Const, 0, ""},
+		{"ETIMEDOUT", Const, 0, ""},
+		{"ETOOMANYREFS", Const, 0, ""},
+		{"ETXTBSY", Const, 0, ""},
+		{"EUCLEAN", Const, 0, ""},
+		{"EUNATCH", Const, 0, ""},
+		{"EUSERS", Const, 0, ""},
+		{"EVFILT_AIO", Const, 0, ""},
+		{"EVFILT_FS", Const, 0, ""},
+		{"EVFILT_LIO", Const, 0, ""},
+		{"EVFILT_MACHPORT", Const, 0, ""},
+		{"EVFILT_PROC", Const, 0, ""},
+		{"EVFILT_READ", Const, 0, ""},
+		{"EVFILT_SIGNAL", Const, 0, ""},
+		{"EVFILT_SYSCOUNT", Const, 0, ""},
+		{"EVFILT_THREADMARKER", Const, 0, ""},
+		{"EVFILT_TIMER", Const, 0, ""},
+		{"EVFILT_USER", Const, 0, ""},
+		{"EVFILT_VM", Const, 0, ""},
+		{"EVFILT_VNODE", Const, 0, ""},
+		{"EVFILT_WRITE", Const, 0, ""},
+		{"EV_ADD", Const, 0, ""},
+		{"EV_CLEAR", Const, 0, ""},
+		{"EV_DELETE", Const, 0, ""},
+		{"EV_DISABLE", Const, 0, ""},
+		{"EV_DISPATCH", Const, 0, ""},
+		{"EV_DROP", Const, 3, ""},
+		{"EV_ENABLE", Const, 0, ""},
+		{"EV_EOF", Const, 0, ""},
+		{"EV_ERROR", Const, 0, ""},
+		{"EV_FLAG0", Const, 0, ""},
+		{"EV_FLAG1", Const, 0, ""},
+		{"EV_ONESHOT", Const, 0, ""},
+		{"EV_OOBAND", Const, 0, ""},
+		{"EV_POLL", Const, 0, ""},
+		{"EV_RECEIPT", Const, 0, ""},
+		{"EV_SYSFLAGS", Const, 0, ""},
+		{"EWINDOWS", Const, 0, ""},
+		{"EWOULDBLOCK", Const, 0, ""},
+		{"EXDEV", Const, 0, ""},
+		{"EXFULL", Const, 0, ""},
+		{"EXTA", Const, 0, ""},
+		{"EXTB", Const, 0, ""},
+		{"EXTPROC", Const, 0, ""},
+		{"Environ", Func, 0, "func() []string"},
+		{"EpollCreate", Func, 0, "func(size int) (fd int, err error)"},
+		{"EpollCreate1", Func, 0, "func(flag int) (fd int, err error)"},
+		{"EpollCtl", Func, 0, "func(epfd int, op int, fd int, event *EpollEvent) (err error)"},
+		{"EpollEvent", Type, 0, ""},
+		{"EpollEvent.Events", Field, 0, ""},
+		{"EpollEvent.Fd", Field, 0, ""},
+		{"EpollEvent.Pad", Field, 0, ""},
+		{"EpollEvent.PadFd", Field, 0, ""},
+		{"EpollWait", Func, 0, "func(epfd int, events []EpollEvent, msec int) (n int, err error)"},
+		{"Errno", Type, 0, ""},
+		{"EscapeArg", Func, 0, ""},
+		{"Exchangedata", Func, 0, ""},
+		{"Exec", Func, 0, "func(argv0 string, argv []string, envv []string) (err error)"},
+		{"Exit", Func, 0, "func(code int)"},
+		{"ExitProcess", Func, 0, ""},
+		{"FD_CLOEXEC", Const, 0, ""},
+		{"FD_SETSIZE", Const, 0, ""},
+		{"FILE_ACTION_ADDED", Const, 0, ""},
+		{"FILE_ACTION_MODIFIED", Const, 0, ""},
+		{"FILE_ACTION_REMOVED", Const, 0, ""},
+		{"FILE_ACTION_RENAMED_NEW_NAME", Const, 0, ""},
+		{"FILE_ACTION_RENAMED_OLD_NAME", Const, 0, ""},
+		{"FILE_APPEND_DATA", Const, 0, ""},
+		{"FILE_ATTRIBUTE_ARCHIVE", Const, 0, ""},
+		{"FILE_ATTRIBUTE_DIRECTORY", Const, 0, ""},
+		{"FILE_ATTRIBUTE_HIDDEN", Const, 0, ""},
+		{"FILE_ATTRIBUTE_NORMAL", Const, 0, ""},
+		{"FILE_ATTRIBUTE_READONLY", Const, 0, ""},
+		{"FILE_ATTRIBUTE_REPARSE_POINT", Const, 4, ""},
+		{"FILE_ATTRIBUTE_SYSTEM", Const, 0, ""},
+		{"FILE_BEGIN", Const, 0, ""},
+		{"FILE_CURRENT", Const, 0, ""},
+		{"FILE_END", Const, 0, ""},
+		{"FILE_FLAG_BACKUP_SEMANTICS", Const, 0, ""},
+		{"FILE_FLAG_OPEN_REPARSE_POINT", Const, 4, ""},
+		{"FILE_FLAG_OVERLAPPED", Const, 0, ""},
+		{"FILE_LIST_DIRECTORY", Const, 0, ""},
+		{"FILE_MAP_COPY", Const, 0, ""},
+		{"FILE_MAP_EXECUTE", Const, 0, ""},
+		{"FILE_MAP_READ", Const, 0, ""},
+		{"FILE_MAP_WRITE", Const, 0, ""},
+		{"FILE_NOTIFY_CHANGE_ATTRIBUTES", Const, 0, ""},
+		{"FILE_NOTIFY_CHANGE_CREATION", Const, 0, ""},
+		{"FILE_NOTIFY_CHANGE_DIR_NAME", Const, 0, ""},
+		{"FILE_NOTIFY_CHANGE_FILE_NAME", Const, 0, ""},
+		{"FILE_NOTIFY_CHANGE_LAST_ACCESS", Const, 0, ""},
+		{"FILE_NOTIFY_CHANGE_LAST_WRITE", Const, 0, ""},
+		{"FILE_NOTIFY_CHANGE_SIZE", Const, 0, ""},
+		{"FILE_SHARE_DELETE", Const, 0, ""},
+		{"FILE_SHARE_READ", Const, 0, ""},
+		{"FILE_SHARE_WRITE", Const, 0, ""},
+		{"FILE_SKIP_COMPLETION_PORT_ON_SUCCESS", Const, 2, ""},
+		{"FILE_SKIP_SET_EVENT_ON_HANDLE", Const, 2, ""},
+		{"FILE_TYPE_CHAR", Const, 0, ""},
+		{"FILE_TYPE_DISK", Const, 0, ""},
+		{"FILE_TYPE_PIPE", Const, 0, ""},
+		{"FILE_TYPE_REMOTE", Const, 0, ""},
+		{"FILE_TYPE_UNKNOWN", Const, 0, ""},
+		{"FILE_WRITE_ATTRIBUTES", Const, 0, ""},
+		{"FLUSHO", Const, 0, ""},
+		{"FORMAT_MESSAGE_ALLOCATE_BUFFER", Const, 0, ""},
+		{"FORMAT_MESSAGE_ARGUMENT_ARRAY", Const, 0, ""},
+		{"FORMAT_MESSAGE_FROM_HMODULE", Const, 0, ""},
+		{"FORMAT_MESSAGE_FROM_STRING", Const, 0, ""},
+		{"FORMAT_MESSAGE_FROM_SYSTEM", Const, 0, ""},
+		{"FORMAT_MESSAGE_IGNORE_INSERTS", Const, 0, ""},
+		{"FORMAT_MESSAGE_MAX_WIDTH_MASK", Const, 0, ""},
+		{"FSCTL_GET_REPARSE_POINT", Const, 4, ""},
+		{"F_ADDFILESIGS", Const, 0, ""},
+		{"F_ADDSIGS", Const, 0, ""},
+		{"F_ALLOCATEALL", Const, 0, ""},
+		{"F_ALLOCATECONTIG", Const, 0, ""},
+		{"F_CANCEL", Const, 0, ""},
+		{"F_CHKCLEAN", Const, 0, ""},
+		{"F_CLOSEM", Const, 1, ""},
+		{"F_DUP2FD", Const, 0, ""},
+		{"F_DUP2FD_CLOEXEC", Const, 1, ""},
+		{"F_DUPFD", Const, 0, ""},
+		{"F_DUPFD_CLOEXEC", Const, 0, ""},
+		{"F_EXLCK", Const, 0, ""},
+		{"F_FINDSIGS", Const, 16, ""},
+		{"F_FLUSH_DATA", Const, 0, ""},
+		{"F_FREEZE_FS", Const, 0, ""},
+		{"F_FSCTL", Const, 1, ""},
+		{"F_FSDIRMASK", Const, 1, ""},
+		{"F_FSIN", Const, 1, ""},
+		{"F_FSINOUT", Const, 1, ""},
+		{"F_FSOUT", Const, 1, ""},
+		{"F_FSPRIV", Const, 1, ""},
+		{"F_FSVOID", Const, 1, ""},
+		{"F_FULLFSYNC", Const, 0, ""},
+		{"F_GETCODEDIR", Const, 16, ""},
+		{"F_GETFD", Const, 0, ""},
+		{"F_GETFL", Const, 0, ""},
+		{"F_GETLEASE", Const, 0, ""},
+		{"F_GETLK", Const, 0, ""},
+		{"F_GETLK64", Const, 0, ""},
+		{"F_GETLKPID", Const, 0, ""},
+		{"F_GETNOSIGPIPE", Const, 0, ""},
+		{"F_GETOWN", Const, 0, ""},
+		{"F_GETOWN_EX", Const, 0, ""},
+		{"F_GETPATH", Const, 0, ""},
+		{"F_GETPATH_MTMINFO", Const, 0, ""},
+		{"F_GETPIPE_SZ", Const, 0, ""},
+		{"F_GETPROTECTIONCLASS", Const, 0, ""},
+		{"F_GETPROTECTIONLEVEL", Const, 16, ""},
+		{"F_GETSIG", Const, 0, ""},
+		{"F_GLOBAL_NOCACHE", Const, 0, ""},
+		{"F_LOCK", Const, 0, ""},
+		{"F_LOG2PHYS", Const, 0, ""},
+		{"F_LOG2PHYS_EXT", Const, 0, ""},
+		{"F_MARKDEPENDENCY", Const, 0, ""},
+		{"F_MAXFD", Const, 1, ""},
+		{"F_NOCACHE", Const, 0, ""},
+		{"F_NODIRECT", Const, 0, ""},
+		{"F_NOTIFY", Const, 0, ""},
+		{"F_OGETLK", Const, 0, ""},
+		{"F_OK", Const, 0, ""},
+		{"F_OSETLK", Const, 0, ""},
+		{"F_OSETLKW", Const, 0, ""},
+		{"F_PARAM_MASK", Const, 1, ""},
+		{"F_PARAM_MAX", Const, 1, ""},
+		{"F_PATHPKG_CHECK", Const, 0, ""},
+		{"F_PEOFPOSMODE", Const, 0, ""},
+		{"F_PREALLOCATE", Const, 0, ""},
+		{"F_RDADVISE", Const, 0, ""},
+		{"F_RDAHEAD", Const, 0, ""},
+		{"F_RDLCK", Const, 0, ""},
+		{"F_READAHEAD", Const, 0, ""},
+		{"F_READBOOTSTRAP", Const, 0, ""},
+		{"F_SETBACKINGSTORE", Const, 0, ""},
+		{"F_SETFD", Const, 0, ""},
+		{"F_SETFL", Const, 0, ""},
+		{"F_SETLEASE", Const, 0, ""},
+		{"F_SETLK", Const, 0, ""},
+		{"F_SETLK64", Const, 0, ""},
+		{"F_SETLKW", Const, 0, ""},
+		{"F_SETLKW64", Const, 0, ""},
+		{"F_SETLKWTIMEOUT", Const, 16, ""},
+		{"F_SETLK_REMOTE", Const, 0, ""},
+		{"F_SETNOSIGPIPE", Const, 0, ""},
+		{"F_SETOWN", Const, 0, ""},
+		{"F_SETOWN_EX", Const, 0, ""},
+		{"F_SETPIPE_SZ", Const, 0, ""},
+		{"F_SETPROTECTIONCLASS", Const, 0, ""},
+		{"F_SETSIG", Const, 0, ""},
+		{"F_SETSIZE", Const, 0, ""},
+		{"F_SHLCK", Const, 0, ""},
+		{"F_SINGLE_WRITER", Const, 16, ""},
+		{"F_TEST", Const, 0, ""},
+		{"F_THAW_FS", Const, 0, ""},
+		{"F_TLOCK", Const, 0, ""},
+		{"F_TRANSCODEKEY", Const, 16, ""},
+		{"F_ULOCK", Const, 0, ""},
+		{"F_UNLCK", Const, 0, ""},
+		{"F_UNLCKSYS", Const, 0, ""},
+		{"F_VOLPOSMODE", Const, 0, ""},
+		{"F_WRITEBOOTSTRAP", Const, 0, ""},
+		{"F_WRLCK", Const, 0, ""},
+		{"Faccessat", Func, 0, "func(dirfd int, path string, mode uint32, flags int) (err error)"},
+		{"Fallocate", Func, 0, "func(fd int, mode uint32, off int64, len int64) (err error)"},
+		{"Fbootstraptransfer_t", Type, 0, ""},
+		{"Fbootstraptransfer_t.Buffer", Field, 0, ""},
+		{"Fbootstraptransfer_t.Length", Field, 0, ""},
+		{"Fbootstraptransfer_t.Offset", Field, 0, ""},
+		{"Fchdir", Func, 0, "func(fd int) (err error)"},
+		{"Fchflags", Func, 0, ""},
+		{"Fchmod", Func, 0, "func(fd int, mode uint32) (err error)"},
+		{"Fchmodat", Func, 0, "func(dirfd int, path string, mode uint32, flags int) error"},
+		{"Fchown", Func, 0, "func(fd int, uid int, gid int) (err error)"},
+		{"Fchownat", Func, 0, "func(dirfd int, path string, uid int, gid int, flags int) (err error)"},
+		{"FcntlFlock", Func, 3, "func(fd uintptr, cmd int, lk *Flock_t) error"},
+		{"FdSet", Type, 0, ""},
+		{"FdSet.Bits", Field, 0, ""},
+		{"FdSet.X__fds_bits", Field, 0, ""},
+		{"Fdatasync", Func, 0, "func(fd int) (err error)"},
+		{"FileNotifyInformation", Type, 0, ""},
+		{"FileNotifyInformation.Action", Field, 0, ""},
+		{"FileNotifyInformation.FileName", Field, 0, ""},
+		{"FileNotifyInformation.FileNameLength", Field, 0, ""},
+		{"FileNotifyInformation.NextEntryOffset", Field, 0, ""},
+		{"Filetime", Type, 0, ""},
+		{"Filetime.HighDateTime", Field, 0, ""},
+		{"Filetime.LowDateTime", Field, 0, ""},
+		{"FindClose", Func, 0, ""},
+		{"FindFirstFile", Func, 0, ""},
+		{"FindNextFile", Func, 0, ""},
+		{"Flock", Func, 0, "func(fd int, how int) (err error)"},
+		{"Flock_t", Type, 0, ""},
+		{"Flock_t.Len", Field, 0, ""},
+		{"Flock_t.Pad_cgo_0", Field, 0, ""},
+		{"Flock_t.Pad_cgo_1", Field, 3, ""},
+		{"Flock_t.Pid", Field, 0, ""},
+		{"Flock_t.Start", Field, 0, ""},
+		{"Flock_t.Sysid", Field, 0, ""},
+		{"Flock_t.Type", Field, 0, ""},
+		{"Flock_t.Whence", Field, 0, ""},
+		{"FlushBpf", Func, 0, ""},
+		{"FlushFileBuffers", Func, 0, ""},
+		{"FlushViewOfFile", Func, 0, ""},
+		{"ForkExec", Func, 0, "func(argv0 string, argv []string, attr *ProcAttr) (pid int, err error)"},
+		{"ForkLock", Var, 0, ""},
+		{"FormatMessage", Func, 0, ""},
+		{"Fpathconf", Func, 0, ""},
+		{"FreeAddrInfoW", Func, 1, ""},
+		{"FreeEnvironmentStrings", Func, 0, ""},
+		{"FreeLibrary", Func, 0, ""},
+		{"Fsid", Type, 0, ""},
+		{"Fsid.Val", Field, 0, ""},
+		{"Fsid.X__fsid_val", Field, 2, ""},
+		{"Fsid.X__val", Field, 0, ""},
+		{"Fstat", Func, 0, "func(fd int, stat *Stat_t) (err error)"},
+		{"Fstatat", Func, 12, ""},
+		{"Fstatfs", Func, 0, "func(fd int, buf *Statfs_t) (err error)"},
+		{"Fstore_t", Type, 0, ""},
+		{"Fstore_t.Bytesalloc", Field, 0, ""},
+		{"Fstore_t.Flags", Field, 0, ""},
+		{"Fstore_t.Length", Field, 0, ""},
+		{"Fstore_t.Offset", Field, 0, ""},
+		{"Fstore_t.Posmode", Field, 0, ""},
+		{"Fsync", Func, 0, "func(fd int) (err error)"},
+		{"Ftruncate", Func, 0, "func(fd int, length int64) (err error)"},
+		{"FullPath", Func, 4, ""},
+		{"Futimes", Func, 0, "func(fd int, tv []Timeval) (err error)"},
+		{"Futimesat", Func, 0, "func(dirfd int, path string, tv []Timeval) (err error)"},
+		{"GENERIC_ALL", Const, 0, ""},
+		{"GENERIC_EXECUTE", Const, 0, ""},
+		{"GENERIC_READ", Const, 0, ""},
+		{"GENERIC_WRITE", Const, 0, ""},
+		{"GUID", Type, 1, ""},
+		{"GUID.Data1", Field, 1, ""},
+		{"GUID.Data2", Field, 1, ""},
+		{"GUID.Data3", Field, 1, ""},
+		{"GUID.Data4", Field, 1, ""},
+		{"GetAcceptExSockaddrs", Func, 0, ""},
+		{"GetAdaptersInfo", Func, 0, ""},
+		{"GetAddrInfoW", Func, 1, ""},
+		{"GetCommandLine", Func, 0, ""},
+		{"GetComputerName", Func, 0, ""},
+		{"GetConsoleMode", Func, 1, ""},
+		{"GetCurrentDirectory", Func, 0, ""},
+		{"GetCurrentProcess", Func, 0, ""},
+		{"GetEnvironmentStrings", Func, 0, ""},
+		{"GetEnvironmentVariable", Func, 0, ""},
+		{"GetExitCodeProcess", Func, 0, ""},
+		{"GetFileAttributes", Func, 0, ""},
+		{"GetFileAttributesEx", Func, 0, ""},
+		{"GetFileExInfoStandard", Const, 0, ""},
+		{"GetFileExMaxInfoLevel", Const, 0, ""},
+		{"GetFileInformationByHandle", Func, 0, ""},
+		{"GetFileType", Func, 0, ""},
+		{"GetFullPathName", Func, 0, ""},
+		{"GetHostByName", Func, 0, ""},
+		{"GetIfEntry", Func, 0, ""},
+		{"GetLastError", Func, 0, ""},
+		{"GetLengthSid", Func, 0, ""},
+		{"GetLongPathName", Func, 0, ""},
+		{"GetProcAddress", Func, 0, ""},
+		{"GetProcessTimes", Func, 0, ""},
+		{"GetProtoByName", Func, 0, ""},
+		{"GetQueuedCompletionStatus", Func, 0, ""},
+		{"GetServByName", Func, 0, ""},
+		{"GetShortPathName", Func, 0, ""},
+		{"GetStartupInfo", Func, 0, ""},
+		{"GetStdHandle", Func, 0, ""},
+		{"GetSystemTimeAsFileTime", Func, 0, ""},
+		{"GetTempPath", Func, 0, ""},
+		{"GetTimeZoneInformation", Func, 0, ""},
+		{"GetTokenInformation", Func, 0, ""},
+		{"GetUserNameEx", Func, 0, ""},
+		{"GetUserProfileDirectory", Func, 0, ""},
+		{"GetVersion", Func, 0, ""},
+		{"Getcwd", Func, 0, "func(buf []byte) (n int, err error)"},
+		{"Getdents", Func, 0, "func(fd int, buf []byte) (n int, err error)"},
+		{"Getdirentries", Func, 0, ""},
+		{"Getdtablesize", Func, 0, ""},
+		{"Getegid", Func, 0, "func() (egid int)"},
+		{"Getenv", Func, 0, "func(key string) (value string, found bool)"},
+		{"Geteuid", Func, 0, "func() (euid int)"},
+		{"Getfsstat", Func, 0, ""},
+		{"Getgid", Func, 0, "func() (gid int)"},
+		{"Getgroups", Func, 0, "func() (gids []int, err error)"},
+		{"Getpagesize", Func, 0, "func() int"},
+		{"Getpeername", Func, 0, "func(fd int) (sa Sockaddr, err error)"},
+		{"Getpgid", Func, 0, "func(pid int) (pgid int, err error)"},
+		{"Getpgrp", Func, 0, "func() (pid int)"},
+		{"Getpid", Func, 0, "func() (pid int)"},
+		{"Getppid", Func, 0, "func() (ppid int)"},
+		{"Getpriority", Func, 0, "func(which int, who int) (prio int, err error)"},
+		{"Getrlimit", Func, 0, "func(resource int, rlim *Rlimit) (err error)"},
+		{"Getrusage", Func, 0, "func(who int, rusage *Rusage) (err error)"},
+		{"Getsid", Func, 0, ""},
+		{"Getsockname", Func, 0, "func(fd int) (sa Sockaddr, err error)"},
+		{"Getsockopt", Func, 1, ""},
+		{"GetsockoptByte", Func, 0, ""},
+		{"GetsockoptICMPv6Filter", Func, 2, "func(fd int, level int, opt int) (*ICMPv6Filter, error)"},
+		{"GetsockoptIPMreq", Func, 0, "func(fd int, level int, opt int) (*IPMreq, error)"},
+		{"GetsockoptIPMreqn", Func, 0, "func(fd int, level int, opt int) (*IPMreqn, error)"},
+		{"GetsockoptIPv6MTUInfo", Func, 2, "func(fd int, level int, opt int) (*IPv6MTUInfo, error)"},
+		{"GetsockoptIPv6Mreq", Func, 0, "func(fd int, level int, opt int) (*IPv6Mreq, error)"},
+		{"GetsockoptInet4Addr", Func, 0, "func(fd int, level int, opt int) (value [4]byte, err error)"},
+		{"GetsockoptInt", Func, 0, "func(fd int, level int, opt int) (value int, err error)"},
+		{"GetsockoptUcred", Func, 1, "func(fd int, level int, opt int) (*Ucred, error)"},
+		{"Gettid", Func, 0, "func() (tid int)"},
+		{"Gettimeofday", Func, 0, "func(tv *Timeval) (err error)"},
+		{"Getuid", Func, 0, "func() (uid int)"},
+		{"Getwd", Func, 0, "func() (wd string, err error)"},
+		{"Getxattr", Func, 1, "func(path string, attr string, dest []byte) (sz int, err error)"},
+		{"HANDLE_FLAG_INHERIT", Const, 0, ""},
+		{"HKEY_CLASSES_ROOT", Const, 0, ""},
+		{"HKEY_CURRENT_CONFIG", Const, 0, ""},
+		{"HKEY_CURRENT_USER", Const, 0, ""},
+		{"HKEY_DYN_DATA", Const, 0, ""},
+		{"HKEY_LOCAL_MACHINE", Const, 0, ""},
+		{"HKEY_PERFORMANCE_DATA", Const, 0, ""},
+		{"HKEY_USERS", Const, 0, ""},
+		{"HUPCL", Const, 0, ""},
+		{"Handle", Type, 0, ""},
+		{"Hostent", Type, 0, ""},
+		{"Hostent.AddrList", Field, 0, ""},
+		{"Hostent.AddrType", Field, 0, ""},
+		{"Hostent.Aliases", Field, 0, ""},
+		{"Hostent.Length", Field, 0, ""},
+		{"Hostent.Name", Field, 0, ""},
+		{"ICANON", Const, 0, ""},
+		{"ICMP6_FILTER", Const, 2, ""},
+		{"ICMPV6_FILTER", Const, 2, ""},
+		{"ICMPv6Filter", Type, 2, ""},
+		{"ICMPv6Filter.Data", Field, 2, ""},
+		{"ICMPv6Filter.Filt", Field, 2, ""},
+		{"ICRNL", Const, 0, ""},
+		{"IEXTEN", Const, 0, ""},
+		{"IFAN_ARRIVAL", Const, 1, ""},
+		{"IFAN_DEPARTURE", Const, 1, ""},
+		{"IFA_ADDRESS", Const, 0, ""},
+		{"IFA_ANYCAST", Const, 0, ""},
+		{"IFA_BROADCAST", Const, 0, ""},
+		{"IFA_CACHEINFO", Const, 0, ""},
+		{"IFA_F_DADFAILED", Const, 0, ""},
+		{"IFA_F_DEPRECATED", Const, 0, ""},
+		{"IFA_F_HOMEADDRESS", Const, 0, ""},
+		{"IFA_F_NODAD", Const, 0, ""},
+		{"IFA_F_OPTIMISTIC", Const, 0, ""},
+		{"IFA_F_PERMANENT", Const, 0, ""},
+		{"IFA_F_SECONDARY", Const, 0, ""},
+		{"IFA_F_TEMPORARY", Const, 0, ""},
+		{"IFA_F_TENTATIVE", Const, 0, ""},
+		{"IFA_LABEL", Const, 0, ""},
+		{"IFA_LOCAL", Const, 0, ""},
+		{"IFA_MAX", Const, 0, ""},
+		{"IFA_MULTICAST", Const, 0, ""},
+		{"IFA_ROUTE", Const, 1, ""},
+		{"IFA_UNSPEC", Const, 0, ""},
+		{"IFF_ALLMULTI", Const, 0, ""},
+		{"IFF_ALTPHYS", Const, 0, ""},
+		{"IFF_AUTOMEDIA", Const, 0, ""},
+		{"IFF_BROADCAST", Const, 0, ""},
+		{"IFF_CANTCHANGE", Const, 0, ""},
+		{"IFF_CANTCONFIG", Const, 1, ""},
+		{"IFF_DEBUG", Const, 0, ""},
+		{"IFF_DRV_OACTIVE", Const, 0, ""},
+		{"IFF_DRV_RUNNING", Const, 0, ""},
+		{"IFF_DYING", Const, 0, ""},
+		{"IFF_DYNAMIC", Const, 0, ""},
+		{"IFF_LINK0", Const, 0, ""},
+		{"IFF_LINK1", Const, 0, ""},
+		{"IFF_LINK2", Const, 0, ""},
+		{"IFF_LOOPBACK", Const, 0, ""},
+		{"IFF_MASTER", Const, 0, ""},
+		{"IFF_MONITOR", Const, 0, ""},
+		{"IFF_MULTICAST", Const, 0, ""},
+		{"IFF_NOARP", Const, 0, ""},
+		{"IFF_NOTRAILERS", Const, 0, ""},
+		{"IFF_NO_PI", Const, 0, ""},
+		{"IFF_OACTIVE", Const, 0, ""},
+		{"IFF_ONE_QUEUE", Const, 0, ""},
+		{"IFF_POINTOPOINT", Const, 0, ""},
+		{"IFF_POINTTOPOINT", Const, 0, ""},
+		{"IFF_PORTSEL", Const, 0, ""},
+		{"IFF_PPROMISC", Const, 0, ""},
+		{"IFF_PROMISC", Const, 0, ""},
+		{"IFF_RENAMING", Const, 0, ""},
+		{"IFF_RUNNING", Const, 0, ""},
+		{"IFF_SIMPLEX", Const, 0, ""},
+		{"IFF_SLAVE", Const, 0, ""},
+		{"IFF_SMART", Const, 0, ""},
+		{"IFF_STATICARP", Const, 0, ""},
+		{"IFF_TAP", Const, 0, ""},
+		{"IFF_TUN", Const, 0, ""},
+		{"IFF_TUN_EXCL", Const, 0, ""},
+		{"IFF_UP", Const, 0, ""},
+		{"IFF_VNET_HDR", Const, 0, ""},
+		{"IFLA_ADDRESS", Const, 0, ""},
+		{"IFLA_BROADCAST", Const, 0, ""},
+		{"IFLA_COST", Const, 0, ""},
+		{"IFLA_IFALIAS", Const, 0, ""},
+		{"IFLA_IFNAME", Const, 0, ""},
+		{"IFLA_LINK", Const, 0, ""},
+		{"IFLA_LINKINFO", Const, 0, ""},
+		{"IFLA_LINKMODE", Const, 0, ""},
+		{"IFLA_MAP", Const, 0, ""},
+		{"IFLA_MASTER", Const, 0, ""},
+		{"IFLA_MAX", Const, 0, ""},
+		{"IFLA_MTU", Const, 0, ""},
+		{"IFLA_NET_NS_PID", Const, 0, ""},
+		{"IFLA_OPERSTATE", Const, 0, ""},
+		{"IFLA_PRIORITY", Const, 0, ""},
+		{"IFLA_PROTINFO", Const, 0, ""},
+		{"IFLA_QDISC", Const, 0, ""},
+		{"IFLA_STATS", Const, 0, ""},
+		{"IFLA_TXQLEN", Const, 0, ""},
+		{"IFLA_UNSPEC", Const, 0, ""},
+		{"IFLA_WEIGHT", Const, 0, ""},
+		{"IFLA_WIRELESS", Const, 0, ""},
+		{"IFNAMSIZ", Const, 0, ""},
+		{"IFT_1822", Const, 0, ""},
+		{"IFT_A12MPPSWITCH", Const, 0, ""},
+		{"IFT_AAL2", Const, 0, ""},
+		{"IFT_AAL5", Const, 0, ""},
+		{"IFT_ADSL", Const, 0, ""},
+		{"IFT_AFLANE8023", Const, 0, ""},
+		{"IFT_AFLANE8025", Const, 0, ""},
+		{"IFT_ARAP", Const, 0, ""},
+		{"IFT_ARCNET", Const, 0, ""},
+		{"IFT_ARCNETPLUS", Const, 0, ""},
+		{"IFT_ASYNC", Const, 0, ""},
+		{"IFT_ATM", Const, 0, ""},
+		{"IFT_ATMDXI", Const, 0, ""},
+		{"IFT_ATMFUNI", Const, 0, ""},
+		{"IFT_ATMIMA", Const, 0, ""},
+		{"IFT_ATMLOGICAL", Const, 0, ""},
+		{"IFT_ATMRADIO", Const, 0, ""},
+		{"IFT_ATMSUBINTERFACE", Const, 0, ""},
+		{"IFT_ATMVCIENDPT", Const, 0, ""},
+		{"IFT_ATMVIRTUAL", Const, 0, ""},
+		{"IFT_BGPPOLICYACCOUNTING", Const, 0, ""},
+		{"IFT_BLUETOOTH", Const, 1, ""},
+		{"IFT_BRIDGE", Const, 0, ""},
+		{"IFT_BSC", Const, 0, ""},
+		{"IFT_CARP", Const, 0, ""},
+		{"IFT_CCTEMUL", Const, 0, ""},
+		{"IFT_CELLULAR", Const, 0, ""},
+		{"IFT_CEPT", Const, 0, ""},
+		{"IFT_CES", Const, 0, ""},
+		{"IFT_CHANNEL", Const, 0, ""},
+		{"IFT_CNR", Const, 0, ""},
+		{"IFT_COFFEE", Const, 0, ""},
+		{"IFT_COMPOSITELINK", Const, 0, ""},
+		{"IFT_DCN", Const, 0, ""},
+		{"IFT_DIGITALPOWERLINE", Const, 0, ""},
+		{"IFT_DIGITALWRAPPEROVERHEADCHANNEL", Const, 0, ""},
+		{"IFT_DLSW", Const, 0, ""},
+		{"IFT_DOCSCABLEDOWNSTREAM", Const, 0, ""},
+		{"IFT_DOCSCABLEMACLAYER", Const, 0, ""},
+		{"IFT_DOCSCABLEUPSTREAM", Const, 0, ""},
+		{"IFT_DOCSCABLEUPSTREAMCHANNEL", Const, 1, ""},
+		{"IFT_DS0", Const, 0, ""},
+		{"IFT_DS0BUNDLE", Const, 0, ""},
+		{"IFT_DS1FDL", Const, 0, ""},
+		{"IFT_DS3", Const, 0, ""},
+		{"IFT_DTM", Const, 0, ""},
+		{"IFT_DUMMY", Const, 1, ""},
+		{"IFT_DVBASILN", Const, 0, ""},
+		{"IFT_DVBASIOUT", Const, 0, ""},
+		{"IFT_DVBRCCDOWNSTREAM", Const, 0, ""},
+		{"IFT_DVBRCCMACLAYER", Const, 0, ""},
+		{"IFT_DVBRCCUPSTREAM", Const, 0, ""},
+		{"IFT_ECONET", Const, 1, ""},
+		{"IFT_ENC", Const, 0, ""},
+		{"IFT_EON", Const, 0, ""},
+		{"IFT_EPLRS", Const, 0, ""},
+		{"IFT_ESCON", Const, 0, ""},
+		{"IFT_ETHER", Const, 0, ""},
+		{"IFT_FAITH", Const, 0, ""},
+		{"IFT_FAST", Const, 0, ""},
+		{"IFT_FASTETHER", Const, 0, ""},
+		{"IFT_FASTETHERFX", Const, 0, ""},
+		{"IFT_FDDI", Const, 0, ""},
+		{"IFT_FIBRECHANNEL", Const, 0, ""},
+		{"IFT_FRAMERELAYINTERCONNECT", Const, 0, ""},
+		{"IFT_FRAMERELAYMPI", Const, 0, ""},
+		{"IFT_FRDLCIENDPT", Const, 0, ""},
+		{"IFT_FRELAY", Const, 0, ""},
+		{"IFT_FRELAYDCE", Const, 0, ""},
+		{"IFT_FRF16MFRBUNDLE", Const, 0, ""},
+		{"IFT_FRFORWARD", Const, 0, ""},
+		{"IFT_G703AT2MB", Const, 0, ""},
+		{"IFT_G703AT64K", Const, 0, ""},
+		{"IFT_GIF", Const, 0, ""},
+		{"IFT_GIGABITETHERNET", Const, 0, ""},
+		{"IFT_GR303IDT", Const, 0, ""},
+		{"IFT_GR303RDT", Const, 0, ""},
+		{"IFT_H323GATEKEEPER", Const, 0, ""},
+		{"IFT_H323PROXY", Const, 0, ""},
+		{"IFT_HDH1822", Const, 0, ""},
+		{"IFT_HDLC", Const, 0, ""},
+		{"IFT_HDSL2", Const, 0, ""},
+		{"IFT_HIPERLAN2", Const, 0, ""},
+		{"IFT_HIPPI", Const, 0, ""},
+		{"IFT_HIPPIINTERFACE", Const, 0, ""},
+		{"IFT_HOSTPAD", Const, 0, ""},
+		{"IFT_HSSI", Const, 0, ""},
+		{"IFT_HY", Const, 0, ""},
+		{"IFT_IBM370PARCHAN", Const, 0, ""},
+		{"IFT_IDSL", Const, 0, ""},
+		{"IFT_IEEE1394", Const, 0, ""},
+		{"IFT_IEEE80211", Const, 0, ""},
+		{"IFT_IEEE80212", Const, 0, ""},
+		{"IFT_IEEE8023ADLAG", Const, 0, ""},
+		{"IFT_IFGSN", Const, 0, ""},
+		{"IFT_IMT", Const, 0, ""},
+		{"IFT_INFINIBAND", Const, 1, ""},
+		{"IFT_INTERLEAVE", Const, 0, ""},
+		{"IFT_IP", Const, 0, ""},
+		{"IFT_IPFORWARD", Const, 0, ""},
+		{"IFT_IPOVERATM", Const, 0, ""},
+		{"IFT_IPOVERCDLC", Const, 0, ""},
+		{"IFT_IPOVERCLAW", Const, 0, ""},
+		{"IFT_IPSWITCH", Const, 0, ""},
+		{"IFT_IPXIP", Const, 0, ""},
+		{"IFT_ISDN", Const, 0, ""},
+		{"IFT_ISDNBASIC", Const, 0, ""},
+		{"IFT_ISDNPRIMARY", Const, 0, ""},
+		{"IFT_ISDNS", Const, 0, ""},
+		{"IFT_ISDNU", Const, 0, ""},
+		{"IFT_ISO88022LLC", Const, 0, ""},
+		{"IFT_ISO88023", Const, 0, ""},
+		{"IFT_ISO88024", Const, 0, ""},
+		{"IFT_ISO88025", Const, 0, ""},
+		{"IFT_ISO88025CRFPINT", Const, 0, ""},
+		{"IFT_ISO88025DTR", Const, 0, ""},
+		{"IFT_ISO88025FIBER", Const, 0, ""},
+		{"IFT_ISO88026", Const, 0, ""},
+		{"IFT_ISUP", Const, 0, ""},
+		{"IFT_L2VLAN", Const, 0, ""},
+		{"IFT_L3IPVLAN", Const, 0, ""},
+		{"IFT_L3IPXVLAN", Const, 0, ""},
+		{"IFT_LAPB", Const, 0, ""},
+		{"IFT_LAPD", Const, 0, ""},
+		{"IFT_LAPF", Const, 0, ""},
+		{"IFT_LINEGROUP", Const, 1, ""},
+		{"IFT_LOCALTALK", Const, 0, ""},
+		{"IFT_LOOP", Const, 0, ""},
+		{"IFT_MEDIAMAILOVERIP", Const, 0, ""},
+		{"IFT_MFSIGLINK", Const, 0, ""},
+		{"IFT_MIOX25", Const, 0, ""},
+		{"IFT_MODEM", Const, 0, ""},
+		{"IFT_MPC", Const, 0, ""},
+		{"IFT_MPLS", Const, 0, ""},
+		{"IFT_MPLSTUNNEL", Const, 0, ""},
+		{"IFT_MSDSL", Const, 0, ""},
+		{"IFT_MVL", Const, 0, ""},
+		{"IFT_MYRINET", Const, 0, ""},
+		{"IFT_NFAS", Const, 0, ""},
+		{"IFT_NSIP", Const, 0, ""},
+		{"IFT_OPTICALCHANNEL", Const, 0, ""},
+		{"IFT_OPTICALTRANSPORT", Const, 0, ""},
+		{"IFT_OTHER", Const, 0, ""},
+		{"IFT_P10", Const, 0, ""},
+		{"IFT_P80", Const, 0, ""},
+		{"IFT_PARA", Const, 0, ""},
+		{"IFT_PDP", Const, 0, ""},
+		{"IFT_PFLOG", Const, 0, ""},
+		{"IFT_PFLOW", Const, 1, ""},
+		{"IFT_PFSYNC", Const, 0, ""},
+		{"IFT_PLC", Const, 0, ""},
+		{"IFT_PON155", Const, 1, ""},
+		{"IFT_PON622", Const, 1, ""},
+		{"IFT_POS", Const, 0, ""},
+		{"IFT_PPP", Const, 0, ""},
+		{"IFT_PPPMULTILINKBUNDLE", Const, 0, ""},
+		{"IFT_PROPATM", Const, 1, ""},
+		{"IFT_PROPBWAP2MP", Const, 0, ""},
+		{"IFT_PROPCNLS", Const, 0, ""},
+		{"IFT_PROPDOCSWIRELESSDOWNSTREAM", Const, 0, ""},
+		{"IFT_PROPDOCSWIRELESSMACLAYER", Const, 0, ""},
+		{"IFT_PROPDOCSWIRELESSUPSTREAM", Const, 0, ""},
+		{"IFT_PROPMUX", Const, 0, ""},
+		{"IFT_PROPVIRTUAL", Const, 0, ""},
+		{"IFT_PROPWIRELESSP2P", Const, 0, ""},
+		{"IFT_PTPSERIAL", Const, 0, ""},
+		{"IFT_PVC", Const, 0, ""},
+		{"IFT_Q2931", Const, 1, ""},
+		{"IFT_QLLC", Const, 0, ""},
+		{"IFT_RADIOMAC", Const, 0, ""},
+		{"IFT_RADSL", Const, 0, ""},
+		{"IFT_REACHDSL", Const, 0, ""},
+		{"IFT_RFC1483", Const, 0, ""},
+		{"IFT_RS232", Const, 0, ""},
+		{"IFT_RSRB", Const, 0, ""},
+		{"IFT_SDLC", Const, 0, ""},
+		{"IFT_SDSL", Const, 0, ""},
+		{"IFT_SHDSL", Const, 0, ""},
+		{"IFT_SIP", Const, 0, ""},
+		{"IFT_SIPSIG", Const, 1, ""},
+		{"IFT_SIPTG", Const, 1, ""},
+		{"IFT_SLIP", Const, 0, ""},
+		{"IFT_SMDSDXI", Const, 0, ""},
+		{"IFT_SMDSICIP", Const, 0, ""},
+		{"IFT_SONET", Const, 0, ""},
+		{"IFT_SONETOVERHEADCHANNEL", Const, 0, ""},
+		{"IFT_SONETPATH", Const, 0, ""},
+		{"IFT_SONETVT", Const, 0, ""},
+		{"IFT_SRP", Const, 0, ""},
+		{"IFT_SS7SIGLINK", Const, 0, ""},
+		{"IFT_STACKTOSTACK", Const, 0, ""},
+		{"IFT_STARLAN", Const, 0, ""},
+		{"IFT_STF", Const, 0, ""},
+		{"IFT_T1", Const, 0, ""},
+		{"IFT_TDLC", Const, 0, ""},
+		{"IFT_TELINK", Const, 1, ""},
+		{"IFT_TERMPAD", Const, 0, ""},
+		{"IFT_TR008", Const, 0, ""},
+		{"IFT_TRANSPHDLC", Const, 0, ""},
+		{"IFT_TUNNEL", Const, 0, ""},
+		{"IFT_ULTRA", Const, 0, ""},
+		{"IFT_USB", Const, 0, ""},
+		{"IFT_V11", Const, 0, ""},
+		{"IFT_V35", Const, 0, ""},
+		{"IFT_V36", Const, 0, ""},
+		{"IFT_V37", Const, 0, ""},
+		{"IFT_VDSL", Const, 0, ""},
+		{"IFT_VIRTUALIPADDRESS", Const, 0, ""},
+		{"IFT_VIRTUALTG", Const, 1, ""},
+		{"IFT_VOICEDID", Const, 1, ""},
+		{"IFT_VOICEEM", Const, 0, ""},
+		{"IFT_VOICEEMFGD", Const, 1, ""},
+		{"IFT_VOICEENCAP", Const, 0, ""},
+		{"IFT_VOICEFGDEANA", Const, 1, ""},
+		{"IFT_VOICEFXO", Const, 0, ""},
+		{"IFT_VOICEFXS", Const, 0, ""},
+		{"IFT_VOICEOVERATM", Const, 0, ""},
+		{"IFT_VOICEOVERCABLE", Const, 1, ""},
+		{"IFT_VOICEOVERFRAMERELAY", Const, 0, ""},
+		{"IFT_VOICEOVERIP", Const, 0, ""},
+		{"IFT_X213", Const, 0, ""},
+		{"IFT_X25", Const, 0, ""},
+		{"IFT_X25DDN", Const, 0, ""},
+		{"IFT_X25HUNTGROUP", Const, 0, ""},
+		{"IFT_X25MLP", Const, 0, ""},
+		{"IFT_X25PLE", Const, 0, ""},
+		{"IFT_XETHER", Const, 0, ""},
+		{"IGNBRK", Const, 0, ""},
+		{"IGNCR", Const, 0, ""},
+		{"IGNORE", Const, 0, ""},
+		{"IGNPAR", Const, 0, ""},
+		{"IMAXBEL", Const, 0, ""},
+		{"INFINITE", Const, 0, ""},
+		{"INLCR", Const, 0, ""},
+		{"INPCK", Const, 0, ""},
+		{"INVALID_FILE_ATTRIBUTES", Const, 0, ""},
+		{"IN_ACCESS", Const, 0, ""},
+		{"IN_ALL_EVENTS", Const, 0, ""},
+		{"IN_ATTRIB", Const, 0, ""},
+		{"IN_CLASSA_HOST", Const, 0, ""},
+		{"IN_CLASSA_MAX", Const, 0, ""},
+		{"IN_CLASSA_NET", Const, 0, ""},
+		{"IN_CLASSA_NSHIFT", Const, 0, ""},
+		{"IN_CLASSB_HOST", Const, 0, ""},
+		{"IN_CLASSB_MAX", Const, 0, ""},
+		{"IN_CLASSB_NET", Const, 0, ""},
+		{"IN_CLASSB_NSHIFT", Const, 0, ""},
+		{"IN_CLASSC_HOST", Const, 0, ""},
+		{"IN_CLASSC_NET", Const, 0, ""},
+		{"IN_CLASSC_NSHIFT", Const, 0, ""},
+		{"IN_CLASSD_HOST", Const, 0, ""},
+		{"IN_CLASSD_NET", Const, 0, ""},
+		{"IN_CLASSD_NSHIFT", Const, 0, ""},
+		{"IN_CLOEXEC", Const, 0, ""},
+		{"IN_CLOSE", Const, 0, ""},
+		{"IN_CLOSE_NOWRITE", Const, 0, ""},
+		{"IN_CLOSE_WRITE", Const, 0, ""},
+		{"IN_CREATE", Const, 0, ""},
+		{"IN_DELETE", Const, 0, ""},
+		{"IN_DELETE_SELF", Const, 0, ""},
+		{"IN_DONT_FOLLOW", Const, 0, ""},
+		{"IN_EXCL_UNLINK", Const, 0, ""},
+		{"IN_IGNORED", Const, 0, ""},
+		{"IN_ISDIR", Const, 0, ""},
+		{"IN_LINKLOCALNETNUM", Const, 0, ""},
+		{"IN_LOOPBACKNET", Const, 0, ""},
+		{"IN_MASK_ADD", Const, 0, ""},
+		{"IN_MODIFY", Const, 0, ""},
+		{"IN_MOVE", Const, 0, ""},
+		{"IN_MOVED_FROM", Const, 0, ""},
+		{"IN_MOVED_TO", Const, 0, ""},
+		{"IN_MOVE_SELF", Const, 0, ""},
+		{"IN_NONBLOCK", Const, 0, ""},
+		{"IN_ONESHOT", Const, 0, ""},
+		{"IN_ONLYDIR", Const, 0, ""},
+		{"IN_OPEN", Const, 0, ""},
+		{"IN_Q_OVERFLOW", Const, 0, ""},
+		{"IN_RFC3021_HOST", Const, 1, ""},
+		{"IN_RFC3021_MASK", Const, 1, ""},
+		{"IN_RFC3021_NET", Const, 1, ""},
+		{"IN_RFC3021_NSHIFT", Const, 1, ""},
+		{"IN_UNMOUNT", Const, 0, ""},
+		{"IOC_IN", Const, 1, ""},
+		{"IOC_INOUT", Const, 1, ""},
+		{"IOC_OUT", Const, 1, ""},
+		{"IOC_VENDOR", Const, 3, ""},
+		{"IOC_WS2", Const, 1, ""},
+		{"IO_REPARSE_TAG_SYMLINK", Const, 4, ""},
+		{"IPMreq", Type, 0, ""},
+		{"IPMreq.Interface", Field, 0, ""},
+		{"IPMreq.Multiaddr", Field, 0, ""},
+		{"IPMreqn", Type, 0, ""},
+		{"IPMreqn.Address", Field, 0, ""},
+		{"IPMreqn.Ifindex", Field, 0, ""},
+		{"IPMreqn.Multiaddr", Field, 0, ""},
+		{"IPPROTO_3PC", Const, 0, ""},
+		{"IPPROTO_ADFS", Const, 0, ""},
+		{"IPPROTO_AH", Const, 0, ""},
+		{"IPPROTO_AHIP", Const, 0, ""},
+		{"IPPROTO_APES", Const, 0, ""},
+		{"IPPROTO_ARGUS", Const, 0, ""},
+		{"IPPROTO_AX25", Const, 0, ""},
+		{"IPPROTO_BHA", Const, 0, ""},
+		{"IPPROTO_BLT", Const, 0, ""},
+		{"IPPROTO_BRSATMON", Const, 0, ""},
+		{"IPPROTO_CARP", Const, 0, ""},
+		{"IPPROTO_CFTP", Const, 0, ""},
+		{"IPPROTO_CHAOS", Const, 0, ""},
+		{"IPPROTO_CMTP", Const, 0, ""},
+		{"IPPROTO_COMP", Const, 0, ""},
+		{"IPPROTO_CPHB", Const, 0, ""},
+		{"IPPROTO_CPNX", Const, 0, ""},
+		{"IPPROTO_DCCP", Const, 0, ""},
+		{"IPPROTO_DDP", Const, 0, ""},
+		{"IPPROTO_DGP", Const, 0, ""},
+		{"IPPROTO_DIVERT", Const, 0, ""},
+		{"IPPROTO_DIVERT_INIT", Const, 3, ""},
+		{"IPPROTO_DIVERT_RESP", Const, 3, ""},
+		{"IPPROTO_DONE", Const, 0, ""},
+		{"IPPROTO_DSTOPTS", Const, 0, ""},
+		{"IPPROTO_EGP", Const, 0, ""},
+		{"IPPROTO_EMCON", Const, 0, ""},
+		{"IPPROTO_ENCAP", Const, 0, ""},
+		{"IPPROTO_EON", Const, 0, ""},
+		{"IPPROTO_ESP", Const, 0, ""},
+		{"IPPROTO_ETHERIP", Const, 0, ""},
+		{"IPPROTO_FRAGMENT", Const, 0, ""},
+		{"IPPROTO_GGP", Const, 0, ""},
+		{"IPPROTO_GMTP", Const, 0, ""},
+		{"IPPROTO_GRE", Const, 0, ""},
+		{"IPPROTO_HELLO", Const, 0, ""},
+		{"IPPROTO_HMP", Const, 0, ""},
+		{"IPPROTO_HOPOPTS", Const, 0, ""},
+		{"IPPROTO_ICMP", Const, 0, ""},
+		{"IPPROTO_ICMPV6", Const, 0, ""},
+		{"IPPROTO_IDP", Const, 0, ""},
+		{"IPPROTO_IDPR", Const, 0, ""},
+		{"IPPROTO_IDRP", Const, 0, ""},
+		{"IPPROTO_IGMP", Const, 0, ""},
+		{"IPPROTO_IGP", Const, 0, ""},
+		{"IPPROTO_IGRP", Const, 0, ""},
+		{"IPPROTO_IL", Const, 0, ""},
+		{"IPPROTO_INLSP", Const, 0, ""},
+		{"IPPROTO_INP", Const, 0, ""},
+		{"IPPROTO_IP", Const, 0, ""},
+		{"IPPROTO_IPCOMP", Const, 0, ""},
+		{"IPPROTO_IPCV", Const, 0, ""},
+		{"IPPROTO_IPEIP", Const, 0, ""},
+		{"IPPROTO_IPIP", Const, 0, ""},
+		{"IPPROTO_IPPC", Const, 0, ""},
+		{"IPPROTO_IPV4", Const, 0, ""},
+		{"IPPROTO_IPV6", Const, 0, ""},
+		{"IPPROTO_IPV6_ICMP", Const, 1, ""},
+		{"IPPROTO_IRTP", Const, 0, ""},
+		{"IPPROTO_KRYPTOLAN", Const, 0, ""},
+		{"IPPROTO_LARP", Const, 0, ""},
+		{"IPPROTO_LEAF1", Const, 0, ""},
+		{"IPPROTO_LEAF2", Const, 0, ""},
+		{"IPPROTO_MAX", Const, 0, ""},
+		{"IPPROTO_MAXID", Const, 0, ""},
+		{"IPPROTO_MEAS", Const, 0, ""},
+		{"IPPROTO_MH", Const, 1, ""},
+		{"IPPROTO_MHRP", Const, 0, ""},
+		{"IPPROTO_MICP", Const, 0, ""},
+		{"IPPROTO_MOBILE", Const, 0, ""},
+		{"IPPROTO_MPLS", Const, 1, ""},
+		{"IPPROTO_MTP", Const, 0, ""},
+		{"IPPROTO_MUX", Const, 0, ""},
+		{"IPPROTO_ND", Const, 0, ""},
+		{"IPPROTO_NHRP", Const, 0, ""},
+		{"IPPROTO_NONE", Const, 0, ""},
+		{"IPPROTO_NSP", Const, 0, ""},
+		{"IPPROTO_NVPII", Const, 0, ""},
+		{"IPPROTO_OLD_DIVERT", Const, 0, ""},
+		{"IPPROTO_OSPFIGP", Const, 0, ""},
+		{"IPPROTO_PFSYNC", Const, 0, ""},
+		{"IPPROTO_PGM", Const, 0, ""},
+		{"IPPROTO_PIGP", Const, 0, ""},
+		{"IPPROTO_PIM", Const, 0, ""},
+		{"IPPROTO_PRM", Const, 0, ""},
+		{"IPPROTO_PUP", Const, 0, ""},
+		{"IPPROTO_PVP", Const, 0, ""},
+		{"IPPROTO_RAW", Const, 0, ""},
+		{"IPPROTO_RCCMON", Const, 0, ""},
+		{"IPPROTO_RDP", Const, 0, ""},
+		{"IPPROTO_ROUTING", Const, 0, ""},
+		{"IPPROTO_RSVP", Const, 0, ""},
+		{"IPPROTO_RVD", Const, 0, ""},
+		{"IPPROTO_SATEXPAK", Const, 0, ""},
+		{"IPPROTO_SATMON", Const, 0, ""},
+		{"IPPROTO_SCCSP", Const, 0, ""},
+		{"IPPROTO_SCTP", Const, 0, ""},
+		{"IPPROTO_SDRP", Const, 0, ""},
+		{"IPPROTO_SEND", Const, 1, ""},
+		{"IPPROTO_SEP", Const, 0, ""},
+		{"IPPROTO_SKIP", Const, 0, ""},
+		{"IPPROTO_SPACER", Const, 0, ""},
+		{"IPPROTO_SRPC", Const, 0, ""},
+		{"IPPROTO_ST", Const, 0, ""},
+		{"IPPROTO_SVMTP", Const, 0, ""},
+		{"IPPROTO_SWIPE", Const, 0, ""},
+		{"IPPROTO_TCF", Const, 0, ""},
+		{"IPPROTO_TCP", Const, 0, ""},
+		{"IPPROTO_TLSP", Const, 0, ""},
+		{"IPPROTO_TP", Const, 0, ""},
+		{"IPPROTO_TPXX", Const, 0, ""},
+		{"IPPROTO_TRUNK1", Const, 0, ""},
+		{"IPPROTO_TRUNK2", Const, 0, ""},
+		{"IPPROTO_TTP", Const, 0, ""},
+		{"IPPROTO_UDP", Const, 0, ""},
+		{"IPPROTO_UDPLITE", Const, 0, ""},
+		{"IPPROTO_VINES", Const, 0, ""},
+		{"IPPROTO_VISA", Const, 0, ""},
+		{"IPPROTO_VMTP", Const, 0, ""},
+		{"IPPROTO_VRRP", Const, 1, ""},
+		{"IPPROTO_WBEXPAK", Const, 0, ""},
+		{"IPPROTO_WBMON", Const, 0, ""},
+		{"IPPROTO_WSN", Const, 0, ""},
+		{"IPPROTO_XNET", Const, 0, ""},
+		{"IPPROTO_XTP", Const, 0, ""},
+		{"IPV6_2292DSTOPTS", Const, 0, ""},
+		{"IPV6_2292HOPLIMIT", Const, 0, ""},
+		{"IPV6_2292HOPOPTS", Const, 0, ""},
+		{"IPV6_2292NEXTHOP", Const, 0, ""},
+		{"IPV6_2292PKTINFO", Const, 0, ""},
+		{"IPV6_2292PKTOPTIONS", Const, 0, ""},
+		{"IPV6_2292RTHDR", Const, 0, ""},
+		{"IPV6_ADDRFORM", Const, 0, ""},
+		{"IPV6_ADD_MEMBERSHIP", Const, 0, ""},
+		{"IPV6_AUTHHDR", Const, 0, ""},
+		{"IPV6_AUTH_LEVEL", Const, 1, ""},
+		{"IPV6_AUTOFLOWLABEL", Const, 0, ""},
+		{"IPV6_BINDANY", Const, 0, ""},
+		{"IPV6_BINDV6ONLY", Const, 0, ""},
+		{"IPV6_BOUND_IF", Const, 0, ""},
+		{"IPV6_CHECKSUM", Const, 0, ""},
+		{"IPV6_DEFAULT_MULTICAST_HOPS", Const, 0, ""},
+		{"IPV6_DEFAULT_MULTICAST_LOOP", Const, 0, ""},
+		{"IPV6_DEFHLIM", Const, 0, ""},
+		{"IPV6_DONTFRAG", Const, 0, ""},
+		{"IPV6_DROP_MEMBERSHIP", Const, 0, ""},
+		{"IPV6_DSTOPTS", Const, 0, ""},
+		{"IPV6_ESP_NETWORK_LEVEL", Const, 1, ""},
+		{"IPV6_ESP_TRANS_LEVEL", Const, 1, ""},
+		{"IPV6_FAITH", Const, 0, ""},
+		{"IPV6_FLOWINFO_MASK", Const, 0, ""},
+		{"IPV6_FLOWLABEL_MASK", Const, 0, ""},
+		{"IPV6_FRAGTTL", Const, 0, ""},
+		{"IPV6_FW_ADD", Const, 0, ""},
+		{"IPV6_FW_DEL", Const, 0, ""},
+		{"IPV6_FW_FLUSH", Const, 0, ""},
+		{"IPV6_FW_GET", Const, 0, ""},
+		{"IPV6_FW_ZERO", Const, 0, ""},
+		{"IPV6_HLIMDEC", Const, 0, ""},
+		{"IPV6_HOPLIMIT", Const, 0, ""},
+		{"IPV6_HOPOPTS", Const, 0, ""},
+		{"IPV6_IPCOMP_LEVEL", Const, 1, ""},
+		{"IPV6_IPSEC_POLICY", Const, 0, ""},
+		{"IPV6_JOIN_ANYCAST", Const, 0, ""},
+		{"IPV6_JOIN_GROUP", Const, 0, ""},
+		{"IPV6_LEAVE_ANYCAST", Const, 0, ""},
+		{"IPV6_LEAVE_GROUP", Const, 0, ""},
+		{"IPV6_MAXHLIM", Const, 0, ""},
+		{"IPV6_MAXOPTHDR", Const, 0, ""},
+		{"IPV6_MAXPACKET", Const, 0, ""},
+		{"IPV6_MAX_GROUP_SRC_FILTER", Const, 0, ""},
+		{"IPV6_MAX_MEMBERSHIPS", Const, 0, ""},
+		{"IPV6_MAX_SOCK_SRC_FILTER", Const, 0, ""},
+		{"IPV6_MIN_MEMBERSHIPS", Const, 0, ""},
+		{"IPV6_MMTU", Const, 0, ""},
+		{"IPV6_MSFILTER", Const, 0, ""},
+		{"IPV6_MTU", Const, 0, ""},
+		{"IPV6_MTU_DISCOVER", Const, 0, ""},
+		{"IPV6_MULTICAST_HOPS", Const, 0, ""},
+		{"IPV6_MULTICAST_IF", Const, 0, ""},
+		{"IPV6_MULTICAST_LOOP", Const, 0, ""},
+		{"IPV6_NEXTHOP", Const, 0, ""},
+		{"IPV6_OPTIONS", Const, 1, ""},
+		{"IPV6_PATHMTU", Const, 0, ""},
+		{"IPV6_PIPEX", Const, 1, ""},
+		{"IPV6_PKTINFO", Const, 0, ""},
+		{"IPV6_PMTUDISC_DO", Const, 0, ""},
+		{"IPV6_PMTUDISC_DONT", Const, 0, ""},
+		{"IPV6_PMTUDISC_PROBE", Const, 0, ""},
+		{"IPV6_PMTUDISC_WANT", Const, 0, ""},
+		{"IPV6_PORTRANGE", Const, 0, ""},
+		{"IPV6_PORTRANGE_DEFAULT", Const, 0, ""},
+		{"IPV6_PORTRANGE_HIGH", Const, 0, ""},
+		{"IPV6_PORTRANGE_LOW", Const, 0, ""},
+		{"IPV6_PREFER_TEMPADDR", Const, 0, ""},
+		{"IPV6_RECVDSTOPTS", Const, 0, ""},
+		{"IPV6_RECVDSTPORT", Const, 3, ""},
+		{"IPV6_RECVERR", Const, 0, ""},
+		{"IPV6_RECVHOPLIMIT", Const, 0, ""},
+		{"IPV6_RECVHOPOPTS", Const, 0, ""},
+		{"IPV6_RECVPATHMTU", Const, 0, ""},
+		{"IPV6_RECVPKTINFO", Const, 0, ""},
+		{"IPV6_RECVRTHDR", Const, 0, ""},
+		{"IPV6_RECVTCLASS", Const, 0, ""},
+		{"IPV6_ROUTER_ALERT", Const, 0, ""},
+		{"IPV6_RTABLE", Const, 1, ""},
+		{"IPV6_RTHDR", Const, 0, ""},
+		{"IPV6_RTHDRDSTOPTS", Const, 0, ""},
+		{"IPV6_RTHDR_LOOSE", Const, 0, ""},
+		{"IPV6_RTHDR_STRICT", Const, 0, ""},
+		{"IPV6_RTHDR_TYPE_0", Const, 0, ""},
+		{"IPV6_RXDSTOPTS", Const, 0, ""},
+		{"IPV6_RXHOPOPTS", Const, 0, ""},
+		{"IPV6_SOCKOPT_RESERVED1", Const, 0, ""},
+		{"IPV6_TCLASS", Const, 0, ""},
+		{"IPV6_UNICAST_HOPS", Const, 0, ""},
+		{"IPV6_USE_MIN_MTU", Const, 0, ""},
+		{"IPV6_V6ONLY", Const, 0, ""},
+		{"IPV6_VERSION", Const, 0, ""},
+		{"IPV6_VERSION_MASK", Const, 0, ""},
+		{"IPV6_XFRM_POLICY", Const, 0, ""},
+		{"IP_ADD_MEMBERSHIP", Const, 0, ""},
+		{"IP_ADD_SOURCE_MEMBERSHIP", Const, 0, ""},
+		{"IP_AUTH_LEVEL", Const, 1, ""},
+		{"IP_BINDANY", Const, 0, ""},
+		{"IP_BLOCK_SOURCE", Const, 0, ""},
+		{"IP_BOUND_IF", Const, 0, ""},
+		{"IP_DEFAULT_MULTICAST_LOOP", Const, 0, ""},
+		{"IP_DEFAULT_MULTICAST_TTL", Const, 0, ""},
+		{"IP_DF", Const, 0, ""},
+		{"IP_DIVERTFL", Const, 3, ""},
+		{"IP_DONTFRAG", Const, 0, ""},
+		{"IP_DROP_MEMBERSHIP", Const, 0, ""},
+		{"IP_DROP_SOURCE_MEMBERSHIP", Const, 0, ""},
+		{"IP_DUMMYNET3", Const, 0, ""},
+		{"IP_DUMMYNET_CONFIGURE", Const, 0, ""},
+		{"IP_DUMMYNET_DEL", Const, 0, ""},
+		{"IP_DUMMYNET_FLUSH", Const, 0, ""},
+		{"IP_DUMMYNET_GET", Const, 0, ""},
+		{"IP_EF", Const, 1, ""},
+		{"IP_ERRORMTU", Const, 1, ""},
+		{"IP_ESP_NETWORK_LEVEL", Const, 1, ""},
+		{"IP_ESP_TRANS_LEVEL", Const, 1, ""},
+		{"IP_FAITH", Const, 0, ""},
+		{"IP_FREEBIND", Const, 0, ""},
+		{"IP_FW3", Const, 0, ""},
+		{"IP_FW_ADD", Const, 0, ""},
+		{"IP_FW_DEL", Const, 0, ""},
+		{"IP_FW_FLUSH", Const, 0, ""},
+		{"IP_FW_GET", Const, 0, ""},
+		{"IP_FW_NAT_CFG", Const, 0, ""},
+		{"IP_FW_NAT_DEL", Const, 0, ""},
+		{"IP_FW_NAT_GET_CONFIG", Const, 0, ""},
+		{"IP_FW_NAT_GET_LOG", Const, 0, ""},
+		{"IP_FW_RESETLOG", Const, 0, ""},
+		{"IP_FW_TABLE_ADD", Const, 0, ""},
+		{"IP_FW_TABLE_DEL", Const, 0, ""},
+		{"IP_FW_TABLE_FLUSH", Const, 0, ""},
+		{"IP_FW_TABLE_GETSIZE", Const, 0, ""},
+		{"IP_FW_TABLE_LIST", Const, 0, ""},
+		{"IP_FW_ZERO", Const, 0, ""},
+		{"IP_HDRINCL", Const, 0, ""},
+		{"IP_IPCOMP_LEVEL", Const, 1, ""},
+		{"IP_IPSECFLOWINFO", Const, 1, ""},
+		{"IP_IPSEC_LOCAL_AUTH", Const, 1, ""},
+		{"IP_IPSEC_LOCAL_CRED", Const, 1, ""},
+		{"IP_IPSEC_LOCAL_ID", Const, 1, ""},
+		{"IP_IPSEC_POLICY", Const, 0, ""},
+		{"IP_IPSEC_REMOTE_AUTH", Const, 1, ""},
+		{"IP_IPSEC_REMOTE_CRED", Const, 1, ""},
+		{"IP_IPSEC_REMOTE_ID", Const, 1, ""},
+		{"IP_MAXPACKET", Const, 0, ""},
+		{"IP_MAX_GROUP_SRC_FILTER", Const, 0, ""},
+		{"IP_MAX_MEMBERSHIPS", Const, 0, ""},
+		{"IP_MAX_SOCK_MUTE_FILTER", Const, 0, ""},
+		{"IP_MAX_SOCK_SRC_FILTER", Const, 0, ""},
+		{"IP_MAX_SOURCE_FILTER", Const, 0, ""},
+		{"IP_MF", Const, 0, ""},
+		{"IP_MINFRAGSIZE", Const, 1, ""},
+		{"IP_MINTTL", Const, 0, ""},
+		{"IP_MIN_MEMBERSHIPS", Const, 0, ""},
+		{"IP_MSFILTER", Const, 0, ""},
+		{"IP_MSS", Const, 0, ""},
+		{"IP_MTU", Const, 0, ""},
+		{"IP_MTU_DISCOVER", Const, 0, ""},
+		{"IP_MULTICAST_IF", Const, 0, ""},
+		{"IP_MULTICAST_IFINDEX", Const, 0, ""},
+		{"IP_MULTICAST_LOOP", Const, 0, ""},
+		{"IP_MULTICAST_TTL", Const, 0, ""},
+		{"IP_MULTICAST_VIF", Const, 0, ""},
+		{"IP_NAT__XXX", Const, 0, ""},
+		{"IP_OFFMASK", Const, 0, ""},
+		{"IP_OLD_FW_ADD", Const, 0, ""},
+		{"IP_OLD_FW_DEL", Const, 0, ""},
+		{"IP_OLD_FW_FLUSH", Const, 0, ""},
+		{"IP_OLD_FW_GET", Const, 0, ""},
+		{"IP_OLD_FW_RESETLOG", Const, 0, ""},
+		{"IP_OLD_FW_ZERO", Const, 0, ""},
+		{"IP_ONESBCAST", Const, 0, ""},
+		{"IP_OPTIONS", Const, 0, ""},
+		{"IP_ORIGDSTADDR", Const, 0, ""},
+		{"IP_PASSSEC", Const, 0, ""},
+		{"IP_PIPEX", Const, 1, ""},
+		{"IP_PKTINFO", Const, 0, ""},
+		{"IP_PKTOPTIONS", Const, 0, ""},
+		{"IP_PMTUDISC", Const, 0, ""},
+		{"IP_PMTUDISC_DO", Const, 0, ""},
+		{"IP_PMTUDISC_DONT", Const, 0, ""},
+		{"IP_PMTUDISC_PROBE", Const, 0, ""},
+		{"IP_PMTUDISC_WANT", Const, 0, ""},
+		{"IP_PORTRANGE", Const, 0, ""},
+		{"IP_PORTRANGE_DEFAULT", Const, 0, ""},
+		{"IP_PORTRANGE_HIGH", Const, 0, ""},
+		{"IP_PORTRANGE_LOW", Const, 0, ""},
+		{"IP_RECVDSTADDR", Const, 0, ""},
+		{"IP_RECVDSTPORT", Const, 1, ""},
+		{"IP_RECVERR", Const, 0, ""},
+		{"IP_RECVIF", Const, 0, ""},
+		{"IP_RECVOPTS", Const, 0, ""},
+		{"IP_RECVORIGDSTADDR", Const, 0, ""},
+		{"IP_RECVPKTINFO", Const, 0, ""},
+		{"IP_RECVRETOPTS", Const, 0, ""},
+		{"IP_RECVRTABLE", Const, 1, ""},
+		{"IP_RECVTOS", Const, 0, ""},
+		{"IP_RECVTTL", Const, 0, ""},
+		{"IP_RETOPTS", Const, 0, ""},
+		{"IP_RF", Const, 0, ""},
+		{"IP_ROUTER_ALERT", Const, 0, ""},
+		{"IP_RSVP_OFF", Const, 0, ""},
+		{"IP_RSVP_ON", Const, 0, ""},
+		{"IP_RSVP_VIF_OFF", Const, 0, ""},
+		{"IP_RSVP_VIF_ON", Const, 0, ""},
+		{"IP_RTABLE", Const, 1, ""},
+		{"IP_SENDSRCADDR", Const, 0, ""},
+		{"IP_STRIPHDR", Const, 0, ""},
+		{"IP_TOS", Const, 0, ""},
+		{"IP_TRAFFIC_MGT_BACKGROUND", Const, 0, ""},
+		{"IP_TRANSPARENT", Const, 0, ""},
+		{"IP_TTL", Const, 0, ""},
+		{"IP_UNBLOCK_SOURCE", Const, 0, ""},
+		{"IP_XFRM_POLICY", Const, 0, ""},
+		{"IPv6MTUInfo", Type, 2, ""},
+		{"IPv6MTUInfo.Addr", Field, 2, ""},
+		{"IPv6MTUInfo.Mtu", Field, 2, ""},
+		{"IPv6Mreq", Type, 0, ""},
+		{"IPv6Mreq.Interface", Field, 0, ""},
+		{"IPv6Mreq.Multiaddr", Field, 0, ""},
+		{"ISIG", Const, 0, ""},
+		{"ISTRIP", Const, 0, ""},
+		{"IUCLC", Const, 0, ""},
+		{"IUTF8", Const, 0, ""},
+		{"IXANY", Const, 0, ""},
+		{"IXOFF", Const, 0, ""},
+		{"IXON", Const, 0, ""},
+		{"IfAddrmsg", Type, 0, ""},
+		{"IfAddrmsg.Family", Field, 0, ""},
+		{"IfAddrmsg.Flags", Field, 0, ""},
+		{"IfAddrmsg.Index", Field, 0, ""},
+		{"IfAddrmsg.Prefixlen", Field, 0, ""},
+		{"IfAddrmsg.Scope", Field, 0, ""},
+		{"IfAnnounceMsghdr", Type, 1, ""},
+		{"IfAnnounceMsghdr.Hdrlen", Field, 2, ""},
+		{"IfAnnounceMsghdr.Index", Field, 1, ""},
+		{"IfAnnounceMsghdr.Msglen", Field, 1, ""},
+		{"IfAnnounceMsghdr.Name", Field, 1, ""},
+		{"IfAnnounceMsghdr.Type", Field, 1, ""},
+		{"IfAnnounceMsghdr.Version", Field, 1, ""},
+		{"IfAnnounceMsghdr.What", Field, 1, ""},
+		{"IfData", Type, 0, ""},
+		{"IfData.Addrlen", Field, 0, ""},
+		{"IfData.Baudrate", Field, 0, ""},
+		{"IfData.Capabilities", Field, 2, ""},
+		{"IfData.Collisions", Field, 0, ""},
+		{"IfData.Datalen", Field, 0, ""},
+		{"IfData.Epoch", Field, 0, ""},
+		{"IfData.Hdrlen", Field, 0, ""},
+		{"IfData.Hwassist", Field, 0, ""},
+		{"IfData.Ibytes", Field, 0, ""},
+		{"IfData.Ierrors", Field, 0, ""},
+		{"IfData.Imcasts", Field, 0, ""},
+		{"IfData.Ipackets", Field, 0, ""},
+		{"IfData.Iqdrops", Field, 0, ""},
+		{"IfData.Lastchange", Field, 0, ""},
+		{"IfData.Link_state", Field, 0, ""},
+		{"IfData.Mclpool", Field, 2, ""},
+		{"IfData.Metric", Field, 0, ""},
+		{"IfData.Mtu", Field, 0, ""},
+		{"IfData.Noproto", Field, 0, ""},
+		{"IfData.Obytes", Field, 0, ""},
+		{"IfData.Oerrors", Field, 0, ""},
+		{"IfData.Omcasts", Field, 0, ""},
+		{"IfData.Opackets", Field, 0, ""},
+		{"IfData.Pad", Field, 2, ""},
+		{"IfData.Pad_cgo_0", Field, 2, ""},
+		{"IfData.Pad_cgo_1", Field, 2, ""},
+		{"IfData.Physical", Field, 0, ""},
+		{"IfData.Recvquota", Field, 0, ""},
+		{"IfData.Recvtiming", Field, 0, ""},
+		{"IfData.Reserved1", Field, 0, ""},
+		{"IfData.Reserved2", Field, 0, ""},
+		{"IfData.Spare_char1", Field, 0, ""},
+		{"IfData.Spare_char2", Field, 0, ""},
+		{"IfData.Type", Field, 0, ""},
+		{"IfData.Typelen", Field, 0, ""},
+		{"IfData.Unused1", Field, 0, ""},
+		{"IfData.Unused2", Field, 0, ""},
+		{"IfData.Xmitquota", Field, 0, ""},
+		{"IfData.Xmittiming", Field, 0, ""},
+		{"IfInfomsg", Type, 0, ""},
+		{"IfInfomsg.Change", Field, 0, ""},
+		{"IfInfomsg.Family", Field, 0, ""},
+		{"IfInfomsg.Flags", Field, 0, ""},
+		{"IfInfomsg.Index", Field, 0, ""},
+		{"IfInfomsg.Type", Field, 0, ""},
+		{"IfInfomsg.X__ifi_pad", Field, 0, ""},
+		{"IfMsghdr", Type, 0, ""},
+		{"IfMsghdr.Addrs", Field, 0, ""},
+		{"IfMsghdr.Data", Field, 0, ""},
+		{"IfMsghdr.Flags", Field, 0, ""},
+		{"IfMsghdr.Hdrlen", Field, 2, ""},
+		{"IfMsghdr.Index", Field, 0, ""},
+		{"IfMsghdr.Msglen", Field, 0, ""},
+		{"IfMsghdr.Pad1", Field, 2, ""},
+		{"IfMsghdr.Pad2", Field, 2, ""},
+		{"IfMsghdr.Pad_cgo_0", Field, 0, ""},
+		{"IfMsghdr.Pad_cgo_1", Field, 2, ""},
+		{"IfMsghdr.Tableid", Field, 2, ""},
+		{"IfMsghdr.Type", Field, 0, ""},
+		{"IfMsghdr.Version", Field, 0, ""},
+		{"IfMsghdr.Xflags", Field, 2, ""},
+		{"IfaMsghdr", Type, 0, ""},
+		{"IfaMsghdr.Addrs", Field, 0, ""},
+		{"IfaMsghdr.Flags", Field, 0, ""},
+		{"IfaMsghdr.Hdrlen", Field, 2, ""},
+		{"IfaMsghdr.Index", Field, 0, ""},
+		{"IfaMsghdr.Metric", Field, 0, ""},
+		{"IfaMsghdr.Msglen", Field, 0, ""},
+		{"IfaMsghdr.Pad1", Field, 2, ""},
+		{"IfaMsghdr.Pad2", Field, 2, ""},
+		{"IfaMsghdr.Pad_cgo_0", Field, 0, ""},
+		{"IfaMsghdr.Tableid", Field, 2, ""},
+		{"IfaMsghdr.Type", Field, 0, ""},
+		{"IfaMsghdr.Version", Field, 0, ""},
+		{"IfmaMsghdr", Type, 0, ""},
+		{"IfmaMsghdr.Addrs", Field, 0, ""},
+		{"IfmaMsghdr.Flags", Field, 0, ""},
+		{"IfmaMsghdr.Index", Field, 0, ""},
+		{"IfmaMsghdr.Msglen", Field, 0, ""},
+		{"IfmaMsghdr.Pad_cgo_0", Field, 0, ""},
+		{"IfmaMsghdr.Type", Field, 0, ""},
+		{"IfmaMsghdr.Version", Field, 0, ""},
+		{"IfmaMsghdr2", Type, 0, ""},
+		{"IfmaMsghdr2.Addrs", Field, 0, ""},
+		{"IfmaMsghdr2.Flags", Field, 0, ""},
+		{"IfmaMsghdr2.Index", Field, 0, ""},
+		{"IfmaMsghdr2.Msglen", Field, 0, ""},
+		{"IfmaMsghdr2.Pad_cgo_0", Field, 0, ""},
+		{"IfmaMsghdr2.Refcount", Field, 0, ""},
+		{"IfmaMsghdr2.Type", Field, 0, ""},
+		{"IfmaMsghdr2.Version", Field, 0, ""},
+		{"ImplementsGetwd", Const, 0, ""},
+		{"Inet4Pktinfo", Type, 0, ""},
+		{"Inet4Pktinfo.Addr", Field, 0, ""},
+		{"Inet4Pktinfo.Ifindex", Field, 0, ""},
+		{"Inet4Pktinfo.Spec_dst", Field, 0, ""},
+		{"Inet6Pktinfo", Type, 0, ""},
+		{"Inet6Pktinfo.Addr", Field, 0, ""},
+		{"Inet6Pktinfo.Ifindex", Field, 0, ""},
+		{"InotifyAddWatch", Func, 0, "func(fd int, pathname string, mask uint32) (watchdesc int, err error)"},
+		{"InotifyEvent", Type, 0, ""},
+		{"InotifyEvent.Cookie", Field, 0, ""},
+		{"InotifyEvent.Len", Field, 0, ""},
+		{"InotifyEvent.Mask", Field, 0, ""},
+		{"InotifyEvent.Name", Field, 0, ""},
+		{"InotifyEvent.Wd", Field, 0, ""},
+		{"InotifyInit", Func, 0, "func() (fd int, err error)"},
+		{"InotifyInit1", Func, 0, "func(flags int) (fd int, err error)"},
+		{"InotifyRmWatch", Func, 0, "func(fd int, watchdesc uint32) (success int, err error)"},
+		{"InterfaceAddrMessage", Type, 0, ""},
+		{"InterfaceAddrMessage.Data", Field, 0, ""},
+		{"InterfaceAddrMessage.Header", Field, 0, ""},
+		{"InterfaceAnnounceMessage", Type, 1, ""},
+		{"InterfaceAnnounceMessage.Header", Field, 1, ""},
+		{"InterfaceInfo", Type, 0, ""},
+		{"InterfaceInfo.Address", Field, 0, ""},
+		{"InterfaceInfo.BroadcastAddress", Field, 0, ""},
+		{"InterfaceInfo.Flags", Field, 0, ""},
+		{"InterfaceInfo.Netmask", Field, 0, ""},
+		{"InterfaceMessage", Type, 0, ""},
+		{"InterfaceMessage.Data", Field, 0, ""},
+		{"InterfaceMessage.Header", Field, 0, ""},
+		{"InterfaceMulticastAddrMessage", Type, 0, ""},
+		{"InterfaceMulticastAddrMessage.Data", Field, 0, ""},
+		{"InterfaceMulticastAddrMessage.Header", Field, 0, ""},
+		{"InvalidHandle", Const, 0, ""},
+		{"Ioperm", Func, 0, "func(from int, num int, on int) (err error)"},
+		{"Iopl", Func, 0, "func(level int) (err error)"},
+		{"Iovec", Type, 0, ""},
+		{"Iovec.Base", Field, 0, ""},
+		{"Iovec.Len", Field, 0, ""},
+		{"IpAdapterInfo", Type, 0, ""},
+		{"IpAdapterInfo.AdapterName", Field, 0, ""},
+		{"IpAdapterInfo.Address", Field, 0, ""},
+		{"IpAdapterInfo.AddressLength", Field, 0, ""},
+		{"IpAdapterInfo.ComboIndex", Field, 0, ""},
+		{"IpAdapterInfo.CurrentIpAddress", Field, 0, ""},
+		{"IpAdapterInfo.Description", Field, 0, ""},
+		{"IpAdapterInfo.DhcpEnabled", Field, 0, ""},
+		{"IpAdapterInfo.DhcpServer", Field, 0, ""},
+		{"IpAdapterInfo.GatewayList", Field, 0, ""},
+		{"IpAdapterInfo.HaveWins", Field, 0, ""},
+		{"IpAdapterInfo.Index", Field, 0, ""},
+		{"IpAdapterInfo.IpAddressList", Field, 0, ""},
+		{"IpAdapterInfo.LeaseExpires", Field, 0, ""},
+		{"IpAdapterInfo.LeaseObtained", Field, 0, ""},
+		{"IpAdapterInfo.Next", Field, 0, ""},
+		{"IpAdapterInfo.PrimaryWinsServer", Field, 0, ""},
+		{"IpAdapterInfo.SecondaryWinsServer", Field, 0, ""},
+		{"IpAdapterInfo.Type", Field, 0, ""},
+		{"IpAddrString", Type, 0, ""},
+		{"IpAddrString.Context", Field, 0, ""},
+		{"IpAddrString.IpAddress", Field, 0, ""},
+		{"IpAddrString.IpMask", Field, 0, ""},
+		{"IpAddrString.Next", Field, 0, ""},
+		{"IpAddressString", Type, 0, ""},
+		{"IpAddressString.String", Field, 0, ""},
+		{"IpMaskString", Type, 0, ""},
+		{"IpMaskString.String", Field, 2, ""},
+		{"Issetugid", Func, 0, ""},
+		{"KEY_ALL_ACCESS", Const, 0, ""},
+		{"KEY_CREATE_LINK", Const, 0, ""},
+		{"KEY_CREATE_SUB_KEY", Const, 0, ""},
+		{"KEY_ENUMERATE_SUB_KEYS", Const, 0, ""},
+		{"KEY_EXECUTE", Const, 0, ""},
+		{"KEY_NOTIFY", Const, 0, ""},
+		{"KEY_QUERY_VALUE", Const, 0, ""},
+		{"KEY_READ", Const, 0, ""},
+		{"KEY_SET_VALUE", Const, 0, ""},
+		{"KEY_WOW64_32KEY", Const, 0, ""},
+		{"KEY_WOW64_64KEY", Const, 0, ""},
+		{"KEY_WRITE", Const, 0, ""},
+		{"Kevent", Func, 0, ""},
+		{"Kevent_t", Type, 0, ""},
+		{"Kevent_t.Data", Field, 0, ""},
+		{"Kevent_t.Fflags", Field, 0, ""},
+		{"Kevent_t.Filter", Field, 0, ""},
+		{"Kevent_t.Flags", Field, 0, ""},
+		{"Kevent_t.Ident", Field, 0, ""},
+		{"Kevent_t.Pad_cgo_0", Field, 2, ""},
+		{"Kevent_t.Udata", Field, 0, ""},
+		{"Kill", Func, 0, "func(pid int, sig Signal) (err error)"},
+		{"Klogctl", Func, 0, "func(typ int, buf []byte) (n int, err error)"},
+		{"Kqueue", Func, 0, ""},
+		{"LANG_ENGLISH", Const, 0, ""},
+		{"LAYERED_PROTOCOL", Const, 2, ""},
+		{"LCNT_OVERLOAD_FLUSH", Const, 1, ""},
+		{"LINUX_REBOOT_CMD_CAD_OFF", Const, 0, ""},
+		{"LINUX_REBOOT_CMD_CAD_ON", Const, 0, ""},
+		{"LINUX_REBOOT_CMD_HALT", Const, 0, ""},
+		{"LINUX_REBOOT_CMD_KEXEC", Const, 0, ""},
+		{"LINUX_REBOOT_CMD_POWER_OFF", Const, 0, ""},
+		{"LINUX_REBOOT_CMD_RESTART", Const, 0, ""},
+		{"LINUX_REBOOT_CMD_RESTART2", Const, 0, ""},
+		{"LINUX_REBOOT_CMD_SW_SUSPEND", Const, 0, ""},
+		{"LINUX_REBOOT_MAGIC1", Const, 0, ""},
+		{"LINUX_REBOOT_MAGIC2", Const, 0, ""},
+		{"LOCK_EX", Const, 0, ""},
+		{"LOCK_NB", Const, 0, ""},
+		{"LOCK_SH", Const, 0, ""},
+		{"LOCK_UN", Const, 0, ""},
+		{"LazyDLL", Type, 0, ""},
+		{"LazyDLL.Name", Field, 0, ""},
+		{"LazyProc", Type, 0, ""},
+		{"LazyProc.Name", Field, 0, ""},
+		{"Lchown", Func, 0, "func(path string, uid int, gid int) (err error)"},
+		{"Linger", Type, 0, ""},
+		{"Linger.Linger", Field, 0, ""},
+		{"Linger.Onoff", Field, 0, ""},
+		{"Link", Func, 0, "func(oldpath string, newpath string) (err error)"},
+		{"Listen", Func, 0, "func(s int, n int) (err error)"},
+		{"Listxattr", Func, 1, "func(path string, dest []byte) (sz int, err error)"},
+		{"LoadCancelIoEx", Func, 1, ""},
+		{"LoadConnectEx", Func, 1, ""},
+		{"LoadCreateSymbolicLink", Func, 4, ""},
+		{"LoadDLL", Func, 0, ""},
+		{"LoadGetAddrInfo", Func, 1, ""},
+		{"LoadLibrary", Func, 0, ""},
+		{"LoadSetFileCompletionNotificationModes", Func, 2, ""},
+		{"LocalFree", Func, 0, ""},
+		{"Log2phys_t", Type, 0, ""},
+		{"Log2phys_t.Contigbytes", Field, 0, ""},
+		{"Log2phys_t.Devoffset", Field, 0, ""},
+		{"Log2phys_t.Flags", Field, 0, ""},
+		{"LookupAccountName", Func, 0, ""},
+		{"LookupAccountSid", Func, 0, ""},
+		{"LookupSID", Func, 0, ""},
+		{"LsfJump", Func, 0, "func(code int, k int, jt int, jf int) *SockFilter"},
+		{"LsfSocket", Func, 0, "func(ifindex int, proto int) (int, error)"},
+		{"LsfStmt", Func, 0, "func(code int, k int) *SockFilter"},
+		{"Lstat", Func, 0, "func(path string, stat *Stat_t) (err error)"},
+		{"MADV_AUTOSYNC", Const, 1, ""},
+		{"MADV_CAN_REUSE", Const, 0, ""},
+		{"MADV_CORE", Const, 1, ""},
+		{"MADV_DOFORK", Const, 0, ""},
+		{"MADV_DONTFORK", Const, 0, ""},
+		{"MADV_DONTNEED", Const, 0, ""},
+		{"MADV_FREE", Const, 0, ""},
+		{"MADV_FREE_REUSABLE", Const, 0, ""},
+		{"MADV_FREE_REUSE", Const, 0, ""},
+		{"MADV_HUGEPAGE", Const, 0, ""},
+		{"MADV_HWPOISON", Const, 0, ""},
+		{"MADV_MERGEABLE", Const, 0, ""},
+		{"MADV_NOCORE", Const, 1, ""},
+		{"MADV_NOHUGEPAGE", Const, 0, ""},
+		{"MADV_NORMAL", Const, 0, ""},
+		{"MADV_NOSYNC", Const, 1, ""},
+		{"MADV_PROTECT", Const, 1, ""},
+		{"MADV_RANDOM", Const, 0, ""},
+		{"MADV_REMOVE", Const, 0, ""},
+		{"MADV_SEQUENTIAL", Const, 0, ""},
+		{"MADV_SPACEAVAIL", Const, 3, ""},
+		{"MADV_UNMERGEABLE", Const, 0, ""},
+		{"MADV_WILLNEED", Const, 0, ""},
+		{"MADV_ZERO_WIRED_PAGES", Const, 0, ""},
+		{"MAP_32BIT", Const, 0, ""},
+		{"MAP_ALIGNED_SUPER", Const, 3, ""},
+		{"MAP_ALIGNMENT_16MB", Const, 3, ""},
+		{"MAP_ALIGNMENT_1TB", Const, 3, ""},
+		{"MAP_ALIGNMENT_256TB", Const, 3, ""},
+		{"MAP_ALIGNMENT_4GB", Const, 3, ""},
+		{"MAP_ALIGNMENT_64KB", Const, 3, ""},
+		{"MAP_ALIGNMENT_64PB", Const, 3, ""},
+		{"MAP_ALIGNMENT_MASK", Const, 3, ""},
+		{"MAP_ALIGNMENT_SHIFT", Const, 3, ""},
+		{"MAP_ANON", Const, 0, ""},
+		{"MAP_ANONYMOUS", Const, 0, ""},
+		{"MAP_COPY", Const, 0, ""},
+		{"MAP_DENYWRITE", Const, 0, ""},
+		{"MAP_EXECUTABLE", Const, 0, ""},
+		{"MAP_FILE", Const, 0, ""},
+		{"MAP_FIXED", Const, 0, ""},
+		{"MAP_FLAGMASK", Const, 3, ""},
+		{"MAP_GROWSDOWN", Const, 0, ""},
+		{"MAP_HASSEMAPHORE", Const, 0, ""},
+		{"MAP_HUGETLB", Const, 0, ""},
+		{"MAP_INHERIT", Const, 3, ""},
+		{"MAP_INHERIT_COPY", Const, 3, ""},
+		{"MAP_INHERIT_DEFAULT", Const, 3, ""},
+		{"MAP_INHERIT_DONATE_COPY", Const, 3, ""},
+		{"MAP_INHERIT_NONE", Const, 3, ""},
+		{"MAP_INHERIT_SHARE", Const, 3, ""},
+		{"MAP_JIT", Const, 0, ""},
+		{"MAP_LOCKED", Const, 0, ""},
+		{"MAP_NOCACHE", Const, 0, ""},
+		{"MAP_NOCORE", Const, 1, ""},
+		{"MAP_NOEXTEND", Const, 0, ""},
+		{"MAP_NONBLOCK", Const, 0, ""},
+		{"MAP_NORESERVE", Const, 0, ""},
+		{"MAP_NOSYNC", Const, 1, ""},
+		{"MAP_POPULATE", Const, 0, ""},
+		{"MAP_PREFAULT_READ", Const, 1, ""},
+		{"MAP_PRIVATE", Const, 0, ""},
+		{"MAP_RENAME", Const, 0, ""},
+		{"MAP_RESERVED0080", Const, 0, ""},
+		{"MAP_RESERVED0100", Const, 1, ""},
+		{"MAP_SHARED", Const, 0, ""},
+		{"MAP_STACK", Const, 0, ""},
+		{"MAP_TRYFIXED", Const, 3, ""},
+		{"MAP_TYPE", Const, 0, ""},
+		{"MAP_WIRED", Const, 3, ""},
+		{"MAXIMUM_REPARSE_DATA_BUFFER_SIZE", Const, 4, ""},
+		{"MAXLEN_IFDESCR", Const, 0, ""},
+		{"MAXLEN_PHYSADDR", Const, 0, ""},
+		{"MAX_ADAPTER_ADDRESS_LENGTH", Const, 0, ""},
+		{"MAX_ADAPTER_DESCRIPTION_LENGTH", Const, 0, ""},
+		{"MAX_ADAPTER_NAME_LENGTH", Const, 0, ""},
+		{"MAX_COMPUTERNAME_LENGTH", Const, 0, ""},
+		{"MAX_INTERFACE_NAME_LEN", Const, 0, ""},
+		{"MAX_LONG_PATH", Const, 0, ""},
+		{"MAX_PATH", Const, 0, ""},
+		{"MAX_PROTOCOL_CHAIN", Const, 2, ""},
+		{"MCL_CURRENT", Const, 0, ""},
+		{"MCL_FUTURE", Const, 0, ""},
+		{"MNT_DETACH", Const, 0, ""},
+		{"MNT_EXPIRE", Const, 0, ""},
+		{"MNT_FORCE", Const, 0, ""},
+		{"MSG_BCAST", Const, 1, ""},
+		{"MSG_CMSG_CLOEXEC", Const, 0, ""},
+		{"MSG_COMPAT", Const, 0, ""},
+		{"MSG_CONFIRM", Const, 0, ""},
+		{"MSG_CONTROLMBUF", Const, 1, ""},
+		{"MSG_CTRUNC", Const, 0, ""},
+		{"MSG_DONTROUTE", Const, 0, ""},
+		{"MSG_DONTWAIT", Const, 0, ""},
+		{"MSG_EOF", Const, 0, ""},
+		{"MSG_EOR", Const, 0, ""},
+		{"MSG_ERRQUEUE", Const, 0, ""},
+		{"MSG_FASTOPEN", Const, 1, ""},
+		{"MSG_FIN", Const, 0, ""},
+		{"MSG_FLUSH", Const, 0, ""},
+		{"MSG_HAVEMORE", Const, 0, ""},
+		{"MSG_HOLD", Const, 0, ""},
+		{"MSG_IOVUSRSPACE", Const, 1, ""},
+		{"MSG_LENUSRSPACE", Const, 1, ""},
+		{"MSG_MCAST", Const, 1, ""},
+		{"MSG_MORE", Const, 0, ""},
+		{"MSG_NAMEMBUF", Const, 1, ""},
+		{"MSG_NBIO", Const, 0, ""},
+		{"MSG_NEEDSA", Const, 0, ""},
+		{"MSG_NOSIGNAL", Const, 0, ""},
+		{"MSG_NOTIFICATION", Const, 0, ""},
+		{"MSG_OOB", Const, 0, ""},
+		{"MSG_PEEK", Const, 0, ""},
+		{"MSG_PROXY", Const, 0, ""},
+		{"MSG_RCVMORE", Const, 0, ""},
+		{"MSG_RST", Const, 0, ""},
+		{"MSG_SEND", Const, 0, ""},
+		{"MSG_SYN", Const, 0, ""},
+		{"MSG_TRUNC", Const, 0, ""},
+		{"MSG_TRYHARD", Const, 0, ""},
+		{"MSG_USERFLAGS", Const, 1, ""},
+		{"MSG_WAITALL", Const, 0, ""},
+		{"MSG_WAITFORONE", Const, 0, ""},
+		{"MSG_WAITSTREAM", Const, 0, ""},
+		{"MS_ACTIVE", Const, 0, ""},
+		{"MS_ASYNC", Const, 0, ""},
+		{"MS_BIND", Const, 0, ""},
+		{"MS_DEACTIVATE", Const, 0, ""},
+		{"MS_DIRSYNC", Const, 0, ""},
+		{"MS_INVALIDATE", Const, 0, ""},
+		{"MS_I_VERSION", Const, 0, ""},
+		{"MS_KERNMOUNT", Const, 0, ""},
+		{"MS_KILLPAGES", Const, 0, ""},
+		{"MS_MANDLOCK", Const, 0, ""},
+		{"MS_MGC_MSK", Const, 0, ""},
+		{"MS_MGC_VAL", Const, 0, ""},
+		{"MS_MOVE", Const, 0, ""},
+		{"MS_NOATIME", Const, 0, ""},
+		{"MS_NODEV", Const, 0, ""},
+		{"MS_NODIRATIME", Const, 0, ""},
+		{"MS_NOEXEC", Const, 0, ""},
+		{"MS_NOSUID", Const, 0, ""},
+		{"MS_NOUSER", Const, 0, ""},
+		{"MS_POSIXACL", Const, 0, ""},
+		{"MS_PRIVATE", Const, 0, ""},
+		{"MS_RDONLY", Const, 0, ""},
+		{"MS_REC", Const, 0, ""},
+		{"MS_RELATIME", Const, 0, ""},
+		{"MS_REMOUNT", Const, 0, ""},
+		{"MS_RMT_MASK", Const, 0, ""},
+		{"MS_SHARED", Const, 0, ""},
+		{"MS_SILENT", Const, 0, ""},
+		{"MS_SLAVE", Const, 0, ""},
+		{"MS_STRICTATIME", Const, 0, ""},
+		{"MS_SYNC", Const, 0, ""},
+		{"MS_SYNCHRONOUS", Const, 0, ""},
+		{"MS_UNBINDABLE", Const, 0, ""},
+		{"Madvise", Func, 0, "func(b []byte, advice int) (err error)"},
+		{"MapViewOfFile", Func, 0, ""},
+		{"MaxTokenInfoClass", Const, 0, ""},
+		{"Mclpool", Type, 2, ""},
+		{"Mclpool.Alive", Field, 2, ""},
+		{"Mclpool.Cwm", Field, 2, ""},
+		{"Mclpool.Grown", Field, 2, ""},
+		{"Mclpool.Hwm", Field, 2, ""},
+		{"Mclpool.Lwm", Field, 2, ""},
+		{"MibIfRow", Type, 0, ""},
+		{"MibIfRow.AdminStatus", Field, 0, ""},
+		{"MibIfRow.Descr", Field, 0, ""},
+		{"MibIfRow.DescrLen", Field, 0, ""},
+		{"MibIfRow.InDiscards", Field, 0, ""},
+		{"MibIfRow.InErrors", Field, 0, ""},
+		{"MibIfRow.InNUcastPkts", Field, 0, ""},
+		{"MibIfRow.InOctets", Field, 0, ""},
+		{"MibIfRow.InUcastPkts", Field, 0, ""},
+		{"MibIfRow.InUnknownProtos", Field, 0, ""},
+		{"MibIfRow.Index", Field, 0, ""},
+		{"MibIfRow.LastChange", Field, 0, ""},
+		{"MibIfRow.Mtu", Field, 0, ""},
+		{"MibIfRow.Name", Field, 0, ""},
+		{"MibIfRow.OperStatus", Field, 0, ""},
+		{"MibIfRow.OutDiscards", Field, 0, ""},
+		{"MibIfRow.OutErrors", Field, 0, ""},
+		{"MibIfRow.OutNUcastPkts", Field, 0, ""},
+		{"MibIfRow.OutOctets", Field, 0, ""},
+		{"MibIfRow.OutQLen", Field, 0, ""},
+		{"MibIfRow.OutUcastPkts", Field, 0, ""},
+		{"MibIfRow.PhysAddr", Field, 0, ""},
+		{"MibIfRow.PhysAddrLen", Field, 0, ""},
+		{"MibIfRow.Speed", Field, 0, ""},
+		{"MibIfRow.Type", Field, 0, ""},
+		{"Mkdir", Func, 0, "func(path string, mode uint32) (err error)"},
+		{"Mkdirat", Func, 0, "func(dirfd int, path string, mode uint32) (err error)"},
+		{"Mkfifo", Func, 0, "func(path string, mode uint32) (err error)"},
+		{"Mknod", Func, 0, "func(path string, mode uint32, dev int) (err error)"},
+		{"Mknodat", Func, 0, "func(dirfd int, path string, mode uint32, dev int) (err error)"},
+		{"Mlock", Func, 0, "func(b []byte) (err error)"},
+		{"Mlockall", Func, 0, "func(flags int) (err error)"},
+		{"Mmap", Func, 0, "func(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)"},
+		{"Mount", Func, 0, "func(source string, target string, fstype string, flags uintptr, data string) (err error)"},
+		{"MoveFile", Func, 0, ""},
+		{"Mprotect", Func, 0, "func(b []byte, prot int) (err error)"},
+		{"Msghdr", Type, 0, ""},
+		{"Msghdr.Control", Field, 0, ""},
+		{"Msghdr.Controllen", Field, 0, ""},
+		{"Msghdr.Flags", Field, 0, ""},
+		{"Msghdr.Iov", Field, 0, ""},
+		{"Msghdr.Iovlen", Field, 0, ""},
+		{"Msghdr.Name", Field, 0, ""},
+		{"Msghdr.Namelen", Field, 0, ""},
+		{"Msghdr.Pad_cgo_0", Field, 0, ""},
+		{"Msghdr.Pad_cgo_1", Field, 0, ""},
+		{"Munlock", Func, 0, "func(b []byte) (err error)"},
+		{"Munlockall", Func, 0, "func() (err error)"},
+		{"Munmap", Func, 0, "func(b []byte) (err error)"},
+		{"MustLoadDLL", Func, 0, ""},
+		{"NAME_MAX", Const, 0, ""},
+		{"NETLINK_ADD_MEMBERSHIP", Const, 0, ""},
+		{"NETLINK_AUDIT", Const, 0, ""},
+		{"NETLINK_BROADCAST_ERROR", Const, 0, ""},
+		{"NETLINK_CONNECTOR", Const, 0, ""},
+		{"NETLINK_DNRTMSG", Const, 0, ""},
+		{"NETLINK_DROP_MEMBERSHIP", Const, 0, ""},
+		{"NETLINK_ECRYPTFS", Const, 0, ""},
+		{"NETLINK_FIB_LOOKUP", Const, 0, ""},
+		{"NETLINK_FIREWALL", Const, 0, ""},
+		{"NETLINK_GENERIC", Const, 0, ""},
+		{"NETLINK_INET_DIAG", Const, 0, ""},
+		{"NETLINK_IP6_FW", Const, 0, ""},
+		{"NETLINK_ISCSI", Const, 0, ""},
+		{"NETLINK_KOBJECT_UEVENT", Const, 0, ""},
+		{"NETLINK_NETFILTER", Const, 0, ""},
+		{"NETLINK_NFLOG", Const, 0, ""},
+		{"NETLINK_NO_ENOBUFS", Const, 0, ""},
+		{"NETLINK_PKTINFO", Const, 0, ""},
+		{"NETLINK_RDMA", Const, 0, ""},
+		{"NETLINK_ROUTE", Const, 0, ""},
+		{"NETLINK_SCSITRANSPORT", Const, 0, ""},
+		{"NETLINK_SELINUX", Const, 0, ""},
+		{"NETLINK_UNUSED", Const, 0, ""},
+		{"NETLINK_USERSOCK", Const, 0, ""},
+		{"NETLINK_XFRM", Const, 0, ""},
+		{"NET_RT_DUMP", Const, 0, ""},
+		{"NET_RT_DUMP2", Const, 0, ""},
+		{"NET_RT_FLAGS", Const, 0, ""},
+		{"NET_RT_IFLIST", Const, 0, ""},
+		{"NET_RT_IFLIST2", Const, 0, ""},
+		{"NET_RT_IFLISTL", Const, 1, ""},
+		{"NET_RT_IFMALIST", Const, 0, ""},
+		{"NET_RT_MAXID", Const, 0, ""},
+		{"NET_RT_OIFLIST", Const, 1, ""},
+		{"NET_RT_OOIFLIST", Const, 1, ""},
+		{"NET_RT_STAT", Const, 0, ""},
+		{"NET_RT_STATS", Const, 1, ""},
+		{"NET_RT_TABLE", Const, 1, ""},
+		{"NET_RT_TRASH", Const, 0, ""},
+		{"NLA_ALIGNTO", Const, 0, ""},
+		{"NLA_F_NESTED", Const, 0, ""},
+		{"NLA_F_NET_BYTEORDER", Const, 0, ""},
+		{"NLA_HDRLEN", Const, 0, ""},
+		{"NLMSG_ALIGNTO", Const, 0, ""},
+		{"NLMSG_DONE", Const, 0, ""},
+		{"NLMSG_ERROR", Const, 0, ""},
+		{"NLMSG_HDRLEN", Const, 0, ""},
+		{"NLMSG_MIN_TYPE", Const, 0, ""},
+		{"NLMSG_NOOP", Const, 0, ""},
+		{"NLMSG_OVERRUN", Const, 0, ""},
+		{"NLM_F_ACK", Const, 0, ""},
+		{"NLM_F_APPEND", Const, 0, ""},
+		{"NLM_F_ATOMIC", Const, 0, ""},
+		{"NLM_F_CREATE", Const, 0, ""},
+		{"NLM_F_DUMP", Const, 0, ""},
+		{"NLM_F_ECHO", Const, 0, ""},
+		{"NLM_F_EXCL", Const, 0, ""},
+		{"NLM_F_MATCH", Const, 0, ""},
+		{"NLM_F_MULTI", Const, 0, ""},
+		{"NLM_F_REPLACE", Const, 0, ""},
+		{"NLM_F_REQUEST", Const, 0, ""},
+		{"NLM_F_ROOT", Const, 0, ""},
+		{"NOFLSH", Const, 0, ""},
+		{"NOTE_ABSOLUTE", Const, 0, ""},
+		{"NOTE_ATTRIB", Const, 0, ""},
+		{"NOTE_BACKGROUND", Const, 16, ""},
+		{"NOTE_CHILD", Const, 0, ""},
+		{"NOTE_CRITICAL", Const, 16, ""},
+		{"NOTE_DELETE", Const, 0, ""},
+		{"NOTE_EOF", Const, 1, ""},
+		{"NOTE_EXEC", Const, 0, ""},
+		{"NOTE_EXIT", Const, 0, ""},
+		{"NOTE_EXITSTATUS", Const, 0, ""},
+		{"NOTE_EXIT_CSERROR", Const, 16, ""},
+		{"NOTE_EXIT_DECRYPTFAIL", Const, 16, ""},
+		{"NOTE_EXIT_DETAIL", Const, 16, ""},
+		{"NOTE_EXIT_DETAIL_MASK", Const, 16, ""},
+		{"NOTE_EXIT_MEMORY", Const, 16, ""},
+		{"NOTE_EXIT_REPARENTED", Const, 16, ""},
+		{"NOTE_EXTEND", Const, 0, ""},
+		{"NOTE_FFAND", Const, 0, ""},
+		{"NOTE_FFCOPY", Const, 0, ""},
+		{"NOTE_FFCTRLMASK", Const, 0, ""},
+		{"NOTE_FFLAGSMASK", Const, 0, ""},
+		{"NOTE_FFNOP", Const, 0, ""},
+		{"NOTE_FFOR", Const, 0, ""},
+		{"NOTE_FORK", Const, 0, ""},
+		{"NOTE_LEEWAY", Const, 16, ""},
+		{"NOTE_LINK", Const, 0, ""},
+		{"NOTE_LOWAT", Const, 0, ""},
+		{"NOTE_NONE", Const, 0, ""},
+		{"NOTE_NSECONDS", Const, 0, ""},
+		{"NOTE_PCTRLMASK", Const, 0, ""},
+		{"NOTE_PDATAMASK", Const, 0, ""},
+		{"NOTE_REAP", Const, 0, ""},
+		{"NOTE_RENAME", Const, 0, ""},
+		{"NOTE_RESOURCEEND", Const, 0, ""},
+		{"NOTE_REVOKE", Const, 0, ""},
+		{"NOTE_SECONDS", Const, 0, ""},
+		{"NOTE_SIGNAL", Const, 0, ""},
+		{"NOTE_TRACK", Const, 0, ""},
+		{"NOTE_TRACKERR", Const, 0, ""},
+		{"NOTE_TRIGGER", Const, 0, ""},
+		{"NOTE_TRUNCATE", Const, 1, ""},
+		{"NOTE_USECONDS", Const, 0, ""},
+		{"NOTE_VM_ERROR", Const, 0, ""},
+		{"NOTE_VM_PRESSURE", Const, 0, ""},
+		{"NOTE_VM_PRESSURE_SUDDEN_TERMINATE", Const, 0, ""},
+		{"NOTE_VM_PRESSURE_TERMINATE", Const, 0, ""},
+		{"NOTE_WRITE", Const, 0, ""},
+		{"NameCanonical", Const, 0, ""},
+		{"NameCanonicalEx", Const, 0, ""},
+		{"NameDisplay", Const, 0, ""},
+		{"NameDnsDomain", Const, 0, ""},
+		{"NameFullyQualifiedDN", Const, 0, ""},
+		{"NameSamCompatible", Const, 0, ""},
+		{"NameServicePrincipal", Const, 0, ""},
+		{"NameUniqueId", Const, 0, ""},
+		{"NameUnknown", Const, 0, ""},
+		{"NameUserPrincipal", Const, 0, ""},
+		{"Nanosleep", Func, 0, "func(time *Timespec, leftover *Timespec) (err error)"},
+		{"NetApiBufferFree", Func, 0, ""},
+		{"NetGetJoinInformation", Func, 2, ""},
+		{"NetSetupDomainName", Const, 2, ""},
+		{"NetSetupUnjoined", Const, 2, ""},
+		{"NetSetupUnknownStatus", Const, 2, ""},
+		{"NetSetupWorkgroupName", Const, 2, ""},
+		{"NetUserGetInfo", Func, 0, ""},
+		{"NetlinkMessage", Type, 0, ""},
+		{"NetlinkMessage.Data", Field, 0, ""},
+		{"NetlinkMessage.Header", Field, 0, ""},
+		{"NetlinkRIB", Func, 0, "func(proto int, family int) ([]byte, error)"},
+		{"NetlinkRouteAttr", Type, 0, ""},
+		{"NetlinkRouteAttr.Attr", Field, 0, ""},
+		{"NetlinkRouteAttr.Value", Field, 0, ""},
+		{"NetlinkRouteRequest", Type, 0, ""},
+		{"NetlinkRouteRequest.Data", Field, 0, ""},
+		{"NetlinkRouteRequest.Header", Field, 0, ""},
+		{"NewCallback", Func, 0, ""},
+		{"NewCallbackCDecl", Func, 3, ""},
+		{"NewLazyDLL", Func, 0, ""},
+		{"NlAttr", Type, 0, ""},
+		{"NlAttr.Len", Field, 0, ""},
+		{"NlAttr.Type", Field, 0, ""},
+		{"NlMsgerr", Type, 0, ""},
+		{"NlMsgerr.Error", Field, 0, ""},
+		{"NlMsgerr.Msg", Field, 0, ""},
+		{"NlMsghdr", Type, 0, ""},
+		{"NlMsghdr.Flags", Field, 0, ""},
+		{"NlMsghdr.Len", Field, 0, ""},
+		{"NlMsghdr.Pid", Field, 0, ""},
+		{"NlMsghdr.Seq", Field, 0, ""},
+		{"NlMsghdr.Type", Field, 0, ""},
+		{"NsecToFiletime", Func, 0, ""},
+		{"NsecToTimespec", Func, 0, "func(nsec int64) Timespec"},
+		{"NsecToTimeval", Func, 0, "func(nsec int64) Timeval"},
+		{"Ntohs", Func, 0, ""},
+		{"OCRNL", Const, 0, ""},
+		{"OFDEL", Const, 0, ""},
+		{"OFILL", Const, 0, ""},
+		{"OFIOGETBMAP", Const, 1, ""},
+		{"OID_PKIX_KP_SERVER_AUTH", Var, 0, ""},
+		{"OID_SERVER_GATED_CRYPTO", Var, 0, ""},
+		{"OID_SGC_NETSCAPE", Var, 0, ""},
+		{"OLCUC", Const, 0, ""},
+		{"ONLCR", Const, 0, ""},
+		{"ONLRET", Const, 0, ""},
+		{"ONOCR", Const, 0, ""},
+		{"ONOEOT", Const, 1, ""},
+		{"OPEN_ALWAYS", Const, 0, ""},
+		{"OPEN_EXISTING", Const, 0, ""},
+		{"OPOST", Const, 0, ""},
+		{"O_ACCMODE", Const, 0, ""},
+		{"O_ALERT", Const, 0, ""},
+		{"O_ALT_IO", Const, 1, ""},
+		{"O_APPEND", Const, 0, ""},
+		{"O_ASYNC", Const, 0, ""},
+		{"O_CLOEXEC", Const, 0, ""},
+		{"O_CREAT", Const, 0, ""},
+		{"O_DIRECT", Const, 0, ""},
+		{"O_DIRECTORY", Const, 0, ""},
+		{"O_DP_GETRAWENCRYPTED", Const, 16, ""},
+		{"O_DSYNC", Const, 0, ""},
+		{"O_EVTONLY", Const, 0, ""},
+		{"O_EXCL", Const, 0, ""},
+		{"O_EXEC", Const, 0, ""},
+		{"O_EXLOCK", Const, 0, ""},
+		{"O_FSYNC", Const, 0, ""},
+		{"O_LARGEFILE", Const, 0, ""},
+		{"O_NDELAY", Const, 0, ""},
+		{"O_NOATIME", Const, 0, ""},
+		{"O_NOCTTY", Const, 0, ""},
+		{"O_NOFOLLOW", Const, 0, ""},
+		{"O_NONBLOCK", Const, 0, ""},
+		{"O_NOSIGPIPE", Const, 1, ""},
+		{"O_POPUP", Const, 0, ""},
+		{"O_RDONLY", Const, 0, ""},
+		{"O_RDWR", Const, 0, ""},
+		{"O_RSYNC", Const, 0, ""},
+		{"O_SHLOCK", Const, 0, ""},
+		{"O_SYMLINK", Const, 0, ""},
+		{"O_SYNC", Const, 0, ""},
+		{"O_TRUNC", Const, 0, ""},
+		{"O_TTY_INIT", Const, 0, ""},
+		{"O_WRONLY", Const, 0, ""},
+		{"Open", Func, 0, "func(path string, mode int, perm uint32) (fd int, err error)"},
+		{"OpenCurrentProcessToken", Func, 0, ""},
+		{"OpenProcess", Func, 0, ""},
+		{"OpenProcessToken", Func, 0, ""},
+		{"Openat", Func, 0, "func(dirfd int, path string, flags int, mode uint32) (fd int, err error)"},
+		{"Overlapped", Type, 0, ""},
+		{"Overlapped.HEvent", Field, 0, ""},
+		{"Overlapped.Internal", Field, 0, ""},
+		{"Overlapped.InternalHigh", Field, 0, ""},
+		{"Overlapped.Offset", Field, 0, ""},
+		{"Overlapped.OffsetHigh", Field, 0, ""},
+		{"PACKET_ADD_MEMBERSHIP", Const, 0, ""},
+		{"PACKET_BROADCAST", Const, 0, ""},
+		{"PACKET_DROP_MEMBERSHIP", Const, 0, ""},
+		{"PACKET_FASTROUTE", Const, 0, ""},
+		{"PACKET_HOST", Const, 0, ""},
+		{"PACKET_LOOPBACK", Const, 0, ""},
+		{"PACKET_MR_ALLMULTI", Const, 0, ""},
+		{"PACKET_MR_MULTICAST", Const, 0, ""},
+		{"PACKET_MR_PROMISC", Const, 0, ""},
+		{"PACKET_MULTICAST", Const, 0, ""},
+		{"PACKET_OTHERHOST", Const, 0, ""},
+		{"PACKET_OUTGOING", Const, 0, ""},
+		{"PACKET_RECV_OUTPUT", Const, 0, ""},
+		{"PACKET_RX_RING", Const, 0, ""},
+		{"PACKET_STATISTICS", Const, 0, ""},
+		{"PAGE_EXECUTE_READ", Const, 0, ""},
+		{"PAGE_EXECUTE_READWRITE", Const, 0, ""},
+		{"PAGE_EXECUTE_WRITECOPY", Const, 0, ""},
+		{"PAGE_READONLY", Const, 0, ""},
+		{"PAGE_READWRITE", Const, 0, ""},
+		{"PAGE_WRITECOPY", Const, 0, ""},
+		{"PARENB", Const, 0, ""},
+		{"PARMRK", Const, 0, ""},
+		{"PARODD", Const, 0, ""},
+		{"PENDIN", Const, 0, ""},
+		{"PFL_HIDDEN", Const, 2, ""},
+		{"PFL_MATCHES_PROTOCOL_ZERO", Const, 2, ""},
+		{"PFL_MULTIPLE_PROTO_ENTRIES", Const, 2, ""},
+		{"PFL_NETWORKDIRECT_PROVIDER", Const, 2, ""},
+		{"PFL_RECOMMENDED_PROTO_ENTRY", Const, 2, ""},
+		{"PF_FLUSH", Const, 1, ""},
+		{"PKCS_7_ASN_ENCODING", Const, 0, ""},
+		{"PMC5_PIPELINE_FLUSH", Const, 1, ""},
+		{"PRIO_PGRP", Const, 2, ""},
+		{"PRIO_PROCESS", Const, 2, ""},
+		{"PRIO_USER", Const, 2, ""},
+		{"PRI_IOFLUSH", Const, 1, ""},
+		{"PROCESS_QUERY_INFORMATION", Const, 0, ""},
+		{"PROCESS_TERMINATE", Const, 2, ""},
+		{"PROT_EXEC", Const, 0, ""},
+		{"PROT_GROWSDOWN", Const, 0, ""},
+		{"PROT_GROWSUP", Const, 0, ""},
+		{"PROT_NONE", Const, 0, ""},
+		{"PROT_READ", Const, 0, ""},
+		{"PROT_WRITE", Const, 0, ""},
+		{"PROV_DH_SCHANNEL", Const, 0, ""},
+		{"PROV_DSS", Const, 0, ""},
+		{"PROV_DSS_DH", Const, 0, ""},
+		{"PROV_EC_ECDSA_FULL", Const, 0, ""},
+		{"PROV_EC_ECDSA_SIG", Const, 0, ""},
+		{"PROV_EC_ECNRA_FULL", Const, 0, ""},
+		{"PROV_EC_ECNRA_SIG", Const, 0, ""},
+		{"PROV_FORTEZZA", Const, 0, ""},
+		{"PROV_INTEL_SEC", Const, 0, ""},
+		{"PROV_MS_EXCHANGE", Const, 0, ""},
+		{"PROV_REPLACE_OWF", Const, 0, ""},
+		{"PROV_RNG", Const, 0, ""},
+		{"PROV_RSA_AES", Const, 0, ""},
+		{"PROV_RSA_FULL", Const, 0, ""},
+		{"PROV_RSA_SCHANNEL", Const, 0, ""},
+		{"PROV_RSA_SIG", Const, 0, ""},
+		{"PROV_SPYRUS_LYNKS", Const, 0, ""},
+		{"PROV_SSL", Const, 0, ""},
+		{"PR_CAPBSET_DROP", Const, 0, ""},
+		{"PR_CAPBSET_READ", Const, 0, ""},
+		{"PR_CLEAR_SECCOMP_FILTER", Const, 0, ""},
+		{"PR_ENDIAN_BIG", Const, 0, ""},
+		{"PR_ENDIAN_LITTLE", Const, 0, ""},
+		{"PR_ENDIAN_PPC_LITTLE", Const, 0, ""},
+		{"PR_FPEMU_NOPRINT", Const, 0, ""},
+		{"PR_FPEMU_SIGFPE", Const, 0, ""},
+		{"PR_FP_EXC_ASYNC", Const, 0, ""},
+		{"PR_FP_EXC_DISABLED", Const, 0, ""},
+		{"PR_FP_EXC_DIV", Const, 0, ""},
+		{"PR_FP_EXC_INV", Const, 0, ""},
+		{"PR_FP_EXC_NONRECOV", Const, 0, ""},
+		{"PR_FP_EXC_OVF", Const, 0, ""},
+		{"PR_FP_EXC_PRECISE", Const, 0, ""},
+		{"PR_FP_EXC_RES", Const, 0, ""},
+		{"PR_FP_EXC_SW_ENABLE", Const, 0, ""},
+		{"PR_FP_EXC_UND", Const, 0, ""},
+		{"PR_GET_DUMPABLE", Const, 0, ""},
+		{"PR_GET_ENDIAN", Const, 0, ""},
+		{"PR_GET_FPEMU", Const, 0, ""},
+		{"PR_GET_FPEXC", Const, 0, ""},
+		{"PR_GET_KEEPCAPS", Const, 0, ""},
+		{"PR_GET_NAME", Const, 0, ""},
+		{"PR_GET_PDEATHSIG", Const, 0, ""},
+		{"PR_GET_SECCOMP", Const, 0, ""},
+		{"PR_GET_SECCOMP_FILTER", Const, 0, ""},
+		{"PR_GET_SECUREBITS", Const, 0, ""},
+		{"PR_GET_TIMERSLACK", Const, 0, ""},
+		{"PR_GET_TIMING", Const, 0, ""},
+		{"PR_GET_TSC", Const, 0, ""},
+		{"PR_GET_UNALIGN", Const, 0, ""},
+		{"PR_MCE_KILL", Const, 0, ""},
+		{"PR_MCE_KILL_CLEAR", Const, 0, ""},
+		{"PR_MCE_KILL_DEFAULT", Const, 0, ""},
+		{"PR_MCE_KILL_EARLY", Const, 0, ""},
+		{"PR_MCE_KILL_GET", Const, 0, ""},
+		{"PR_MCE_KILL_LATE", Const, 0, ""},
+		{"PR_MCE_KILL_SET", Const, 0, ""},
+		{"PR_SECCOMP_FILTER_EVENT", Const, 0, ""},
+		{"PR_SECCOMP_FILTER_SYSCALL", Const, 0, ""},
+		{"PR_SET_DUMPABLE", Const, 0, ""},
+		{"PR_SET_ENDIAN", Const, 0, ""},
+		{"PR_SET_FPEMU", Const, 0, ""},
+		{"PR_SET_FPEXC", Const, 0, ""},
+		{"PR_SET_KEEPCAPS", Const, 0, ""},
+		{"PR_SET_NAME", Const, 0, ""},
+		{"PR_SET_PDEATHSIG", Const, 0, ""},
+		{"PR_SET_PTRACER", Const, 0, ""},
+		{"PR_SET_SECCOMP", Const, 0, ""},
+		{"PR_SET_SECCOMP_FILTER", Const, 0, ""},
+		{"PR_SET_SECUREBITS", Const, 0, ""},
+		{"PR_SET_TIMERSLACK", Const, 0, ""},
+		{"PR_SET_TIMING", Const, 0, ""},
+		{"PR_SET_TSC", Const, 0, ""},
+		{"PR_SET_UNALIGN", Const, 0, ""},
+		{"PR_TASK_PERF_EVENTS_DISABLE", Const, 0, ""},
+		{"PR_TASK_PERF_EVENTS_ENABLE", Const, 0, ""},
+		{"PR_TIMING_STATISTICAL", Const, 0, ""},
+		{"PR_TIMING_TIMESTAMP", Const, 0, ""},
+		{"PR_TSC_ENABLE", Const, 0, ""},
+		{"PR_TSC_SIGSEGV", Const, 0, ""},
+		{"PR_UNALIGN_NOPRINT", Const, 0, ""},
+		{"PR_UNALIGN_SIGBUS", Const, 0, ""},
+		{"PTRACE_ARCH_PRCTL", Const, 0, ""},
+		{"PTRACE_ATTACH", Const, 0, ""},
+		{"PTRACE_CONT", Const, 0, ""},
+		{"PTRACE_DETACH", Const, 0, ""},
+		{"PTRACE_EVENT_CLONE", Const, 0, ""},
+		{"PTRACE_EVENT_EXEC", Const, 0, ""},
+		{"PTRACE_EVENT_EXIT", Const, 0, ""},
+		{"PTRACE_EVENT_FORK", Const, 0, ""},
+		{"PTRACE_EVENT_VFORK", Const, 0, ""},
+		{"PTRACE_EVENT_VFORK_DONE", Const, 0, ""},
+		{"PTRACE_GETCRUNCHREGS", Const, 0, ""},
+		{"PTRACE_GETEVENTMSG", Const, 0, ""},
+		{"PTRACE_GETFPREGS", Const, 0, ""},
+		{"PTRACE_GETFPXREGS", Const, 0, ""},
+		{"PTRACE_GETHBPREGS", Const, 0, ""},
+		{"PTRACE_GETREGS", Const, 0, ""},
+		{"PTRACE_GETREGSET", Const, 0, ""},
+		{"PTRACE_GETSIGINFO", Const, 0, ""},
+		{"PTRACE_GETVFPREGS", Const, 0, ""},
+		{"PTRACE_GETWMMXREGS", Const, 0, ""},
+		{"PTRACE_GET_THREAD_AREA", Const, 0, ""},
+		{"PTRACE_KILL", Const, 0, ""},
+		{"PTRACE_OLDSETOPTIONS", Const, 0, ""},
+		{"PTRACE_O_MASK", Const, 0, ""},
+		{"PTRACE_O_TRACECLONE", Const, 0, ""},
+		{"PTRACE_O_TRACEEXEC", Const, 0, ""},
+		{"PTRACE_O_TRACEEXIT", Const, 0, ""},
+		{"PTRACE_O_TRACEFORK", Const, 0, ""},
+		{"PTRACE_O_TRACESYSGOOD", Const, 0, ""},
+		{"PTRACE_O_TRACEVFORK", Const, 0, ""},
+		{"PTRACE_O_TRACEVFORKDONE", Const, 0, ""},
+		{"PTRACE_PEEKDATA", Const, 0, ""},
+		{"PTRACE_PEEKTEXT", Const, 0, ""},
+		{"PTRACE_PEEKUSR", Const, 0, ""},
+		{"PTRACE_POKEDATA", Const, 0, ""},
+		{"PTRACE_POKETEXT", Const, 0, ""},
+		{"PTRACE_POKEUSR", Const, 0, ""},
+		{"PTRACE_SETCRUNCHREGS", Const, 0, ""},
+		{"PTRACE_SETFPREGS", Const, 0, ""},
+		{"PTRACE_SETFPXREGS", Const, 0, ""},
+		{"PTRACE_SETHBPREGS", Const, 0, ""},
+		{"PTRACE_SETOPTIONS", Const, 0, ""},
+		{"PTRACE_SETREGS", Const, 0, ""},
+		{"PTRACE_SETREGSET", Const, 0, ""},
+		{"PTRACE_SETSIGINFO", Const, 0, ""},
+		{"PTRACE_SETVFPREGS", Const, 0, ""},
+		{"PTRACE_SETWMMXREGS", Const, 0, ""},
+		{"PTRACE_SET_SYSCALL", Const, 0, ""},
+		{"PTRACE_SET_THREAD_AREA", Const, 0, ""},
+		{"PTRACE_SINGLEBLOCK", Const, 0, ""},
+		{"PTRACE_SINGLESTEP", Const, 0, ""},
+		{"PTRACE_SYSCALL", Const, 0, ""},
+		{"PTRACE_SYSEMU", Const, 0, ""},
+		{"PTRACE_SYSEMU_SINGLESTEP", Const, 0, ""},
+		{"PTRACE_TRACEME", Const, 0, ""},
+		{"PT_ATTACH", Const, 0, ""},
+		{"PT_ATTACHEXC", Const, 0, ""},
+		{"PT_CONTINUE", Const, 0, ""},
+		{"PT_DATA_ADDR", Const, 0, ""},
+		{"PT_DENY_ATTACH", Const, 0, ""},
+		{"PT_DETACH", Const, 0, ""},
+		{"PT_FIRSTMACH", Const, 0, ""},
+		{"PT_FORCEQUOTA", Const, 0, ""},
+		{"PT_KILL", Const, 0, ""},
+		{"PT_MASK", Const, 1, ""},
+		{"PT_READ_D", Const, 0, ""},
+		{"PT_READ_I", Const, 0, ""},
+		{"PT_READ_U", Const, 0, ""},
+		{"PT_SIGEXC", Const, 0, ""},
+		{"PT_STEP", Const, 0, ""},
+		{"PT_TEXT_ADDR", Const, 0, ""},
+		{"PT_TEXT_END_ADDR", Const, 0, ""},
+		{"PT_THUPDATE", Const, 0, ""},
+		{"PT_TRACE_ME", Const, 0, ""},
+		{"PT_WRITE_D", Const, 0, ""},
+		{"PT_WRITE_I", Const, 0, ""},
+		{"PT_WRITE_U", Const, 0, ""},
+		{"ParseDirent", Func, 0, "func(buf []byte, max int, names []string) (consumed int, count int, newnames []string)"},
+		{"ParseNetlinkMessage", Func, 0, "func(b []byte) ([]NetlinkMessage, error)"},
+		{"ParseNetlinkRouteAttr", Func, 0, "func(m *NetlinkMessage) ([]NetlinkRouteAttr, error)"},
+		{"ParseRoutingMessage", Func, 0, ""},
+		{"ParseRoutingSockaddr", Func, 0, ""},
+		{"ParseSocketControlMessage", Func, 0, "func(b []byte) ([]SocketControlMessage, error)"},
+		{"ParseUnixCredentials", Func, 0, "func(m *SocketControlMessage) (*Ucred, error)"},
+		{"ParseUnixRights", Func, 0, "func(m *SocketControlMessage) ([]int, error)"},
+		{"PathMax", Const, 0, ""},
+		{"Pathconf", Func, 0, ""},
+		{"Pause", Func, 0, "func() (err error)"},
+		{"Pipe", Func, 0, "func(p []int) error"},
+		{"Pipe2", Func, 1, "func(p []int, flags int) error"},
+		{"PivotRoot", Func, 0, "func(newroot string, putold string) (err error)"},
+		{"Pointer", Type, 11, ""},
+		{"PostQueuedCompletionStatus", Func, 0, ""},
+		{"Pread", Func, 0, "func(fd int, p []byte, offset int64) (n int, err error)"},
+		{"Proc", Type, 0, ""},
+		{"Proc.Dll", Field, 0, ""},
+		{"Proc.Name", Field, 0, ""},
+		{"ProcAttr", Type, 0, ""},
+		{"ProcAttr.Dir", Field, 0, ""},
+		{"ProcAttr.Env", Field, 0, ""},
+		{"ProcAttr.Files", Field, 0, ""},
+		{"ProcAttr.Sys", Field, 0, ""},
+		{"Process32First", Func, 4, ""},
+		{"Process32Next", Func, 4, ""},
+		{"ProcessEntry32", Type, 4, ""},
+		{"ProcessEntry32.DefaultHeapID", Field, 4, ""},
+		{"ProcessEntry32.ExeFile", Field, 4, ""},
+		{"ProcessEntry32.Flags", Field, 4, ""},
+		{"ProcessEntry32.ModuleID", Field, 4, ""},
+		{"ProcessEntry32.ParentProcessID", Field, 4, ""},
+		{"ProcessEntry32.PriClassBase", Field, 4, ""},
+		{"ProcessEntry32.ProcessID", Field, 4, ""},
+		{"ProcessEntry32.Size", Field, 4, ""},
+		{"ProcessEntry32.Threads", Field, 4, ""},
+		{"ProcessEntry32.Usage", Field, 4, ""},
+		{"ProcessInformation", Type, 0, ""},
+		{"ProcessInformation.Process", Field, 0, ""},
+		{"ProcessInformation.ProcessId", Field, 0, ""},
+		{"ProcessInformation.Thread", Field, 0, ""},
+		{"ProcessInformation.ThreadId", Field, 0, ""},
+		{"Protoent", Type, 0, ""},
+		{"Protoent.Aliases", Field, 0, ""},
+		{"Protoent.Name", Field, 0, ""},
+		{"Protoent.Proto", Field, 0, ""},
+		{"PtraceAttach", Func, 0, "func(pid int) (err error)"},
+		{"PtraceCont", Func, 0, "func(pid int, signal int) (err error)"},
+		{"PtraceDetach", Func, 0, "func(pid int) (err error)"},
+		{"PtraceGetEventMsg", Func, 0, "func(pid int) (msg uint, err error)"},
+		{"PtraceGetRegs", Func, 0, "func(pid int, regsout *PtraceRegs) (err error)"},
+		{"PtracePeekData", Func, 0, "func(pid int, addr uintptr, out []byte) (count int, err error)"},
+		{"PtracePeekText", Func, 0, "func(pid int, addr uintptr, out []byte) (count int, err error)"},
+		{"PtracePokeData", Func, 0, "func(pid int, addr uintptr, data []byte) (count int, err error)"},
+		{"PtracePokeText", Func, 0, "func(pid int, addr uintptr, data []byte) (count int, err error)"},
+		{"PtraceRegs", Type, 0, ""},
+		{"PtraceRegs.Cs", Field, 0, ""},
+		{"PtraceRegs.Ds", Field, 0, ""},
+		{"PtraceRegs.Eax", Field, 0, ""},
+		{"PtraceRegs.Ebp", Field, 0, ""},
+		{"PtraceRegs.Ebx", Field, 0, ""},
+		{"PtraceRegs.Ecx", Field, 0, ""},
+		{"PtraceRegs.Edi", Field, 0, ""},
+		{"PtraceRegs.Edx", Field, 0, ""},
+		{"PtraceRegs.Eflags", Field, 0, ""},
+		{"PtraceRegs.Eip", Field, 0, ""},
+		{"PtraceRegs.Es", Field, 0, ""},
+		{"PtraceRegs.Esi", Field, 0, ""},
+		{"PtraceRegs.Esp", Field, 0, ""},
+		{"PtraceRegs.Fs", Field, 0, ""},
+		{"PtraceRegs.Fs_base", Field, 0, ""},
+		{"PtraceRegs.Gs", Field, 0, ""},
+		{"PtraceRegs.Gs_base", Field, 0, ""},
+		{"PtraceRegs.Orig_eax", Field, 0, ""},
+		{"PtraceRegs.Orig_rax", Field, 0, ""},
+		{"PtraceRegs.R10", Field, 0, ""},
+		{"PtraceRegs.R11", Field, 0, ""},
+		{"PtraceRegs.R12", Field, 0, ""},
+		{"PtraceRegs.R13", Field, 0, ""},
+		{"PtraceRegs.R14", Field, 0, ""},
+		{"PtraceRegs.R15", Field, 0, ""},
+		{"PtraceRegs.R8", Field, 0, ""},
+		{"PtraceRegs.R9", Field, 0, ""},
+		{"PtraceRegs.Rax", Field, 0, ""},
+		{"PtraceRegs.Rbp", Field, 0, ""},
+		{"PtraceRegs.Rbx", Field, 0, ""},
+		{"PtraceRegs.Rcx", Field, 0, ""},
+		{"PtraceRegs.Rdi", Field, 0, ""},
+		{"PtraceRegs.Rdx", Field, 0, ""},
+		{"PtraceRegs.Rip", Field, 0, ""},
+		{"PtraceRegs.Rsi", Field, 0, ""},
+		{"PtraceRegs.Rsp", Field, 0, ""},
+		{"PtraceRegs.Ss", Field, 0, ""},
+		{"PtraceRegs.Uregs", Field, 0, ""},
+		{"PtraceRegs.Xcs", Field, 0, ""},
+		{"PtraceRegs.Xds", Field, 0, ""},
+		{"PtraceRegs.Xes", Field, 0, ""},
+		{"PtraceRegs.Xfs", Field, 0, ""},
+		{"PtraceRegs.Xgs", Field, 0, ""},
+		{"PtraceRegs.Xss", Field, 0, ""},
+		{"PtraceSetOptions", Func, 0, "func(pid int, options int) (err error)"},
+		{"PtraceSetRegs", Func, 0, "func(pid int, regs *PtraceRegs) (err error)"},
+		{"PtraceSingleStep", Func, 0, "func(pid int) (err error)"},
+		{"PtraceSyscall", Func, 1, "func(pid int, signal int) (err error)"},
+		{"Pwrite", Func, 0, "func(fd int, p []byte, offset int64) (n int, err error)"},
+		{"REG_BINARY", Const, 0, ""},
+		{"REG_DWORD", Const, 0, ""},
+		{"REG_DWORD_BIG_ENDIAN", Const, 0, ""},
+		{"REG_DWORD_LITTLE_ENDIAN", Const, 0, ""},
+		{"REG_EXPAND_SZ", Const, 0, ""},
+		{"REG_FULL_RESOURCE_DESCRIPTOR", Const, 0, ""},
+		{"REG_LINK", Const, 0, ""},
+		{"REG_MULTI_SZ", Const, 0, ""},
+		{"REG_NONE", Const, 0, ""},
+		{"REG_QWORD", Const, 0, ""},
+		{"REG_QWORD_LITTLE_ENDIAN", Const, 0, ""},
+		{"REG_RESOURCE_LIST", Const, 0, ""},
+		{"REG_RESOURCE_REQUIREMENTS_LIST", Const, 0, ""},
+		{"REG_SZ", Const, 0, ""},
+		{"RLIMIT_AS", Const, 0, ""},
+		{"RLIMIT_CORE", Const, 0, ""},
+		{"RLIMIT_CPU", Const, 0, ""},
+		{"RLIMIT_CPU_USAGE_MONITOR", Const, 16, ""},
+		{"RLIMIT_DATA", Const, 0, ""},
+		{"RLIMIT_FSIZE", Const, 0, ""},
+		{"RLIMIT_NOFILE", Const, 0, ""},
+		{"RLIMIT_STACK", Const, 0, ""},
+		{"RLIM_INFINITY", Const, 0, ""},
+		{"RTAX_ADVMSS", Const, 0, ""},
+		{"RTAX_AUTHOR", Const, 0, ""},
+		{"RTAX_BRD", Const, 0, ""},
+		{"RTAX_CWND", Const, 0, ""},
+		{"RTAX_DST", Const, 0, ""},
+		{"RTAX_FEATURES", Const, 0, ""},
+		{"RTAX_FEATURE_ALLFRAG", Const, 0, ""},
+		{"RTAX_FEATURE_ECN", Const, 0, ""},
+		{"RTAX_FEATURE_SACK", Const, 0, ""},
+		{"RTAX_FEATURE_TIMESTAMP", Const, 0, ""},
+		{"RTAX_GATEWAY", Const, 0, ""},
+		{"RTAX_GENMASK", Const, 0, ""},
+		{"RTAX_HOPLIMIT", Const, 0, ""},
+		{"RTAX_IFA", Const, 0, ""},
+		{"RTAX_IFP", Const, 0, ""},
+		{"RTAX_INITCWND", Const, 0, ""},
+		{"RTAX_INITRWND", Const, 0, ""},
+		{"RTAX_LABEL", Const, 1, ""},
+		{"RTAX_LOCK", Const, 0, ""},
+		{"RTAX_MAX", Const, 0, ""},
+		{"RTAX_MTU", Const, 0, ""},
+		{"RTAX_NETMASK", Const, 0, ""},
+		{"RTAX_REORDERING", Const, 0, ""},
+		{"RTAX_RTO_MIN", Const, 0, ""},
+		{"RTAX_RTT", Const, 0, ""},
+		{"RTAX_RTTVAR", Const, 0, ""},
+		{"RTAX_SRC", Const, 1, ""},
+		{"RTAX_SRCMASK", Const, 1, ""},
+		{"RTAX_SSTHRESH", Const, 0, ""},
+		{"RTAX_TAG", Const, 1, ""},
+		{"RTAX_UNSPEC", Const, 0, ""},
+		{"RTAX_WINDOW", Const, 0, ""},
+		{"RTA_ALIGNTO", Const, 0, ""},
+		{"RTA_AUTHOR", Const, 0, ""},
+		{"RTA_BRD", Const, 0, ""},
+		{"RTA_CACHEINFO", Const, 0, ""},
+		{"RTA_DST", Const, 0, ""},
+		{"RTA_FLOW", Const, 0, ""},
+		{"RTA_GATEWAY", Const, 0, ""},
+		{"RTA_GENMASK", Const, 0, ""},
+		{"RTA_IFA", Const, 0, ""},
+		{"RTA_IFP", Const, 0, ""},
+		{"RTA_IIF", Const, 0, ""},
+		{"RTA_LABEL", Const, 1, ""},
+		{"RTA_MAX", Const, 0, ""},
+		{"RTA_METRICS", Const, 0, ""},
+		{"RTA_MULTIPATH", Const, 0, ""},
+		{"RTA_NETMASK", Const, 0, ""},
+		{"RTA_OIF", Const, 0, ""},
+		{"RTA_PREFSRC", Const, 0, ""},
+		{"RTA_PRIORITY", Const, 0, ""},
+		{"RTA_SRC", Const, 0, ""},
+		{"RTA_SRCMASK", Const, 1, ""},
+		{"RTA_TABLE", Const, 0, ""},
+		{"RTA_TAG", Const, 1, ""},
+		{"RTA_UNSPEC", Const, 0, ""},
+		{"RTCF_DIRECTSRC", Const, 0, ""},
+		{"RTCF_DOREDIRECT", Const, 0, ""},
+		{"RTCF_LOG", Const, 0, ""},
+		{"RTCF_MASQ", Const, 0, ""},
+		{"RTCF_NAT", Const, 0, ""},
+		{"RTCF_VALVE", Const, 0, ""},
+		{"RTF_ADDRCLASSMASK", Const, 0, ""},
+		{"RTF_ADDRCONF", Const, 0, ""},
+		{"RTF_ALLONLINK", Const, 0, ""},
+		{"RTF_ANNOUNCE", Const, 1, ""},
+		{"RTF_BLACKHOLE", Const, 0, ""},
+		{"RTF_BROADCAST", Const, 0, ""},
+		{"RTF_CACHE", Const, 0, ""},
+		{"RTF_CLONED", Const, 1, ""},
+		{"RTF_CLONING", Const, 0, ""},
+		{"RTF_CONDEMNED", Const, 0, ""},
+		{"RTF_DEFAULT", Const, 0, ""},
+		{"RTF_DELCLONE", Const, 0, ""},
+		{"RTF_DONE", Const, 0, ""},
+		{"RTF_DYNAMIC", Const, 0, ""},
+		{"RTF_FLOW", Const, 0, ""},
+		{"RTF_FMASK", Const, 0, ""},
+		{"RTF_GATEWAY", Const, 0, ""},
+		{"RTF_GWFLAG_COMPAT", Const, 3, ""},
+		{"RTF_HOST", Const, 0, ""},
+		{"RTF_IFREF", Const, 0, ""},
+		{"RTF_IFSCOPE", Const, 0, ""},
+		{"RTF_INTERFACE", Const, 0, ""},
+		{"RTF_IRTT", Const, 0, ""},
+		{"RTF_LINKRT", Const, 0, ""},
+		{"RTF_LLDATA", Const, 0, ""},
+		{"RTF_LLINFO", Const, 0, ""},
+		{"RTF_LOCAL", Const, 0, ""},
+		{"RTF_MASK", Const, 1, ""},
+		{"RTF_MODIFIED", Const, 0, ""},
+		{"RTF_MPATH", Const, 1, ""},
+		{"RTF_MPLS", Const, 1, ""},
+		{"RTF_MSS", Const, 0, ""},
+		{"RTF_MTU", Const, 0, ""},
+		{"RTF_MULTICAST", Const, 0, ""},
+		{"RTF_NAT", Const, 0, ""},
+		{"RTF_NOFORWARD", Const, 0, ""},
+		{"RTF_NONEXTHOP", Const, 0, ""},
+		{"RTF_NOPMTUDISC", Const, 0, ""},
+		{"RTF_PERMANENT_ARP", Const, 1, ""},
+		{"RTF_PINNED", Const, 0, ""},
+		{"RTF_POLICY", Const, 0, ""},
+		{"RTF_PRCLONING", Const, 0, ""},
+		{"RTF_PROTO1", Const, 0, ""},
+		{"RTF_PROTO2", Const, 0, ""},
+		{"RTF_PROTO3", Const, 0, ""},
+		{"RTF_PROXY", Const, 16, ""},
+		{"RTF_REINSTATE", Const, 0, ""},
+		{"RTF_REJECT", Const, 0, ""},
+		{"RTF_RNH_LOCKED", Const, 0, ""},
+		{"RTF_ROUTER", Const, 16, ""},
+		{"RTF_SOURCE", Const, 1, ""},
+		{"RTF_SRC", Const, 1, ""},
+		{"RTF_STATIC", Const, 0, ""},
+		{"RTF_STICKY", Const, 0, ""},
+		{"RTF_THROW", Const, 0, ""},
+		{"RTF_TUNNEL", Const, 1, ""},
+		{"RTF_UP", Const, 0, ""},
+		{"RTF_USETRAILERS", Const, 1, ""},
+		{"RTF_WASCLONED", Const, 0, ""},
+		{"RTF_WINDOW", Const, 0, ""},
+		{"RTF_XRESOLVE", Const, 0, ""},
+		{"RTM_ADD", Const, 0, ""},
+		{"RTM_BASE", Const, 0, ""},
+		{"RTM_CHANGE", Const, 0, ""},
+		{"RTM_CHGADDR", Const, 1, ""},
+		{"RTM_DELACTION", Const, 0, ""},
+		{"RTM_DELADDR", Const, 0, ""},
+		{"RTM_DELADDRLABEL", Const, 0, ""},
+		{"RTM_DELETE", Const, 0, ""},
+		{"RTM_DELLINK", Const, 0, ""},
+		{"RTM_DELMADDR", Const, 0, ""},
+		{"RTM_DELNEIGH", Const, 0, ""},
+		{"RTM_DELQDISC", Const, 0, ""},
+		{"RTM_DELROUTE", Const, 0, ""},
+		{"RTM_DELRULE", Const, 0, ""},
+		{"RTM_DELTCLASS", Const, 0, ""},
+		{"RTM_DELTFILTER", Const, 0, ""},
+		{"RTM_DESYNC", Const, 1, ""},
+		{"RTM_F_CLONED", Const, 0, ""},
+		{"RTM_F_EQUALIZE", Const, 0, ""},
+		{"RTM_F_NOTIFY", Const, 0, ""},
+		{"RTM_F_PREFIX", Const, 0, ""},
+		{"RTM_GET", Const, 0, ""},
+		{"RTM_GET2", Const, 0, ""},
+		{"RTM_GETACTION", Const, 0, ""},
+		{"RTM_GETADDR", Const, 0, ""},
+		{"RTM_GETADDRLABEL", Const, 0, ""},
+		{"RTM_GETANYCAST", Const, 0, ""},
+		{"RTM_GETDCB", Const, 0, ""},
+		{"RTM_GETLINK", Const, 0, ""},
+		{"RTM_GETMULTICAST", Const, 0, ""},
+		{"RTM_GETNEIGH", Const, 0, ""},
+		{"RTM_GETNEIGHTBL", Const, 0, ""},
+		{"RTM_GETQDISC", Const, 0, ""},
+		{"RTM_GETROUTE", Const, 0, ""},
+		{"RTM_GETRULE", Const, 0, ""},
+		{"RTM_GETTCLASS", Const, 0, ""},
+		{"RTM_GETTFILTER", Const, 0, ""},
+		{"RTM_IEEE80211", Const, 0, ""},
+		{"RTM_IFANNOUNCE", Const, 0, ""},
+		{"RTM_IFINFO", Const, 0, ""},
+		{"RTM_IFINFO2", Const, 0, ""},
+		{"RTM_LLINFO_UPD", Const, 1, ""},
+		{"RTM_LOCK", Const, 0, ""},
+		{"RTM_LOSING", Const, 0, ""},
+		{"RTM_MAX", Const, 0, ""},
+		{"RTM_MAXSIZE", Const, 1, ""},
+		{"RTM_MISS", Const, 0, ""},
+		{"RTM_NEWACTION", Const, 0, ""},
+		{"RTM_NEWADDR", Const, 0, ""},
+		{"RTM_NEWADDRLABEL", Const, 0, ""},
+		{"RTM_NEWLINK", Const, 0, ""},
+		{"RTM_NEWMADDR", Const, 0, ""},
+		{"RTM_NEWMADDR2", Const, 0, ""},
+		{"RTM_NEWNDUSEROPT", Const, 0, ""},
+		{"RTM_NEWNEIGH", Const, 0, ""},
+		{"RTM_NEWNEIGHTBL", Const, 0, ""},
+		{"RTM_NEWPREFIX", Const, 0, ""},
+		{"RTM_NEWQDISC", Const, 0, ""},
+		{"RTM_NEWROUTE", Const, 0, ""},
+		{"RTM_NEWRULE", Const, 0, ""},
+		{"RTM_NEWTCLASS", Const, 0, ""},
+		{"RTM_NEWTFILTER", Const, 0, ""},
+		{"RTM_NR_FAMILIES", Const, 0, ""},
+		{"RTM_NR_MSGTYPES", Const, 0, ""},
+		{"RTM_OIFINFO", Const, 1, ""},
+		{"RTM_OLDADD", Const, 0, ""},
+		{"RTM_OLDDEL", Const, 0, ""},
+		{"RTM_OOIFINFO", Const, 1, ""},
+		{"RTM_REDIRECT", Const, 0, ""},
+		{"RTM_RESOLVE", Const, 0, ""},
+		{"RTM_RTTUNIT", Const, 0, ""},
+		{"RTM_SETDCB", Const, 0, ""},
+		{"RTM_SETGATE", Const, 1, ""},
+		{"RTM_SETLINK", Const, 0, ""},
+		{"RTM_SETNEIGHTBL", Const, 0, ""},
+		{"RTM_VERSION", Const, 0, ""},
+		{"RTNH_ALIGNTO", Const, 0, ""},
+		{"RTNH_F_DEAD", Const, 0, ""},
+		{"RTNH_F_ONLINK", Const, 0, ""},
+		{"RTNH_F_PERVASIVE", Const, 0, ""},
+		{"RTNLGRP_IPV4_IFADDR", Const, 1, ""},
+		{"RTNLGRP_IPV4_MROUTE", Const, 1, ""},
+		{"RTNLGRP_IPV4_ROUTE", Const, 1, ""},
+		{"RTNLGRP_IPV4_RULE", Const, 1, ""},
+		{"RTNLGRP_IPV6_IFADDR", Const, 1, ""},
+		{"RTNLGRP_IPV6_IFINFO", Const, 1, ""},
+		{"RTNLGRP_IPV6_MROUTE", Const, 1, ""},
+		{"RTNLGRP_IPV6_PREFIX", Const, 1, ""},
+		{"RTNLGRP_IPV6_ROUTE", Const, 1, ""},
+		{"RTNLGRP_IPV6_RULE", Const, 1, ""},
+		{"RTNLGRP_LINK", Const, 1, ""},
+		{"RTNLGRP_ND_USEROPT", Const, 1, ""},
+		{"RTNLGRP_NEIGH", Const, 1, ""},
+		{"RTNLGRP_NONE", Const, 1, ""},
+		{"RTNLGRP_NOTIFY", Const, 1, ""},
+		{"RTNLGRP_TC", Const, 1, ""},
+		{"RTN_ANYCAST", Const, 0, ""},
+		{"RTN_BLACKHOLE", Const, 0, ""},
+		{"RTN_BROADCAST", Const, 0, ""},
+		{"RTN_LOCAL", Const, 0, ""},
+		{"RTN_MAX", Const, 0, ""},
+		{"RTN_MULTICAST", Const, 0, ""},
+		{"RTN_NAT", Const, 0, ""},
+		{"RTN_PROHIBIT", Const, 0, ""},
+		{"RTN_THROW", Const, 0, ""},
+		{"RTN_UNICAST", Const, 0, ""},
+		{"RTN_UNREACHABLE", Const, 0, ""},
+		{"RTN_UNSPEC", Const, 0, ""},
+		{"RTN_XRESOLVE", Const, 0, ""},
+		{"RTPROT_BIRD", Const, 0, ""},
+		{"RTPROT_BOOT", Const, 0, ""},
+		{"RTPROT_DHCP", Const, 0, ""},
+		{"RTPROT_DNROUTED", Const, 0, ""},
+		{"RTPROT_GATED", Const, 0, ""},
+		{"RTPROT_KERNEL", Const, 0, ""},
+		{"RTPROT_MRT", Const, 0, ""},
+		{"RTPROT_NTK", Const, 0, ""},
+		{"RTPROT_RA", Const, 0, ""},
+		{"RTPROT_REDIRECT", Const, 0, ""},
+		{"RTPROT_STATIC", Const, 0, ""},
+		{"RTPROT_UNSPEC", Const, 0, ""},
+		{"RTPROT_XORP", Const, 0, ""},
+		{"RTPROT_ZEBRA", Const, 0, ""},
+		{"RTV_EXPIRE", Const, 0, ""},
+		{"RTV_HOPCOUNT", Const, 0, ""},
+		{"RTV_MTU", Const, 0, ""},
+		{"RTV_RPIPE", Const, 0, ""},
+		{"RTV_RTT", Const, 0, ""},
+		{"RTV_RTTVAR", Const, 0, ""},
+		{"RTV_SPIPE", Const, 0, ""},
+		{"RTV_SSTHRESH", Const, 0, ""},
+		{"RTV_WEIGHT", Const, 0, ""},
+		{"RT_CACHING_CONTEXT", Const, 1, ""},
+		{"RT_CLASS_DEFAULT", Const, 0, ""},
+		{"RT_CLASS_LOCAL", Const, 0, ""},
+		{"RT_CLASS_MAIN", Const, 0, ""},
+		{"RT_CLASS_MAX", Const, 0, ""},
+		{"RT_CLASS_UNSPEC", Const, 0, ""},
+		{"RT_DEFAULT_FIB", Const, 1, ""},
+		{"RT_NORTREF", Const, 1, ""},
+		{"RT_SCOPE_HOST", Const, 0, ""},
+		{"RT_SCOPE_LINK", Const, 0, ""},
+		{"RT_SCOPE_NOWHERE", Const, 0, ""},
+		{"RT_SCOPE_SITE", Const, 0, ""},
+		{"RT_SCOPE_UNIVERSE", Const, 0, ""},
+		{"RT_TABLEID_MAX", Const, 1, ""},
+		{"RT_TABLE_COMPAT", Const, 0, ""},
+		{"RT_TABLE_DEFAULT", Const, 0, ""},
+		{"RT_TABLE_LOCAL", Const, 0, ""},
+		{"RT_TABLE_MAIN", Const, 0, ""},
+		{"RT_TABLE_MAX", Const, 0, ""},
+		{"RT_TABLE_UNSPEC", Const, 0, ""},
+		{"RUSAGE_CHILDREN", Const, 0, ""},
+		{"RUSAGE_SELF", Const, 0, ""},
+		{"RUSAGE_THREAD", Const, 0, ""},
+		{"Radvisory_t", Type, 0, ""},
+		{"Radvisory_t.Count", Field, 0, ""},
+		{"Radvisory_t.Offset", Field, 0, ""},
+		{"Radvisory_t.Pad_cgo_0", Field, 0, ""},
+		{"RawConn", Type, 9, ""},
+		{"RawSockaddr", Type, 0, ""},
+		{"RawSockaddr.Data", Field, 0, ""},
+		{"RawSockaddr.Family", Field, 0, ""},
+		{"RawSockaddr.Len", Field, 0, ""},
+		{"RawSockaddrAny", Type, 0, ""},
+		{"RawSockaddrAny.Addr", Field, 0, ""},
+		{"RawSockaddrAny.Pad", Field, 0, ""},
+		{"RawSockaddrDatalink", Type, 0, ""},
+		{"RawSockaddrDatalink.Alen", Field, 0, ""},
+		{"RawSockaddrDatalink.Data", Field, 0, ""},
+		{"RawSockaddrDatalink.Family", Field, 0, ""},
+		{"RawSockaddrDatalink.Index", Field, 0, ""},
+		{"RawSockaddrDatalink.Len", Field, 0, ""},
+		{"RawSockaddrDatalink.Nlen", Field, 0, ""},
+		{"RawSockaddrDatalink.Pad_cgo_0", Field, 2, ""},
+		{"RawSockaddrDatalink.Slen", Field, 0, ""},
+		{"RawSockaddrDatalink.Type", Field, 0, ""},
+		{"RawSockaddrInet4", Type, 0, ""},
+		{"RawSockaddrInet4.Addr", Field, 0, ""},
+		{"RawSockaddrInet4.Family", Field, 0, ""},
+		{"RawSockaddrInet4.Len", Field, 0, ""},
+		{"RawSockaddrInet4.Port", Field, 0, ""},
+		{"RawSockaddrInet4.Zero", Field, 0, ""},
+		{"RawSockaddrInet6", Type, 0, ""},
+		{"RawSockaddrInet6.Addr", Field, 0, ""},
+		{"RawSockaddrInet6.Family", Field, 0, ""},
+		{"RawSockaddrInet6.Flowinfo", Field, 0, ""},
+		{"RawSockaddrInet6.Len", Field, 0, ""},
+		{"RawSockaddrInet6.Port", Field, 0, ""},
+		{"RawSockaddrInet6.Scope_id", Field, 0, ""},
+		{"RawSockaddrLinklayer", Type, 0, ""},
+		{"RawSockaddrLinklayer.Addr", Field, 0, ""},
+		{"RawSockaddrLinklayer.Family", Field, 0, ""},
+		{"RawSockaddrLinklayer.Halen", Field, 0, ""},
+		{"RawSockaddrLinklayer.Hatype", Field, 0, ""},
+		{"RawSockaddrLinklayer.Ifindex", Field, 0, ""},
+		{"RawSockaddrLinklayer.Pkttype", Field, 0, ""},
+		{"RawSockaddrLinklayer.Protocol", Field, 0, ""},
+		{"RawSockaddrNetlink", Type, 0, ""},
+		{"RawSockaddrNetlink.Family", Field, 0, ""},
+		{"RawSockaddrNetlink.Groups", Field, 0, ""},
+		{"RawSockaddrNetlink.Pad", Field, 0, ""},
+		{"RawSockaddrNetlink.Pid", Field, 0, ""},
+		{"RawSockaddrUnix", Type, 0, ""},
+		{"RawSockaddrUnix.Family", Field, 0, ""},
+		{"RawSockaddrUnix.Len", Field, 0, ""},
+		{"RawSockaddrUnix.Pad_cgo_0", Field, 2, ""},
+		{"RawSockaddrUnix.Path", Field, 0, ""},
+		{"RawSyscall", Func, 0, "func(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr) (r1 uintptr, r2 uintptr, err Errno)"},
+		{"RawSyscall6", Func, 0, "func(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr, a4 uintptr, a5 uintptr, a6 uintptr) (r1 uintptr, r2 uintptr, err Errno)"},
+		{"Read", Func, 0, "func(fd int, p []byte) (n int, err error)"},
+		{"ReadConsole", Func, 1, ""},
+		{"ReadDirectoryChanges", Func, 0, ""},
+		{"ReadDirent", Func, 0, "func(fd int, buf []byte) (n int, err error)"},
+		{"ReadFile", Func, 0, ""},
+		{"Readlink", Func, 0, "func(path string, buf []byte) (n int, err error)"},
+		{"Reboot", Func, 0, "func(cmd int) (err error)"},
+		{"Recvfrom", Func, 0, "func(fd int, p []byte, flags int) (n int, from Sockaddr, err error)"},
+		{"Recvmsg", Func, 0, "func(fd int, p []byte, oob []byte, flags int) (n int, oobn int, recvflags int, from Sockaddr, err error)"},
+		{"RegCloseKey", Func, 0, ""},
+		{"RegEnumKeyEx", Func, 0, ""},
+		{"RegOpenKeyEx", Func, 0, ""},
+		{"RegQueryInfoKey", Func, 0, ""},
+		{"RegQueryValueEx", Func, 0, ""},
+		{"RemoveDirectory", Func, 0, ""},
+		{"Removexattr", Func, 1, "func(path string, attr string) (err error)"},
+		{"Rename", Func, 0, "func(oldpath string, newpath string) (err error)"},
+		{"Renameat", Func, 0, "func(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)"},
+		{"Revoke", Func, 0, ""},
+		{"Rlimit", Type, 0, ""},
+		{"Rlimit.Cur", Field, 0, ""},
+		{"Rlimit.Max", Field, 0, ""},
+		{"Rmdir", Func, 0, "func(path string) error"},
+		{"RouteMessage", Type, 0, ""},
+		{"RouteMessage.Data", Field, 0, ""},
+		{"RouteMessage.Header", Field, 0, ""},
+		{"RouteRIB", Func, 0, ""},
+		{"RoutingMessage", Type, 0, ""},
+		{"RtAttr", Type, 0, ""},
+		{"RtAttr.Len", Field, 0, ""},
+		{"RtAttr.Type", Field, 0, ""},
+		{"RtGenmsg", Type, 0, ""},
+		{"RtGenmsg.Family", Field, 0, ""},
+		{"RtMetrics", Type, 0, ""},
+		{"RtMetrics.Expire", Field, 0, ""},
+		{"RtMetrics.Filler", Field, 0, ""},
+		{"RtMetrics.Hopcount", Field, 0, ""},
+		{"RtMetrics.Locks", Field, 0, ""},
+		{"RtMetrics.Mtu", Field, 0, ""},
+		{"RtMetrics.Pad", Field, 3, ""},
+		{"RtMetrics.Pksent", Field, 0, ""},
+		{"RtMetrics.Recvpipe", Field, 0, ""},
+		{"RtMetrics.Refcnt", Field, 2, ""},
+		{"RtMetrics.Rtt", Field, 0, ""},
+		{"RtMetrics.Rttvar", Field, 0, ""},
+		{"RtMetrics.Sendpipe", Field, 0, ""},
+		{"RtMetrics.Ssthresh", Field, 0, ""},
+		{"RtMetrics.Weight", Field, 0, ""},
+		{"RtMsg", Type, 0, ""},
+		{"RtMsg.Dst_len", Field, 0, ""},
+		{"RtMsg.Family", Field, 0, ""},
+		{"RtMsg.Flags", Field, 0, ""},
+		{"RtMsg.Protocol", Field, 0, ""},
+		{"RtMsg.Scope", Field, 0, ""},
+		{"RtMsg.Src_len", Field, 0, ""},
+		{"RtMsg.Table", Field, 0, ""},
+		{"RtMsg.Tos", Field, 0, ""},
+		{"RtMsg.Type", Field, 0, ""},
+		{"RtMsghdr", Type, 0, ""},
+		{"RtMsghdr.Addrs", Field, 0, ""},
+		{"RtMsghdr.Errno", Field, 0, ""},
+		{"RtMsghdr.Flags", Field, 0, ""},
+		{"RtMsghdr.Fmask", Field, 0, ""},
+		{"RtMsghdr.Hdrlen", Field, 2, ""},
+		{"RtMsghdr.Index", Field, 0, ""},
+		{"RtMsghdr.Inits", Field, 0, ""},
+		{"RtMsghdr.Mpls", Field, 2, ""},
+		{"RtMsghdr.Msglen", Field, 0, ""},
+		{"RtMsghdr.Pad_cgo_0", Field, 0, ""},
+		{"RtMsghdr.Pad_cgo_1", Field, 2, ""},
+		{"RtMsghdr.Pid", Field, 0, ""},
+		{"RtMsghdr.Priority", Field, 2, ""},
+		{"RtMsghdr.Rmx", Field, 0, ""},
+		{"RtMsghdr.Seq", Field, 0, ""},
+		{"RtMsghdr.Tableid", Field, 2, ""},
+		{"RtMsghdr.Type", Field, 0, ""},
+		{"RtMsghdr.Use", Field, 0, ""},
+		{"RtMsghdr.Version", Field, 0, ""},
+		{"RtNexthop", Type, 0, ""},
+		{"RtNexthop.Flags", Field, 0, ""},
+		{"RtNexthop.Hops", Field, 0, ""},
+		{"RtNexthop.Ifindex", Field, 0, ""},
+		{"RtNexthop.Len", Field, 0, ""},
+		{"Rusage", Type, 0, ""},
+		{"Rusage.CreationTime", Field, 0, ""},
+		{"Rusage.ExitTime", Field, 0, ""},
+		{"Rusage.Idrss", Field, 0, ""},
+		{"Rusage.Inblock", Field, 0, ""},
+		{"Rusage.Isrss", Field, 0, ""},
+		{"Rusage.Ixrss", Field, 0, ""},
+		{"Rusage.KernelTime", Field, 0, ""},
+		{"Rusage.Majflt", Field, 0, ""},
+		{"Rusage.Maxrss", Field, 0, ""},
+		{"Rusage.Minflt", Field, 0, ""},
+		{"Rusage.Msgrcv", Field, 0, ""},
+		{"Rusage.Msgsnd", Field, 0, ""},
+		{"Rusage.Nivcsw", Field, 0, ""},
+		{"Rusage.Nsignals", Field, 0, ""},
+		{"Rusage.Nswap", Field, 0, ""},
+		{"Rusage.Nvcsw", Field, 0, ""},
+		{"Rusage.Oublock", Field, 0, ""},
+		{"Rusage.Stime", Field, 0, ""},
+		{"Rusage.UserTime", Field, 0, ""},
+		{"Rusage.Utime", Field, 0, ""},
+		{"SCM_BINTIME", Const, 0, ""},
+		{"SCM_CREDENTIALS", Const, 0, ""},
+		{"SCM_CREDS", Const, 0, ""},
+		{"SCM_RIGHTS", Const, 0, ""},
+		{"SCM_TIMESTAMP", Const, 0, ""},
+		{"SCM_TIMESTAMPING", Const, 0, ""},
+		{"SCM_TIMESTAMPNS", Const, 0, ""},
+		{"SCM_TIMESTAMP_MONOTONIC", Const, 0, ""},
+		{"SHUT_RD", Const, 0, ""},
+		{"SHUT_RDWR", Const, 0, ""},
+		{"SHUT_WR", Const, 0, ""},
+		{"SID", Type, 0, ""},
+		{"SIDAndAttributes", Type, 0, ""},
+		{"SIDAndAttributes.Attributes", Field, 0, ""},
+		{"SIDAndAttributes.Sid", Field, 0, ""},
+		{"SIGABRT", Const, 0, ""},
+		{"SIGALRM", Const, 0, ""},
+		{"SIGBUS", Const, 0, ""},
+		{"SIGCHLD", Const, 0, ""},
+		{"SIGCLD", Const, 0, ""},
+		{"SIGCONT", Const, 0, ""},
+		{"SIGEMT", Const, 0, ""},
+		{"SIGFPE", Const, 0, ""},
+		{"SIGHUP", Const, 0, ""},
+		{"SIGILL", Const, 0, ""},
+		{"SIGINFO", Const, 0, ""},
+		{"SIGINT", Const, 0, ""},
+		{"SIGIO", Const, 0, ""},
+		{"SIGIOT", Const, 0, ""},
+		{"SIGKILL", Const, 0, ""},
+		{"SIGLIBRT", Const, 1, ""},
+		{"SIGLWP", Const, 0, ""},
+		{"SIGPIPE", Const, 0, ""},
+		{"SIGPOLL", Const, 0, ""},
+		{"SIGPROF", Const, 0, ""},
+		{"SIGPWR", Const, 0, ""},
+		{"SIGQUIT", Const, 0, ""},
+		{"SIGSEGV", Const, 0, ""},
+		{"SIGSTKFLT", Const, 0, ""},
+		{"SIGSTOP", Const, 0, ""},
+		{"SIGSYS", Const, 0, ""},
+		{"SIGTERM", Const, 0, ""},
+		{"SIGTHR", Const, 0, ""},
+		{"SIGTRAP", Const, 0, ""},
+		{"SIGTSTP", Const, 0, ""},
+		{"SIGTTIN", Const, 0, ""},
+		{"SIGTTOU", Const, 0, ""},
+		{"SIGUNUSED", Const, 0, ""},
+		{"SIGURG", Const, 0, ""},
+		{"SIGUSR1", Const, 0, ""},
+		{"SIGUSR2", Const, 0, ""},
+		{"SIGVTALRM", Const, 0, ""},
+		{"SIGWINCH", Const, 0, ""},
+		{"SIGXCPU", Const, 0, ""},
+		{"SIGXFSZ", Const, 0, ""},
+		{"SIOCADDDLCI", Const, 0, ""},
+		{"SIOCADDMULTI", Const, 0, ""},
+		{"SIOCADDRT", Const, 0, ""},
+		{"SIOCAIFADDR", Const, 0, ""},
+		{"SIOCAIFGROUP", Const, 0, ""},
+		{"SIOCALIFADDR", Const, 0, ""},
+		{"SIOCARPIPLL", Const, 0, ""},
+		{"SIOCATMARK", Const, 0, ""},
+		{"SIOCAUTOADDR", Const, 0, ""},
+		{"SIOCAUTONETMASK", Const, 0, ""},
+		{"SIOCBRDGADD", Const, 1, ""},
+		{"SIOCBRDGADDS", Const, 1, ""},
+		{"SIOCBRDGARL", Const, 1, ""},
+		{"SIOCBRDGDADDR", Const, 1, ""},
+		{"SIOCBRDGDEL", Const, 1, ""},
+		{"SIOCBRDGDELS", Const, 1, ""},
+		{"SIOCBRDGFLUSH", Const, 1, ""},
+		{"SIOCBRDGFRL", Const, 1, ""},
+		{"SIOCBRDGGCACHE", Const, 1, ""},
+		{"SIOCBRDGGFD", Const, 1, ""},
+		{"SIOCBRDGGHT", Const, 1, ""},
+		{"SIOCBRDGGIFFLGS", Const, 1, ""},
+		{"SIOCBRDGGMA", Const, 1, ""},
+		{"SIOCBRDGGPARAM", Const, 1, ""},
+		{"SIOCBRDGGPRI", Const, 1, ""},
+		{"SIOCBRDGGRL", Const, 1, ""},
+		{"SIOCBRDGGSIFS", Const, 1, ""},
+		{"SIOCBRDGGTO", Const, 1, ""},
+		{"SIOCBRDGIFS", Const, 1, ""},
+		{"SIOCBRDGRTS", Const, 1, ""},
+		{"SIOCBRDGSADDR", Const, 1, ""},
+		{"SIOCBRDGSCACHE", Const, 1, ""},
+		{"SIOCBRDGSFD", Const, 1, ""},
+		{"SIOCBRDGSHT", Const, 1, ""},
+		{"SIOCBRDGSIFCOST", Const, 1, ""},
+		{"SIOCBRDGSIFFLGS", Const, 1, ""},
+		{"SIOCBRDGSIFPRIO", Const, 1, ""},
+		{"SIOCBRDGSMA", Const, 1, ""},
+		{"SIOCBRDGSPRI", Const, 1, ""},
+		{"SIOCBRDGSPROTO", Const, 1, ""},
+		{"SIOCBRDGSTO", Const, 1, ""},
+		{"SIOCBRDGSTXHC", Const, 1, ""},
+		{"SIOCDARP", Const, 0, ""},
+		{"SIOCDELDLCI", Const, 0, ""},
+		{"SIOCDELMULTI", Const, 0, ""},
+		{"SIOCDELRT", Const, 0, ""},
+		{"SIOCDEVPRIVATE", Const, 0, ""},
+		{"SIOCDIFADDR", Const, 0, ""},
+		{"SIOCDIFGROUP", Const, 0, ""},
+		{"SIOCDIFPHYADDR", Const, 0, ""},
+		{"SIOCDLIFADDR", Const, 0, ""},
+		{"SIOCDRARP", Const, 0, ""},
+		{"SIOCGARP", Const, 0, ""},
+		{"SIOCGDRVSPEC", Const, 0, ""},
+		{"SIOCGETKALIVE", Const, 1, ""},
+		{"SIOCGETLABEL", Const, 1, ""},
+		{"SIOCGETPFLOW", Const, 1, ""},
+		{"SIOCGETPFSYNC", Const, 1, ""},
+		{"SIOCGETSGCNT", Const, 0, ""},
+		{"SIOCGETVIFCNT", Const, 0, ""},
+		{"SIOCGETVLAN", Const, 0, ""},
+		{"SIOCGHIWAT", Const, 0, ""},
+		{"SIOCGIFADDR", Const, 0, ""},
+		{"SIOCGIFADDRPREF", Const, 1, ""},
+		{"SIOCGIFALIAS", Const, 1, ""},
+		{"SIOCGIFALTMTU", Const, 0, ""},
+		{"SIOCGIFASYNCMAP", Const, 0, ""},
+		{"SIOCGIFBOND", Const, 0, ""},
+		{"SIOCGIFBR", Const, 0, ""},
+		{"SIOCGIFBRDADDR", Const, 0, ""},
+		{"SIOCGIFCAP", Const, 0, ""},
+		{"SIOCGIFCONF", Const, 0, ""},
+		{"SIOCGIFCOUNT", Const, 0, ""},
+		{"SIOCGIFDATA", Const, 1, ""},
+		{"SIOCGIFDESCR", Const, 0, ""},
+		{"SIOCGIFDEVMTU", Const, 0, ""},
+		{"SIOCGIFDLT", Const, 1, ""},
+		{"SIOCGIFDSTADDR", Const, 0, ""},
+		{"SIOCGIFENCAP", Const, 0, ""},
+		{"SIOCGIFFIB", Const, 1, ""},
+		{"SIOCGIFFLAGS", Const, 0, ""},
+		{"SIOCGIFGATTR", Const, 1, ""},
+		{"SIOCGIFGENERIC", Const, 0, ""},
+		{"SIOCGIFGMEMB", Const, 0, ""},
+		{"SIOCGIFGROUP", Const, 0, ""},
+		{"SIOCGIFHARDMTU", Const, 3, ""},
+		{"SIOCGIFHWADDR", Const, 0, ""},
+		{"SIOCGIFINDEX", Const, 0, ""},
+		{"SIOCGIFKPI", Const, 0, ""},
+		{"SIOCGIFMAC", Const, 0, ""},
+		{"SIOCGIFMAP", Const, 0, ""},
+		{"SIOCGIFMEDIA", Const, 0, ""},
+		{"SIOCGIFMEM", Const, 0, ""},
+		{"SIOCGIFMETRIC", Const, 0, ""},
+		{"SIOCGIFMTU", Const, 0, ""},
+		{"SIOCGIFNAME", Const, 0, ""},
+		{"SIOCGIFNETMASK", Const, 0, ""},
+		{"SIOCGIFPDSTADDR", Const, 0, ""},
+		{"SIOCGIFPFLAGS", Const, 0, ""},
+		{"SIOCGIFPHYS", Const, 0, ""},
+		{"SIOCGIFPRIORITY", Const, 1, ""},
+		{"SIOCGIFPSRCADDR", Const, 0, ""},
+		{"SIOCGIFRDOMAIN", Const, 1, ""},
+		{"SIOCGIFRTLABEL", Const, 1, ""},
+		{"SIOCGIFSLAVE", Const, 0, ""},
+		{"SIOCGIFSTATUS", Const, 0, ""},
+		{"SIOCGIFTIMESLOT", Const, 1, ""},
+		{"SIOCGIFTXQLEN", Const, 0, ""},
+		{"SIOCGIFVLAN", Const, 0, ""},
+		{"SIOCGIFWAKEFLAGS", Const, 0, ""},
+		{"SIOCGIFXFLAGS", Const, 1, ""},
+		{"SIOCGLIFADDR", Const, 0, ""},
+		{"SIOCGLIFPHYADDR", Const, 0, ""},
+		{"SIOCGLIFPHYRTABLE", Const, 1, ""},
+		{"SIOCGLIFPHYTTL", Const, 3, ""},
+		{"SIOCGLINKSTR", Const, 1, ""},
+		{"SIOCGLOWAT", Const, 0, ""},
+		{"SIOCGPGRP", Const, 0, ""},
+		{"SIOCGPRIVATE_0", Const, 0, ""},
+		{"SIOCGPRIVATE_1", Const, 0, ""},
+		{"SIOCGRARP", Const, 0, ""},
+		{"SIOCGSPPPPARAMS", Const, 3, ""},
+		{"SIOCGSTAMP", Const, 0, ""},
+		{"SIOCGSTAMPNS", Const, 0, ""},
+		{"SIOCGVH", Const, 1, ""},
+		{"SIOCGVNETID", Const, 3, ""},
+		{"SIOCIFCREATE", Const, 0, ""},
+		{"SIOCIFCREATE2", Const, 0, ""},
+		{"SIOCIFDESTROY", Const, 0, ""},
+		{"SIOCIFGCLONERS", Const, 0, ""},
+		{"SIOCINITIFADDR", Const, 1, ""},
+		{"SIOCPROTOPRIVATE", Const, 0, ""},
+		{"SIOCRSLVMULTI", Const, 0, ""},
+		{"SIOCRTMSG", Const, 0, ""},
+		{"SIOCSARP", Const, 0, ""},
+		{"SIOCSDRVSPEC", Const, 0, ""},
+		{"SIOCSETKALIVE", Const, 1, ""},
+		{"SIOCSETLABEL", Const, 1, ""},
+		{"SIOCSETPFLOW", Const, 1, ""},
+		{"SIOCSETPFSYNC", Const, 1, ""},
+		{"SIOCSETVLAN", Const, 0, ""},
+		{"SIOCSHIWAT", Const, 0, ""},
+		{"SIOCSIFADDR", Const, 0, ""},
+		{"SIOCSIFADDRPREF", Const, 1, ""},
+		{"SIOCSIFALTMTU", Const, 0, ""},
+		{"SIOCSIFASYNCMAP", Const, 0, ""},
+		{"SIOCSIFBOND", Const, 0, ""},
+		{"SIOCSIFBR", Const, 0, ""},
+		{"SIOCSIFBRDADDR", Const, 0, ""},
+		{"SIOCSIFCAP", Const, 0, ""},
+		{"SIOCSIFDESCR", Const, 0, ""},
+		{"SIOCSIFDSTADDR", Const, 0, ""},
+		{"SIOCSIFENCAP", Const, 0, ""},
+		{"SIOCSIFFIB", Const, 1, ""},
+		{"SIOCSIFFLAGS", Const, 0, ""},
+		{"SIOCSIFGATTR", Const, 1, ""},
+		{"SIOCSIFGENERIC", Const, 0, ""},
+		{"SIOCSIFHWADDR", Const, 0, ""},
+		{"SIOCSIFHWBROADCAST", Const, 0, ""},
+		{"SIOCSIFKPI", Const, 0, ""},
+		{"SIOCSIFLINK", Const, 0, ""},
+		{"SIOCSIFLLADDR", Const, 0, ""},
+		{"SIOCSIFMAC", Const, 0, ""},
+		{"SIOCSIFMAP", Const, 0, ""},
+		{"SIOCSIFMEDIA", Const, 0, ""},
+		{"SIOCSIFMEM", Const, 0, ""},
+		{"SIOCSIFMETRIC", Const, 0, ""},
+		{"SIOCSIFMTU", Const, 0, ""},
+		{"SIOCSIFNAME", Const, 0, ""},
+		{"SIOCSIFNETMASK", Const, 0, ""},
+		{"SIOCSIFPFLAGS", Const, 0, ""},
+		{"SIOCSIFPHYADDR", Const, 0, ""},
+		{"SIOCSIFPHYS", Const, 0, ""},
+		{"SIOCSIFPRIORITY", Const, 1, ""},
+		{"SIOCSIFRDOMAIN", Const, 1, ""},
+		{"SIOCSIFRTLABEL", Const, 1, ""},
+		{"SIOCSIFRVNET", Const, 0, ""},
+		{"SIOCSIFSLAVE", Const, 0, ""},
+		{"SIOCSIFTIMESLOT", Const, 1, ""},
+		{"SIOCSIFTXQLEN", Const, 0, ""},
+		{"SIOCSIFVLAN", Const, 0, ""},
+		{"SIOCSIFVNET", Const, 0, ""},
+		{"SIOCSIFXFLAGS", Const, 1, ""},
+		{"SIOCSLIFPHYADDR", Const, 0, ""},
+		{"SIOCSLIFPHYRTABLE", Const, 1, ""},
+		{"SIOCSLIFPHYTTL", Const, 3, ""},
+		{"SIOCSLINKSTR", Const, 1, ""},
+		{"SIOCSLOWAT", Const, 0, ""},
+		{"SIOCSPGRP", Const, 0, ""},
+		{"SIOCSRARP", Const, 0, ""},
+		{"SIOCSSPPPPARAMS", Const, 3, ""},
+		{"SIOCSVH", Const, 1, ""},
+		{"SIOCSVNETID", Const, 3, ""},
+		{"SIOCZIFDATA", Const, 1, ""},
+		{"SIO_GET_EXTENSION_FUNCTION_POINTER", Const, 1, ""},
+		{"SIO_GET_INTERFACE_LIST", Const, 0, ""},
+		{"SIO_KEEPALIVE_VALS", Const, 3, ""},
+		{"SIO_UDP_CONNRESET", Const, 4, ""},
+		{"SOCK_CLOEXEC", Const, 0, ""},
+		{"SOCK_DCCP", Const, 0, ""},
+		{"SOCK_DGRAM", Const, 0, ""},
+		{"SOCK_FLAGS_MASK", Const, 1, ""},
+		{"SOCK_MAXADDRLEN", Const, 0, ""},
+		{"SOCK_NONBLOCK", Const, 0, ""},
+		{"SOCK_NOSIGPIPE", Const, 1, ""},
+		{"SOCK_PACKET", Const, 0, ""},
+		{"SOCK_RAW", Const, 0, ""},
+		{"SOCK_RDM", Const, 0, ""},
+		{"SOCK_SEQPACKET", Const, 0, ""},
+		{"SOCK_STREAM", Const, 0, ""},
+		{"SOL_AAL", Const, 0, ""},
+		{"SOL_ATM", Const, 0, ""},
+		{"SOL_DECNET", Const, 0, ""},
+		{"SOL_ICMPV6", Const, 0, ""},
+		{"SOL_IP", Const, 0, ""},
+		{"SOL_IPV6", Const, 0, ""},
+		{"SOL_IRDA", Const, 0, ""},
+		{"SOL_PACKET", Const, 0, ""},
+		{"SOL_RAW", Const, 0, ""},
+		{"SOL_SOCKET", Const, 0, ""},
+		{"SOL_TCP", Const, 0, ""},
+		{"SOL_X25", Const, 0, ""},
+		{"SOMAXCONN", Const, 0, ""},
+		{"SO_ACCEPTCONN", Const, 0, ""},
+		{"SO_ACCEPTFILTER", Const, 0, ""},
+		{"SO_ATTACH_FILTER", Const, 0, ""},
+		{"SO_BINDANY", Const, 1, ""},
+		{"SO_BINDTODEVICE", Const, 0, ""},
+		{"SO_BINTIME", Const, 0, ""},
+		{"SO_BROADCAST", Const, 0, ""},
+		{"SO_BSDCOMPAT", Const, 0, ""},
+		{"SO_DEBUG", Const, 0, ""},
+		{"SO_DETACH_FILTER", Const, 0, ""},
+		{"SO_DOMAIN", Const, 0, ""},
+		{"SO_DONTROUTE", Const, 0, ""},
+		{"SO_DONTTRUNC", Const, 0, ""},
+		{"SO_ERROR", Const, 0, ""},
+		{"SO_KEEPALIVE", Const, 0, ""},
+		{"SO_LABEL", Const, 0, ""},
+		{"SO_LINGER", Const, 0, ""},
+		{"SO_LINGER_SEC", Const, 0, ""},
+		{"SO_LISTENINCQLEN", Const, 0, ""},
+		{"SO_LISTENQLEN", Const, 0, ""},
+		{"SO_LISTENQLIMIT", Const, 0, ""},
+		{"SO_MARK", Const, 0, ""},
+		{"SO_NETPROC", Const, 1, ""},
+		{"SO_NKE", Const, 0, ""},
+		{"SO_NOADDRERR", Const, 0, ""},
+		{"SO_NOHEADER", Const, 1, ""},
+		{"SO_NOSIGPIPE", Const, 0, ""},
+		{"SO_NOTIFYCONFLICT", Const, 0, ""},
+		{"SO_NO_CHECK", Const, 0, ""},
+		{"SO_NO_DDP", Const, 0, ""},
+		{"SO_NO_OFFLOAD", Const, 0, ""},
+		{"SO_NP_EXTENSIONS", Const, 0, ""},
+		{"SO_NREAD", Const, 0, ""},
+		{"SO_NUMRCVPKT", Const, 16, ""},
+		{"SO_NWRITE", Const, 0, ""},
+		{"SO_OOBINLINE", Const, 0, ""},
+		{"SO_OVERFLOWED", Const, 1, ""},
+		{"SO_PASSCRED", Const, 0, ""},
+		{"SO_PASSSEC", Const, 0, ""},
+		{"SO_PEERCRED", Const, 0, ""},
+		{"SO_PEERLABEL", Const, 0, ""},
+		{"SO_PEERNAME", Const, 0, ""},
+		{"SO_PEERSEC", Const, 0, ""},
+		{"SO_PRIORITY", Const, 0, ""},
+		{"SO_PROTOCOL", Const, 0, ""},
+		{"SO_PROTOTYPE", Const, 1, ""},
+		{"SO_RANDOMPORT", Const, 0, ""},
+		{"SO_RCVBUF", Const, 0, ""},
+		{"SO_RCVBUFFORCE", Const, 0, ""},
+		{"SO_RCVLOWAT", Const, 0, ""},
+		{"SO_RCVTIMEO", Const, 0, ""},
+		{"SO_RESTRICTIONS", Const, 0, ""},
+		{"SO_RESTRICT_DENYIN", Const, 0, ""},
+		{"SO_RESTRICT_DENYOUT", Const, 0, ""},
+		{"SO_RESTRICT_DENYSET", Const, 0, ""},
+		{"SO_REUSEADDR", Const, 0, ""},
+		{"SO_REUSEPORT", Const, 0, ""},
+		{"SO_REUSESHAREUID", Const, 0, ""},
+		{"SO_RTABLE", Const, 1, ""},
+		{"SO_RXQ_OVFL", Const, 0, ""},
+		{"SO_SECURITY_AUTHENTICATION", Const, 0, ""},
+		{"SO_SECURITY_ENCRYPTION_NETWORK", Const, 0, ""},
+		{"SO_SECURITY_ENCRYPTION_TRANSPORT", Const, 0, ""},
+		{"SO_SETFIB", Const, 0, ""},
+		{"SO_SNDBUF", Const, 0, ""},
+		{"SO_SNDBUFFORCE", Const, 0, ""},
+		{"SO_SNDLOWAT", Const, 0, ""},
+		{"SO_SNDTIMEO", Const, 0, ""},
+		{"SO_SPLICE", Const, 1, ""},
+		{"SO_TIMESTAMP", Const, 0, ""},
+		{"SO_TIMESTAMPING", Const, 0, ""},
+		{"SO_TIMESTAMPNS", Const, 0, ""},
+		{"SO_TIMESTAMP_MONOTONIC", Const, 0, ""},
+		{"SO_TYPE", Const, 0, ""},
+		{"SO_UPCALLCLOSEWAIT", Const, 0, ""},
+		{"SO_UPDATE_ACCEPT_CONTEXT", Const, 0, ""},
+		{"SO_UPDATE_CONNECT_CONTEXT", Const, 1, ""},
+		{"SO_USELOOPBACK", Const, 0, ""},
+		{"SO_USER_COOKIE", Const, 1, ""},
+		{"SO_VENDOR", Const, 3, ""},
+		{"SO_WANTMORE", Const, 0, ""},
+		{"SO_WANTOOBFLAG", Const, 0, ""},
+		{"SSLExtraCertChainPolicyPara", Type, 0, ""},
+		{"SSLExtraCertChainPolicyPara.AuthType", Field, 0, ""},
+		{"SSLExtraCertChainPolicyPara.Checks", Field, 0, ""},
+		{"SSLExtraCertChainPolicyPara.ServerName", Field, 0, ""},
+		{"SSLExtraCertChainPolicyPara.Size", Field, 0, ""},
+		{"STANDARD_RIGHTS_ALL", Const, 0, ""},
+		{"STANDARD_RIGHTS_EXECUTE", Const, 0, ""},
+		{"STANDARD_RIGHTS_READ", Const, 0, ""},
+		{"STANDARD_RIGHTS_REQUIRED", Const, 0, ""},
+		{"STANDARD_RIGHTS_WRITE", Const, 0, ""},
+		{"STARTF_USESHOWWINDOW", Const, 0, ""},
+		{"STARTF_USESTDHANDLES", Const, 0, ""},
+		{"STD_ERROR_HANDLE", Const, 0, ""},
+		{"STD_INPUT_HANDLE", Const, 0, ""},
+		{"STD_OUTPUT_HANDLE", Const, 0, ""},
+		{"SUBLANG_ENGLISH_US", Const, 0, ""},
+		{"SW_FORCEMINIMIZE", Const, 0, ""},
+		{"SW_HIDE", Const, 0, ""},
+		{"SW_MAXIMIZE", Const, 0, ""},
+		{"SW_MINIMIZE", Const, 0, ""},
+		{"SW_NORMAL", Const, 0, ""},
+		{"SW_RESTORE", Const, 0, ""},
+		{"SW_SHOW", Const, 0, ""},
+		{"SW_SHOWDEFAULT", Const, 0, ""},
+		{"SW_SHOWMAXIMIZED", Const, 0, ""},
+		{"SW_SHOWMINIMIZED", Const, 0, ""},
+		{"SW_SHOWMINNOACTIVE", Const, 0, ""},
+		{"SW_SHOWNA", Const, 0, ""},
+		{"SW_SHOWNOACTIVATE", Const, 0, ""},
+		{"SW_SHOWNORMAL", Const, 0, ""},
+		{"SYMBOLIC_LINK_FLAG_DIRECTORY", Const, 4, ""},
+		{"SYNCHRONIZE", Const, 0, ""},
+		{"SYSCTL_VERSION", Const, 1, ""},
+		{"SYSCTL_VERS_0", Const, 1, ""},
+		{"SYSCTL_VERS_1", Const, 1, ""},
+		{"SYSCTL_VERS_MASK", Const, 1, ""},
+		{"SYS_ABORT2", Const, 0, ""},
+		{"SYS_ACCEPT", Const, 0, ""},
+		{"SYS_ACCEPT4", Const, 0, ""},
+		{"SYS_ACCEPT_NOCANCEL", Const, 0, ""},
+		{"SYS_ACCESS", Const, 0, ""},
+		{"SYS_ACCESS_EXTENDED", Const, 0, ""},
+		{"SYS_ACCT", Const, 0, ""},
+		{"SYS_ADD_KEY", Const, 0, ""},
+		{"SYS_ADD_PROFIL", Const, 0, ""},
+		{"SYS_ADJFREQ", Const, 1, ""},
+		{"SYS_ADJTIME", Const, 0, ""},
+		{"SYS_ADJTIMEX", Const, 0, ""},
+		{"SYS_AFS_SYSCALL", Const, 0, ""},
+		{"SYS_AIO_CANCEL", Const, 0, ""},
+		{"SYS_AIO_ERROR", Const, 0, ""},
+		{"SYS_AIO_FSYNC", Const, 0, ""},
+		{"SYS_AIO_MLOCK", Const, 14, ""},
+		{"SYS_AIO_READ", Const, 0, ""},
+		{"SYS_AIO_RETURN", Const, 0, ""},
+		{"SYS_AIO_SUSPEND", Const, 0, ""},
+		{"SYS_AIO_SUSPEND_NOCANCEL", Const, 0, ""},
+		{"SYS_AIO_WAITCOMPLETE", Const, 14, ""},
+		{"SYS_AIO_WRITE", Const, 0, ""},
+		{"SYS_ALARM", Const, 0, ""},
+		{"SYS_ARCH_PRCTL", Const, 0, ""},
+		{"SYS_ARM_FADVISE64_64", Const, 0, ""},
+		{"SYS_ARM_SYNC_FILE_RANGE", Const, 0, ""},
+		{"SYS_ATGETMSG", Const, 0, ""},
+		{"SYS_ATPGETREQ", Const, 0, ""},
+		{"SYS_ATPGETRSP", Const, 0, ""},
+		{"SYS_ATPSNDREQ", Const, 0, ""},
+		{"SYS_ATPSNDRSP", Const, 0, ""},
+		{"SYS_ATPUTMSG", Const, 0, ""},
+		{"SYS_ATSOCKET", Const, 0, ""},
+		{"SYS_AUDIT", Const, 0, ""},
+		{"SYS_AUDITCTL", Const, 0, ""},
+		{"SYS_AUDITON", Const, 0, ""},
+		{"SYS_AUDIT_SESSION_JOIN", Const, 0, ""},
+		{"SYS_AUDIT_SESSION_PORT", Const, 0, ""},
+		{"SYS_AUDIT_SESSION_SELF", Const, 0, ""},
+		{"SYS_BDFLUSH", Const, 0, ""},
+		{"SYS_BIND", Const, 0, ""},
+		{"SYS_BINDAT", Const, 3, ""},
+		{"SYS_BREAK", Const, 0, ""},
+		{"SYS_BRK", Const, 0, ""},
+		{"SYS_BSDTHREAD_CREATE", Const, 0, ""},
+		{"SYS_BSDTHREAD_REGISTER", Const, 0, ""},
+		{"SYS_BSDTHREAD_TERMINATE", Const, 0, ""},
+		{"SYS_CAPGET", Const, 0, ""},
+		{"SYS_CAPSET", Const, 0, ""},
+		{"SYS_CAP_ENTER", Const, 0, ""},
+		{"SYS_CAP_FCNTLS_GET", Const, 1, ""},
+		{"SYS_CAP_FCNTLS_LIMIT", Const, 1, ""},
+		{"SYS_CAP_GETMODE", Const, 0, ""},
+		{"SYS_CAP_GETRIGHTS", Const, 0, ""},
+		{"SYS_CAP_IOCTLS_GET", Const, 1, ""},
+		{"SYS_CAP_IOCTLS_LIMIT", Const, 1, ""},
+		{"SYS_CAP_NEW", Const, 0, ""},
+		{"SYS_CAP_RIGHTS_GET", Const, 1, ""},
+		{"SYS_CAP_RIGHTS_LIMIT", Const, 1, ""},
+		{"SYS_CHDIR", Const, 0, ""},
+		{"SYS_CHFLAGS", Const, 0, ""},
+		{"SYS_CHFLAGSAT", Const, 3, ""},
+		{"SYS_CHMOD", Const, 0, ""},
+		{"SYS_CHMOD_EXTENDED", Const, 0, ""},
+		{"SYS_CHOWN", Const, 0, ""},
+		{"SYS_CHOWN32", Const, 0, ""},
+		{"SYS_CHROOT", Const, 0, ""},
+		{"SYS_CHUD", Const, 0, ""},
+		{"SYS_CLOCK_ADJTIME", Const, 0, ""},
+		{"SYS_CLOCK_GETCPUCLOCKID2", Const, 1, ""},
+		{"SYS_CLOCK_GETRES", Const, 0, ""},
+		{"SYS_CLOCK_GETTIME", Const, 0, ""},
+		{"SYS_CLOCK_NANOSLEEP", Const, 0, ""},
+		{"SYS_CLOCK_SETTIME", Const, 0, ""},
+		{"SYS_CLONE", Const, 0, ""},
+		{"SYS_CLOSE", Const, 0, ""},
+		{"SYS_CLOSEFROM", Const, 0, ""},
+		{"SYS_CLOSE_NOCANCEL", Const, 0, ""},
+		{"SYS_CONNECT", Const, 0, ""},
+		{"SYS_CONNECTAT", Const, 3, ""},
+		{"SYS_CONNECT_NOCANCEL", Const, 0, ""},
+		{"SYS_COPYFILE", Const, 0, ""},
+		{"SYS_CPUSET", Const, 0, ""},
+		{"SYS_CPUSET_GETAFFINITY", Const, 0, ""},
+		{"SYS_CPUSET_GETID", Const, 0, ""},
+		{"SYS_CPUSET_SETAFFINITY", Const, 0, ""},
+		{"SYS_CPUSET_SETID", Const, 0, ""},
+		{"SYS_CREAT", Const, 0, ""},
+		{"SYS_CREATE_MODULE", Const, 0, ""},
+		{"SYS_CSOPS", Const, 0, ""},
+		{"SYS_CSOPS_AUDITTOKEN", Const, 16, ""},
+		{"SYS_DELETE", Const, 0, ""},
+		{"SYS_DELETE_MODULE", Const, 0, ""},
+		{"SYS_DUP", Const, 0, ""},
+		{"SYS_DUP2", Const, 0, ""},
+		{"SYS_DUP3", Const, 0, ""},
+		{"SYS_EACCESS", Const, 0, ""},
+		{"SYS_EPOLL_CREATE", Const, 0, ""},
+		{"SYS_EPOLL_CREATE1", Const, 0, ""},
+		{"SYS_EPOLL_CTL", Const, 0, ""},
+		{"SYS_EPOLL_CTL_OLD", Const, 0, ""},
+		{"SYS_EPOLL_PWAIT", Const, 0, ""},
+		{"SYS_EPOLL_WAIT", Const, 0, ""},
+		{"SYS_EPOLL_WAIT_OLD", Const, 0, ""},
+		{"SYS_EVENTFD", Const, 0, ""},
+		{"SYS_EVENTFD2", Const, 0, ""},
+		{"SYS_EXCHANGEDATA", Const, 0, ""},
+		{"SYS_EXECVE", Const, 0, ""},
+		{"SYS_EXIT", Const, 0, ""},
+		{"SYS_EXIT_GROUP", Const, 0, ""},
+		{"SYS_EXTATTRCTL", Const, 0, ""},
+		{"SYS_EXTATTR_DELETE_FD", Const, 0, ""},
+		{"SYS_EXTATTR_DELETE_FILE", Const, 0, ""},
+		{"SYS_EXTATTR_DELETE_LINK", Const, 0, ""},
+		{"SYS_EXTATTR_GET_FD", Const, 0, ""},
+		{"SYS_EXTATTR_GET_FILE", Const, 0, ""},
+		{"SYS_EXTATTR_GET_LINK", Const, 0, ""},
+		{"SYS_EXTATTR_LIST_FD", Const, 0, ""},
+		{"SYS_EXTATTR_LIST_FILE", Const, 0, ""},
+		{"SYS_EXTATTR_LIST_LINK", Const, 0, ""},
+		{"SYS_EXTATTR_SET_FD", Const, 0, ""},
+		{"SYS_EXTATTR_SET_FILE", Const, 0, ""},
+		{"SYS_EXTATTR_SET_LINK", Const, 0, ""},
+		{"SYS_FACCESSAT", Const, 0, ""},
+		{"SYS_FADVISE64", Const, 0, ""},
+		{"SYS_FADVISE64_64", Const, 0, ""},
+		{"SYS_FALLOCATE", Const, 0, ""},
+		{"SYS_FANOTIFY_INIT", Const, 0, ""},
+		{"SYS_FANOTIFY_MARK", Const, 0, ""},
+		{"SYS_FCHDIR", Const, 0, ""},
+		{"SYS_FCHFLAGS", Const, 0, ""},
+		{"SYS_FCHMOD", Const, 0, ""},
+		{"SYS_FCHMODAT", Const, 0, ""},
+		{"SYS_FCHMOD_EXTENDED", Const, 0, ""},
+		{"SYS_FCHOWN", Const, 0, ""},
+		{"SYS_FCHOWN32", Const, 0, ""},
+		{"SYS_FCHOWNAT", Const, 0, ""},
+		{"SYS_FCHROOT", Const, 1, ""},
+		{"SYS_FCNTL", Const, 0, ""},
+		{"SYS_FCNTL64", Const, 0, ""},
+		{"SYS_FCNTL_NOCANCEL", Const, 0, ""},
+		{"SYS_FDATASYNC", Const, 0, ""},
+		{"SYS_FEXECVE", Const, 0, ""},
+		{"SYS_FFCLOCK_GETCOUNTER", Const, 0, ""},
+		{"SYS_FFCLOCK_GETESTIMATE", Const, 0, ""},
+		{"SYS_FFCLOCK_SETESTIMATE", Const, 0, ""},
+		{"SYS_FFSCTL", Const, 0, ""},
+		{"SYS_FGETATTRLIST", Const, 0, ""},
+		{"SYS_FGETXATTR", Const, 0, ""},
+		{"SYS_FHOPEN", Const, 0, ""},
+		{"SYS_FHSTAT", Const, 0, ""},
+		{"SYS_FHSTATFS", Const, 0, ""},
+		{"SYS_FILEPORT_MAKEFD", Const, 0, ""},
+		{"SYS_FILEPORT_MAKEPORT", Const, 0, ""},
+		{"SYS_FKTRACE", Const, 1, ""},
+		{"SYS_FLISTXATTR", Const, 0, ""},
+		{"SYS_FLOCK", Const, 0, ""},
+		{"SYS_FORK", Const, 0, ""},
+		{"SYS_FPATHCONF", Const, 0, ""},
+		{"SYS_FREEBSD6_FTRUNCATE", Const, 0, ""},
+		{"SYS_FREEBSD6_LSEEK", Const, 0, ""},
+		{"SYS_FREEBSD6_MMAP", Const, 0, ""},
+		{"SYS_FREEBSD6_PREAD", Const, 0, ""},
+		{"SYS_FREEBSD6_PWRITE", Const, 0, ""},
+		{"SYS_FREEBSD6_TRUNCATE", Const, 0, ""},
+		{"SYS_FREMOVEXATTR", Const, 0, ""},
+		{"SYS_FSCTL", Const, 0, ""},
+		{"SYS_FSETATTRLIST", Const, 0, ""},
+		{"SYS_FSETXATTR", Const, 0, ""},
+		{"SYS_FSGETPATH", Const, 0, ""},
+		{"SYS_FSTAT", Const, 0, ""},
+		{"SYS_FSTAT64", Const, 0, ""},
+		{"SYS_FSTAT64_EXTENDED", Const, 0, ""},
+		{"SYS_FSTATAT", Const, 0, ""},
+		{"SYS_FSTATAT64", Const, 0, ""},
+		{"SYS_FSTATFS", Const, 0, ""},
+		{"SYS_FSTATFS64", Const, 0, ""},
+		{"SYS_FSTATV", Const, 0, ""},
+		{"SYS_FSTATVFS1", Const, 1, ""},
+		{"SYS_FSTAT_EXTENDED", Const, 0, ""},
+		{"SYS_FSYNC", Const, 0, ""},
+		{"SYS_FSYNC_NOCANCEL", Const, 0, ""},
+		{"SYS_FSYNC_RANGE", Const, 1, ""},
+		{"SYS_FTIME", Const, 0, ""},
+		{"SYS_FTRUNCATE", Const, 0, ""},
+		{"SYS_FTRUNCATE64", Const, 0, ""},
+		{"SYS_FUTEX", Const, 0, ""},
+		{"SYS_FUTIMENS", Const, 1, ""},
+		{"SYS_FUTIMES", Const, 0, ""},
+		{"SYS_FUTIMESAT", Const, 0, ""},
+		{"SYS_GETATTRLIST", Const, 0, ""},
+		{"SYS_GETAUDIT", Const, 0, ""},
+		{"SYS_GETAUDIT_ADDR", Const, 0, ""},
+		{"SYS_GETAUID", Const, 0, ""},
+		{"SYS_GETCONTEXT", Const, 0, ""},
+		{"SYS_GETCPU", Const, 0, ""},
+		{"SYS_GETCWD", Const, 0, ""},
+		{"SYS_GETDENTS", Const, 0, ""},
+		{"SYS_GETDENTS64", Const, 0, ""},
+		{"SYS_GETDIRENTRIES", Const, 0, ""},
+		{"SYS_GETDIRENTRIES64", Const, 0, ""},
+		{"SYS_GETDIRENTRIESATTR", Const, 0, ""},
+		{"SYS_GETDTABLECOUNT", Const, 1, ""},
+		{"SYS_GETDTABLESIZE", Const, 0, ""},
+		{"SYS_GETEGID", Const, 0, ""},
+		{"SYS_GETEGID32", Const, 0, ""},
+		{"SYS_GETEUID", Const, 0, ""},
+		{"SYS_GETEUID32", Const, 0, ""},
+		{"SYS_GETFH", Const, 0, ""},
+		{"SYS_GETFSSTAT", Const, 0, ""},
+		{"SYS_GETFSSTAT64", Const, 0, ""},
+		{"SYS_GETGID", Const, 0, ""},
+		{"SYS_GETGID32", Const, 0, ""},
+		{"SYS_GETGROUPS", Const, 0, ""},
+		{"SYS_GETGROUPS32", Const, 0, ""},
+		{"SYS_GETHOSTUUID", Const, 0, ""},
+		{"SYS_GETITIMER", Const, 0, ""},
+		{"SYS_GETLCID", Const, 0, ""},
+		{"SYS_GETLOGIN", Const, 0, ""},
+		{"SYS_GETLOGINCLASS", Const, 0, ""},
+		{"SYS_GETPEERNAME", Const, 0, ""},
+		{"SYS_GETPGID", Const, 0, ""},
+		{"SYS_GETPGRP", Const, 0, ""},
+		{"SYS_GETPID", Const, 0, ""},
+		{"SYS_GETPMSG", Const, 0, ""},
+		{"SYS_GETPPID", Const, 0, ""},
+		{"SYS_GETPRIORITY", Const, 0, ""},
+		{"SYS_GETRESGID", Const, 0, ""},
+		{"SYS_GETRESGID32", Const, 0, ""},
+		{"SYS_GETRESUID", Const, 0, ""},
+		{"SYS_GETRESUID32", Const, 0, ""},
+		{"SYS_GETRLIMIT", Const, 0, ""},
+		{"SYS_GETRTABLE", Const, 1, ""},
+		{"SYS_GETRUSAGE", Const, 0, ""},
+		{"SYS_GETSGROUPS", Const, 0, ""},
+		{"SYS_GETSID", Const, 0, ""},
+		{"SYS_GETSOCKNAME", Const, 0, ""},
+		{"SYS_GETSOCKOPT", Const, 0, ""},
+		{"SYS_GETTHRID", Const, 1, ""},
+		{"SYS_GETTID", Const, 0, ""},
+		{"SYS_GETTIMEOFDAY", Const, 0, ""},
+		{"SYS_GETUID", Const, 0, ""},
+		{"SYS_GETUID32", Const, 0, ""},
+		{"SYS_GETVFSSTAT", Const, 1, ""},
+		{"SYS_GETWGROUPS", Const, 0, ""},
+		{"SYS_GETXATTR", Const, 0, ""},
+		{"SYS_GET_KERNEL_SYMS", Const, 0, ""},
+		{"SYS_GET_MEMPOLICY", Const, 0, ""},
+		{"SYS_GET_ROBUST_LIST", Const, 0, ""},
+		{"SYS_GET_THREAD_AREA", Const, 0, ""},
+		{"SYS_GSSD_SYSCALL", Const, 14, ""},
+		{"SYS_GTTY", Const, 0, ""},
+		{"SYS_IDENTITYSVC", Const, 0, ""},
+		{"SYS_IDLE", Const, 0, ""},
+		{"SYS_INITGROUPS", Const, 0, ""},
+		{"SYS_INIT_MODULE", Const, 0, ""},
+		{"SYS_INOTIFY_ADD_WATCH", Const, 0, ""},
+		{"SYS_INOTIFY_INIT", Const, 0, ""},
+		{"SYS_INOTIFY_INIT1", Const, 0, ""},
+		{"SYS_INOTIFY_RM_WATCH", Const, 0, ""},
+		{"SYS_IOCTL", Const, 0, ""},
+		{"SYS_IOPERM", Const, 0, ""},
+		{"SYS_IOPL", Const, 0, ""},
+		{"SYS_IOPOLICYSYS", Const, 0, ""},
+		{"SYS_IOPRIO_GET", Const, 0, ""},
+		{"SYS_IOPRIO_SET", Const, 0, ""},
+		{"SYS_IO_CANCEL", Const, 0, ""},
+		{"SYS_IO_DESTROY", Const, 0, ""},
+		{"SYS_IO_GETEVENTS", Const, 0, ""},
+		{"SYS_IO_SETUP", Const, 0, ""},
+		{"SYS_IO_SUBMIT", Const, 0, ""},
+		{"SYS_IPC", Const, 0, ""},
+		{"SYS_ISSETUGID", Const, 0, ""},
+		{"SYS_JAIL", Const, 0, ""},
+		{"SYS_JAIL_ATTACH", Const, 0, ""},
+		{"SYS_JAIL_GET", Const, 0, ""},
+		{"SYS_JAIL_REMOVE", Const, 0, ""},
+		{"SYS_JAIL_SET", Const, 0, ""},
+		{"SYS_KAS_INFO", Const, 16, ""},
+		{"SYS_KDEBUG_TRACE", Const, 0, ""},
+		{"SYS_KENV", Const, 0, ""},
+		{"SYS_KEVENT", Const, 0, ""},
+		{"SYS_KEVENT64", Const, 0, ""},
+		{"SYS_KEXEC_LOAD", Const, 0, ""},
+		{"SYS_KEYCTL", Const, 0, ""},
+		{"SYS_KILL", Const, 0, ""},
+		{"SYS_KLDFIND", Const, 0, ""},
+		{"SYS_KLDFIRSTMOD", Const, 0, ""},
+		{"SYS_KLDLOAD", Const, 0, ""},
+		{"SYS_KLDNEXT", Const, 0, ""},
+		{"SYS_KLDSTAT", Const, 0, ""},
+		{"SYS_KLDSYM", Const, 0, ""},
+		{"SYS_KLDUNLOAD", Const, 0, ""},
+		{"SYS_KLDUNLOADF", Const, 0, ""},
+		{"SYS_KMQ_NOTIFY", Const, 14, ""},
+		{"SYS_KMQ_OPEN", Const, 14, ""},
+		{"SYS_KMQ_SETATTR", Const, 14, ""},
+		{"SYS_KMQ_TIMEDRECEIVE", Const, 14, ""},
+		{"SYS_KMQ_TIMEDSEND", Const, 14, ""},
+		{"SYS_KMQ_UNLINK", Const, 14, ""},
+		{"SYS_KQUEUE", Const, 0, ""},
+		{"SYS_KQUEUE1", Const, 1, ""},
+		{"SYS_KSEM_CLOSE", Const, 14, ""},
+		{"SYS_KSEM_DESTROY", Const, 14, ""},
+		{"SYS_KSEM_GETVALUE", Const, 14, ""},
+		{"SYS_KSEM_INIT", Const, 14, ""},
+		{"SYS_KSEM_OPEN", Const, 14, ""},
+		{"SYS_KSEM_POST", Const, 14, ""},
+		{"SYS_KSEM_TIMEDWAIT", Const, 14, ""},
+		{"SYS_KSEM_TRYWAIT", Const, 14, ""},
+		{"SYS_KSEM_UNLINK", Const, 14, ""},
+		{"SYS_KSEM_WAIT", Const, 14, ""},
+		{"SYS_KTIMER_CREATE", Const, 0, ""},
+		{"SYS_KTIMER_DELETE", Const, 0, ""},
+		{"SYS_KTIMER_GETOVERRUN", Const, 0, ""},
+		{"SYS_KTIMER_GETTIME", Const, 0, ""},
+		{"SYS_KTIMER_SETTIME", Const, 0, ""},
+		{"SYS_KTRACE", Const, 0, ""},
+		{"SYS_LCHFLAGS", Const, 0, ""},
+		{"SYS_LCHMOD", Const, 0, ""},
+		{"SYS_LCHOWN", Const, 0, ""},
+		{"SYS_LCHOWN32", Const, 0, ""},
+		{"SYS_LEDGER", Const, 16, ""},
+		{"SYS_LGETFH", Const, 0, ""},
+		{"SYS_LGETXATTR", Const, 0, ""},
+		{"SYS_LINK", Const, 0, ""},
+		{"SYS_LINKAT", Const, 0, ""},
+		{"SYS_LIO_LISTIO", Const, 0, ""},
+		{"SYS_LISTEN", Const, 0, ""},
+		{"SYS_LISTXATTR", Const, 0, ""},
+		{"SYS_LLISTXATTR", Const, 0, ""},
+		{"SYS_LOCK", Const, 0, ""},
+		{"SYS_LOOKUP_DCOOKIE", Const, 0, ""},
+		{"SYS_LPATHCONF", Const, 0, ""},
+		{"SYS_LREMOVEXATTR", Const, 0, ""},
+		{"SYS_LSEEK", Const, 0, ""},
+		{"SYS_LSETXATTR", Const, 0, ""},
+		{"SYS_LSTAT", Const, 0, ""},
+		{"SYS_LSTAT64", Const, 0, ""},
+		{"SYS_LSTAT64_EXTENDED", Const, 0, ""},
+		{"SYS_LSTATV", Const, 0, ""},
+		{"SYS_LSTAT_EXTENDED", Const, 0, ""},
+		{"SYS_LUTIMES", Const, 0, ""},
+		{"SYS_MAC_SYSCALL", Const, 0, ""},
+		{"SYS_MADVISE", Const, 0, ""},
+		{"SYS_MADVISE1", Const, 0, ""},
+		{"SYS_MAXSYSCALL", Const, 0, ""},
+		{"SYS_MBIND", Const, 0, ""},
+		{"SYS_MIGRATE_PAGES", Const, 0, ""},
+		{"SYS_MINCORE", Const, 0, ""},
+		{"SYS_MINHERIT", Const, 0, ""},
+		{"SYS_MKCOMPLEX", Const, 0, ""},
+		{"SYS_MKDIR", Const, 0, ""},
+		{"SYS_MKDIRAT", Const, 0, ""},
+		{"SYS_MKDIR_EXTENDED", Const, 0, ""},
+		{"SYS_MKFIFO", Const, 0, ""},
+		{"SYS_MKFIFOAT", Const, 0, ""},
+		{"SYS_MKFIFO_EXTENDED", Const, 0, ""},
+		{"SYS_MKNOD", Const, 0, ""},
+		{"SYS_MKNODAT", Const, 0, ""},
+		{"SYS_MLOCK", Const, 0, ""},
+		{"SYS_MLOCKALL", Const, 0, ""},
+		{"SYS_MMAP", Const, 0, ""},
+		{"SYS_MMAP2", Const, 0, ""},
+		{"SYS_MODCTL", Const, 1, ""},
+		{"SYS_MODFIND", Const, 0, ""},
+		{"SYS_MODFNEXT", Const, 0, ""},
+		{"SYS_MODIFY_LDT", Const, 0, ""},
+		{"SYS_MODNEXT", Const, 0, ""},
+		{"SYS_MODSTAT", Const, 0, ""},
+		{"SYS_MODWATCH", Const, 0, ""},
+		{"SYS_MOUNT", Const, 0, ""},
+		{"SYS_MOVE_PAGES", Const, 0, ""},
+		{"SYS_MPROTECT", Const, 0, ""},
+		{"SYS_MPX", Const, 0, ""},
+		{"SYS_MQUERY", Const, 1, ""},
+		{"SYS_MQ_GETSETATTR", Const, 0, ""},
+		{"SYS_MQ_NOTIFY", Const, 0, ""},
+		{"SYS_MQ_OPEN", Const, 0, ""},
+		{"SYS_MQ_TIMEDRECEIVE", Const, 0, ""},
+		{"SYS_MQ_TIMEDSEND", Const, 0, ""},
+		{"SYS_MQ_UNLINK", Const, 0, ""},
+		{"SYS_MREMAP", Const, 0, ""},
+		{"SYS_MSGCTL", Const, 0, ""},
+		{"SYS_MSGGET", Const, 0, ""},
+		{"SYS_MSGRCV", Const, 0, ""},
+		{"SYS_MSGRCV_NOCANCEL", Const, 0, ""},
+		{"SYS_MSGSND", Const, 0, ""},
+		{"SYS_MSGSND_NOCANCEL", Const, 0, ""},
+		{"SYS_MSGSYS", Const, 0, ""},
+		{"SYS_MSYNC", Const, 0, ""},
+		{"SYS_MSYNC_NOCANCEL", Const, 0, ""},
+		{"SYS_MUNLOCK", Const, 0, ""},
+		{"SYS_MUNLOCKALL", Const, 0, ""},
+		{"SYS_MUNMAP", Const, 0, ""},
+		{"SYS_NAME_TO_HANDLE_AT", Const, 0, ""},
+		{"SYS_NANOSLEEP", Const, 0, ""},
+		{"SYS_NEWFSTATAT", Const, 0, ""},
+		{"SYS_NFSCLNT", Const, 0, ""},
+		{"SYS_NFSSERVCTL", Const, 0, ""},
+		{"SYS_NFSSVC", Const, 0, ""},
+		{"SYS_NFSTAT", Const, 0, ""},
+		{"SYS_NICE", Const, 0, ""},
+		{"SYS_NLM_SYSCALL", Const, 14, ""},
+		{"SYS_NLSTAT", Const, 0, ""},
+		{"SYS_NMOUNT", Const, 0, ""},
+		{"SYS_NSTAT", Const, 0, ""},
+		{"SYS_NTP_ADJTIME", Const, 0, ""},
+		{"SYS_NTP_GETTIME", Const, 0, ""},
+		{"SYS_NUMA_GETAFFINITY", Const, 14, ""},
+		{"SYS_NUMA_SETAFFINITY", Const, 14, ""},
+		{"SYS_OABI_SYSCALL_BASE", Const, 0, ""},
+		{"SYS_OBREAK", Const, 0, ""},
+		{"SYS_OLDFSTAT", Const, 0, ""},
+		{"SYS_OLDLSTAT", Const, 0, ""},
+		{"SYS_OLDOLDUNAME", Const, 0, ""},
+		{"SYS_OLDSTAT", Const, 0, ""},
+		{"SYS_OLDUNAME", Const, 0, ""},
+		{"SYS_OPEN", Const, 0, ""},
+		{"SYS_OPENAT", Const, 0, ""},
+		{"SYS_OPENBSD_POLL", Const, 0, ""},
+		{"SYS_OPEN_BY_HANDLE_AT", Const, 0, ""},
+		{"SYS_OPEN_DPROTECTED_NP", Const, 16, ""},
+		{"SYS_OPEN_EXTENDED", Const, 0, ""},
+		{"SYS_OPEN_NOCANCEL", Const, 0, ""},
+		{"SYS_OVADVISE", Const, 0, ""},
+		{"SYS_PACCEPT", Const, 1, ""},
+		{"SYS_PATHCONF", Const, 0, ""},
+		{"SYS_PAUSE", Const, 0, ""},
+		{"SYS_PCICONFIG_IOBASE", Const, 0, ""},
+		{"SYS_PCICONFIG_READ", Const, 0, ""},
+		{"SYS_PCICONFIG_WRITE", Const, 0, ""},
+		{"SYS_PDFORK", Const, 0, ""},
+		{"SYS_PDGETPID", Const, 0, ""},
+		{"SYS_PDKILL", Const, 0, ""},
+		{"SYS_PERF_EVENT_OPEN", Const, 0, ""},
+		{"SYS_PERSONALITY", Const, 0, ""},
+		{"SYS_PID_HIBERNATE", Const, 0, ""},
+		{"SYS_PID_RESUME", Const, 0, ""},
+		{"SYS_PID_SHUTDOWN_SOCKETS", Const, 0, ""},
+		{"SYS_PID_SUSPEND", Const, 0, ""},
+		{"SYS_PIPE", Const, 0, ""},
+		{"SYS_PIPE2", Const, 0, ""},
+		{"SYS_PIVOT_ROOT", Const, 0, ""},
+		{"SYS_PMC_CONTROL", Const, 1, ""},
+		{"SYS_PMC_GET_INFO", Const, 1, ""},
+		{"SYS_POLL", Const, 0, ""},
+		{"SYS_POLLTS", Const, 1, ""},
+		{"SYS_POLL_NOCANCEL", Const, 0, ""},
+		{"SYS_POSIX_FADVISE", Const, 0, ""},
+		{"SYS_POSIX_FALLOCATE", Const, 0, ""},
+		{"SYS_POSIX_OPENPT", Const, 0, ""},
+		{"SYS_POSIX_SPAWN", Const, 0, ""},
+		{"SYS_PPOLL", Const, 0, ""},
+		{"SYS_PRCTL", Const, 0, ""},
+		{"SYS_PREAD", Const, 0, ""},
+		{"SYS_PREAD64", Const, 0, ""},
+		{"SYS_PREADV", Const, 0, ""},
+		{"SYS_PREAD_NOCANCEL", Const, 0, ""},
+		{"SYS_PRLIMIT64", Const, 0, ""},
+		{"SYS_PROCCTL", Const, 3, ""},
+		{"SYS_PROCESS_POLICY", Const, 0, ""},
+		{"SYS_PROCESS_VM_READV", Const, 0, ""},
+		{"SYS_PROCESS_VM_WRITEV", Const, 0, ""},
+		{"SYS_PROC_INFO", Const, 0, ""},
+		{"SYS_PROF", Const, 0, ""},
+		{"SYS_PROFIL", Const, 0, ""},
+		{"SYS_PSELECT", Const, 0, ""},
+		{"SYS_PSELECT6", Const, 0, ""},
+		{"SYS_PSET_ASSIGN", Const, 1, ""},
+		{"SYS_PSET_CREATE", Const, 1, ""},
+		{"SYS_PSET_DESTROY", Const, 1, ""},
+		{"SYS_PSYNCH_CVBROAD", Const, 0, ""},
+		{"SYS_PSYNCH_CVCLRPREPOST", Const, 0, ""},
+		{"SYS_PSYNCH_CVSIGNAL", Const, 0, ""},
+		{"SYS_PSYNCH_CVWAIT", Const, 0, ""},
+		{"SYS_PSYNCH_MUTEXDROP", Const, 0, ""},
+		{"SYS_PSYNCH_MUTEXWAIT", Const, 0, ""},
+		{"SYS_PSYNCH_RW_DOWNGRADE", Const, 0, ""},
+		{"SYS_PSYNCH_RW_LONGRDLOCK", Const, 0, ""},
+		{"SYS_PSYNCH_RW_RDLOCK", Const, 0, ""},
+		{"SYS_PSYNCH_RW_UNLOCK", Const, 0, ""},
+		{"SYS_PSYNCH_RW_UNLOCK2", Const, 0, ""},
+		{"SYS_PSYNCH_RW_UPGRADE", Const, 0, ""},
+		{"SYS_PSYNCH_RW_WRLOCK", Const, 0, ""},
+		{"SYS_PSYNCH_RW_YIELDWRLOCK", Const, 0, ""},
+		{"SYS_PTRACE", Const, 0, ""},
+		{"SYS_PUTPMSG", Const, 0, ""},
+		{"SYS_PWRITE", Const, 0, ""},
+		{"SYS_PWRITE64", Const, 0, ""},
+		{"SYS_PWRITEV", Const, 0, ""},
+		{"SYS_PWRITE_NOCANCEL", Const, 0, ""},
+		{"SYS_QUERY_MODULE", Const, 0, ""},
+		{"SYS_QUOTACTL", Const, 0, ""},
+		{"SYS_RASCTL", Const, 1, ""},
+		{"SYS_RCTL_ADD_RULE", Const, 0, ""},
+		{"SYS_RCTL_GET_LIMITS", Const, 0, ""},
+		{"SYS_RCTL_GET_RACCT", Const, 0, ""},
+		{"SYS_RCTL_GET_RULES", Const, 0, ""},
+		{"SYS_RCTL_REMOVE_RULE", Const, 0, ""},
+		{"SYS_READ", Const, 0, ""},
+		{"SYS_READAHEAD", Const, 0, ""},
+		{"SYS_READDIR", Const, 0, ""},
+		{"SYS_READLINK", Const, 0, ""},
+		{"SYS_READLINKAT", Const, 0, ""},
+		{"SYS_READV", Const, 0, ""},
+		{"SYS_READV_NOCANCEL", Const, 0, ""},
+		{"SYS_READ_NOCANCEL", Const, 0, ""},
+		{"SYS_REBOOT", Const, 0, ""},
+		{"SYS_RECV", Const, 0, ""},
+		{"SYS_RECVFROM", Const, 0, ""},
+		{"SYS_RECVFROM_NOCANCEL", Const, 0, ""},
+		{"SYS_RECVMMSG", Const, 0, ""},
+		{"SYS_RECVMSG", Const, 0, ""},
+		{"SYS_RECVMSG_NOCANCEL", Const, 0, ""},
+		{"SYS_REMAP_FILE_PAGES", Const, 0, ""},
+		{"SYS_REMOVEXATTR", Const, 0, ""},
+		{"SYS_RENAME", Const, 0, ""},
+		{"SYS_RENAMEAT", Const, 0, ""},
+		{"SYS_REQUEST_KEY", Const, 0, ""},
+		{"SYS_RESTART_SYSCALL", Const, 0, ""},
+		{"SYS_REVOKE", Const, 0, ""},
+		{"SYS_RFORK", Const, 0, ""},
+		{"SYS_RMDIR", Const, 0, ""},
+		{"SYS_RTPRIO", Const, 0, ""},
+		{"SYS_RTPRIO_THREAD", Const, 0, ""},
+		{"SYS_RT_SIGACTION", Const, 0, ""},
+		{"SYS_RT_SIGPENDING", Const, 0, ""},
+		{"SYS_RT_SIGPROCMASK", Const, 0, ""},
+		{"SYS_RT_SIGQUEUEINFO", Const, 0, ""},
+		{"SYS_RT_SIGRETURN", Const, 0, ""},
+		{"SYS_RT_SIGSUSPEND", Const, 0, ""},
+		{"SYS_RT_SIGTIMEDWAIT", Const, 0, ""},
+		{"SYS_RT_TGSIGQUEUEINFO", Const, 0, ""},
+		{"SYS_SBRK", Const, 0, ""},
+		{"SYS_SCHED_GETAFFINITY", Const, 0, ""},
+		{"SYS_SCHED_GETPARAM", Const, 0, ""},
+		{"SYS_SCHED_GETSCHEDULER", Const, 0, ""},
+		{"SYS_SCHED_GET_PRIORITY_MAX", Const, 0, ""},
+		{"SYS_SCHED_GET_PRIORITY_MIN", Const, 0, ""},
+		{"SYS_SCHED_RR_GET_INTERVAL", Const, 0, ""},
+		{"SYS_SCHED_SETAFFINITY", Const, 0, ""},
+		{"SYS_SCHED_SETPARAM", Const, 0, ""},
+		{"SYS_SCHED_SETSCHEDULER", Const, 0, ""},
+		{"SYS_SCHED_YIELD", Const, 0, ""},
+		{"SYS_SCTP_GENERIC_RECVMSG", Const, 0, ""},
+		{"SYS_SCTP_GENERIC_SENDMSG", Const, 0, ""},
+		{"SYS_SCTP_GENERIC_SENDMSG_IOV", Const, 0, ""},
+		{"SYS_SCTP_PEELOFF", Const, 0, ""},
+		{"SYS_SEARCHFS", Const, 0, ""},
+		{"SYS_SECURITY", Const, 0, ""},
+		{"SYS_SELECT", Const, 0, ""},
+		{"SYS_SELECT_NOCANCEL", Const, 0, ""},
+		{"SYS_SEMCONFIG", Const, 1, ""},
+		{"SYS_SEMCTL", Const, 0, ""},
+		{"SYS_SEMGET", Const, 0, ""},
+		{"SYS_SEMOP", Const, 0, ""},
+		{"SYS_SEMSYS", Const, 0, ""},
+		{"SYS_SEMTIMEDOP", Const, 0, ""},
+		{"SYS_SEM_CLOSE", Const, 0, ""},
+		{"SYS_SEM_DESTROY", Const, 0, ""},
+		{"SYS_SEM_GETVALUE", Const, 0, ""},
+		{"SYS_SEM_INIT", Const, 0, ""},
+		{"SYS_SEM_OPEN", Const, 0, ""},
+		{"SYS_SEM_POST", Const, 0, ""},
+		{"SYS_SEM_TRYWAIT", Const, 0, ""},
+		{"SYS_SEM_UNLINK", Const, 0, ""},
+		{"SYS_SEM_WAIT", Const, 0, ""},
+		{"SYS_SEM_WAIT_NOCANCEL", Const, 0, ""},
+		{"SYS_SEND", Const, 0, ""},
+		{"SYS_SENDFILE", Const, 0, ""},
+		{"SYS_SENDFILE64", Const, 0, ""},
+		{"SYS_SENDMMSG", Const, 0, ""},
+		{"SYS_SENDMSG", Const, 0, ""},
+		{"SYS_SENDMSG_NOCANCEL", Const, 0, ""},
+		{"SYS_SENDTO", Const, 0, ""},
+		{"SYS_SENDTO_NOCANCEL", Const, 0, ""},
+		{"SYS_SETATTRLIST", Const, 0, ""},
+		{"SYS_SETAUDIT", Const, 0, ""},
+		{"SYS_SETAUDIT_ADDR", Const, 0, ""},
+		{"SYS_SETAUID", Const, 0, ""},
+		{"SYS_SETCONTEXT", Const, 0, ""},
+		{"SYS_SETDOMAINNAME", Const, 0, ""},
+		{"SYS_SETEGID", Const, 0, ""},
+		{"SYS_SETEUID", Const, 0, ""},
+		{"SYS_SETFIB", Const, 0, ""},
+		{"SYS_SETFSGID", Const, 0, ""},
+		{"SYS_SETFSGID32", Const, 0, ""},
+		{"SYS_SETFSUID", Const, 0, ""},
+		{"SYS_SETFSUID32", Const, 0, ""},
+		{"SYS_SETGID", Const, 0, ""},
+		{"SYS_SETGID32", Const, 0, ""},
+		{"SYS_SETGROUPS", Const, 0, ""},
+		{"SYS_SETGROUPS32", Const, 0, ""},
+		{"SYS_SETHOSTNAME", Const, 0, ""},
+		{"SYS_SETITIMER", Const, 0, ""},
+		{"SYS_SETLCID", Const, 0, ""},
+		{"SYS_SETLOGIN", Const, 0, ""},
+		{"SYS_SETLOGINCLASS", Const, 0, ""},
+		{"SYS_SETNS", Const, 0, ""},
+		{"SYS_SETPGID", Const, 0, ""},
+		{"SYS_SETPRIORITY", Const, 0, ""},
+		{"SYS_SETPRIVEXEC", Const, 0, ""},
+		{"SYS_SETREGID", Const, 0, ""},
+		{"SYS_SETREGID32", Const, 0, ""},
+		{"SYS_SETRESGID", Const, 0, ""},
+		{"SYS_SETRESGID32", Const, 0, ""},
+		{"SYS_SETRESUID", Const, 0, ""},
+		{"SYS_SETRESUID32", Const, 0, ""},
+		{"SYS_SETREUID", Const, 0, ""},
+		{"SYS_SETREUID32", Const, 0, ""},
+		{"SYS_SETRLIMIT", Const, 0, ""},
+		{"SYS_SETRTABLE", Const, 1, ""},
+		{"SYS_SETSGROUPS", Const, 0, ""},
+		{"SYS_SETSID", Const, 0, ""},
+		{"SYS_SETSOCKOPT", Const, 0, ""},
+		{"SYS_SETTID", Const, 0, ""},
+		{"SYS_SETTID_WITH_PID", Const, 0, ""},
+		{"SYS_SETTIMEOFDAY", Const, 0, ""},
+		{"SYS_SETUID", Const, 0, ""},
+		{"SYS_SETUID32", Const, 0, ""},
+		{"SYS_SETWGROUPS", Const, 0, ""},
+		{"SYS_SETXATTR", Const, 0, ""},
+		{"SYS_SET_MEMPOLICY", Const, 0, ""},
+		{"SYS_SET_ROBUST_LIST", Const, 0, ""},
+		{"SYS_SET_THREAD_AREA", Const, 0, ""},
+		{"SYS_SET_TID_ADDRESS", Const, 0, ""},
+		{"SYS_SGETMASK", Const, 0, ""},
+		{"SYS_SHARED_REGION_CHECK_NP", Const, 0, ""},
+		{"SYS_SHARED_REGION_MAP_AND_SLIDE_NP", Const, 0, ""},
+		{"SYS_SHMAT", Const, 0, ""},
+		{"SYS_SHMCTL", Const, 0, ""},
+		{"SYS_SHMDT", Const, 0, ""},
+		{"SYS_SHMGET", Const, 0, ""},
+		{"SYS_SHMSYS", Const, 0, ""},
+		{"SYS_SHM_OPEN", Const, 0, ""},
+		{"SYS_SHM_UNLINK", Const, 0, ""},
+		{"SYS_SHUTDOWN", Const, 0, ""},
+		{"SYS_SIGACTION", Const, 0, ""},
+		{"SYS_SIGALTSTACK", Const, 0, ""},
+		{"SYS_SIGNAL", Const, 0, ""},
+		{"SYS_SIGNALFD", Const, 0, ""},
+		{"SYS_SIGNALFD4", Const, 0, ""},
+		{"SYS_SIGPENDING", Const, 0, ""},
+		{"SYS_SIGPROCMASK", Const, 0, ""},
+		{"SYS_SIGQUEUE", Const, 0, ""},
+		{"SYS_SIGQUEUEINFO", Const, 1, ""},
+		{"SYS_SIGRETURN", Const, 0, ""},
+		{"SYS_SIGSUSPEND", Const, 0, ""},
+		{"SYS_SIGSUSPEND_NOCANCEL", Const, 0, ""},
+		{"SYS_SIGTIMEDWAIT", Const, 0, ""},
+		{"SYS_SIGWAIT", Const, 0, ""},
+		{"SYS_SIGWAITINFO", Const, 0, ""},
+		{"SYS_SOCKET", Const, 0, ""},
+		{"SYS_SOCKETCALL", Const, 0, ""},
+		{"SYS_SOCKETPAIR", Const, 0, ""},
+		{"SYS_SPLICE", Const, 0, ""},
+		{"SYS_SSETMASK", Const, 0, ""},
+		{"SYS_SSTK", Const, 0, ""},
+		{"SYS_STACK_SNAPSHOT", Const, 0, ""},
+		{"SYS_STAT", Const, 0, ""},
+		{"SYS_STAT64", Const, 0, ""},
+		{"SYS_STAT64_EXTENDED", Const, 0, ""},
+		{"SYS_STATFS", Const, 0, ""},
+		{"SYS_STATFS64", Const, 0, ""},
+		{"SYS_STATV", Const, 0, ""},
+		{"SYS_STATVFS1", Const, 1, ""},
+		{"SYS_STAT_EXTENDED", Const, 0, ""},
+		{"SYS_STIME", Const, 0, ""},
+		{"SYS_STTY", Const, 0, ""},
+		{"SYS_SWAPCONTEXT", Const, 0, ""},
+		{"SYS_SWAPCTL", Const, 1, ""},
+		{"SYS_SWAPOFF", Const, 0, ""},
+		{"SYS_SWAPON", Const, 0, ""},
+		{"SYS_SYMLINK", Const, 0, ""},
+		{"SYS_SYMLINKAT", Const, 0, ""},
+		{"SYS_SYNC", Const, 0, ""},
+		{"SYS_SYNCFS", Const, 0, ""},
+		{"SYS_SYNC_FILE_RANGE", Const, 0, ""},
+		{"SYS_SYSARCH", Const, 0, ""},
+		{"SYS_SYSCALL", Const, 0, ""},
+		{"SYS_SYSCALL_BASE", Const, 0, ""},
+		{"SYS_SYSFS", Const, 0, ""},
+		{"SYS_SYSINFO", Const, 0, ""},
+		{"SYS_SYSLOG", Const, 0, ""},
+		{"SYS_TEE", Const, 0, ""},
+		{"SYS_TGKILL", Const, 0, ""},
+		{"SYS_THREAD_SELFID", Const, 0, ""},
+		{"SYS_THR_CREATE", Const, 0, ""},
+		{"SYS_THR_EXIT", Const, 0, ""},
+		{"SYS_THR_KILL", Const, 0, ""},
+		{"SYS_THR_KILL2", Const, 0, ""},
+		{"SYS_THR_NEW", Const, 0, ""},
+		{"SYS_THR_SELF", Const, 0, ""},
+		{"SYS_THR_SET_NAME", Const, 0, ""},
+		{"SYS_THR_SUSPEND", Const, 0, ""},
+		{"SYS_THR_WAKE", Const, 0, ""},
+		{"SYS_TIME", Const, 0, ""},
+		{"SYS_TIMERFD_CREATE", Const, 0, ""},
+		{"SYS_TIMERFD_GETTIME", Const, 0, ""},
+		{"SYS_TIMERFD_SETTIME", Const, 0, ""},
+		{"SYS_TIMER_CREATE", Const, 0, ""},
+		{"SYS_TIMER_DELETE", Const, 0, ""},
+		{"SYS_TIMER_GETOVERRUN", Const, 0, ""},
+		{"SYS_TIMER_GETTIME", Const, 0, ""},
+		{"SYS_TIMER_SETTIME", Const, 0, ""},
+		{"SYS_TIMES", Const, 0, ""},
+		{"SYS_TKILL", Const, 0, ""},
+		{"SYS_TRUNCATE", Const, 0, ""},
+		{"SYS_TRUNCATE64", Const, 0, ""},
+		{"SYS_TUXCALL", Const, 0, ""},
+		{"SYS_UGETRLIMIT", Const, 0, ""},
+		{"SYS_ULIMIT", Const, 0, ""},
+		{"SYS_UMASK", Const, 0, ""},
+		{"SYS_UMASK_EXTENDED", Const, 0, ""},
+		{"SYS_UMOUNT", Const, 0, ""},
+		{"SYS_UMOUNT2", Const, 0, ""},
+		{"SYS_UNAME", Const, 0, ""},
+		{"SYS_UNDELETE", Const, 0, ""},
+		{"SYS_UNLINK", Const, 0, ""},
+		{"SYS_UNLINKAT", Const, 0, ""},
+		{"SYS_UNMOUNT", Const, 0, ""},
+		{"SYS_UNSHARE", Const, 0, ""},
+		{"SYS_USELIB", Const, 0, ""},
+		{"SYS_USTAT", Const, 0, ""},
+		{"SYS_UTIME", Const, 0, ""},
+		{"SYS_UTIMENSAT", Const, 0, ""},
+		{"SYS_UTIMES", Const, 0, ""},
+		{"SYS_UTRACE", Const, 0, ""},
+		{"SYS_UUIDGEN", Const, 0, ""},
+		{"SYS_VADVISE", Const, 1, ""},
+		{"SYS_VFORK", Const, 0, ""},
+		{"SYS_VHANGUP", Const, 0, ""},
+		{"SYS_VM86", Const, 0, ""},
+		{"SYS_VM86OLD", Const, 0, ""},
+		{"SYS_VMSPLICE", Const, 0, ""},
+		{"SYS_VM_PRESSURE_MONITOR", Const, 0, ""},
+		{"SYS_VSERVER", Const, 0, ""},
+		{"SYS_WAIT4", Const, 0, ""},
+		{"SYS_WAIT4_NOCANCEL", Const, 0, ""},
+		{"SYS_WAIT6", Const, 1, ""},
+		{"SYS_WAITEVENT", Const, 0, ""},
+		{"SYS_WAITID", Const, 0, ""},
+		{"SYS_WAITID_NOCANCEL", Const, 0, ""},
+		{"SYS_WAITPID", Const, 0, ""},
+		{"SYS_WATCHEVENT", Const, 0, ""},
+		{"SYS_WORKQ_KERNRETURN", Const, 0, ""},
+		{"SYS_WORKQ_OPEN", Const, 0, ""},
+		{"SYS_WRITE", Const, 0, ""},
+		{"SYS_WRITEV", Const, 0, ""},
+		{"SYS_WRITEV_NOCANCEL", Const, 0, ""},
+		{"SYS_WRITE_NOCANCEL", Const, 0, ""},
+		{"SYS_YIELD", Const, 0, ""},
+		{"SYS__LLSEEK", Const, 0, ""},
+		{"SYS__LWP_CONTINUE", Const, 1, ""},
+		{"SYS__LWP_CREATE", Const, 1, ""},
+		{"SYS__LWP_CTL", Const, 1, ""},
+		{"SYS__LWP_DETACH", Const, 1, ""},
+		{"SYS__LWP_EXIT", Const, 1, ""},
+		{"SYS__LWP_GETNAME", Const, 1, ""},
+		{"SYS__LWP_GETPRIVATE", Const, 1, ""},
+		{"SYS__LWP_KILL", Const, 1, ""},
+		{"SYS__LWP_PARK", Const, 1, ""},
+		{"SYS__LWP_SELF", Const, 1, ""},
+		{"SYS__LWP_SETNAME", Const, 1, ""},
+		{"SYS__LWP_SETPRIVATE", Const, 1, ""},
+		{"SYS__LWP_SUSPEND", Const, 1, ""},
+		{"SYS__LWP_UNPARK", Const, 1, ""},
+		{"SYS__LWP_UNPARK_ALL", Const, 1, ""},
+		{"SYS__LWP_WAIT", Const, 1, ""},
+		{"SYS__LWP_WAKEUP", Const, 1, ""},
+		{"SYS__NEWSELECT", Const, 0, ""},
+		{"SYS__PSET_BIND", Const, 1, ""},
+		{"SYS__SCHED_GETAFFINITY", Const, 1, ""},
+		{"SYS__SCHED_GETPARAM", Const, 1, ""},
+		{"SYS__SCHED_SETAFFINITY", Const, 1, ""},
+		{"SYS__SCHED_SETPARAM", Const, 1, ""},
+		{"SYS__SYSCTL", Const, 0, ""},
+		{"SYS__UMTX_LOCK", Const, 0, ""},
+		{"SYS__UMTX_OP", Const, 0, ""},
+		{"SYS__UMTX_UNLOCK", Const, 0, ""},
+		{"SYS___ACL_ACLCHECK_FD", Const, 0, ""},
+		{"SYS___ACL_ACLCHECK_FILE", Const, 0, ""},
+		{"SYS___ACL_ACLCHECK_LINK", Const, 0, ""},
+		{"SYS___ACL_DELETE_FD", Const, 0, ""},
+		{"SYS___ACL_DELETE_FILE", Const, 0, ""},
+		{"SYS___ACL_DELETE_LINK", Const, 0, ""},
+		{"SYS___ACL_GET_FD", Const, 0, ""},
+		{"SYS___ACL_GET_FILE", Const, 0, ""},
+		{"SYS___ACL_GET_LINK", Const, 0, ""},
+		{"SYS___ACL_SET_FD", Const, 0, ""},
+		{"SYS___ACL_SET_FILE", Const, 0, ""},
+		{"SYS___ACL_SET_LINK", Const, 0, ""},
+		{"SYS___CAP_RIGHTS_GET", Const, 14, ""},
+		{"SYS___CLONE", Const, 1, ""},
+		{"SYS___DISABLE_THREADSIGNAL", Const, 0, ""},
+		{"SYS___GETCWD", Const, 0, ""},
+		{"SYS___GETLOGIN", Const, 1, ""},
+		{"SYS___GET_TCB", Const, 1, ""},
+		{"SYS___MAC_EXECVE", Const, 0, ""},
+		{"SYS___MAC_GETFSSTAT", Const, 0, ""},
+		{"SYS___MAC_GET_FD", Const, 0, ""},
+		{"SYS___MAC_GET_FILE", Const, 0, ""},
+		{"SYS___MAC_GET_LCID", Const, 0, ""},
+		{"SYS___MAC_GET_LCTX", Const, 0, ""},
+		{"SYS___MAC_GET_LINK", Const, 0, ""},
+		{"SYS___MAC_GET_MOUNT", Const, 0, ""},
+		{"SYS___MAC_GET_PID", Const, 0, ""},
+		{"SYS___MAC_GET_PROC", Const, 0, ""},
+		{"SYS___MAC_MOUNT", Const, 0, ""},
+		{"SYS___MAC_SET_FD", Const, 0, ""},
+		{"SYS___MAC_SET_FILE", Const, 0, ""},
+		{"SYS___MAC_SET_LCTX", Const, 0, ""},
+		{"SYS___MAC_SET_LINK", Const, 0, ""},
+		{"SYS___MAC_SET_PROC", Const, 0, ""},
+		{"SYS___MAC_SYSCALL", Const, 0, ""},
+		{"SYS___OLD_SEMWAIT_SIGNAL", Const, 0, ""},
+		{"SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL", Const, 0, ""},
+		{"SYS___POSIX_CHOWN", Const, 1, ""},
+		{"SYS___POSIX_FCHOWN", Const, 1, ""},
+		{"SYS___POSIX_LCHOWN", Const, 1, ""},
+		{"SYS___POSIX_RENAME", Const, 1, ""},
+		{"SYS___PTHREAD_CANCELED", Const, 0, ""},
+		{"SYS___PTHREAD_CHDIR", Const, 0, ""},
+		{"SYS___PTHREAD_FCHDIR", Const, 0, ""},
+		{"SYS___PTHREAD_KILL", Const, 0, ""},
+		{"SYS___PTHREAD_MARKCANCEL", Const, 0, ""},
+		{"SYS___PTHREAD_SIGMASK", Const, 0, ""},
+		{"SYS___QUOTACTL", Const, 1, ""},
+		{"SYS___SEMCTL", Const, 1, ""},
+		{"SYS___SEMWAIT_SIGNAL", Const, 0, ""},
+		{"SYS___SEMWAIT_SIGNAL_NOCANCEL", Const, 0, ""},
+		{"SYS___SETLOGIN", Const, 1, ""},
+		{"SYS___SETUGID", Const, 0, ""},
+		{"SYS___SET_TCB", Const, 1, ""},
+		{"SYS___SIGACTION_SIGTRAMP", Const, 1, ""},
+		{"SYS___SIGTIMEDWAIT", Const, 1, ""},
+		{"SYS___SIGWAIT", Const, 0, ""},
+		{"SYS___SIGWAIT_NOCANCEL", Const, 0, ""},
+		{"SYS___SYSCTL", Const, 0, ""},
+		{"SYS___TFORK", Const, 1, ""},
+		{"SYS___THREXIT", Const, 1, ""},
+		{"SYS___THRSIGDIVERT", Const, 1, ""},
+		{"SYS___THRSLEEP", Const, 1, ""},
+		{"SYS___THRWAKEUP", Const, 1, ""},
+		{"S_ARCH1", Const, 1, ""},
+		{"S_ARCH2", Const, 1, ""},
+		{"S_BLKSIZE", Const, 0, ""},
+		{"S_IEXEC", Const, 0, ""},
+		{"S_IFBLK", Const, 0, ""},
+		{"S_IFCHR", Const, 0, ""},
+		{"S_IFDIR", Const, 0, ""},
+		{"S_IFIFO", Const, 0, ""},
+		{"S_IFLNK", Const, 0, ""},
+		{"S_IFMT", Const, 0, ""},
+		{"S_IFREG", Const, 0, ""},
+		{"S_IFSOCK", Const, 0, ""},
+		{"S_IFWHT", Const, 0, ""},
+		{"S_IREAD", Const, 0, ""},
+		{"S_IRGRP", Const, 0, ""},
+		{"S_IROTH", Const, 0, ""},
+		{"S_IRUSR", Const, 0, ""},
+		{"S_IRWXG", Const, 0, ""},
+		{"S_IRWXO", Const, 0, ""},
+		{"S_IRWXU", Const, 0, ""},
+		{"S_ISGID", Const, 0, ""},
+		{"S_ISTXT", Const, 0, ""},
+		{"S_ISUID", Const, 0, ""},
+		{"S_ISVTX", Const, 0, ""},
+		{"S_IWGRP", Const, 0, ""},
+		{"S_IWOTH", Const, 0, ""},
+		{"S_IWRITE", Const, 0, ""},
+		{"S_IWUSR", Const, 0, ""},
+		{"S_IXGRP", Const, 0, ""},
+		{"S_IXOTH", Const, 0, ""},
+		{"S_IXUSR", Const, 0, ""},
+		{"S_LOGIN_SET", Const, 1, ""},
+		{"SecurityAttributes", Type, 0, ""},
+		{"SecurityAttributes.InheritHandle", Field, 0, ""},
+		{"SecurityAttributes.Length", Field, 0, ""},
+		{"SecurityAttributes.SecurityDescriptor", Field, 0, ""},
+		{"Seek", Func, 0, "func(fd int, offset int64, whence int) (off int64, err error)"},
+		{"Select", Func, 0, "func(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)"},
+		{"Sendfile", Func, 0, "func(outfd int, infd int, offset *int64, count int) (written int, err error)"},
+		{"Sendmsg", Func, 0, "func(fd int, p []byte, oob []byte, to Sockaddr, flags int) (err error)"},
+		{"SendmsgN", Func, 3, "func(fd int, p []byte, oob []byte, to Sockaddr, flags int) (n int, err error)"},
+		{"Sendto", Func, 0, "func(fd int, p []byte, flags int, to Sockaddr) (err error)"},
+		{"Servent", Type, 0, ""},
+		{"Servent.Aliases", Field, 0, ""},
+		{"Servent.Name", Field, 0, ""},
+		{"Servent.Port", Field, 0, ""},
+		{"Servent.Proto", Field, 0, ""},
+		{"SetBpf", Func, 0, ""},
+		{"SetBpfBuflen", Func, 0, ""},
+		{"SetBpfDatalink", Func, 0, ""},
+		{"SetBpfHeadercmpl", Func, 0, ""},
+		{"SetBpfImmediate", Func, 0, ""},
+		{"SetBpfInterface", Func, 0, ""},
+		{"SetBpfPromisc", Func, 0, ""},
+		{"SetBpfTimeout", Func, 0, ""},
+		{"SetCurrentDirectory", Func, 0, ""},
+		{"SetEndOfFile", Func, 0, ""},
+		{"SetEnvironmentVariable", Func, 0, ""},
+		{"SetFileAttributes", Func, 0, ""},
+		{"SetFileCompletionNotificationModes", Func, 2, ""},
+		{"SetFilePointer", Func, 0, ""},
+		{"SetFileTime", Func, 0, ""},
+		{"SetHandleInformation", Func, 0, ""},
+		{"SetKevent", Func, 0, ""},
+		{"SetLsfPromisc", Func, 0, "func(name string, m bool) error"},
+		{"SetNonblock", Func, 0, "func(fd int, nonblocking bool) (err error)"},
+		{"Setdomainname", Func, 0, "func(p []byte) (err error)"},
+		{"Setegid", Func, 0, "func(egid int) (err error)"},
+		{"Setenv", Func, 0, "func(key string, value string) error"},
+		{"Seteuid", Func, 0, "func(euid int) (err error)"},
+		{"Setfsgid", Func, 0, "func(gid int) (err error)"},
+		{"Setfsuid", Func, 0, "func(uid int) (err error)"},
+		{"Setgid", Func, 0, "func(gid int) (err error)"},
+		{"Setgroups", Func, 0, "func(gids []int) (err error)"},
+		{"Sethostname", Func, 0, "func(p []byte) (err error)"},
+		{"Setlogin", Func, 0, ""},
+		{"Setpgid", Func, 0, "func(pid int, pgid int) (err error)"},
+		{"Setpriority", Func, 0, "func(which int, who int, prio int) (err error)"},
+		{"Setprivexec", Func, 0, ""},
+		{"Setregid", Func, 0, "func(rgid int, egid int) (err error)"},
+		{"Setresgid", Func, 0, "func(rgid int, egid int, sgid int) (err error)"},
+		{"Setresuid", Func, 0, "func(ruid int, euid int, suid int) (err error)"},
+		{"Setreuid", Func, 0, "func(ruid int, euid int) (err error)"},
+		{"Setrlimit", Func, 0, "func(resource int, rlim *Rlimit) error"},
+		{"Setsid", Func, 0, "func() (pid int, err error)"},
+		{"Setsockopt", Func, 0, ""},
+		{"SetsockoptByte", Func, 0, "func(fd int, level int, opt int, value byte) (err error)"},
+		{"SetsockoptICMPv6Filter", Func, 2, "func(fd int, level int, opt int, filter *ICMPv6Filter) error"},
+		{"SetsockoptIPMreq", Func, 0, "func(fd int, level int, opt int, mreq *IPMreq) (err error)"},
+		{"SetsockoptIPMreqn", Func, 0, "func(fd int, level int, opt int, mreq *IPMreqn) (err error)"},
+		{"SetsockoptIPv6Mreq", Func, 0, "func(fd int, level int, opt int, mreq *IPv6Mreq) (err error)"},
+		{"SetsockoptInet4Addr", Func, 0, "func(fd int, level int, opt int, value [4]byte) (err error)"},
+		{"SetsockoptInt", Func, 0, "func(fd int, level int, opt int, value int) (err error)"},
+		{"SetsockoptLinger", Func, 0, "func(fd int, level int, opt int, l *Linger) (err error)"},
+		{"SetsockoptString", Func, 0, "func(fd int, level int, opt int, s string) (err error)"},
+		{"SetsockoptTimeval", Func, 0, "func(fd int, level int, opt int, tv *Timeval) (err error)"},
+		{"Settimeofday", Func, 0, "func(tv *Timeval) (err error)"},
+		{"Setuid", Func, 0, "func(uid int) (err error)"},
+		{"Setxattr", Func, 1, "func(path string, attr string, data []byte, flags int) (err error)"},
+		{"Shutdown", Func, 0, "func(fd int, how int) (err error)"},
+		{"SidTypeAlias", Const, 0, ""},
+		{"SidTypeComputer", Const, 0, ""},
+		{"SidTypeDeletedAccount", Const, 0, ""},
+		{"SidTypeDomain", Const, 0, ""},
+		{"SidTypeGroup", Const, 0, ""},
+		{"SidTypeInvalid", Const, 0, ""},
+		{"SidTypeLabel", Const, 0, ""},
+		{"SidTypeUnknown", Const, 0, ""},
+		{"SidTypeUser", Const, 0, ""},
+		{"SidTypeWellKnownGroup", Const, 0, ""},
+		{"Signal", Type, 0, ""},
+		{"SizeofBpfHdr", Const, 0, ""},
+		{"SizeofBpfInsn", Const, 0, ""},
+		{"SizeofBpfProgram", Const, 0, ""},
+		{"SizeofBpfStat", Const, 0, ""},
+		{"SizeofBpfVersion", Const, 0, ""},
+		{"SizeofBpfZbuf", Const, 0, ""},
+		{"SizeofBpfZbufHeader", Const, 0, ""},
+		{"SizeofCmsghdr", Const, 0, ""},
+		{"SizeofICMPv6Filter", Const, 2, ""},
+		{"SizeofIPMreq", Const, 0, ""},
+		{"SizeofIPMreqn", Const, 0, ""},
+		{"SizeofIPv6MTUInfo", Const, 2, ""},
+		{"SizeofIPv6Mreq", Const, 0, ""},
+		{"SizeofIfAddrmsg", Const, 0, ""},
+		{"SizeofIfAnnounceMsghdr", Const, 1, ""},
+		{"SizeofIfData", Const, 0, ""},
+		{"SizeofIfInfomsg", Const, 0, ""},
+		{"SizeofIfMsghdr", Const, 0, ""},
+		{"SizeofIfaMsghdr", Const, 0, ""},
+		{"SizeofIfmaMsghdr", Const, 0, ""},
+		{"SizeofIfmaMsghdr2", Const, 0, ""},
+		{"SizeofInet4Pktinfo", Const, 0, ""},
+		{"SizeofInet6Pktinfo", Const, 0, ""},
+		{"SizeofInotifyEvent", Const, 0, ""},
+		{"SizeofLinger", Const, 0, ""},
+		{"SizeofMsghdr", Const, 0, ""},
+		{"SizeofNlAttr", Const, 0, ""},
+		{"SizeofNlMsgerr", Const, 0, ""},
+		{"SizeofNlMsghdr", Const, 0, ""},
+		{"SizeofRtAttr", Const, 0, ""},
+		{"SizeofRtGenmsg", Const, 0, ""},
+		{"SizeofRtMetrics", Const, 0, ""},
+		{"SizeofRtMsg", Const, 0, ""},
+		{"SizeofRtMsghdr", Const, 0, ""},
+		{"SizeofRtNexthop", Const, 0, ""},
+		{"SizeofSockFilter", Const, 0, ""},
+		{"SizeofSockFprog", Const, 0, ""},
+		{"SizeofSockaddrAny", Const, 0, ""},
+		{"SizeofSockaddrDatalink", Const, 0, ""},
+		{"SizeofSockaddrInet4", Const, 0, ""},
+		{"SizeofSockaddrInet6", Const, 0, ""},
+		{"SizeofSockaddrLinklayer", Const, 0, ""},
+		{"SizeofSockaddrNetlink", Const, 0, ""},
+		{"SizeofSockaddrUnix", Const, 0, ""},
+		{"SizeofTCPInfo", Const, 1, ""},
+		{"SizeofUcred", Const, 0, ""},
+		{"SlicePtrFromStrings", Func, 1, "func(ss []string) ([]*byte, error)"},
+		{"SockFilter", Type, 0, ""},
+		{"SockFilter.Code", Field, 0, ""},
+		{"SockFilter.Jf", Field, 0, ""},
+		{"SockFilter.Jt", Field, 0, ""},
+		{"SockFilter.K", Field, 0, ""},
+		{"SockFprog", Type, 0, ""},
+		{"SockFprog.Filter", Field, 0, ""},
+		{"SockFprog.Len", Field, 0, ""},
+		{"SockFprog.Pad_cgo_0", Field, 0, ""},
+		{"Sockaddr", Type, 0, ""},
+		{"SockaddrDatalink", Type, 0, ""},
+		{"SockaddrDatalink.Alen", Field, 0, ""},
+		{"SockaddrDatalink.Data", Field, 0, ""},
+		{"SockaddrDatalink.Family", Field, 0, ""},
+		{"SockaddrDatalink.Index", Field, 0, ""},
+		{"SockaddrDatalink.Len", Field, 0, ""},
+		{"SockaddrDatalink.Nlen", Field, 0, ""},
+		{"SockaddrDatalink.Slen", Field, 0, ""},
+		{"SockaddrDatalink.Type", Field, 0, ""},
+		{"SockaddrGen", Type, 0, ""},
+		{"SockaddrInet4", Type, 0, ""},
+		{"SockaddrInet4.Addr", Field, 0, ""},
+		{"SockaddrInet4.Port", Field, 0, ""},
+		{"SockaddrInet6", Type, 0, ""},
+		{"SockaddrInet6.Addr", Field, 0, ""},
+		{"SockaddrInet6.Port", Field, 0, ""},
+		{"SockaddrInet6.ZoneId", Field, 0, ""},
+		{"SockaddrLinklayer", Type, 0, ""},
+		{"SockaddrLinklayer.Addr", Field, 0, ""},
+		{"SockaddrLinklayer.Halen", Field, 0, ""},
+		{"SockaddrLinklayer.Hatype", Field, 0, ""},
+		{"SockaddrLinklayer.Ifindex", Field, 0, ""},
+		{"SockaddrLinklayer.Pkttype", Field, 0, ""},
+		{"SockaddrLinklayer.Protocol", Field, 0, ""},
+		{"SockaddrNetlink", Type, 0, ""},
+		{"SockaddrNetlink.Family", Field, 0, ""},
+		{"SockaddrNetlink.Groups", Field, 0, ""},
+		{"SockaddrNetlink.Pad", Field, 0, ""},
+		{"SockaddrNetlink.Pid", Field, 0, ""},
+		{"SockaddrUnix", Type, 0, ""},
+		{"SockaddrUnix.Name", Field, 0, ""},
+		{"Socket", Func, 0, "func(domain int, typ int, proto int) (fd int, err error)"},
+		{"SocketControlMessage", Type, 0, ""},
+		{"SocketControlMessage.Data", Field, 0, ""},
+		{"SocketControlMessage.Header", Field, 0, ""},
+		{"SocketDisableIPv6", Var, 0, ""},
+		{"Socketpair", Func, 0, "func(domain int, typ int, proto int) (fd [2]int, err error)"},
+		{"Splice", Func, 0, "func(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)"},
+		{"StartProcess", Func, 0, "func(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error)"},
+		{"StartupInfo", Type, 0, ""},
+		{"StartupInfo.Cb", Field, 0, ""},
+		{"StartupInfo.Desktop", Field, 0, ""},
+		{"StartupInfo.FillAttribute", Field, 0, ""},
+		{"StartupInfo.Flags", Field, 0, ""},
+		{"StartupInfo.ShowWindow", Field, 0, ""},
+		{"StartupInfo.StdErr", Field, 0, ""},
+		{"StartupInfo.StdInput", Field, 0, ""},
+		{"StartupInfo.StdOutput", Field, 0, ""},
+		{"StartupInfo.Title", Field, 0, ""},
+		{"StartupInfo.X", Field, 0, ""},
+		{"StartupInfo.XCountChars", Field, 0, ""},
+		{"StartupInfo.XSize", Field, 0, ""},
+		{"StartupInfo.Y", Field, 0, ""},
+		{"StartupInfo.YCountChars", Field, 0, ""},
+		{"StartupInfo.YSize", Field, 0, ""},
+		{"Stat", Func, 0, "func(path string, stat *Stat_t) (err error)"},
+		{"Stat_t", Type, 0, ""},
+		{"Stat_t.Atim", Field, 0, ""},
+		{"Stat_t.Atim_ext", Field, 12, ""},
+		{"Stat_t.Atimespec", Field, 0, ""},
+		{"Stat_t.Birthtimespec", Field, 0, ""},
+		{"Stat_t.Blksize", Field, 0, ""},
+		{"Stat_t.Blocks", Field, 0, ""},
+		{"Stat_t.Btim_ext", Field, 12, ""},
+		{"Stat_t.Ctim", Field, 0, ""},
+		{"Stat_t.Ctim_ext", Field, 12, ""},
+		{"Stat_t.Ctimespec", Field, 0, ""},
+		{"Stat_t.Dev", Field, 0, ""},
+		{"Stat_t.Flags", Field, 0, ""},
+		{"Stat_t.Gen", Field, 0, ""},
+		{"Stat_t.Gid", Field, 0, ""},
+		{"Stat_t.Ino", Field, 0, ""},
+		{"Stat_t.Lspare", Field, 0, ""},
+		{"Stat_t.Lspare0", Field, 2, ""},
+		{"Stat_t.Lspare1", Field, 2, ""},
+		{"Stat_t.Mode", Field, 0, ""},
+		{"Stat_t.Mtim", Field, 0, ""},
+		{"Stat_t.Mtim_ext", Field, 12, ""},
+		{"Stat_t.Mtimespec", Field, 0, ""},
+		{"Stat_t.Nlink", Field, 0, ""},
+		{"Stat_t.Pad_cgo_0", Field, 0, ""},
+		{"Stat_t.Pad_cgo_1", Field, 0, ""},
+		{"Stat_t.Pad_cgo_2", Field, 0, ""},
+		{"Stat_t.Padding0", Field, 12, ""},
+		{"Stat_t.Padding1", Field, 12, ""},
+		{"Stat_t.Qspare", Field, 0, ""},
+		{"Stat_t.Rdev", Field, 0, ""},
+		{"Stat_t.Size", Field, 0, ""},
+		{"Stat_t.Spare", Field, 2, ""},
+		{"Stat_t.Uid", Field, 0, ""},
+		{"Stat_t.X__pad0", Field, 0, ""},
+		{"Stat_t.X__pad1", Field, 0, ""},
+		{"Stat_t.X__pad2", Field, 0, ""},
+		{"Stat_t.X__st_birthtim", Field, 2, ""},
+		{"Stat_t.X__st_ino", Field, 0, ""},
+		{"Stat_t.X__unused", Field, 0, ""},
+		{"Statfs", Func, 0, "func(path string, buf *Statfs_t) (err error)"},
+		{"Statfs_t", Type, 0, ""},
+		{"Statfs_t.Asyncreads", Field, 0, ""},
+		{"Statfs_t.Asyncwrites", Field, 0, ""},
+		{"Statfs_t.Bavail", Field, 0, ""},
+		{"Statfs_t.Bfree", Field, 0, ""},
+		{"Statfs_t.Blocks", Field, 0, ""},
+		{"Statfs_t.Bsize", Field, 0, ""},
+		{"Statfs_t.Charspare", Field, 0, ""},
+		{"Statfs_t.F_asyncreads", Field, 2, ""},
+		{"Statfs_t.F_asyncwrites", Field, 2, ""},
+		{"Statfs_t.F_bavail", Field, 2, ""},
+		{"Statfs_t.F_bfree", Field, 2, ""},
+		{"Statfs_t.F_blocks", Field, 2, ""},
+		{"Statfs_t.F_bsize", Field, 2, ""},
+		{"Statfs_t.F_ctime", Field, 2, ""},
+		{"Statfs_t.F_favail", Field, 2, ""},
+		{"Statfs_t.F_ffree", Field, 2, ""},
+		{"Statfs_t.F_files", Field, 2, ""},
+		{"Statfs_t.F_flags", Field, 2, ""},
+		{"Statfs_t.F_fsid", Field, 2, ""},
+		{"Statfs_t.F_fstypename", Field, 2, ""},
+		{"Statfs_t.F_iosize", Field, 2, ""},
+		{"Statfs_t.F_mntfromname", Field, 2, ""},
+		{"Statfs_t.F_mntfromspec", Field, 3, ""},
+		{"Statfs_t.F_mntonname", Field, 2, ""},
+		{"Statfs_t.F_namemax", Field, 2, ""},
+		{"Statfs_t.F_owner", Field, 2, ""},
+		{"Statfs_t.F_spare", Field, 2, ""},
+		{"Statfs_t.F_syncreads", Field, 2, ""},
+		{"Statfs_t.F_syncwrites", Field, 2, ""},
+		{"Statfs_t.Ffree", Field, 0, ""},
+		{"Statfs_t.Files", Field, 0, ""},
+		{"Statfs_t.Flags", Field, 0, ""},
+		{"Statfs_t.Frsize", Field, 0, ""},
+		{"Statfs_t.Fsid", Field, 0, ""},
+		{"Statfs_t.Fssubtype", Field, 0, ""},
+		{"Statfs_t.Fstypename", Field, 0, ""},
+		{"Statfs_t.Iosize", Field, 0, ""},
+		{"Statfs_t.Mntfromname", Field, 0, ""},
+		{"Statfs_t.Mntonname", Field, 0, ""},
+		{"Statfs_t.Mount_info", Field, 2, ""},
+		{"Statfs_t.Namelen", Field, 0, ""},
+		{"Statfs_t.Namemax", Field, 0, ""},
+		{"Statfs_t.Owner", Field, 0, ""},
+		{"Statfs_t.Pad_cgo_0", Field, 0, ""},
+		{"Statfs_t.Pad_cgo_1", Field, 2, ""},
+		{"Statfs_t.Reserved", Field, 0, ""},
+		{"Statfs_t.Spare", Field, 0, ""},
+		{"Statfs_t.Syncreads", Field, 0, ""},
+		{"Statfs_t.Syncwrites", Field, 0, ""},
+		{"Statfs_t.Type", Field, 0, ""},
+		{"Statfs_t.Version", Field, 0, ""},
+		{"Stderr", Var, 0, ""},
+		{"Stdin", Var, 0, ""},
+		{"Stdout", Var, 0, ""},
+		{"StringBytePtr", Func, 0, "func(s string) *byte"},
+		{"StringByteSlice", Func, 0, "func(s string) []byte"},
+		{"StringSlicePtr", Func, 0, "func(ss []string) []*byte"},
+		{"StringToSid", Func, 0, ""},
+		{"StringToUTF16", Func, 0, ""},
+		{"StringToUTF16Ptr", Func, 0, ""},
+		{"Symlink", Func, 0, "func(oldpath string, newpath string) (err error)"},
+		{"Sync", Func, 0, "func()"},
+		{"SyncFileRange", Func, 0, "func(fd int, off int64, n int64, flags int) (err error)"},
+		{"SysProcAttr", Type, 0, ""},
+		{"SysProcAttr.AdditionalInheritedHandles", Field, 17, ""},
+		{"SysProcAttr.AmbientCaps", Field, 9, ""},
+		{"SysProcAttr.CgroupFD", Field, 20, ""},
+		{"SysProcAttr.Chroot", Field, 0, ""},
+		{"SysProcAttr.Cloneflags", Field, 2, ""},
+		{"SysProcAttr.CmdLine", Field, 0, ""},
+		{"SysProcAttr.CreationFlags", Field, 1, ""},
+		{"SysProcAttr.Credential", Field, 0, ""},
+		{"SysProcAttr.Ctty", Field, 1, ""},
+		{"SysProcAttr.Foreground", Field, 5, ""},
+		{"SysProcAttr.GidMappings", Field, 4, ""},
+		{"SysProcAttr.GidMappingsEnableSetgroups", Field, 5, ""},
+		{"SysProcAttr.HideWindow", Field, 0, ""},
+		{"SysProcAttr.Jail", Field, 21, ""},
+		{"SysProcAttr.NoInheritHandles", Field, 16, ""},
+		{"SysProcAttr.Noctty", Field, 0, ""},
+		{"SysProcAttr.ParentProcess", Field, 17, ""},
+		{"SysProcAttr.Pdeathsig", Field, 0, ""},
+		{"SysProcAttr.Pgid", Field, 5, ""},
+		{"SysProcAttr.PidFD", Field, 22, ""},
+		{"SysProcAttr.ProcessAttributes", Field, 13, ""},
+		{"SysProcAttr.Ptrace", Field, 0, ""},
+		{"SysProcAttr.Setctty", Field, 0, ""},
+		{"SysProcAttr.Setpgid", Field, 0, ""},
+		{"SysProcAttr.Setsid", Field, 0, ""},
+		{"SysProcAttr.ThreadAttributes", Field, 13, ""},
+		{"SysProcAttr.Token", Field, 10, ""},
+		{"SysProcAttr.UidMappings", Field, 4, ""},
+		{"SysProcAttr.Unshareflags", Field, 7, ""},
+		{"SysProcAttr.UseCgroupFD", Field, 20, ""},
+		{"SysProcIDMap", Type, 4, ""},
+		{"SysProcIDMap.ContainerID", Field, 4, ""},
+		{"SysProcIDMap.HostID", Field, 4, ""},
+		{"SysProcIDMap.Size", Field, 4, ""},
+		{"Syscall", Func, 0, "func(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr) (r1 uintptr, r2 uintptr, err Errno)"},
+		{"Syscall12", Func, 0, ""},
+		{"Syscall15", Func, 0, ""},
+		{"Syscall18", Func, 12, ""},
+		{"Syscall6", Func, 0, "func(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr, a4 uintptr, a5 uintptr, a6 uintptr) (r1 uintptr, r2 uintptr, err Errno)"},
+		{"Syscall9", Func, 0, ""},
+		{"SyscallN", Func, 18, ""},
+		{"Sysctl", Func, 0, ""},
+		{"SysctlUint32", Func, 0, ""},
+		{"Sysctlnode", Type, 2, ""},
+		{"Sysctlnode.Flags", Field, 2, ""},
+		{"Sysctlnode.Name", Field, 2, ""},
+		{"Sysctlnode.Num", Field, 2, ""},
+		{"Sysctlnode.Un", Field, 2, ""},
+		{"Sysctlnode.Ver", Field, 2, ""},
+		{"Sysctlnode.X__rsvd", Field, 2, ""},
+		{"Sysctlnode.X_sysctl_desc", Field, 2, ""},
+		{"Sysctlnode.X_sysctl_func", Field, 2, ""},
+		{"Sysctlnode.X_sysctl_parent", Field, 2, ""},
+		{"Sysctlnode.X_sysctl_size", Field, 2, ""},
+		{"Sysinfo", Func, 0, "func(info *Sysinfo_t) (err error)"},
+		{"Sysinfo_t", Type, 0, ""},
+		{"Sysinfo_t.Bufferram", Field, 0, ""},
+		{"Sysinfo_t.Freehigh", Field, 0, ""},
+		{"Sysinfo_t.Freeram", Field, 0, ""},
+		{"Sysinfo_t.Freeswap", Field, 0, ""},
+		{"Sysinfo_t.Loads", Field, 0, ""},
+		{"Sysinfo_t.Pad", Field, 0, ""},
+		{"Sysinfo_t.Pad_cgo_0", Field, 0, ""},
+		{"Sysinfo_t.Pad_cgo_1", Field, 0, ""},
+		{"Sysinfo_t.Procs", Field, 0, ""},
+		{"Sysinfo_t.Sharedram", Field, 0, ""},
+		{"Sysinfo_t.Totalhigh", Field, 0, ""},
+		{"Sysinfo_t.Totalram", Field, 0, ""},
+		{"Sysinfo_t.Totalswap", Field, 0, ""},
+		{"Sysinfo_t.Unit", Field, 0, ""},
+		{"Sysinfo_t.Uptime", Field, 0, ""},
+		{"Sysinfo_t.X_f", Field, 0, ""},
+		{"Systemtime", Type, 0, ""},
+		{"Systemtime.Day", Field, 0, ""},
+		{"Systemtime.DayOfWeek", Field, 0, ""},
+		{"Systemtime.Hour", Field, 0, ""},
+		{"Systemtime.Milliseconds", Field, 0, ""},
+		{"Systemtime.Minute", Field, 0, ""},
+		{"Systemtime.Month", Field, 0, ""},
+		{"Systemtime.Second", Field, 0, ""},
+		{"Systemtime.Year", Field, 0, ""},
+		{"TCGETS", Const, 0, ""},
+		{"TCIFLUSH", Const, 1, ""},
+		{"TCIOFLUSH", Const, 1, ""},
+		{"TCOFLUSH", Const, 1, ""},
+		{"TCPInfo", Type, 1, ""},
+		{"TCPInfo.Advmss", Field, 1, ""},
+		{"TCPInfo.Ato", Field, 1, ""},
+		{"TCPInfo.Backoff", Field, 1, ""},
+		{"TCPInfo.Ca_state", Field, 1, ""},
+		{"TCPInfo.Fackets", Field, 1, ""},
+		{"TCPInfo.Last_ack_recv", Field, 1, ""},
+		{"TCPInfo.Last_ack_sent", Field, 1, ""},
+		{"TCPInfo.Last_data_recv", Field, 1, ""},
+		{"TCPInfo.Last_data_sent", Field, 1, ""},
+		{"TCPInfo.Lost", Field, 1, ""},
+		{"TCPInfo.Options", Field, 1, ""},
+		{"TCPInfo.Pad_cgo_0", Field, 1, ""},
+		{"TCPInfo.Pmtu", Field, 1, ""},
+		{"TCPInfo.Probes", Field, 1, ""},
+		{"TCPInfo.Rcv_mss", Field, 1, ""},
+		{"TCPInfo.Rcv_rtt", Field, 1, ""},
+		{"TCPInfo.Rcv_space", Field, 1, ""},
+		{"TCPInfo.Rcv_ssthresh", Field, 1, ""},
+		{"TCPInfo.Reordering", Field, 1, ""},
+		{"TCPInfo.Retrans", Field, 1, ""},
+		{"TCPInfo.Retransmits", Field, 1, ""},
+		{"TCPInfo.Rto", Field, 1, ""},
+		{"TCPInfo.Rtt", Field, 1, ""},
+		{"TCPInfo.Rttvar", Field, 1, ""},
+		{"TCPInfo.Sacked", Field, 1, ""},
+		{"TCPInfo.Snd_cwnd", Field, 1, ""},
+		{"TCPInfo.Snd_mss", Field, 1, ""},
+		{"TCPInfo.Snd_ssthresh", Field, 1, ""},
+		{"TCPInfo.State", Field, 1, ""},
+		{"TCPInfo.Total_retrans", Field, 1, ""},
+		{"TCPInfo.Unacked", Field, 1, ""},
+		{"TCPKeepalive", Type, 3, ""},
+		{"TCPKeepalive.Interval", Field, 3, ""},
+		{"TCPKeepalive.OnOff", Field, 3, ""},
+		{"TCPKeepalive.Time", Field, 3, ""},
+		{"TCP_CA_NAME_MAX", Const, 0, ""},
+		{"TCP_CONGCTL", Const, 1, ""},
+		{"TCP_CONGESTION", Const, 0, ""},
+		{"TCP_CONNECTIONTIMEOUT", Const, 0, ""},
+		{"TCP_CORK", Const, 0, ""},
+		{"TCP_DEFER_ACCEPT", Const, 0, ""},
+		{"TCP_ENABLE_ECN", Const, 16, ""},
+		{"TCP_INFO", Const, 0, ""},
+		{"TCP_KEEPALIVE", Const, 0, ""},
+		{"TCP_KEEPCNT", Const, 0, ""},
+		{"TCP_KEEPIDLE", Const, 0, ""},
+		{"TCP_KEEPINIT", Const, 1, ""},
+		{"TCP_KEEPINTVL", Const, 0, ""},
+		{"TCP_LINGER2", Const, 0, ""},
+		{"TCP_MAXBURST", Const, 0, ""},
+		{"TCP_MAXHLEN", Const, 0, ""},
+		{"TCP_MAXOLEN", Const, 0, ""},
+		{"TCP_MAXSEG", Const, 0, ""},
+		{"TCP_MAXWIN", Const, 0, ""},
+		{"TCP_MAX_SACK", Const, 0, ""},
+		{"TCP_MAX_WINSHIFT", Const, 0, ""},
+		{"TCP_MD5SIG", Const, 0, ""},
+		{"TCP_MD5SIG_MAXKEYLEN", Const, 0, ""},
+		{"TCP_MINMSS", Const, 0, ""},
+		{"TCP_MINMSSOVERLOAD", Const, 0, ""},
+		{"TCP_MSS", Const, 0, ""},
+		{"TCP_NODELAY", Const, 0, ""},
+		{"TCP_NOOPT", Const, 0, ""},
+		{"TCP_NOPUSH", Const, 0, ""},
+		{"TCP_NOTSENT_LOWAT", Const, 16, ""},
+		{"TCP_NSTATES", Const, 1, ""},
+		{"TCP_QUICKACK", Const, 0, ""},
+		{"TCP_RXT_CONNDROPTIME", Const, 0, ""},
+		{"TCP_RXT_FINDROP", Const, 0, ""},
+		{"TCP_SACK_ENABLE", Const, 1, ""},
+		{"TCP_SENDMOREACKS", Const, 16, ""},
+		{"TCP_SYNCNT", Const, 0, ""},
+		{"TCP_VENDOR", Const, 3, ""},
+		{"TCP_WINDOW_CLAMP", Const, 0, ""},
+		{"TCSAFLUSH", Const, 1, ""},
+		{"TCSETS", Const, 0, ""},
+		{"TF_DISCONNECT", Const, 0, ""},
+		{"TF_REUSE_SOCKET", Const, 0, ""},
+		{"TF_USE_DEFAULT_WORKER", Const, 0, ""},
+		{"TF_USE_KERNEL_APC", Const, 0, ""},
+		{"TF_USE_SYSTEM_THREAD", Const, 0, ""},
+		{"TF_WRITE_BEHIND", Const, 0, ""},
+		{"TH32CS_INHERIT", Const, 4, ""},
+		{"TH32CS_SNAPALL", Const, 4, ""},
+		{"TH32CS_SNAPHEAPLIST", Const, 4, ""},
+		{"TH32CS_SNAPMODULE", Const, 4, ""},
+		{"TH32CS_SNAPMODULE32", Const, 4, ""},
+		{"TH32CS_SNAPPROCESS", Const, 4, ""},
+		{"TH32CS_SNAPTHREAD", Const, 4, ""},
+		{"TIME_ZONE_ID_DAYLIGHT", Const, 0, ""},
+		{"TIME_ZONE_ID_STANDARD", Const, 0, ""},
+		{"TIME_ZONE_ID_UNKNOWN", Const, 0, ""},
+		{"TIOCCBRK", Const, 0, ""},
+		{"TIOCCDTR", Const, 0, ""},
+		{"TIOCCONS", Const, 0, ""},
+		{"TIOCDCDTIMESTAMP", Const, 0, ""},
+		{"TIOCDRAIN", Const, 0, ""},
+		{"TIOCDSIMICROCODE", Const, 0, ""},
+		{"TIOCEXCL", Const, 0, ""},
+		{"TIOCEXT", Const, 0, ""},
+		{"TIOCFLAG_CDTRCTS", Const, 1, ""},
+		{"TIOCFLAG_CLOCAL", Const, 1, ""},
+		{"TIOCFLAG_CRTSCTS", Const, 1, ""},
+		{"TIOCFLAG_MDMBUF", Const, 1, ""},
+		{"TIOCFLAG_PPS", Const, 1, ""},
+		{"TIOCFLAG_SOFTCAR", Const, 1, ""},
+		{"TIOCFLUSH", Const, 0, ""},
+		{"TIOCGDEV", Const, 0, ""},
+		{"TIOCGDRAINWAIT", Const, 0, ""},
+		{"TIOCGETA", Const, 0, ""},
+		{"TIOCGETD", Const, 0, ""},
+		{"TIOCGFLAGS", Const, 1, ""},
+		{"TIOCGICOUNT", Const, 0, ""},
+		{"TIOCGLCKTRMIOS", Const, 0, ""},
+		{"TIOCGLINED", Const, 1, ""},
+		{"TIOCGPGRP", Const, 0, ""},
+		{"TIOCGPTN", Const, 0, ""},
+		{"TIOCGQSIZE", Const, 1, ""},
+		{"TIOCGRANTPT", Const, 1, ""},
+		{"TIOCGRS485", Const, 0, ""},
+		{"TIOCGSERIAL", Const, 0, ""},
+		{"TIOCGSID", Const, 0, ""},
+		{"TIOCGSIZE", Const, 1, ""},
+		{"TIOCGSOFTCAR", Const, 0, ""},
+		{"TIOCGTSTAMP", Const, 1, ""},
+		{"TIOCGWINSZ", Const, 0, ""},
+		{"TIOCINQ", Const, 0, ""},
+		{"TIOCIXOFF", Const, 0, ""},
+		{"TIOCIXON", Const, 0, ""},
+		{"TIOCLINUX", Const, 0, ""},
+		{"TIOCMBIC", Const, 0, ""},
+		{"TIOCMBIS", Const, 0, ""},
+		{"TIOCMGDTRWAIT", Const, 0, ""},
+		{"TIOCMGET", Const, 0, ""},
+		{"TIOCMIWAIT", Const, 0, ""},
+		{"TIOCMODG", Const, 0, ""},
+		{"TIOCMODS", Const, 0, ""},
+		{"TIOCMSDTRWAIT", Const, 0, ""},
+		{"TIOCMSET", Const, 0, ""},
+		{"TIOCM_CAR", Const, 0, ""},
+		{"TIOCM_CD", Const, 0, ""},
+		{"TIOCM_CTS", Const, 0, ""},
+		{"TIOCM_DCD", Const, 0, ""},
+		{"TIOCM_DSR", Const, 0, ""},
+		{"TIOCM_DTR", Const, 0, ""},
+		{"TIOCM_LE", Const, 0, ""},
+		{"TIOCM_RI", Const, 0, ""},
+		{"TIOCM_RNG", Const, 0, ""},
+		{"TIOCM_RTS", Const, 0, ""},
+		{"TIOCM_SR", Const, 0, ""},
+		{"TIOCM_ST", Const, 0, ""},
+		{"TIOCNOTTY", Const, 0, ""},
+		{"TIOCNXCL", Const, 0, ""},
+		{"TIOCOUTQ", Const, 0, ""},
+		{"TIOCPKT", Const, 0, ""},
+		{"TIOCPKT_DATA", Const, 0, ""},
+		{"TIOCPKT_DOSTOP", Const, 0, ""},
+		{"TIOCPKT_FLUSHREAD", Const, 0, ""},
+		{"TIOCPKT_FLUSHWRITE", Const, 0, ""},
+		{"TIOCPKT_IOCTL", Const, 0, ""},
+		{"TIOCPKT_NOSTOP", Const, 0, ""},
+		{"TIOCPKT_START", Const, 0, ""},
+		{"TIOCPKT_STOP", Const, 0, ""},
+		{"TIOCPTMASTER", Const, 0, ""},
+		{"TIOCPTMGET", Const, 1, ""},
+		{"TIOCPTSNAME", Const, 1, ""},
+		{"TIOCPTYGNAME", Const, 0, ""},
+		{"TIOCPTYGRANT", Const, 0, ""},
+		{"TIOCPTYUNLK", Const, 0, ""},
+		{"TIOCRCVFRAME", Const, 1, ""},
+		{"TIOCREMOTE", Const, 0, ""},
+		{"TIOCSBRK", Const, 0, ""},
+		{"TIOCSCONS", Const, 0, ""},
+		{"TIOCSCTTY", Const, 0, ""},
+		{"TIOCSDRAINWAIT", Const, 0, ""},
+		{"TIOCSDTR", Const, 0, ""},
+		{"TIOCSERCONFIG", Const, 0, ""},
+		{"TIOCSERGETLSR", Const, 0, ""},
+		{"TIOCSERGETMULTI", Const, 0, ""},
+		{"TIOCSERGSTRUCT", Const, 0, ""},
+		{"TIOCSERGWILD", Const, 0, ""},
+		{"TIOCSERSETMULTI", Const, 0, ""},
+		{"TIOCSERSWILD", Const, 0, ""},
+		{"TIOCSER_TEMT", Const, 0, ""},
+		{"TIOCSETA", Const, 0, ""},
+		{"TIOCSETAF", Const, 0, ""},
+		{"TIOCSETAW", Const, 0, ""},
+		{"TIOCSETD", Const, 0, ""},
+		{"TIOCSFLAGS", Const, 1, ""},
+		{"TIOCSIG", Const, 0, ""},
+		{"TIOCSLCKTRMIOS", Const, 0, ""},
+		{"TIOCSLINED", Const, 1, ""},
+		{"TIOCSPGRP", Const, 0, ""},
+		{"TIOCSPTLCK", Const, 0, ""},
+		{"TIOCSQSIZE", Const, 1, ""},
+		{"TIOCSRS485", Const, 0, ""},
+		{"TIOCSSERIAL", Const, 0, ""},
+		{"TIOCSSIZE", Const, 1, ""},
+		{"TIOCSSOFTCAR", Const, 0, ""},
+		{"TIOCSTART", Const, 0, ""},
+		{"TIOCSTAT", Const, 0, ""},
+		{"TIOCSTI", Const, 0, ""},
+		{"TIOCSTOP", Const, 0, ""},
+		{"TIOCSTSTAMP", Const, 1, ""},
+		{"TIOCSWINSZ", Const, 0, ""},
+		{"TIOCTIMESTAMP", Const, 0, ""},
+		{"TIOCUCNTL", Const, 0, ""},
+		{"TIOCVHANGUP", Const, 0, ""},
+		{"TIOCXMTFRAME", Const, 1, ""},
+		{"TOKEN_ADJUST_DEFAULT", Const, 0, ""},
+		{"TOKEN_ADJUST_GROUPS", Const, 0, ""},
+		{"TOKEN_ADJUST_PRIVILEGES", Const, 0, ""},
+		{"TOKEN_ADJUST_SESSIONID", Const, 11, ""},
+		{"TOKEN_ALL_ACCESS", Const, 0, ""},
+		{"TOKEN_ASSIGN_PRIMARY", Const, 0, ""},
+		{"TOKEN_DUPLICATE", Const, 0, ""},
+		{"TOKEN_EXECUTE", Const, 0, ""},
+		{"TOKEN_IMPERSONATE", Const, 0, ""},
+		{"TOKEN_QUERY", Const, 0, ""},
+		{"TOKEN_QUERY_SOURCE", Const, 0, ""},
+		{"TOKEN_READ", Const, 0, ""},
+		{"TOKEN_WRITE", Const, 0, ""},
+		{"TOSTOP", Const, 0, ""},
+		{"TRUNCATE_EXISTING", Const, 0, ""},
+		{"TUNATTACHFILTER", Const, 0, ""},
+		{"TUNDETACHFILTER", Const, 0, ""},
+		{"TUNGETFEATURES", Const, 0, ""},
+		{"TUNGETIFF", Const, 0, ""},
+		{"TUNGETSNDBUF", Const, 0, ""},
+		{"TUNGETVNETHDRSZ", Const, 0, ""},
+		{"TUNSETDEBUG", Const, 0, ""},
+		{"TUNSETGROUP", Const, 0, ""},
+		{"TUNSETIFF", Const, 0, ""},
+		{"TUNSETLINK", Const, 0, ""},
+		{"TUNSETNOCSUM", Const, 0, ""},
+		{"TUNSETOFFLOAD", Const, 0, ""},
+		{"TUNSETOWNER", Const, 0, ""},
+		{"TUNSETPERSIST", Const, 0, ""},
+		{"TUNSETSNDBUF", Const, 0, ""},
+		{"TUNSETTXFILTER", Const, 0, ""},
+		{"TUNSETVNETHDRSZ", Const, 0, ""},
+		{"Tee", Func, 0, "func(rfd int, wfd int, len int, flags int) (n int64, err error)"},
+		{"TerminateProcess", Func, 0, ""},
+		{"Termios", Type, 0, ""},
+		{"Termios.Cc", Field, 0, ""},
+		{"Termios.Cflag", Field, 0, ""},
+		{"Termios.Iflag", Field, 0, ""},
+		{"Termios.Ispeed", Field, 0, ""},
+		{"Termios.Lflag", Field, 0, ""},
+		{"Termios.Line", Field, 0, ""},
+		{"Termios.Oflag", Field, 0, ""},
+		{"Termios.Ospeed", Field, 0, ""},
+		{"Termios.Pad_cgo_0", Field, 0, ""},
+		{"Tgkill", Func, 0, "func(tgid int, tid int, sig Signal) (err error)"},
+		{"Time", Func, 0, "func(t *Time_t) (tt Time_t, err error)"},
+		{"Time_t", Type, 0, ""},
+		{"Times", Func, 0, "func(tms *Tms) (ticks uintptr, err error)"},
+		{"Timespec", Type, 0, ""},
+		{"Timespec.Nsec", Field, 0, ""},
+		{"Timespec.Pad_cgo_0", Field, 2, ""},
+		{"Timespec.Sec", Field, 0, ""},
+		{"TimespecToNsec", Func, 0, "func(ts Timespec) int64"},
+		{"Timeval", Type, 0, ""},
+		{"Timeval.Pad_cgo_0", Field, 0, ""},
+		{"Timeval.Sec", Field, 0, ""},
+		{"Timeval.Usec", Field, 0, ""},
+		{"Timeval32", Type, 0, ""},
+		{"Timeval32.Sec", Field, 0, ""},
+		{"Timeval32.Usec", Field, 0, ""},
+		{"TimevalToNsec", Func, 0, "func(tv Timeval) int64"},
+		{"Timex", Type, 0, ""},
+		{"Timex.Calcnt", Field, 0, ""},
+		{"Timex.Constant", Field, 0, ""},
+		{"Timex.Errcnt", Field, 0, ""},
+		{"Timex.Esterror", Field, 0, ""},
+		{"Timex.Freq", Field, 0, ""},
+		{"Timex.Jitcnt", Field, 0, ""},
+		{"Timex.Jitter", Field, 0, ""},
+		{"Timex.Maxerror", Field, 0, ""},
+		{"Timex.Modes", Field, 0, ""},
+		{"Timex.Offset", Field, 0, ""},
+		{"Timex.Pad_cgo_0", Field, 0, ""},
+		{"Timex.Pad_cgo_1", Field, 0, ""},
+		{"Timex.Pad_cgo_2", Field, 0, ""},
+		{"Timex.Pad_cgo_3", Field, 0, ""},
+		{"Timex.Ppsfreq", Field, 0, ""},
+		{"Timex.Precision", Field, 0, ""},
+		{"Timex.Shift", Field, 0, ""},
+		{"Timex.Stabil", Field, 0, ""},
+		{"Timex.Status", Field, 0, ""},
+		{"Timex.Stbcnt", Field, 0, ""},
+		{"Timex.Tai", Field, 0, ""},
+		{"Timex.Tick", Field, 0, ""},
+		{"Timex.Time", Field, 0, ""},
+		{"Timex.Tolerance", Field, 0, ""},
+		{"Timezoneinformation", Type, 0, ""},
+		{"Timezoneinformation.Bias", Field, 0, ""},
+		{"Timezoneinformation.DaylightBias", Field, 0, ""},
+		{"Timezoneinformation.DaylightDate", Field, 0, ""},
+		{"Timezoneinformation.DaylightName", Field, 0, ""},
+		{"Timezoneinformation.StandardBias", Field, 0, ""},
+		{"Timezoneinformation.StandardDate", Field, 0, ""},
+		{"Timezoneinformation.StandardName", Field, 0, ""},
+		{"Tms", Type, 0, ""},
+		{"Tms.Cstime", Field, 0, ""},
+		{"Tms.Cutime", Field, 0, ""},
+		{"Tms.Stime", Field, 0, ""},
+		{"Tms.Utime", Field, 0, ""},
+		{"Token", Type, 0, ""},
+		{"TokenAccessInformation", Const, 0, ""},
+		{"TokenAuditPolicy", Const, 0, ""},
+		{"TokenDefaultDacl", Const, 0, ""},
+		{"TokenElevation", Const, 0, ""},
+		{"TokenElevationType", Const, 0, ""},
+		{"TokenGroups", Const, 0, ""},
+		{"TokenGroupsAndPrivileges", Const, 0, ""},
+		{"TokenHasRestrictions", Const, 0, ""},
+		{"TokenImpersonationLevel", Const, 0, ""},
+		{"TokenIntegrityLevel", Const, 0, ""},
+		{"TokenLinkedToken", Const, 0, ""},
+		{"TokenLogonSid", Const, 0, ""},
+		{"TokenMandatoryPolicy", Const, 0, ""},
+		{"TokenOrigin", Const, 0, ""},
+		{"TokenOwner", Const, 0, ""},
+		{"TokenPrimaryGroup", Const, 0, ""},
+		{"TokenPrivileges", Const, 0, ""},
+		{"TokenRestrictedSids", Const, 0, ""},
+		{"TokenSandBoxInert", Const, 0, ""},
+		{"TokenSessionId", Const, 0, ""},
+		{"TokenSessionReference", Const, 0, ""},
+		{"TokenSource", Const, 0, ""},
+		{"TokenStatistics", Const, 0, ""},
+		{"TokenType", Const, 0, ""},
+		{"TokenUIAccess", Const, 0, ""},
+		{"TokenUser", Const, 0, ""},
+		{"TokenVirtualizationAllowed", Const, 0, ""},
+		{"TokenVirtualizationEnabled", Const, 0, ""},
+		{"Tokenprimarygroup", Type, 0, ""},
+		{"Tokenprimarygroup.PrimaryGroup", Field, 0, ""},
+		{"Tokenuser", Type, 0, ""},
+		{"Tokenuser.User", Field, 0, ""},
+		{"TranslateAccountName", Func, 0, ""},
+		{"TranslateName", Func, 0, ""},
+		{"TransmitFile", Func, 0, ""},
+		{"TransmitFileBuffers", Type, 0, ""},
+		{"TransmitFileBuffers.Head", Field, 0, ""},
+		{"TransmitFileBuffers.HeadLength", Field, 0, ""},
+		{"TransmitFileBuffers.Tail", Field, 0, ""},
+		{"TransmitFileBuffers.TailLength", Field, 0, ""},
+		{"Truncate", Func, 0, "func(path string, length int64) (err error)"},
+		{"UNIX_PATH_MAX", Const, 12, ""},
+		{"USAGE_MATCH_TYPE_AND", Const, 0, ""},
+		{"USAGE_MATCH_TYPE_OR", Const, 0, ""},
+		{"UTF16FromString", Func, 1, ""},
+		{"UTF16PtrFromString", Func, 1, ""},
+		{"UTF16ToString", Func, 0, ""},
+		{"Ucred", Type, 0, ""},
+		{"Ucred.Gid", Field, 0, ""},
+		{"Ucred.Pid", Field, 0, ""},
+		{"Ucred.Uid", Field, 0, ""},
+		{"Umask", Func, 0, "func(mask int) (oldmask int)"},
+		{"Uname", Func, 0, "func(buf *Utsname) (err error)"},
+		{"Undelete", Func, 0, ""},
+		{"UnixCredentials", Func, 0, "func(ucred *Ucred) []byte"},
+		{"UnixRights", Func, 0, "func(fds ...int) []byte"},
+		{"Unlink", Func, 0, "func(path string) error"},
+		{"Unlinkat", Func, 0, "func(dirfd int, path string) error"},
+		{"UnmapViewOfFile", Func, 0, ""},
+		{"Unmount", Func, 0, "func(target string, flags int) (err error)"},
+		{"Unsetenv", Func, 4, "func(key string) error"},
+		{"Unshare", Func, 0, "func(flags int) (err error)"},
+		{"UserInfo10", Type, 0, ""},
+		{"UserInfo10.Comment", Field, 0, ""},
+		{"UserInfo10.FullName", Field, 0, ""},
+		{"UserInfo10.Name", Field, 0, ""},
+		{"UserInfo10.UsrComment", Field, 0, ""},
+		{"Ustat", Func, 0, "func(dev int, ubuf *Ustat_t) (err error)"},
+		{"Ustat_t", Type, 0, ""},
+		{"Ustat_t.Fname", Field, 0, ""},
+		{"Ustat_t.Fpack", Field, 0, ""},
+		{"Ustat_t.Pad_cgo_0", Field, 0, ""},
+		{"Ustat_t.Pad_cgo_1", Field, 0, ""},
+		{"Ustat_t.Tfree", Field, 0, ""},
+		{"Ustat_t.Tinode", Field, 0, ""},
+		{"Utimbuf", Type, 0, ""},
+		{"Utimbuf.Actime", Field, 0, ""},
+		{"Utimbuf.Modtime", Field, 0, ""},
+		{"Utime", Func, 0, "func(path string, buf *Utimbuf) (err error)"},
+		{"Utimes", Func, 0, "func(path string, tv []Timeval) (err error)"},
+		{"UtimesNano", Func, 1, "func(path string, ts []Timespec) (err error)"},
+		{"Utsname", Type, 0, ""},
+		{"Utsname.Domainname", Field, 0, ""},
+		{"Utsname.Machine", Field, 0, ""},
+		{"Utsname.Nodename", Field, 0, ""},
+		{"Utsname.Release", Field, 0, ""},
+		{"Utsname.Sysname", Field, 0, ""},
+		{"Utsname.Version", Field, 0, ""},
+		{"VDISCARD", Const, 0, ""},
+		{"VDSUSP", Const, 1, ""},
+		{"VEOF", Const, 0, ""},
+		{"VEOL", Const, 0, ""},
+		{"VEOL2", Const, 0, ""},
+		{"VERASE", Const, 0, ""},
+		{"VERASE2", Const, 1, ""},
+		{"VINTR", Const, 0, ""},
+		{"VKILL", Const, 0, ""},
+		{"VLNEXT", Const, 0, ""},
+		{"VMIN", Const, 0, ""},
+		{"VQUIT", Const, 0, ""},
+		{"VREPRINT", Const, 0, ""},
+		{"VSTART", Const, 0, ""},
+		{"VSTATUS", Const, 1, ""},
+		{"VSTOP", Const, 0, ""},
+		{"VSUSP", Const, 0, ""},
+		{"VSWTC", Const, 0, ""},
+		{"VT0", Const, 1, ""},
+		{"VT1", Const, 1, ""},
+		{"VTDLY", Const, 1, ""},
+		{"VTIME", Const, 0, ""},
+		{"VWERASE", Const, 0, ""},
+		{"VirtualLock", Func, 0, ""},
+		{"VirtualUnlock", Func, 0, ""},
+		{"WAIT_ABANDONED", Const, 0, ""},
+		{"WAIT_FAILED", Const, 0, ""},
+		{"WAIT_OBJECT_0", Const, 0, ""},
+		{"WAIT_TIMEOUT", Const, 0, ""},
+		{"WALL", Const, 0, ""},
+		{"WALLSIG", Const, 1, ""},
+		{"WALTSIG", Const, 1, ""},
+		{"WCLONE", Const, 0, ""},
+		{"WCONTINUED", Const, 0, ""},
+		{"WCOREFLAG", Const, 0, ""},
+		{"WEXITED", Const, 0, ""},
+		{"WLINUXCLONE", Const, 0, ""},
+		{"WNOHANG", Const, 0, ""},
+		{"WNOTHREAD", Const, 0, ""},
+		{"WNOWAIT", Const, 0, ""},
+		{"WNOZOMBIE", Const, 1, ""},
+		{"WOPTSCHECKED", Const, 1, ""},
+		{"WORDSIZE", Const, 0, ""},
+		{"WSABuf", Type, 0, ""},
+		{"WSABuf.Buf", Field, 0, ""},
+		{"WSABuf.Len", Field, 0, ""},
+		{"WSACleanup", Func, 0, ""},
+		{"WSADESCRIPTION_LEN", Const, 0, ""},
+		{"WSAData", Type, 0, ""},
+		{"WSAData.Description", Field, 0, ""},
+		{"WSAData.HighVersion", Field, 0, ""},
+		{"WSAData.MaxSockets", Field, 0, ""},
+		{"WSAData.MaxUdpDg", Field, 0, ""},
+		{"WSAData.SystemStatus", Field, 0, ""},
+		{"WSAData.VendorInfo", Field, 0, ""},
+		{"WSAData.Version", Field, 0, ""},
+		{"WSAEACCES", Const, 2, ""},
+		{"WSAECONNABORTED", Const, 9, ""},
+		{"WSAECONNRESET", Const, 3, ""},
+		{"WSAENOPROTOOPT", Const, 23, ""},
+		{"WSAEnumProtocols", Func, 2, ""},
+		{"WSAID_CONNECTEX", Var, 1, ""},
+		{"WSAIoctl", Func, 0, ""},
+		{"WSAPROTOCOL_LEN", Const, 2, ""},
+		{"WSAProtocolChain", Type, 2, ""},
+		{"WSAProtocolChain.ChainEntries", Field, 2, ""},
+		{"WSAProtocolChain.ChainLen", Field, 2, ""},
+		{"WSAProtocolInfo", Type, 2, ""},
+		{"WSAProtocolInfo.AddressFamily", Field, 2, ""},
+		{"WSAProtocolInfo.CatalogEntryId", Field, 2, ""},
+		{"WSAProtocolInfo.MaxSockAddr", Field, 2, ""},
+		{"WSAProtocolInfo.MessageSize", Field, 2, ""},
+		{"WSAProtocolInfo.MinSockAddr", Field, 2, ""},
+		{"WSAProtocolInfo.NetworkByteOrder", Field, 2, ""},
+		{"WSAProtocolInfo.Protocol", Field, 2, ""},
+		{"WSAProtocolInfo.ProtocolChain", Field, 2, ""},
+		{"WSAProtocolInfo.ProtocolMaxOffset", Field, 2, ""},
+		{"WSAProtocolInfo.ProtocolName", Field, 2, ""},
+		{"WSAProtocolInfo.ProviderFlags", Field, 2, ""},
+		{"WSAProtocolInfo.ProviderId", Field, 2, ""},
+		{"WSAProtocolInfo.ProviderReserved", Field, 2, ""},
+		{"WSAProtocolInfo.SecurityScheme", Field, 2, ""},
+		{"WSAProtocolInfo.ServiceFlags1", Field, 2, ""},
+		{"WSAProtocolInfo.ServiceFlags2", Field, 2, ""},
+		{"WSAProtocolInfo.ServiceFlags3", Field, 2, ""},
+		{"WSAProtocolInfo.ServiceFlags4", Field, 2, ""},
+		{"WSAProtocolInfo.SocketType", Field, 2, ""},
+		{"WSAProtocolInfo.Version", Field, 2, ""},
+		{"WSARecv", Func, 0, ""},
+		{"WSARecvFrom", Func, 0, ""},
+		{"WSASYS_STATUS_LEN", Const, 0, ""},
+		{"WSASend", Func, 0, ""},
+		{"WSASendTo", Func, 0, ""},
+		{"WSASendto", Func, 0, ""},
+		{"WSAStartup", Func, 0, ""},
+		{"WSTOPPED", Const, 0, ""},
+		{"WTRAPPED", Const, 1, ""},
+		{"WUNTRACED", Const, 0, ""},
+		{"Wait4", Func, 0, "func(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error)"},
+		{"WaitForSingleObject", Func, 0, ""},
+		{"WaitStatus", Type, 0, ""},
+		{"WaitStatus.ExitCode", Field, 0, ""},
+		{"Win32FileAttributeData", Type, 0, ""},
+		{"Win32FileAttributeData.CreationTime", Field, 0, ""},
+		{"Win32FileAttributeData.FileAttributes", Field, 0, ""},
+		{"Win32FileAttributeData.FileSizeHigh", Field, 0, ""},
+		{"Win32FileAttributeData.FileSizeLow", Field, 0, ""},
+		{"Win32FileAttributeData.LastAccessTime", Field, 0, ""},
+		{"Win32FileAttributeData.LastWriteTime", Field, 0, ""},
+		{"Win32finddata", Type, 0, ""},
+		{"Win32finddata.AlternateFileName", Field, 0, ""},
+		{"Win32finddata.CreationTime", Field, 0, ""},
+		{"Win32finddata.FileAttributes", Field, 0, ""},
+		{"Win32finddata.FileName", Field, 0, ""},
+		{"Win32finddata.FileSizeHigh", Field, 0, ""},
+		{"Win32finddata.FileSizeLow", Field, 0, ""},
+		{"Win32finddata.LastAccessTime", Field, 0, ""},
+		{"Win32finddata.LastWriteTime", Field, 0, ""},
+		{"Win32finddata.Reserved0", Field, 0, ""},
+		{"Win32finddata.Reserved1", Field, 0, ""},
+		{"Write", Func, 0, "func(fd int, p []byte) (n int, err error)"},
+		{"WriteConsole", Func, 1, ""},
+		{"WriteFile", Func, 0, ""},
+		{"X509_ASN_ENCODING", Const, 0, ""},
+		{"XCASE", Const, 0, ""},
+		{"XP1_CONNECTIONLESS", Const, 2, ""},
+		{"XP1_CONNECT_DATA", Const, 2, ""},
+		{"XP1_DISCONNECT_DATA", Const, 2, ""},
+		{"XP1_EXPEDITED_DATA", Const, 2, ""},
+		{"XP1_GRACEFUL_CLOSE", Const, 2, ""},
+		{"XP1_GUARANTEED_DELIVERY", Const, 2, ""},
+		{"XP1_GUARANTEED_ORDER", Const, 2, ""},
+		{"XP1_IFS_HANDLES", Const, 2, ""},
+		{"XP1_MESSAGE_ORIENTED", Const, 2, ""},
+		{"XP1_MULTIPOINT_CONTROL_PLANE", Const, 2, ""},
+		{"XP1_MULTIPOINT_DATA_PLANE", Const, 2, ""},
+		{"XP1_PARTIAL_MESSAGE", Const, 2, ""},
+		{"XP1_PSEUDO_STREAM", Const, 2, ""},
+		{"XP1_QOS_SUPPORTED", Const, 2, ""},
+		{"XP1_SAN_SUPPORT_SDP", Const, 2, ""},
+		{"XP1_SUPPORT_BROADCAST", Const, 2, ""},
+		{"XP1_SUPPORT_MULTIPOINT", Const, 2, ""},
+		{"XP1_UNI_RECV", Const, 2, ""},
+		{"XP1_UNI_SEND", Const, 2, ""},
+	},
+	"syscall/js": {
+		{"CopyBytesToGo", Func, 0, ""},
+		{"CopyBytesToJS", Func, 0, ""},
+		{"Error", Type, 0, ""},
+		{"Func", Type, 0, ""},
+		{"FuncOf", Func, 0, ""},
+		{"Global", Func, 0, ""},
+		{"Null", Func, 0, ""},
+		{"Type", Type, 0, ""},
+		{"TypeBoolean", Const, 0, ""},
+		{"TypeFunction", Const, 0, ""},
+		{"TypeNull", Const, 0, ""},
+		{"TypeNumber", Const, 0, ""},
+		{"TypeObject", Const, 0, ""},
+		{"TypeString", Const, 0, ""},
+		{"TypeSymbol", Const, 0, ""},
+		{"TypeUndefined", Const, 0, ""},
+		{"Undefined", Func, 0, ""},
+		{"Value", Type, 0, ""},
+		{"ValueError", Type, 0, ""},
+		{"ValueOf", Func, 0, ""},
+	},
+	"testing": {
+		{"(*B).Chdir", Method, 24, ""},
+		{"(*B).Cleanup", Method, 14, ""},
+		{"(*B).Context", Method, 24, ""},
+		{"(*B).Elapsed", Method, 20, ""},
+		{"(*B).Error", Method, 0, ""},
+		{"(*B).Errorf", Method, 0, ""},
+		{"(*B).Fail", Method, 0, ""},
+		{"(*B).FailNow", Method, 0, ""},
+		{"(*B).Failed", Method, 0, ""},
+		{"(*B).Fatal", Method, 0, ""},
+		{"(*B).Fatalf", Method, 0, ""},
+		{"(*B).Helper", Method, 9, ""},
+		{"(*B).Log", Method, 0, ""},
+		{"(*B).Logf", Method, 0, ""},
+		{"(*B).Loop", Method, 24, ""},
+		{"(*B).Name", Method, 8, ""},
+		{"(*B).ReportAllocs", Method, 1, ""},
+		{"(*B).ReportMetric", Method, 13, ""},
+		{"(*B).ResetTimer", Method, 0, ""},
+		{"(*B).Run", Method, 7, ""},
+		{"(*B).RunParallel", Method, 3, ""},
+		{"(*B).SetBytes", Method, 0, ""},
+		{"(*B).SetParallelism", Method, 3, ""},
+		{"(*B).Setenv", Method, 17, ""},
+		{"(*B).Skip", Method, 1, ""},
+		{"(*B).SkipNow", Method, 1, ""},
+		{"(*B).Skipf", Method, 1, ""},
+		{"(*B).Skipped", Method, 1, ""},
+		{"(*B).StartTimer", Method, 0, ""},
+		{"(*B).StopTimer", Method, 0, ""},
+		{"(*B).TempDir", Method, 15, ""},
+		{"(*F).Add", Method, 18, ""},
+		{"(*F).Chdir", Method, 24, ""},
+		{"(*F).Cleanup", Method, 18, ""},
+		{"(*F).Context", Method, 24, ""},
+		{"(*F).Error", Method, 18, ""},
+		{"(*F).Errorf", Method, 18, ""},
+		{"(*F).Fail", Method, 18, ""},
+		{"(*F).FailNow", Method, 18, ""},
+		{"(*F).Failed", Method, 18, ""},
+		{"(*F).Fatal", Method, 18, ""},
+		{"(*F).Fatalf", Method, 18, ""},
+		{"(*F).Fuzz", Method, 18, ""},
+		{"(*F).Helper", Method, 18, ""},
+		{"(*F).Log", Method, 18, ""},
+		{"(*F).Logf", Method, 18, ""},
+		{"(*F).Name", Method, 18, ""},
+		{"(*F).Setenv", Method, 18, ""},
+		{"(*F).Skip", Method, 18, ""},
+		{"(*F).SkipNow", Method, 18, ""},
+		{"(*F).Skipf", Method, 18, ""},
+		{"(*F).Skipped", Method, 18, ""},
+		{"(*F).TempDir", Method, 18, ""},
+		{"(*M).Run", Method, 4, ""},
+		{"(*PB).Next", Method, 3, ""},
+		{"(*T).Chdir", Method, 24, ""},
+		{"(*T).Cleanup", Method, 14, ""},
+		{"(*T).Context", Method, 24, ""},
+		{"(*T).Deadline", Method, 15, ""},
+		{"(*T).Error", Method, 0, ""},
+		{"(*T).Errorf", Method, 0, ""},
+		{"(*T).Fail", Method, 0, ""},
+		{"(*T).FailNow", Method, 0, ""},
+		{"(*T).Failed", Method, 0, ""},
+		{"(*T).Fatal", Method, 0, ""},
+		{"(*T).Fatalf", Method, 0, ""},
+		{"(*T).Helper", Method, 9, ""},
+		{"(*T).Log", Method, 0, ""},
+		{"(*T).Logf", Method, 0, ""},
+		{"(*T).Name", Method, 8, ""},
+		{"(*T).Parallel", Method, 0, ""},
+		{"(*T).Run", Method, 7, ""},
+		{"(*T).Setenv", Method, 17, ""},
+		{"(*T).Skip", Method, 1, ""},
+		{"(*T).SkipNow", Method, 1, ""},
+		{"(*T).Skipf", Method, 1, ""},
+		{"(*T).Skipped", Method, 1, ""},
+		{"(*T).TempDir", Method, 15, ""},
+		{"(BenchmarkResult).AllocedBytesPerOp", Method, 1, ""},
+		{"(BenchmarkResult).AllocsPerOp", Method, 1, ""},
+		{"(BenchmarkResult).MemString", Method, 1, ""},
+		{"(BenchmarkResult).NsPerOp", Method, 0, ""},
+		{"(BenchmarkResult).String", Method, 0, ""},
+		{"AllocsPerRun", Func, 1, "func(runs int, f func()) (avg float64)"},
+		{"B", Type, 0, ""},
+		{"B.N", Field, 0, ""},
+		{"Benchmark", Func, 0, "func(f func(b *B)) BenchmarkResult"},
+		{"BenchmarkResult", Type, 0, ""},
+		{"BenchmarkResult.Bytes", Field, 0, ""},
+		{"BenchmarkResult.Extra", Field, 13, ""},
+		{"BenchmarkResult.MemAllocs", Field, 1, ""},
+		{"BenchmarkResult.MemBytes", Field, 1, ""},
+		{"BenchmarkResult.N", Field, 0, ""},
+		{"BenchmarkResult.T", Field, 0, ""},
+		{"Cover", Type, 2, ""},
+		{"Cover.Blocks", Field, 2, ""},
+		{"Cover.Counters", Field, 2, ""},
+		{"Cover.CoveredPackages", Field, 2, ""},
+		{"Cover.Mode", Field, 2, ""},
+		{"CoverBlock", Type, 2, ""},
+		{"CoverBlock.Col0", Field, 2, ""},
+		{"CoverBlock.Col1", Field, 2, ""},
+		{"CoverBlock.Line0", Field, 2, ""},
+		{"CoverBlock.Line1", Field, 2, ""},
+		{"CoverBlock.Stmts", Field, 2, ""},
+		{"CoverMode", Func, 8, "func() string"},
+		{"Coverage", Func, 4, "func() float64"},
+		{"F", Type, 18, ""},
+		{"Init", Func, 13, "func()"},
+		{"InternalBenchmark", Type, 0, ""},
+		{"InternalBenchmark.F", Field, 0, ""},
+		{"InternalBenchmark.Name", Field, 0, ""},
+		{"InternalExample", Type, 0, ""},
+		{"InternalExample.F", Field, 0, ""},
+		{"InternalExample.Name", Field, 0, ""},
+		{"InternalExample.Output", Field, 0, ""},
+		{"InternalExample.Unordered", Field, 7, ""},
+		{"InternalFuzzTarget", Type, 18, ""},
+		{"InternalFuzzTarget.Fn", Field, 18, ""},
+		{"InternalFuzzTarget.Name", Field, 18, ""},
+		{"InternalTest", Type, 0, ""},
+		{"InternalTest.F", Field, 0, ""},
+		{"InternalTest.Name", Field, 0, ""},
+		{"M", Type, 4, ""},
+		{"Main", Func, 0, "func(matchString func(pat string, str string) (bool, error), tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample)"},
+		{"MainStart", Func, 4, "func(deps testDeps, tests []InternalTest, benchmarks []InternalBenchmark, fuzzTargets []InternalFuzzTarget, examples []InternalExample) *M"},
+		{"PB", Type, 3, ""},
+		{"RegisterCover", Func, 2, "func(c Cover)"},
+		{"RunBenchmarks", Func, 0, "func(matchString func(pat string, str string) (bool, error), benchmarks []InternalBenchmark)"},
+		{"RunExamples", Func, 0, "func(matchString func(pat string, str string) (bool, error), examples []InternalExample) (ok bool)"},
+		{"RunTests", Func, 0, "func(matchString func(pat string, str string) (bool, error), tests []InternalTest) (ok bool)"},
+		{"Short", Func, 0, "func() bool"},
+		{"T", Type, 0, ""},
+		{"TB", Type, 2, ""},
+		{"Testing", Func, 21, "func() bool"},
+		{"Verbose", Func, 1, "func() bool"},
+	},
+	"testing/fstest": {
+		{"(MapFS).Glob", Method, 16, ""},
+		{"(MapFS).Lstat", Method, 25, ""},
+		{"(MapFS).Open", Method, 16, ""},
+		{"(MapFS).ReadDir", Method, 16, ""},
+		{"(MapFS).ReadFile", Method, 16, ""},
+		{"(MapFS).ReadLink", Method, 25, ""},
+		{"(MapFS).Stat", Method, 16, ""},
+		{"(MapFS).Sub", Method, 16, ""},
+		{"MapFS", Type, 16, ""},
+		{"MapFile", Type, 16, ""},
+		{"MapFile.Data", Field, 16, ""},
+		{"MapFile.ModTime", Field, 16, ""},
+		{"MapFile.Mode", Field, 16, ""},
+		{"MapFile.Sys", Field, 16, ""},
+		{"TestFS", Func, 16, "func(fsys fs.FS, expected ...string) error"},
+	},
+	"testing/iotest": {
+		{"DataErrReader", Func, 0, "func(r io.Reader) io.Reader"},
+		{"ErrReader", Func, 16, "func(err error) io.Reader"},
+		{"ErrTimeout", Var, 0, ""},
+		{"HalfReader", Func, 0, "func(r io.Reader) io.Reader"},
+		{"NewReadLogger", Func, 0, "func(prefix string, r io.Reader) io.Reader"},
+		{"NewWriteLogger", Func, 0, "func(prefix string, w io.Writer) io.Writer"},
+		{"OneByteReader", Func, 0, "func(r io.Reader) io.Reader"},
+		{"TestReader", Func, 16, "func(r io.Reader, content []byte) error"},
+		{"TimeoutReader", Func, 0, "func(r io.Reader) io.Reader"},
+		{"TruncateWriter", Func, 0, "func(w io.Writer, n int64) io.Writer"},
+	},
+	"testing/quick": {
+		{"(*CheckEqualError).Error", Method, 0, ""},
+		{"(*CheckError).Error", Method, 0, ""},
+		{"(SetupError).Error", Method, 0, ""},
+		{"Check", Func, 0, "func(f any, config *Config) error"},
+		{"CheckEqual", Func, 0, "func(f any, g any, config *Config) error"},
+		{"CheckEqualError", Type, 0, ""},
+		{"CheckEqualError.CheckError", Field, 0, ""},
+		{"CheckEqualError.Out1", Field, 0, ""},
+		{"CheckEqualError.Out2", Field, 0, ""},
+		{"CheckError", Type, 0, ""},
+		{"CheckError.Count", Field, 0, ""},
+		{"CheckError.In", Field, 0, ""},
+		{"Config", Type, 0, ""},
+		{"Config.MaxCount", Field, 0, ""},
+		{"Config.MaxCountScale", Field, 0, ""},
+		{"Config.Rand", Field, 0, ""},
+		{"Config.Values", Field, 0, ""},
+		{"Generator", Type, 0, ""},
+		{"SetupError", Type, 0, ""},
+		{"Value", Func, 0, "func(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool)"},
+	},
+	"testing/slogtest": {
+		{"Run", Func, 22, "func(t *testing.T, newHandler func(*testing.T) slog.Handler, result func(*testing.T) map[string]any)"},
+		{"TestHandler", Func, 21, "func(h slog.Handler, results func() []map[string]any) error"},
+	},
+	"text/scanner": {
+		{"(*Position).IsValid", Method, 0, ""},
+		{"(*Scanner).Init", Method, 0, ""},
+		{"(*Scanner).IsValid", Method, 0, ""},
+		{"(*Scanner).Next", Method, 0, ""},
+		{"(*Scanner).Peek", Method, 0, ""},
+		{"(*Scanner).Pos", Method, 0, ""},
+		{"(*Scanner).Scan", Method, 0, ""},
+		{"(*Scanner).TokenText", Method, 0, ""},
+		{"(Position).String", Method, 0, ""},
+		{"(Scanner).String", Method, 0, ""},
+		{"Char", Const, 0, ""},
+		{"Comment", Const, 0, ""},
+		{"EOF", Const, 0, ""},
+		{"Float", Const, 0, ""},
+		{"GoTokens", Const, 0, ""},
+		{"GoWhitespace", Const, 0, ""},
+		{"Ident", Const, 0, ""},
+		{"Int", Const, 0, ""},
+		{"Position", Type, 0, ""},
+		{"Position.Column", Field, 0, ""},
+		{"Position.Filename", Field, 0, ""},
+		{"Position.Line", Field, 0, ""},
+		{"Position.Offset", Field, 0, ""},
+		{"RawString", Const, 0, ""},
+		{"ScanChars", Const, 0, ""},
+		{"ScanComments", Const, 0, ""},
+		{"ScanFloats", Const, 0, ""},
+		{"ScanIdents", Const, 0, ""},
+		{"ScanInts", Const, 0, ""},
+		{"ScanRawStrings", Const, 0, ""},
+		{"ScanStrings", Const, 0, ""},
+		{"Scanner", Type, 0, ""},
+		{"Scanner.Error", Field, 0, ""},
+		{"Scanner.ErrorCount", Field, 0, ""},
+		{"Scanner.IsIdentRune", Field, 4, ""},
+		{"Scanner.Mode", Field, 0, ""},
+		{"Scanner.Position", Field, 0, ""},
+		{"Scanner.Whitespace", Field, 0, ""},
+		{"SkipComments", Const, 0, ""},
+		{"String", Const, 0, ""},
+		{"TokenString", Func, 0, "func(tok rune) string"},
+	},
+	"text/tabwriter": {
+		{"(*Writer).Flush", Method, 0, ""},
+		{"(*Writer).Init", Method, 0, ""},
+		{"(*Writer).Write", Method, 0, ""},
+		{"AlignRight", Const, 0, ""},
+		{"Debug", Const, 0, ""},
+		{"DiscardEmptyColumns", Const, 0, ""},
+		{"Escape", Const, 0, ""},
+		{"FilterHTML", Const, 0, ""},
+		{"NewWriter", Func, 0, "func(output io.Writer, minwidth int, tabwidth int, padding int, padchar byte, flags uint) *Writer"},
+		{"StripEscape", Const, 0, ""},
+		{"TabIndent", Const, 0, ""},
+		{"Writer", Type, 0, ""},
+	},
+	"text/template": {
+		{"(*Template).AddParseTree", Method, 0, ""},
+		{"(*Template).Clone", Method, 0, ""},
+		{"(*Template).DefinedTemplates", Method, 5, ""},
+		{"(*Template).Delims", Method, 0, ""},
+		{"(*Template).Execute", Method, 0, ""},
+		{"(*Template).ExecuteTemplate", Method, 0, ""},
+		{"(*Template).Funcs", Method, 0, ""},
+		{"(*Template).Lookup", Method, 0, ""},
+		{"(*Template).Name", Method, 0, ""},
+		{"(*Template).New", Method, 0, ""},
+		{"(*Template).Option", Method, 5, ""},
+		{"(*Template).Parse", Method, 0, ""},
+		{"(*Template).ParseFS", Method, 16, ""},
+		{"(*Template).ParseFiles", Method, 0, ""},
+		{"(*Template).ParseGlob", Method, 0, ""},
+		{"(*Template).Templates", Method, 0, ""},
+		{"(ExecError).Error", Method, 6, ""},
+		{"(ExecError).Unwrap", Method, 13, ""},
+		{"(Template).Copy", Method, 2, ""},
+		{"(Template).ErrorContext", Method, 1, ""},
+		{"ExecError", Type, 6, ""},
+		{"ExecError.Err", Field, 6, ""},
+		{"ExecError.Name", Field, 6, ""},
+		{"FuncMap", Type, 0, ""},
+		{"HTMLEscape", Func, 0, "func(w io.Writer, b []byte)"},
+		{"HTMLEscapeString", Func, 0, "func(s string) string"},
+		{"HTMLEscaper", Func, 0, "func(args ...any) string"},
+		{"IsTrue", Func, 6, "func(val any) (truth bool, ok bool)"},
+		{"JSEscape", Func, 0, "func(w io.Writer, b []byte)"},
+		{"JSEscapeString", Func, 0, "func(s string) string"},
+		{"JSEscaper", Func, 0, "func(args ...any) string"},
+		{"Must", Func, 0, "func(t *Template, err error) *Template"},
+		{"New", Func, 0, "func(name string) *Template"},
+		{"ParseFS", Func, 16, "func(fsys fs.FS, patterns ...string) (*Template, error)"},
+		{"ParseFiles", Func, 0, "func(filenames ...string) (*Template, error)"},
+		{"ParseGlob", Func, 0, "func(pattern string) (*Template, error)"},
+		{"Template", Type, 0, ""},
+		{"Template.Tree", Field, 0, ""},
+		{"URLQueryEscaper", Func, 0, "func(args ...any) string"},
+	},
+	"text/template/parse": {
+		{"(*ActionNode).Copy", Method, 0, ""},
+		{"(*ActionNode).String", Method, 0, ""},
+		{"(*BoolNode).Copy", Method, 0, ""},
+		{"(*BoolNode).String", Method, 0, ""},
+		{"(*BranchNode).Copy", Method, 4, ""},
+		{"(*BranchNode).String", Method, 0, ""},
+		{"(*BreakNode).Copy", Method, 18, ""},
+		{"(*BreakNode).String", Method, 18, ""},
+		{"(*ChainNode).Add", Method, 1, ""},
+		{"(*ChainNode).Copy", Method, 1, ""},
+		{"(*ChainNode).String", Method, 1, ""},
+		{"(*CommandNode).Copy", Method, 0, ""},
+		{"(*CommandNode).String", Method, 0, ""},
+		{"(*CommentNode).Copy", Method, 16, ""},
+		{"(*CommentNode).String", Method, 16, ""},
+		{"(*ContinueNode).Copy", Method, 18, ""},
+		{"(*ContinueNode).String", Method, 18, ""},
+		{"(*DotNode).Copy", Method, 0, ""},
+		{"(*DotNode).String", Method, 0, ""},
+		{"(*DotNode).Type", Method, 0, ""},
+		{"(*FieldNode).Copy", Method, 0, ""},
+		{"(*FieldNode).String", Method, 0, ""},
+		{"(*IdentifierNode).Copy", Method, 0, ""},
+		{"(*IdentifierNode).SetPos", Method, 1, ""},
+		{"(*IdentifierNode).SetTree", Method, 4, ""},
+		{"(*IdentifierNode).String", Method, 0, ""},
+		{"(*IfNode).Copy", Method, 0, ""},
+		{"(*IfNode).String", Method, 0, ""},
+		{"(*ListNode).Copy", Method, 0, ""},
+		{"(*ListNode).CopyList", Method, 0, ""},
+		{"(*ListNode).String", Method, 0, ""},
+		{"(*NilNode).Copy", Method, 1, ""},
+		{"(*NilNode).String", Method, 1, ""},
+		{"(*NilNode).Type", Method, 1, ""},
+		{"(*NumberNode).Copy", Method, 0, ""},
+		{"(*NumberNode).String", Method, 0, ""},
+		{"(*PipeNode).Copy", Method, 0, ""},
+		{"(*PipeNode).CopyPipe", Method, 0, ""},
+		{"(*PipeNode).String", Method, 0, ""},
+		{"(*RangeNode).Copy", Method, 0, ""},
+		{"(*RangeNode).String", Method, 0, ""},
+		{"(*StringNode).Copy", Method, 0, ""},
+		{"(*StringNode).String", Method, 0, ""},
+		{"(*TemplateNode).Copy", Method, 0, ""},
+		{"(*TemplateNode).String", Method, 0, ""},
+		{"(*TextNode).Copy", Method, 0, ""},
+		{"(*TextNode).String", Method, 0, ""},
+		{"(*Tree).Copy", Method, 2, ""},
+		{"(*Tree).ErrorContext", Method, 1, ""},
+		{"(*Tree).Parse", Method, 0, ""},
+		{"(*VariableNode).Copy", Method, 0, ""},
+		{"(*VariableNode).String", Method, 0, ""},
+		{"(*WithNode).Copy", Method, 0, ""},
+		{"(*WithNode).String", Method, 0, ""},
+		{"(ActionNode).Position", Method, 1, ""},
+		{"(ActionNode).Type", Method, 0, ""},
+		{"(BoolNode).Position", Method, 1, ""},
+		{"(BoolNode).Type", Method, 0, ""},
+		{"(BranchNode).Position", Method, 1, ""},
+		{"(BranchNode).Type", Method, 0, ""},
+		{"(BreakNode).Position", Method, 18, ""},
+		{"(BreakNode).Type", Method, 18, ""},
+		{"(ChainNode).Position", Method, 1, ""},
+		{"(ChainNode).Type", Method, 1, ""},
+		{"(CommandNode).Position", Method, 1, ""},
+		{"(CommandNode).Type", Method, 0, ""},
+		{"(CommentNode).Position", Method, 16, ""},
+		{"(CommentNode).Type", Method, 16, ""},
+		{"(ContinueNode).Position", Method, 18, ""},
+		{"(ContinueNode).Type", Method, 18, ""},
+		{"(DotNode).Position", Method, 1, ""},
+		{"(FieldNode).Position", Method, 1, ""},
+		{"(FieldNode).Type", Method, 0, ""},
+		{"(IdentifierNode).Position", Method, 1, ""},
+		{"(IdentifierNode).Type", Method, 0, ""},
+		{"(IfNode).Position", Method, 1, ""},
+		{"(IfNode).Type", Method, 0, ""},
+		{"(ListNode).Position", Method, 1, ""},
+		{"(ListNode).Type", Method, 0, ""},
+		{"(NilNode).Position", Method, 1, ""},
+		{"(NodeType).Type", Method, 0, ""},
+		{"(NumberNode).Position", Method, 1, ""},
+		{"(NumberNode).Type", Method, 0, ""},
+		{"(PipeNode).Position", Method, 1, ""},
+		{"(PipeNode).Type", Method, 0, ""},
+		{"(Pos).Position", Method, 1, ""},
+		{"(RangeNode).Position", Method, 1, ""},
+		{"(RangeNode).Type", Method, 0, ""},
+		{"(StringNode).Position", Method, 1, ""},
+		{"(StringNode).Type", Method, 0, ""},
+		{"(TemplateNode).Position", Method, 1, ""},
+		{"(TemplateNode).Type", Method, 0, ""},
+		{"(TextNode).Position", Method, 1, ""},
+		{"(TextNode).Type", Method, 0, ""},
+		{"(VariableNode).Position", Method, 1, ""},
+		{"(VariableNode).Type", Method, 0, ""},
+		{"(WithNode).Position", Method, 1, ""},
+		{"(WithNode).Type", Method, 0, ""},
+		{"ActionNode", Type, 0, ""},
+		{"ActionNode.Line", Field, 0, ""},
+		{"ActionNode.NodeType", Field, 0, ""},
+		{"ActionNode.Pipe", Field, 0, ""},
+		{"ActionNode.Pos", Field, 1, ""},
+		{"BoolNode", Type, 0, ""},
+		{"BoolNode.NodeType", Field, 0, ""},
+		{"BoolNode.Pos", Field, 1, ""},
+		{"BoolNode.True", Field, 0, ""},
+		{"BranchNode", Type, 0, ""},
+		{"BranchNode.ElseList", Field, 0, ""},
+		{"BranchNode.Line", Field, 0, ""},
+		{"BranchNode.List", Field, 0, ""},
+		{"BranchNode.NodeType", Field, 0, ""},
+		{"BranchNode.Pipe", Field, 0, ""},
+		{"BranchNode.Pos", Field, 1, ""},
+		{"BreakNode", Type, 18, ""},
+		{"BreakNode.Line", Field, 18, ""},
+		{"BreakNode.NodeType", Field, 18, ""},
+		{"BreakNode.Pos", Field, 18, ""},
+		{"ChainNode", Type, 1, ""},
+		{"ChainNode.Field", Field, 1, ""},
+		{"ChainNode.Node", Field, 1, ""},
+		{"ChainNode.NodeType", Field, 1, ""},
+		{"ChainNode.Pos", Field, 1, ""},
+		{"CommandNode", Type, 0, ""},
+		{"CommandNode.Args", Field, 0, ""},
+		{"CommandNode.NodeType", Field, 0, ""},
+		{"CommandNode.Pos", Field, 1, ""},
+		{"CommentNode", Type, 16, ""},
+		{"CommentNode.NodeType", Field, 16, ""},
+		{"CommentNode.Pos", Field, 16, ""},
+		{"CommentNode.Text", Field, 16, ""},
+		{"ContinueNode", Type, 18, ""},
+		{"ContinueNode.Line", Field, 18, ""},
+		{"ContinueNode.NodeType", Field, 18, ""},
+		{"ContinueNode.Pos", Field, 18, ""},
+		{"DotNode", Type, 0, ""},
+		{"DotNode.NodeType", Field, 4, ""},
+		{"DotNode.Pos", Field, 1, ""},
+		{"FieldNode", Type, 0, ""},
+		{"FieldNode.Ident", Field, 0, ""},
+		{"FieldNode.NodeType", Field, 0, ""},
+		{"FieldNode.Pos", Field, 1, ""},
+		{"IdentifierNode", Type, 0, ""},
+		{"IdentifierNode.Ident", Field, 0, ""},
+		{"IdentifierNode.NodeType", Field, 0, ""},
+		{"IdentifierNode.Pos", Field, 1, ""},
+		{"IfNode", Type, 0, ""},
+		{"IfNode.BranchNode", Field, 0, ""},
+		{"IsEmptyTree", Func, 0, "func(n Node) bool"},
+		{"ListNode", Type, 0, ""},
+		{"ListNode.NodeType", Field, 0, ""},
+		{"ListNode.Nodes", Field, 0, ""},
+		{"ListNode.Pos", Field, 1, ""},
+		{"Mode", Type, 16, ""},
+		{"New", Func, 0, "func(name string, funcs ...map[string]any) *Tree"},
+		{"NewIdentifier", Func, 0, "func(ident string) *IdentifierNode"},
+		{"NilNode", Type, 1, ""},
+		{"NilNode.NodeType", Field, 4, ""},
+		{"NilNode.Pos", Field, 1, ""},
+		{"Node", Type, 0, ""},
+		{"NodeAction", Const, 0, ""},
+		{"NodeBool", Const, 0, ""},
+		{"NodeBreak", Const, 18, ""},
+		{"NodeChain", Const, 1, ""},
+		{"NodeCommand", Const, 0, ""},
+		{"NodeComment", Const, 16, ""},
+		{"NodeContinue", Const, 18, ""},
+		{"NodeDot", Const, 0, ""},
+		{"NodeField", Const, 0, ""},
+		{"NodeIdentifier", Const, 0, ""},
+		{"NodeIf", Const, 0, ""},
+		{"NodeList", Const, 0, ""},
+		{"NodeNil", Const, 1, ""},
+		{"NodeNumber", Const, 0, ""},
+		{"NodePipe", Const, 0, ""},
+		{"NodeRange", Const, 0, ""},
+		{"NodeString", Const, 0, ""},
+		{"NodeTemplate", Const, 0, ""},
+		{"NodeText", Const, 0, ""},
+		{"NodeType", Type, 0, ""},
+		{"NodeVariable", Const, 0, ""},
+		{"NodeWith", Const, 0, ""},
+		{"NumberNode", Type, 0, ""},
+		{"NumberNode.Complex128", Field, 0, ""},
+		{"NumberNode.Float64", Field, 0, ""},
+		{"NumberNode.Int64", Field, 0, ""},
+		{"NumberNode.IsComplex", Field, 0, ""},
+		{"NumberNode.IsFloat", Field, 0, ""},
+		{"NumberNode.IsInt", Field, 0, ""},
+		{"NumberNode.IsUint", Field, 0, ""},
+		{"NumberNode.NodeType", Field, 0, ""},
+		{"NumberNode.Pos", Field, 1, ""},
+		{"NumberNode.Text", Field, 0, ""},
+		{"NumberNode.Uint64", Field, 0, ""},
+		{"Parse", Func, 0, "func(name string, text string, leftDelim string, rightDelim string, funcs ...map[string]any) (map[string]*Tree, error)"},
+		{"ParseComments", Const, 16, ""},
+		{"PipeNode", Type, 0, ""},
+		{"PipeNode.Cmds", Field, 0, ""},
+		{"PipeNode.Decl", Field, 0, ""},
+		{"PipeNode.IsAssign", Field, 11, ""},
+		{"PipeNode.Line", Field, 0, ""},
+		{"PipeNode.NodeType", Field, 0, ""},
+		{"PipeNode.Pos", Field, 1, ""},
+		{"Pos", Type, 1, ""},
+		{"RangeNode", Type, 0, ""},
+		{"RangeNode.BranchNode", Field, 0, ""},
+		{"SkipFuncCheck", Const, 17, ""},
+		{"StringNode", Type, 0, ""},
+		{"StringNode.NodeType", Field, 0, ""},
+		{"StringNode.Pos", Field, 1, ""},
+		{"StringNode.Quoted", Field, 0, ""},
+		{"StringNode.Text", Field, 0, ""},
+		{"TemplateNode", Type, 0, ""},
+		{"TemplateNode.Line", Field, 0, ""},
+		{"TemplateNode.Name", Field, 0, ""},
+		{"TemplateNode.NodeType", Field, 0, ""},
+		{"TemplateNode.Pipe", Field, 0, ""},
+		{"TemplateNode.Pos", Field, 1, ""},
+		{"TextNode", Type, 0, ""},
+		{"TextNode.NodeType", Field, 0, ""},
+		{"TextNode.Pos", Field, 1, ""},
+		{"TextNode.Text", Field, 0, ""},
+		{"Tree", Type, 0, ""},
+		{"Tree.Mode", Field, 16, ""},
+		{"Tree.Name", Field, 0, ""},
+		{"Tree.ParseName", Field, 1, ""},
+		{"Tree.Root", Field, 0, ""},
+		{"VariableNode", Type, 0, ""},
+		{"VariableNode.Ident", Field, 0, ""},
+		{"VariableNode.NodeType", Field, 0, ""},
+		{"VariableNode.Pos", Field, 1, ""},
+		{"WithNode", Type, 0, ""},
+		{"WithNode.BranchNode", Field, 0, ""},
+	},
+	"time": {
+		{"(*Location).String", Method, 0, ""},
+		{"(*ParseError).Error", Method, 0, ""},
+		{"(*Ticker).Reset", Method, 15, ""},
+		{"(*Ticker).Stop", Method, 0, ""},
+		{"(*Time).GobDecode", Method, 0, ""},
+		{"(*Time).UnmarshalBinary", Method, 2, ""},
+		{"(*Time).UnmarshalJSON", Method, 0, ""},
+		{"(*Time).UnmarshalText", Method, 2, ""},
+		{"(*Timer).Reset", Method, 1, ""},
+		{"(*Timer).Stop", Method, 0, ""},
+		{"(Duration).Abs", Method, 19, ""},
+		{"(Duration).Hours", Method, 0, ""},
+		{"(Duration).Microseconds", Method, 13, ""},
+		{"(Duration).Milliseconds", Method, 13, ""},
+		{"(Duration).Minutes", Method, 0, ""},
+		{"(Duration).Nanoseconds", Method, 0, ""},
+		{"(Duration).Round", Method, 9, ""},
+		{"(Duration).Seconds", Method, 0, ""},
+		{"(Duration).String", Method, 0, ""},
+		{"(Duration).Truncate", Method, 9, ""},
+		{"(Month).String", Method, 0, ""},
+		{"(Time).Add", Method, 0, ""},
+		{"(Time).AddDate", Method, 0, ""},
+		{"(Time).After", Method, 0, ""},
+		{"(Time).AppendBinary", Method, 24, ""},
+		{"(Time).AppendFormat", Method, 5, ""},
+		{"(Time).AppendText", Method, 24, ""},
+		{"(Time).Before", Method, 0, ""},
+		{"(Time).Clock", Method, 0, ""},
+		{"(Time).Compare", Method, 20, ""},
+		{"(Time).Date", Method, 0, ""},
+		{"(Time).Day", Method, 0, ""},
+		{"(Time).Equal", Method, 0, ""},
+		{"(Time).Format", Method, 0, ""},
+		{"(Time).GoString", Method, 17, ""},
+		{"(Time).GobEncode", Method, 0, ""},
+		{"(Time).Hour", Method, 0, ""},
+		{"(Time).ISOWeek", Method, 0, ""},
+		{"(Time).In", Method, 0, ""},
+		{"(Time).IsDST", Method, 17, ""},
+		{"(Time).IsZero", Method, 0, ""},
+		{"(Time).Local", Method, 0, ""},
+		{"(Time).Location", Method, 0, ""},
+		{"(Time).MarshalBinary", Method, 2, ""},
+		{"(Time).MarshalJSON", Method, 0, ""},
+		{"(Time).MarshalText", Method, 2, ""},
+		{"(Time).Minute", Method, 0, ""},
+		{"(Time).Month", Method, 0, ""},
+		{"(Time).Nanosecond", Method, 0, ""},
+		{"(Time).Round", Method, 1, ""},
+		{"(Time).Second", Method, 0, ""},
+		{"(Time).String", Method, 0, ""},
+		{"(Time).Sub", Method, 0, ""},
+		{"(Time).Truncate", Method, 1, ""},
+		{"(Time).UTC", Method, 0, ""},
+		{"(Time).Unix", Method, 0, ""},
+		{"(Time).UnixMicro", Method, 17, ""},
+		{"(Time).UnixMilli", Method, 17, ""},
+		{"(Time).UnixNano", Method, 0, ""},
+		{"(Time).Weekday", Method, 0, ""},
+		{"(Time).Year", Method, 0, ""},
+		{"(Time).YearDay", Method, 1, ""},
+		{"(Time).Zone", Method, 0, ""},
+		{"(Time).ZoneBounds", Method, 19, ""},
+		{"(Weekday).String", Method, 0, ""},
+		{"ANSIC", Const, 0, ""},
+		{"After", Func, 0, "func(d Duration) <-chan Time"},
+		{"AfterFunc", Func, 0, "func(d Duration, f func()) *Timer"},
+		{"April", Const, 0, ""},
+		{"August", Const, 0, ""},
+		{"Date", Func, 0, "func(year int, month Month, day int, hour int, min int, sec int, nsec int, loc *Location) Time"},
+		{"DateOnly", Const, 20, ""},
+		{"DateTime", Const, 20, ""},
+		{"December", Const, 0, ""},
+		{"Duration", Type, 0, ""},
+		{"February", Const, 0, ""},
+		{"FixedZone", Func, 0, "func(name string, offset int) *Location"},
+		{"Friday", Const, 0, ""},
+		{"Hour", Const, 0, ""},
+		{"January", Const, 0, ""},
+		{"July", Const, 0, ""},
+		{"June", Const, 0, ""},
+		{"Kitchen", Const, 0, ""},
+		{"Layout", Const, 17, ""},
+		{"LoadLocation", Func, 0, "func(name string) (*Location, error)"},
+		{"LoadLocationFromTZData", Func, 10, "func(name string, data []byte) (*Location, error)"},
+		{"Local", Var, 0, ""},
+		{"Location", Type, 0, ""},
+		{"March", Const, 0, ""},
+		{"May", Const, 0, ""},
+		{"Microsecond", Const, 0, ""},
+		{"Millisecond", Const, 0, ""},
+		{"Minute", Const, 0, ""},
+		{"Monday", Const, 0, ""},
+		{"Month", Type, 0, ""},
+		{"Nanosecond", Const, 0, ""},
+		{"NewTicker", Func, 0, "func(d Duration) *Ticker"},
+		{"NewTimer", Func, 0, "func(d Duration) *Timer"},
+		{"November", Const, 0, ""},
+		{"Now", Func, 0, "func() Time"},
+		{"October", Const, 0, ""},
+		{"Parse", Func, 0, "func(layout string, value string) (Time, error)"},
+		{"ParseDuration", Func, 0, "func(s string) (Duration, error)"},
+		{"ParseError", Type, 0, ""},
+		{"ParseError.Layout", Field, 0, ""},
+		{"ParseError.LayoutElem", Field, 0, ""},
+		{"ParseError.Message", Field, 0, ""},
+		{"ParseError.Value", Field, 0, ""},
+		{"ParseError.ValueElem", Field, 0, ""},
+		{"ParseInLocation", Func, 1, "func(layout string, value string, loc *Location) (Time, error)"},
+		{"RFC1123", Const, 0, ""},
+		{"RFC1123Z", Const, 0, ""},
+		{"RFC3339", Const, 0, ""},
+		{"RFC3339Nano", Const, 0, ""},
+		{"RFC822", Const, 0, ""},
+		{"RFC822Z", Const, 0, ""},
+		{"RFC850", Const, 0, ""},
+		{"RubyDate", Const, 0, ""},
+		{"Saturday", Const, 0, ""},
+		{"Second", Const, 0, ""},
+		{"September", Const, 0, ""},
+		{"Since", Func, 0, "func(t Time) Duration"},
+		{"Sleep", Func, 0, "func(d Duration)"},
+		{"Stamp", Const, 0, ""},
+		{"StampMicro", Const, 0, ""},
+		{"StampMilli", Const, 0, ""},
+		{"StampNano", Const, 0, ""},
+		{"Sunday", Const, 0, ""},
+		{"Thursday", Const, 0, ""},
+		{"Tick", Func, 0, "func(d Duration) <-chan Time"},
+		{"Ticker", Type, 0, ""},
+		{"Ticker.C", Field, 0, ""},
+		{"Time", Type, 0, ""},
+		{"TimeOnly", Const, 20, ""},
+		{"Timer", Type, 0, ""},
+		{"Timer.C", Field, 0, ""},
+		{"Tuesday", Const, 0, ""},
+		{"UTC", Var, 0, ""},
+		{"Unix", Func, 0, "func(sec int64, nsec int64) Time"},
+		{"UnixDate", Const, 0, ""},
+		{"UnixMicro", Func, 17, "func(usec int64) Time"},
+		{"UnixMilli", Func, 17, "func(msec int64) Time"},
+		{"Until", Func, 8, "func(t Time) Duration"},
+		{"Wednesday", Const, 0, ""},
+		{"Weekday", Type, 0, ""},
+	},
+	"unicode": {
+		{"(SpecialCase).ToLower", Method, 0, ""},
+		{"(SpecialCase).ToTitle", Method, 0, ""},
+		{"(SpecialCase).ToUpper", Method, 0, ""},
+		{"ASCII_Hex_Digit", Var, 0, ""},
+		{"Adlam", Var, 7, ""},
+		{"Ahom", Var, 5, ""},
+		{"Anatolian_Hieroglyphs", Var, 5, ""},
+		{"Arabic", Var, 0, ""},
+		{"Armenian", Var, 0, ""},
+		{"Avestan", Var, 0, ""},
+		{"AzeriCase", Var, 0, ""},
+		{"Balinese", Var, 0, ""},
+		{"Bamum", Var, 0, ""},
+		{"Bassa_Vah", Var, 4, ""},
+		{"Batak", Var, 0, ""},
+		{"Bengali", Var, 0, ""},
+		{"Bhaiksuki", Var, 7, ""},
+		{"Bidi_Control", Var, 0, ""},
+		{"Bopomofo", Var, 0, ""},
+		{"Brahmi", Var, 0, ""},
+		{"Braille", Var, 0, ""},
+		{"Buginese", Var, 0, ""},
+		{"Buhid", Var, 0, ""},
+		{"C", Var, 0, ""},
+		{"Canadian_Aboriginal", Var, 0, ""},
+		{"Carian", Var, 0, ""},
+		{"CaseRange", Type, 0, ""},
+		{"CaseRange.Delta", Field, 0, ""},
+		{"CaseRange.Hi", Field, 0, ""},
+		{"CaseRange.Lo", Field, 0, ""},
+		{"CaseRanges", Var, 0, ""},
+		{"Categories", Var, 0, ""},
+		{"Caucasian_Albanian", Var, 4, ""},
+		{"Cc", Var, 0, ""},
+		{"Cf", Var, 0, ""},
+		{"Chakma", Var, 1, ""},
+		{"Cham", Var, 0, ""},
+		{"Cherokee", Var, 0, ""},
+		{"Chorasmian", Var, 16, ""},
+		{"Co", Var, 0, ""},
+		{"Common", Var, 0, ""},
+		{"Coptic", Var, 0, ""},
+		{"Cs", Var, 0, ""},
+		{"Cuneiform", Var, 0, ""},
+		{"Cypriot", Var, 0, ""},
+		{"Cypro_Minoan", Var, 21, ""},
+		{"Cyrillic", Var, 0, ""},
+		{"Dash", Var, 0, ""},
+		{"Deprecated", Var, 0, ""},
+		{"Deseret", Var, 0, ""},
+		{"Devanagari", Var, 0, ""},
+		{"Diacritic", Var, 0, ""},
+		{"Digit", Var, 0, ""},
+		{"Dives_Akuru", Var, 16, ""},
+		{"Dogra", Var, 13, ""},
+		{"Duployan", Var, 4, ""},
+		{"Egyptian_Hieroglyphs", Var, 0, ""},
+		{"Elbasan", Var, 4, ""},
+		{"Elymaic", Var, 14, ""},
+		{"Ethiopic", Var, 0, ""},
+		{"Extender", Var, 0, ""},
+		{"FoldCategory", Var, 0, ""},
+		{"FoldScript", Var, 0, ""},
+		{"Georgian", Var, 0, ""},
+		{"Glagolitic", Var, 0, ""},
+		{"Gothic", Var, 0, ""},
+		{"Grantha", Var, 4, ""},
+		{"GraphicRanges", Var, 0, ""},
+		{"Greek", Var, 0, ""},
+		{"Gujarati", Var, 0, ""},
+		{"Gunjala_Gondi", Var, 13, ""},
+		{"Gurmukhi", Var, 0, ""},
+		{"Han", Var, 0, ""},
+		{"Hangul", Var, 0, ""},
+		{"Hanifi_Rohingya", Var, 13, ""},
+		{"Hanunoo", Var, 0, ""},
+		{"Hatran", Var, 5, ""},
+		{"Hebrew", Var, 0, ""},
+		{"Hex_Digit", Var, 0, ""},
+		{"Hiragana", Var, 0, ""},
+		{"Hyphen", Var, 0, ""},
+		{"IDS_Binary_Operator", Var, 0, ""},
+		{"IDS_Trinary_Operator", Var, 0, ""},
+		{"Ideographic", Var, 0, ""},
+		{"Imperial_Aramaic", Var, 0, ""},
+		{"In", Func, 2, "func(r rune, ranges ...*RangeTable) bool"},
+		{"Inherited", Var, 0, ""},
+		{"Inscriptional_Pahlavi", Var, 0, ""},
+		{"Inscriptional_Parthian", Var, 0, ""},
+		{"Is", Func, 0, "func(rangeTab *RangeTable, r rune) bool"},
+		{"IsControl", Func, 0, "func(r rune) bool"},
+		{"IsDigit", Func, 0, "func(r rune) bool"},
+		{"IsGraphic", Func, 0, "func(r rune) bool"},
+		{"IsLetter", Func, 0, "func(r rune) bool"},
+		{"IsLower", Func, 0, "func(r rune) bool"},
+		{"IsMark", Func, 0, "func(r rune) bool"},
+		{"IsNumber", Func, 0, "func(r rune) bool"},
+		{"IsOneOf", Func, 0, "func(ranges []*RangeTable, r rune) bool"},
+		{"IsPrint", Func, 0, "func(r rune) bool"},
+		{"IsPunct", Func, 0, "func(r rune) bool"},
+		{"IsSpace", Func, 0, "func(r rune) bool"},
+		{"IsSymbol", Func, 0, "func(r rune) bool"},
+		{"IsTitle", Func, 0, "func(r rune) bool"},
+		{"IsUpper", Func, 0, "func(r rune) bool"},
+		{"Javanese", Var, 0, ""},
+		{"Join_Control", Var, 0, ""},
+		{"Kaithi", Var, 0, ""},
+		{"Kannada", Var, 0, ""},
+		{"Katakana", Var, 0, ""},
+		{"Kawi", Var, 21, ""},
+		{"Kayah_Li", Var, 0, ""},
+		{"Kharoshthi", Var, 0, ""},
+		{"Khitan_Small_Script", Var, 16, ""},
+		{"Khmer", Var, 0, ""},
+		{"Khojki", Var, 4, ""},
+		{"Khudawadi", Var, 4, ""},
+		{"L", Var, 0, ""},
+		{"Lao", Var, 0, ""},
+		{"Latin", Var, 0, ""},
+		{"Lepcha", Var, 0, ""},
+		{"Letter", Var, 0, ""},
+		{"Limbu", Var, 0, ""},
+		{"Linear_A", Var, 4, ""},
+		{"Linear_B", Var, 0, ""},
+		{"Lisu", Var, 0, ""},
+		{"Ll", Var, 0, ""},
+		{"Lm", Var, 0, ""},
+		{"Lo", Var, 0, ""},
+		{"Logical_Order_Exception", Var, 0, ""},
+		{"Lower", Var, 0, ""},
+		{"LowerCase", Const, 0, ""},
+		{"Lt", Var, 0, ""},
+		{"Lu", Var, 0, ""},
+		{"Lycian", Var, 0, ""},
+		{"Lydian", Var, 0, ""},
+		{"M", Var, 0, ""},
+		{"Mahajani", Var, 4, ""},
+		{"Makasar", Var, 13, ""},
+		{"Malayalam", Var, 0, ""},
+		{"Mandaic", Var, 0, ""},
+		{"Manichaean", Var, 4, ""},
+		{"Marchen", Var, 7, ""},
+		{"Mark", Var, 0, ""},
+		{"Masaram_Gondi", Var, 10, ""},
+		{"MaxASCII", Const, 0, ""},
+		{"MaxCase", Const, 0, ""},
+		{"MaxLatin1", Const, 0, ""},
+		{"MaxRune", Const, 0, ""},
+		{"Mc", Var, 0, ""},
+		{"Me", Var, 0, ""},
+		{"Medefaidrin", Var, 13, ""},
+		{"Meetei_Mayek", Var, 0, ""},
+		{"Mende_Kikakui", Var, 4, ""},
+		{"Meroitic_Cursive", Var, 1, ""},
+		{"Meroitic_Hieroglyphs", Var, 1, ""},
+		{"Miao", Var, 1, ""},
+		{"Mn", Var, 0, ""},
+		{"Modi", Var, 4, ""},
+		{"Mongolian", Var, 0, ""},
+		{"Mro", Var, 4, ""},
+		{"Multani", Var, 5, ""},
+		{"Myanmar", Var, 0, ""},
+		{"N", Var, 0, ""},
+		{"Nabataean", Var, 4, ""},
+		{"Nag_Mundari", Var, 21, ""},
+		{"Nandinagari", Var, 14, ""},
+		{"Nd", Var, 0, ""},
+		{"New_Tai_Lue", Var, 0, ""},
+		{"Newa", Var, 7, ""},
+		{"Nko", Var, 0, ""},
+		{"Nl", Var, 0, ""},
+		{"No", Var, 0, ""},
+		{"Noncharacter_Code_Point", Var, 0, ""},
+		{"Number", Var, 0, ""},
+		{"Nushu", Var, 10, ""},
+		{"Nyiakeng_Puachue_Hmong", Var, 14, ""},
+		{"Ogham", Var, 0, ""},
+		{"Ol_Chiki", Var, 0, ""},
+		{"Old_Hungarian", Var, 5, ""},
+		{"Old_Italic", Var, 0, ""},
+		{"Old_North_Arabian", Var, 4, ""},
+		{"Old_Permic", Var, 4, ""},
+		{"Old_Persian", Var, 0, ""},
+		{"Old_Sogdian", Var, 13, ""},
+		{"Old_South_Arabian", Var, 0, ""},
+		{"Old_Turkic", Var, 0, ""},
+		{"Old_Uyghur", Var, 21, ""},
+		{"Oriya", Var, 0, ""},
+		{"Osage", Var, 7, ""},
+		{"Osmanya", Var, 0, ""},
+		{"Other", Var, 0, ""},
+		{"Other_Alphabetic", Var, 0, ""},
+		{"Other_Default_Ignorable_Code_Point", Var, 0, ""},
+		{"Other_Grapheme_Extend", Var, 0, ""},
+		{"Other_ID_Continue", Var, 0, ""},
+		{"Other_ID_Start", Var, 0, ""},
+		{"Other_Lowercase", Var, 0, ""},
+		{"Other_Math", Var, 0, ""},
+		{"Other_Uppercase", Var, 0, ""},
+		{"P", Var, 0, ""},
+		{"Pahawh_Hmong", Var, 4, ""},
+		{"Palmyrene", Var, 4, ""},
+		{"Pattern_Syntax", Var, 0, ""},
+		{"Pattern_White_Space", Var, 0, ""},
+		{"Pau_Cin_Hau", Var, 4, ""},
+		{"Pc", Var, 0, ""},
+		{"Pd", Var, 0, ""},
+		{"Pe", Var, 0, ""},
+		{"Pf", Var, 0, ""},
+		{"Phags_Pa", Var, 0, ""},
+		{"Phoenician", Var, 0, ""},
+		{"Pi", Var, 0, ""},
+		{"Po", Var, 0, ""},
+		{"Prepended_Concatenation_Mark", Var, 7, ""},
+		{"PrintRanges", Var, 0, ""},
+		{"Properties", Var, 0, ""},
+		{"Ps", Var, 0, ""},
+		{"Psalter_Pahlavi", Var, 4, ""},
+		{"Punct", Var, 0, ""},
+		{"Quotation_Mark", Var, 0, ""},
+		{"Radical", Var, 0, ""},
+		{"Range16", Type, 0, ""},
+		{"Range16.Hi", Field, 0, ""},
+		{"Range16.Lo", Field, 0, ""},
+		{"Range16.Stride", Field, 0, ""},
+		{"Range32", Type, 0, ""},
+		{"Range32.Hi", Field, 0, ""},
+		{"Range32.Lo", Field, 0, ""},
+		{"Range32.Stride", Field, 0, ""},
+		{"RangeTable", Type, 0, ""},
+		{"RangeTable.LatinOffset", Field, 1, ""},
+		{"RangeTable.R16", Field, 0, ""},
+		{"RangeTable.R32", Field, 0, ""},
+		{"Regional_Indicator", Var, 10, ""},
+		{"Rejang", Var, 0, ""},
+		{"ReplacementChar", Const, 0, ""},
+		{"Runic", Var, 0, ""},
+		{"S", Var, 0, ""},
+		{"STerm", Var, 0, ""},
+		{"Samaritan", Var, 0, ""},
+		{"Saurashtra", Var, 0, ""},
+		{"Sc", Var, 0, ""},
+		{"Scripts", Var, 0, ""},
+		{"Sentence_Terminal", Var, 7, ""},
+		{"Sharada", Var, 1, ""},
+		{"Shavian", Var, 0, ""},
+		{"Siddham", Var, 4, ""},
+		{"SignWriting", Var, 5, ""},
+		{"SimpleFold", Func, 0, "func(r rune) rune"},
+		{"Sinhala", Var, 0, ""},
+		{"Sk", Var, 0, ""},
+		{"Sm", Var, 0, ""},
+		{"So", Var, 0, ""},
+		{"Soft_Dotted", Var, 0, ""},
+		{"Sogdian", Var, 13, ""},
+		{"Sora_Sompeng", Var, 1, ""},
+		{"Soyombo", Var, 10, ""},
+		{"Space", Var, 0, ""},
+		{"SpecialCase", Type, 0, ""},
+		{"Sundanese", Var, 0, ""},
+		{"Syloti_Nagri", Var, 0, ""},
+		{"Symbol", Var, 0, ""},
+		{"Syriac", Var, 0, ""},
+		{"Tagalog", Var, 0, ""},
+		{"Tagbanwa", Var, 0, ""},
+		{"Tai_Le", Var, 0, ""},
+		{"Tai_Tham", Var, 0, ""},
+		{"Tai_Viet", Var, 0, ""},
+		{"Takri", Var, 1, ""},
+		{"Tamil", Var, 0, ""},
+		{"Tangsa", Var, 21, ""},
+		{"Tangut", Var, 7, ""},
+		{"Telugu", Var, 0, ""},
+		{"Terminal_Punctuation", Var, 0, ""},
+		{"Thaana", Var, 0, ""},
+		{"Thai", Var, 0, ""},
+		{"Tibetan", Var, 0, ""},
+		{"Tifinagh", Var, 0, ""},
+		{"Tirhuta", Var, 4, ""},
+		{"Title", Var, 0, ""},
+		{"TitleCase", Const, 0, ""},
+		{"To", Func, 0, "func(_case int, r rune) rune"},
+		{"ToLower", Func, 0, "func(r rune) rune"},
+		{"ToTitle", Func, 0, "func(r rune) rune"},
+		{"ToUpper", Func, 0, "func(r rune) rune"},
+		{"Toto", Var, 21, ""},
+		{"TurkishCase", Var, 0, ""},
+		{"Ugaritic", Var, 0, ""},
+		{"Unified_Ideograph", Var, 0, ""},
+		{"Upper", Var, 0, ""},
+		{"UpperCase", Const, 0, ""},
+		{"UpperLower", Const, 0, ""},
+		{"Vai", Var, 0, ""},
+		{"Variation_Selector", Var, 0, ""},
+		{"Version", Const, 0, ""},
+		{"Vithkuqi", Var, 21, ""},
+		{"Wancho", Var, 14, ""},
+		{"Warang_Citi", Var, 4, ""},
+		{"White_Space", Var, 0, ""},
+		{"Yezidi", Var, 16, ""},
+		{"Yi", Var, 0, ""},
+		{"Z", Var, 0, ""},
+		{"Zanabazar_Square", Var, 10, ""},
+		{"Zl", Var, 0, ""},
+		{"Zp", Var, 0, ""},
+		{"Zs", Var, 0, ""},
+	},
+	"unicode/utf16": {
+		{"AppendRune", Func, 20, "func(a []uint16, r rune) []uint16"},
+		{"Decode", Func, 0, "func(s []uint16) []rune"},
+		{"DecodeRune", Func, 0, "func(r1 rune, r2 rune) rune"},
+		{"Encode", Func, 0, "func(s []rune) []uint16"},
+		{"EncodeRune", Func, 0, "func(r rune) (r1 rune, r2 rune)"},
+		{"IsSurrogate", Func, 0, "func(r rune) bool"},
+		{"RuneLen", Func, 23, "func(r rune) int"},
+	},
+	"unicode/utf8": {
+		{"AppendRune", Func, 18, "func(p []byte, r rune) []byte"},
+		{"DecodeLastRune", Func, 0, "func(p []byte) (r rune, size int)"},
+		{"DecodeLastRuneInString", Func, 0, "func(s string) (r rune, size int)"},
+		{"DecodeRune", Func, 0, "func(p []byte) (r rune, size int)"},
+		{"DecodeRuneInString", Func, 0, "func(s string) (r rune, size int)"},
+		{"EncodeRune", Func, 0, "func(p []byte, r rune) int"},
+		{"FullRune", Func, 0, "func(p []byte) bool"},
+		{"FullRuneInString", Func, 0, "func(s string) bool"},
+		{"MaxRune", Const, 0, ""},
+		{"RuneCount", Func, 0, "func(p []byte) int"},
+		{"RuneCountInString", Func, 0, "func(s string) (n int)"},
+		{"RuneError", Const, 0, ""},
+		{"RuneLen", Func, 0, "func(r rune) int"},
+		{"RuneSelf", Const, 0, ""},
+		{"RuneStart", Func, 0, "func(b byte) bool"},
+		{"UTFMax", Const, 0, ""},
+		{"Valid", Func, 0, "func(p []byte) bool"},
+		{"ValidRune", Func, 1, "func(r rune) bool"},
+		{"ValidString", Func, 0, "func(s string) bool"},
+	},
+	"unique": {
+		{"(Handle).Value", Method, 23, ""},
+		{"Handle", Type, 23, ""},
+		{"Make", Func, 23, "func[T comparable](value T) Handle[T]"},
+	},
+	"unsafe": {
+		{"Add", Func, 0, ""},
+		{"Alignof", Func, 0, ""},
+		{"Offsetof", Func, 0, ""},
+		{"Pointer", Type, 0, ""},
+		{"Sizeof", Func, 0, ""},
+		{"Slice", Func, 0, ""},
+		{"SliceData", Func, 0, ""},
+		{"String", Func, 0, ""},
+		{"StringData", Func, 0, ""},
+	},
+	"weak": {
+		{"(Pointer).Value", Method, 24, ""},
+		{"Make", Func, 24, "func[T any](ptr *T) Pointer[T]"},
+		{"Pointer", Type, 24, ""},
+	},
+}
diff --git a/vendor/golang.org/x/tools/internal/stdlib/stdlib.go b/vendor/golang.org/x/tools/internal/stdlib/stdlib.go
new file mode 100644
index 0000000000..e223e0f340
--- /dev/null
+++ b/vendor/golang.org/x/tools/internal/stdlib/stdlib.go
@@ -0,0 +1,105 @@
+// Copyright 2022 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.
+
+//go:generate go run generate.go
+
+// Package stdlib provides a table of all exported symbols in the
+// standard library, along with the version at which they first
+// appeared. It also provides the import graph of std packages.
+package stdlib
+
+import (
+	"fmt"
+	"strings"
+)
+
+type Symbol struct {
+	Name    string
+	Kind    Kind
+	Version Version // Go version that first included the symbol
+	// Signature provides the type of a function (defined only for Kind=Func).
+	// Imported types are denoted as pkg.T; pkg is not fully qualified.
+	// TODO(adonovan): use an unambiguous encoding that is parseable.
+	//
+	// Example2:
+	//    func[M ~map[K]V, K comparable, V any](m M) M
+	//    func(fi fs.FileInfo, link string) (*Header, error)
+	Signature string // if Kind == stdlib.Func
+}
+
+// A Kind indicates the kind of a symbol:
+// function, variable, constant, type, and so on.
+type Kind int8
+
+const (
+	Invalid Kind = iota // Example name:
+	Type                // "Buffer"
+	Func                // "Println"
+	Var                 // "EOF"
+	Const               // "Pi"
+	Field               // "Point.X"
+	Method              // "(*Buffer).Grow"
+)
+
+func (kind Kind) String() string {
+	return [...]string{
+		Invalid: "invalid",
+		Type:    "type",
+		Func:    "func",
+		Var:     "var",
+		Const:   "const",
+		Field:   "field",
+		Method:  "method",
+	}[kind]
+}
+
+// A Version represents a version of Go of the form "go1.%d".
+type Version int8
+
+// String returns a version string of the form "go1.23", without allocating.
+func (v Version) String() string { return versions[v] }
+
+var versions [30]string // (increase constant as needed)
+
+func init() {
+	for i := range versions {
+		versions[i] = fmt.Sprintf("go1.%d", i)
+	}
+}
+
+// HasPackage reports whether the specified package path is part of
+// the standard library's public API.
+func HasPackage(path string) bool {
+	_, ok := PackageSymbols[path]
+	return ok
+}
+
+// SplitField splits the field symbol name into type and field
+// components. It must be called only on Field symbols.
+//
+// Example: "File.Package" -> ("File", "Package")
+func (sym *Symbol) SplitField() (typename, name string) {
+	if sym.Kind != Field {
+		panic("not a field")
+	}
+	typename, name, _ = strings.Cut(sym.Name, ".")
+	return
+}
+
+// SplitMethod splits the method symbol name into pointer, receiver,
+// and method components. It must be called only on Method symbols.
+//
+// Example: "(*Buffer).Grow" -> (true, "Buffer", "Grow")
+func (sym *Symbol) SplitMethod() (ptr bool, recv, name string) {
+	if sym.Kind != Method {
+		panic("not a method")
+	}
+	recv, name, _ = strings.Cut(sym.Name, ".")
+	recv = recv[len("(") : len(recv)-len(")")]
+	ptr = recv[0] == '*'
+	if ptr {
+		recv = recv[len("*"):]
+	}
+	return
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 6a0549d0c2..1908b1c088 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -587,6 +587,9 @@ github.com/docker/cli/cli/config/types
 ## explicit
 github.com/docker/distribution/digestset
 github.com/docker/distribution/reference
+# github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936
+## explicit; go 1.13
+github.com/dprotaso/go-yit
 # github.com/emicklei/go-restful/v3 v3.12.2
 ## explicit; go 1.13
 github.com/emicklei/go-restful/v3
@@ -663,6 +666,9 @@ github.com/gammazero/deque
 # github.com/gammazero/workerpool v1.1.3
 ## explicit; go 1.18
 github.com/gammazero/workerpool
+# github.com/getkin/kin-openapi v0.128.0
+## explicit; go 1.20
+github.com/getkin/kin-openapi/openapi3
 # github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
 ## explicit
 github.com/ghodss/yaml
@@ -986,6 +992,9 @@ github.com/inconshreveable/mousetrap
 # github.com/invopop/jsonschema v0.7.0
 ## explicit; go 1.16
 github.com/invopop/jsonschema
+# github.com/invopop/yaml v0.3.1
+## explicit; go 1.14
+github.com/invopop/yaml
 # github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
 ## explicit
 github.com/jbenet/go-context/io
@@ -1076,6 +1085,9 @@ github.com/modern-go/concurrent
 # github.com/modern-go/reflect2 v1.0.2
 ## explicit; go 1.12
 github.com/modern-go/reflect2
+# github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
+## explicit
+github.com/mohae/deepcopy
 # github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00
 ## explicit
 github.com/monochromegane/go-gitignore
@@ -1097,6 +1109,11 @@ github.com/nats-io/nkeys
 # github.com/nats-io/nuid v1.0.1
 ## explicit
 github.com/nats-io/nuid
+# github.com/oapi-codegen/oapi-codegen/v2 v2.4.2-0.20250511160408-c8cf342fd5ea
+## explicit; go 1.22
+github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen
+github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen
+github.com/oapi-codegen/oapi-codegen/v2/pkg/util
 # github.com/opencontainers/go-digest v1.0.0
 ## explicit; go 1.13
 github.com/opencontainers/go-digest
@@ -1110,6 +1127,9 @@ github.com/otiai10/copy
 # github.com/patrickmn/go-cache v2.1.0+incompatible
 ## explicit
 github.com/patrickmn/go-cache
+# github.com/perimeterx/marshmallow v1.1.5
+## explicit; go 1.17
+github.com/perimeterx/marshmallow
 # github.com/peterbourgon/diskv v2.0.1+incompatible
 ## explicit
 github.com/peterbourgon/diskv
@@ -1188,6 +1208,15 @@ github.com/sirupsen/logrus
 # github.com/skeema/knownhosts v1.3.0
 ## explicit; go 1.17
 github.com/skeema/knownhosts
+# github.com/speakeasy-api/jsonpath v0.6.0
+## explicit; go 1.22
+github.com/speakeasy-api/jsonpath/pkg/jsonpath
+github.com/speakeasy-api/jsonpath/pkg/jsonpath/config
+github.com/speakeasy-api/jsonpath/pkg/jsonpath/token
+# github.com/speakeasy-api/openapi-overlay v0.10.2
+## explicit; go 1.22
+github.com/speakeasy-api/openapi-overlay/pkg/loader
+github.com/speakeasy-api/openapi-overlay/pkg/overlay
 # github.com/spf13/cobra v1.9.1
 ## explicit; go 1.15
 github.com/spf13/cobra
@@ -1253,6 +1282,9 @@ github.com/vmihailenco/msgpack/v5/msgpcode
 github.com/vmihailenco/tagparser/v2
 github.com/vmihailenco/tagparser/v2/internal
 github.com/vmihailenco/tagparser/v2/internal/parser
+# github.com/vmware-labs/yaml-jsonpath v0.3.2
+## explicit; go 1.13
+github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath
 # github.com/x448/float16 v0.8.4
 ## explicit; go 1.11
 github.com/x448/float16
@@ -1428,6 +1460,9 @@ golang.org/x/exp/maps
 golang.org/x/exp/slices
 # golang.org/x/mod v0.24.0
 ## explicit; go 1.23.0
+golang.org/x/mod/internal/lazyregexp
+golang.org/x/mod/modfile
+golang.org/x/mod/module
 golang.org/x/mod/semver
 # golang.org/x/net v0.40.0
 ## explicit; go 1.23.0
@@ -1478,11 +1513,17 @@ golang.org/x/sys/windows/registry
 golang.org/x/term
 # golang.org/x/text v0.25.0
 ## explicit; go 1.23.0
+golang.org/x/text/cases
 golang.org/x/text/encoding
 golang.org/x/text/encoding/internal
 golang.org/x/text/encoding/internal/identifier
 golang.org/x/text/encoding/unicode
+golang.org/x/text/internal
+golang.org/x/text/internal/language
+golang.org/x/text/internal/language/compact
+golang.org/x/text/internal/tag
 golang.org/x/text/internal/utf8internal
+golang.org/x/text/language
 golang.org/x/text/runes
 golang.org/x/text/secure/bidirule
 golang.org/x/text/transform
@@ -1491,6 +1532,19 @@ golang.org/x/text/unicode/norm
 # golang.org/x/time v0.11.0
 ## explicit; go 1.23.0
 golang.org/x/time/rate
+# golang.org/x/tools v0.33.0
+## explicit; go 1.23.0
+golang.org/x/tools/go/ast/astutil
+golang.org/x/tools/imports
+golang.org/x/tools/internal/event
+golang.org/x/tools/internal/event/core
+golang.org/x/tools/internal/event/keys
+golang.org/x/tools/internal/event/label
+golang.org/x/tools/internal/gocommand
+golang.org/x/tools/internal/gopathwalk
+golang.org/x/tools/internal/imports
+golang.org/x/tools/internal/modindex
+golang.org/x/tools/internal/stdlib
 # google.golang.org/api v0.234.0
 ## explicit; go 1.23.0
 google.golang.org/api/googleapi
diff --git a/wire_gen.go b/wire_gen.go
index 31520f79bb..aa5de9ad89 100644
--- a/wire_gen.go
+++ b/wire_gen.go
@@ -949,7 +949,7 @@ func InitializeApp() (*App, error) {
 	bulkUpdateRepositoryImpl := bulkUpdate.NewBulkUpdateRepository(db, sugaredLogger)
 	deployedAppServiceImpl := deployedApp.NewDeployedAppServiceImpl(sugaredLogger, k8sCommonServiceImpl, devtronAppsHandlerServiceImpl, environmentRepositoryImpl, pipelineRepositoryImpl, cdWorkflowRepositoryImpl)
 	bulkUpdateServiceImpl := service7.NewBulkUpdateServiceImpl(bulkUpdateRepositoryImpl, sugaredLogger, environmentRepositoryImpl, pipelineRepositoryImpl, appRepositoryImpl, deploymentTemplateHistoryServiceImpl, configMapHistoryServiceImpl, pipelineBuilderImpl, enforcerUtilImpl, ciHandlerImpl, ciPipelineRepositoryImpl, appWorkflowRepositoryImpl, appWorkflowServiceImpl, scopedVariableManagerImpl, deployedAppMetricsServiceImpl, chartRefServiceImpl, deployedAppServiceImpl, cdPipelineEventPublishServiceImpl, handlerServiceImpl)
-	bulkUpdateRestHandlerImpl := restHandler.NewBulkUpdateRestHandlerImpl(pipelineBuilderImpl, sugaredLogger, bulkUpdateServiceImpl, chartServiceImpl, propertiesConfigServiceImpl, userServiceImpl, teamServiceImpl, enforcerImpl, ciHandlerImpl, validate, clientImpl, ciPipelineRepositoryImpl, pipelineRepositoryImpl, enforcerUtilImpl, environmentServiceImpl, gitRegistryConfigImpl, dockerRegistryConfigImpl, cdHandlerImpl, appCloneServiceImpl, appWorkflowServiceImpl, materialRepositoryImpl)
+	bulkUpdateRestHandlerImpl := restHandler.NewBulkUpdateRestHandlerImpl(pipelineBuilderImpl, sugaredLogger, bulkUpdateServiceImpl, chartServiceImpl, propertiesConfigServiceImpl, userServiceImpl, enforcerImpl, ciHandlerImpl, validate, clientImpl, ciPipelineRepositoryImpl, pipelineRepositoryImpl, enforcerUtilImpl, environmentServiceImpl, gitRegistryConfigImpl, dockerRegistryConfigImpl, cdHandlerImpl, appCloneServiceImpl, appWorkflowServiceImpl, materialRepositoryImpl)
 	bulkUpdateRouterImpl := router.NewBulkUpdateRouterImpl(bulkUpdateRestHandlerImpl)
 	webhookSecretValidatorImpl := gitWebhook.NewWebhookSecretValidatorImpl(sugaredLogger)
 	webhookEventDataRepositoryImpl := repository2.NewWebhookEventDataRepositoryImpl(db)

From 184183991814ce163d81c1da0c9fae81c96ebde2 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Mon, 30 Jun 2025 03:10:33 +0530
Subject: [PATCH 02/22] feat: added migration support for build edit v2 new
 table

---
 api/restHandler/BulkUpdateRestHandler.go      |  15 +-
 api/restHandler/BulkUpdateRestHandler_ent.go  |   3 +
 .../bulkUpdate/BulkUpdateRepository.go        |  30 ++-
 pkg/bulkAction/bean/bean.go                   |   2 +-
 pkg/bulkAction/service/BulkUpdateService.go   |  27 +--
 .../service/BulkUpdateService_ent.go          |   3 +
 .../sql/33904000_bulk_edit_config.down.sql    |   9 +
 scripts/sql/33904000_bulk_edit_config.up.sql  | 213 ++++++++++++++++++
 .../{bulk_update.yaml => bulk_edit.yaml}      |   0
 specs/bulkEdit/v1beta1/schema.json            |   2 +-
 10 files changed, 273 insertions(+), 31 deletions(-)
 create mode 100644 scripts/sql/33904000_bulk_edit_config.down.sql
 create mode 100644 scripts/sql/33904000_bulk_edit_config.up.sql
 rename specs/bulkEdit/v1beta1/{bulk_update.yaml => bulk_edit.yaml} (100%)

diff --git a/api/restHandler/BulkUpdateRestHandler.go b/api/restHandler/BulkUpdateRestHandler.go
index 61b4a209f4..8ba45a1d0c 100644
--- a/api/restHandler/BulkUpdateRestHandler.go
+++ b/api/restHandler/BulkUpdateRestHandler.go
@@ -60,7 +60,9 @@ type BulkUpdateRestHandler interface {
 
 type BulkEditRestHandler interface {
 	BulkEditV1Beta1RestHandler
-	BulkEditV1Beta2RestHandler
+	// BulkEditV1Beta2RestHandlerEnt interface that defines the methods for bulk edit v1beta2.
+	// v1beta2 is an Ent only version, so it does not have a separate interface.
+	BulkEditV1Beta2RestHandlerEnt
 }
 
 type BulkEditV1Beta1RestHandler interface {
@@ -69,9 +71,6 @@ type BulkEditV1Beta1RestHandler interface {
 	BulkUpdate(w http.ResponseWriter, r *http.Request)
 }
 
-type BulkEditV1Beta2RestHandler interface {
-}
-
 type BulkUpdateRestHandlerImpl struct {
 	pipelineBuilder         pipeline.PipelineBuilder
 	ciPipelineRepository    pipelineConfig.CiPipelineRepository
@@ -137,18 +136,16 @@ func NewBulkUpdateRestHandlerImpl(pipelineBuilder pipeline.PipelineBuilder, logg
 }
 
 func (handler BulkUpdateRestHandlerImpl) FindBulkUpdateReadme(w http.ResponseWriter, r *http.Request) {
-	var operation string
 	vars := mux.Vars(r)
 	apiVersion := vars["apiVersion"]
 	kind := vars["kind"]
-	operation = fmt.Sprintf("%s/%s", apiVersion, kind)
-	response, err := handler.bulkUpdateService.FindBulkUpdateReadme(operation)
+	response, err := handler.bulkUpdateService.GetBulkEditConfig(apiVersion, kind)
 	if err != nil {
 		common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
 		return
 	}
-	//auth free, only login required
-	var responseArr []*bean.BulkUpdateSeeExampleResponse
+	// auth free, only login required
+	var responseArr []*bean.BulkEditConfigResponse
 	responseArr = append(responseArr, response)
 	common.WriteJsonResp(w, nil, responseArr, http.StatusOK)
 }
diff --git a/api/restHandler/BulkUpdateRestHandler_ent.go b/api/restHandler/BulkUpdateRestHandler_ent.go
index 766729ef30..3322414d08 100644
--- a/api/restHandler/BulkUpdateRestHandler_ent.go
+++ b/api/restHandler/BulkUpdateRestHandler_ent.go
@@ -8,6 +8,9 @@ import (
 	"net/http"
 )
 
+type BulkEditV1Beta2RestHandlerEnt interface {
+}
+
 func (handler BulkUpdateRestHandlerImpl) BulkHibernateV1(w http.ResponseWriter, r *http.Request) {
 	handler.BulkHibernate(w, r) // For backward compatibility, redirect to the new handler
 }
diff --git a/internal/sql/repository/bulkUpdate/BulkUpdateRepository.go b/internal/sql/repository/bulkUpdate/BulkUpdateRepository.go
index 58301427b8..7858efde0b 100644
--- a/internal/sql/repository/bulkUpdate/BulkUpdateRepository.go
+++ b/internal/sql/repository/bulkUpdate/BulkUpdateRepository.go
@@ -26,6 +26,8 @@ import (
 	"go.uber.org/zap"
 )
 
+// DEPRECATED: Use BulkEditConfig instead of BulkUpdateReadme.
+// TODO: Remove this table in future versions.
 type BulkUpdateReadme struct {
 	tableName struct{} `sql:"bulk_update_readme" pg:",discard_unknown_columns"`
 	Id        int      `sql:"id"`
@@ -34,10 +36,21 @@ type BulkUpdateReadme struct {
 	Readme    string   `sql:"readme"`
 }
 
+// BulkEditConfig is used to store the configuration for bulk edit operations.
+type BulkEditConfig struct {
+	tableName  struct{} `sql:"bulk_edit_config" pg:",discard_unknown_columns"`
+	Id         int      `sql:"id,pk"`
+	ApiVersion string   `sql:"api_version,notnull"`
+	Kind       string   `sql:"kind,notnull"`
+	Readme     string   `sql:"readme"`
+	Schema     string   `sql:"schema"`
+}
+
 type BulkUpdateRepository interface {
-	FindBulkUpdateReadme(operation string) (*BulkUpdateReadme, error)
+	FindBulkEditConfig(apiVersion, kind string) (*BulkEditConfig, error)
+
+	// methods for Deployment Template :
 
-	//For Deployment Template :
 	FindDeploymentTemplateBulkAppNameForGlobal(appNameIncludes []string, appNameExcludes []string) ([]*app.App, error)
 	FindDeploymentTemplateBulkAppNameForEnv(appNameIncludes []string, appNameExcludes []string, envId int) ([]*app.App, error)
 	FindAppByChartId(chartId int) (*app.App, error)
@@ -47,7 +60,8 @@ type BulkUpdateRepository interface {
 	BulkUpdateChartsValuesYamlAndGlobalOverrideById(id int, patchValuesYml string, patchGlobalOverrideYml string) error
 	BulkUpdateChartsEnvYamlOverrideById(id int, patch string) error
 
-	//For ConfigMap & Secret :
+	// methods for ConfigMap & Secret :
+
 	FindCMBulkAppModelForGlobal(appNameIncludes []string, appNameExcludes []string, configMapNames []string) ([]*chartConfig.ConfigMapAppModel, error)
 	FindSecretBulkAppModelForGlobal(appNameIncludes []string, appNameExcludes []string, secretNames []string) ([]*chartConfig.ConfigMapAppModel, error)
 	FindCMBulkAppModelForEnv(appNameIncludes []string, appNameExcludes []string, envId int, configMapNames []string) ([]*chartConfig.ConfigMapEnvModel, error)
@@ -104,12 +118,14 @@ func appendBuildSecretNameQuery(q *orm.Query, secretNames []string) *orm.Query {
 	return q.Where("secret_data LIKE ANY (array[?])", pg.In(secretNamesLikeClause))
 }
 
-func (repositoryImpl BulkUpdateRepositoryImpl) FindBulkUpdateReadme(resource string) (*BulkUpdateReadme, error) {
-	bulkUpdateReadme := &BulkUpdateReadme{}
+func (repositoryImpl BulkUpdateRepositoryImpl) FindBulkEditConfig(apiVersion, kind string) (*BulkEditConfig, error) {
+	bulkEditConfig := &BulkEditConfig{}
 	err := repositoryImpl.dbConnection.
-		Model(bulkUpdateReadme).Where("resource LIKE ?", resource).
+		Model(bulkEditConfig).
+		Where("api_version = ?", apiVersion).
+		Where("kind = ?", kind).
 		Select()
-	return bulkUpdateReadme, err
+	return bulkEditConfig, err
 }
 
 func (repositoryImpl BulkUpdateRepositoryImpl) FindDeploymentTemplateBulkAppNameForGlobal(appNameIncludes []string, appNameExcludes []string) ([]*app.App, error) {
diff --git a/pkg/bulkAction/bean/bean.go b/pkg/bulkAction/bean/bean.go
index e59c06eab8..9be99a79d7 100644
--- a/pkg/bulkAction/bean/bean.go
+++ b/pkg/bulkAction/bean/bean.go
@@ -49,7 +49,7 @@ type BulkUpdateScript struct {
 	Kind       string             `json:"kind" validate:"required"`
 	Spec       *BulkUpdatePayload `json:"spec" validate:"required"`
 }
-type BulkUpdateSeeExampleResponse struct {
+type BulkEditConfigResponse struct {
 	Operation string            `json:"operation"`
 	Script    *BulkUpdateScript `json:"script" validate:"required"`
 	ReadMe    string            `json:"readme"`
diff --git a/pkg/bulkAction/service/BulkUpdateService.go b/pkg/bulkAction/service/BulkUpdateService.go
index 2e34755b99..c63caf26f0 100644
--- a/pkg/bulkAction/service/BulkUpdateService.go
+++ b/pkg/bulkAction/service/BulkUpdateService.go
@@ -19,7 +19,6 @@ package service
 import (
 	"context"
 	"encoding/base64"
-	"encoding/json"
 	"errors"
 	"fmt"
 	"github.com/devtron-labs/devtron/api/bean"
@@ -68,7 +67,7 @@ import (
 )
 
 type BulkUpdateService interface {
-	FindBulkUpdateReadme(operation string) (response *bean4.BulkUpdateSeeExampleResponse, err error)
+	GetBulkEditConfig(apiVersion, kind string) (response *bean4.BulkEditConfigResponse, err error)
 	GetBulkAppName(bulkUpdateRequest *bean4.BulkUpdatePayload) (*bean4.ImpactedObjectsResponse, error)
 	ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error)
 	BulkUpdateDeploymentTemplate(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.DeploymentTemplateBulkUpdateResponse
@@ -84,6 +83,8 @@ type BulkUpdateService interface {
 
 	GetBulkActionImpactedPipelinesAndWfs(dto *bean4.CdBulkActionRequestDto) ([]*pipelineConfig.Pipeline, []int, []int, error)
 	PerformBulkActionOnCdPipelines(dto *bean4.CdBulkActionRequestDto, impactedPipelines []*pipelineConfig.Pipeline, ctx context.Context, dryRun bool, impactedAppWfIds []int, impactedCiPipelineIds []int) (*bean4.PipelineAndWfBulkActionResponseDto, error)
+	// BulkUpdateServiceEnt is the interface for the bulk update service in the Ent version
+	BulkUpdateServiceEnt
 }
 
 type BulkUpdateServiceImpl struct {
@@ -158,23 +159,23 @@ const (
 	Skipped            = "skipped"
 )
 
-func (impl BulkUpdateServiceImpl) FindBulkUpdateReadme(operation string) (*bean4.BulkUpdateSeeExampleResponse, error) {
-	bulkUpdateReadme, err := impl.bulkUpdateRepository.FindBulkUpdateReadme(operation)
-	response := &bean4.BulkUpdateSeeExampleResponse{}
+func (impl BulkUpdateServiceImpl) GetBulkEditConfig(apiVersion, kind string) (*bean4.BulkEditConfigResponse, error) {
+	bulkEditConfig, err := impl.bulkUpdateRepository.FindBulkEditConfig(apiVersion, kind)
+	response := &bean4.BulkEditConfigResponse{}
 	if err != nil {
 		impl.logger.Errorw("error in fetching batch operation example", "err", err)
 		return response, err
 	}
-	script := &bean4.BulkUpdateScript{}
-	err = json.Unmarshal([]byte(bulkUpdateReadme.Script), &script)
-	if err != nil {
-		impl.logger.Errorw("error in script value(in db) of batch operation example", "err", err)
-		return response, err
+	// script is only maintained for backward compatibility,
+	// there is valid usage of this field in the UI.
+	script := &bean4.BulkUpdateScript{
+		ApiVersion: bulkEditConfig.ApiVersion,
+		Kind:       bulkEditConfig.Kind,
 	}
-	response = &bean4.BulkUpdateSeeExampleResponse{
-		Operation: bulkUpdateReadme.Resource,
+	response = &bean4.BulkEditConfigResponse{
+		Operation: fmt.Sprintf("%s/%s", bulkEditConfig.ApiVersion, bulkEditConfig.Kind),
 		Script:    script,
-		ReadMe:    bulkUpdateReadme.Readme,
+		ReadMe:    bulkEditConfig.Readme,
 	}
 	return response, nil
 }
diff --git a/pkg/bulkAction/service/BulkUpdateService_ent.go b/pkg/bulkAction/service/BulkUpdateService_ent.go
index f8344d8bda..d0eeb8d2d6 100644
--- a/pkg/bulkAction/service/BulkUpdateService_ent.go
+++ b/pkg/bulkAction/service/BulkUpdateService_ent.go
@@ -6,6 +6,9 @@ import (
 	"github.com/devtron-labs/devtron/pkg/bulkAction/bean"
 )
 
+type BulkUpdateServiceEnt interface {
+}
+
 func (impl BulkUpdateServiceImpl) isEnvDTConfigUpdateAllowed(ctx context.Context, appId, envId int, userMetadata *userBean.UserMetadata) error {
 	return nil
 }
diff --git a/scripts/sql/33904000_bulk_edit_config.down.sql b/scripts/sql/33904000_bulk_edit_config.down.sql
new file mode 100644
index 0000000000..31b65004d2
--- /dev/null
+++ b/scripts/sql/33904000_bulk_edit_config.down.sql
@@ -0,0 +1,9 @@
+BEGIN;
+
+-- Drop table
+DROP TABLE IF EXISTS "public"."bulk_edit_config";
+
+-- Drop sequence
+DROP SEQUENCE IF EXISTS id_seq_bulk_edit_config;
+
+COMMIT;
\ No newline at end of file
diff --git a/scripts/sql/33904000_bulk_edit_config.up.sql b/scripts/sql/33904000_bulk_edit_config.up.sql
new file mode 100644
index 0000000000..a123e7a2d1
--- /dev/null
+++ b/scripts/sql/33904000_bulk_edit_config.up.sql
@@ -0,0 +1,213 @@
+BEGIN;
+
+-- Create a new sequence
+CREATE SEQUENCE IF NOT EXISTS id_seq_bulk_edit_config;
+
+-- Create a new table
+CREATE TABLE IF NOT EXISTS "public"."bulk_edit_config" (
+    "id"            INTEGER             NOT NULL DEFAULT nextval('id_seq_workflow_config_snapshot'::regclass),
+    "api_version"   VARCHAR(255) NOT NULL,
+    "kind"          VARCHAR(255) NOT NULL,
+    "readme"        TEXT,
+    "schema"        TEXT,
+    "created_on"    timestamptz NOT NULL,
+    "created_by"    INTEGER NOT NULL,
+    "updated_on"    timestamptz,
+    "updated_by"    INTEGER,
+    PRIMARY KEY ("id"),
+    UNIQUE ("api_version", "kind")
+);
+
+-- Insert data from bulk_update_readme (assuming only one row for 'v1beta1/application')
+INSERT INTO "public"."bulk_edit_config" ("api_version", "kind", "readme", "schema", "created_on", "created_by")
+SELECT 'v1beta1', 'application','# Bulk Update - Application
+
+This feature helps you to update Deployment Template, ConfigMaps & Secrets for multiple apps in one go! You can filter the apps on the basis of environments, global flag, and app names(we provide support for both substrings included and excluded in the app name).
+
+## Example
+
+Example below will select all applications having `abc and xyz` present in their name and out of those will exclude applications having `abcd and xyza` in their name. Since global flag is false and envId 23 is provided, it will make changes in envId 23 and not in global deployment template for this application.
+
+If you want to update globally then please set `global: true`. If you have provided envId by deployment template, configMap or secret is not overridden for that particular environment then it will not apply the changes.
+Also, of all the provided names of configMaps/secrets, for every app & environment override only the name that are present in them will be considered.
+
+```
+apiVersion: batch/v1beta1
+kind: Application
+spec:
+  includes:
+    names:
+    - "%abc%"
+    - "%xyz%"
+  excludes:
+    names:
+    - "%abcd%"
+    - "%xyza%"
+  envIds:
+  - 23
+  global: false
+  deploymentTemplate:
+    spec:
+      patchJson: ''[{ "op": "add", "path": "/MaxSurge", "value": 1 },{"op": "replace","path":"/GracePeriod","value": "30"}]''
+  configMap:
+    spec:
+      names:
+      - "configmap1"
+      - "configmap2"
+      - "configmap3"
+      patchJson: ''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''
+  secret:
+    spec:
+      names:
+      - "secret1"
+      - "secret2"
+      patchJson: ''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''
+```
+
+## Payload Configuration
+
+
+The following tables list the configurable parameters of the Payload component in the Script and their description along with example. Also, if you do not need to apply updates on all the tasks, i.e. Deployment Template, ConfigMaps & Secrets, leave the Spec object empty for that respective task.
+
+| Parameter                      | Description                        | Example                                                    |
+| -------------------------- | ---------------------------------- | ---------------------------------------------------------- |
+|`includes.names `        | Will filter apps having exact string or similar substrings                 | `["app%","%abc", "xyz"]` (will include all apps having `"app%"` **OR** `"%abc"` as one of their substring, example - app1, app-test, test-abc etc. **OR** application with name xyz)    |
+| `excludes.names`          | Will filter apps not having exact string or similar substrings.              | `["%z","%y", "abc"]`       (will filter out all apps having `"%z"` **OR** `"%y"` as one of their substring, example - appz, test-app-y etc. **OR** application with name abc)                                        |
+| `envIds`       | List of envIds to be updated for the selected applications.           | `[1,2,3]`                                                   |
+| `global`       | Flag to update global deployment template of applications.            | `true`,`false`                                                        |
+| `deploymentTemplate.spec.patchJson`       | String having the update operation(you can apply more than one changes at a time). It supports [JSON patch ](http://jsonpatch.com/) specifications for update. | `''[ { "op": "add", "path": "/MaxSurge", "value": 1 }, { "op": "replace", "path": "/GracePeriod", "value": "30" }]''` |
+| `configMap.spec.names`      | Names of all ConfigMaps to be updated. | `configmap1`,`configmap2`,`configmap3` |
+| `secret.spec.names`      | Names of all Secrets to be updated. | `secret1`,`secret2`|
+| `configMap.spec.patchJson` / `secret.spec.patchJson`       | String having the update operation for ConfigMaps/Secrets(you can apply more than one changes at a time). It supports [JSON patch ](http://jsonpatch.com/) specifications for update. | `''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''`(Replace the `{key}` part to the key you want to perform operation on & the `{value}`is the key''s corresponding value |
+','{
+  "$schema": "https://json-schema.org/draft/2020-12/schema",
+  "title": "Bulk Edit Application batch/v1beta1 Schema",
+  "type": "object",
+  "description": "Input Script for bulk edit",
+  "required": [
+    "apiVersion",
+    "kind",
+    "spec"
+  ],
+  "properties": {
+    "apiVersion": {
+      "const": "v1beta1"
+    },
+    "kind": {
+      "const": "Application"
+    },
+    "spec": {
+      "type": "object",
+      "anyOf": [
+        {
+          "required": [
+            "deploymentTemplate"
+          ]
+        },
+        {
+          "required": [
+            "configMap"
+          ]
+        },
+        {
+          "required": [
+            "secret"
+          ]
+        }
+      ],
+      "properties": {
+        "includes": {
+          "type": "object",
+          "properties": {
+            "names": {
+              "type": "array",
+              "items": {
+                "type": "string",
+                "pattern": "^[a-z%]+[a-z0-9%\\-\\?]*[a-z0-9%]+$"
+              },
+              "description": "Array of application names to be included"
+            }
+          }
+        },
+        "excludes": {
+          "type": "object",
+          "properties": {
+            "names": {
+              "type": "array",
+              "items": {
+                "type": "string",
+                "pattern": "^[a-z%]+[a-z0-9%\\-\\?]*[a-z0-9%]+$"
+              },
+              "description": "Array of application names to be excluded"
+            }
+          }
+        },
+        "envIds": {
+          "type": "array",
+          "items": {
+            "type": "integer",
+            "exclusiveMinimum": 0
+          },
+          "description": "Array of Environment Ids of dependent apps"
+        },
+        "global": {
+          "type": "boolean",
+          "description": "Flag for updating base Configurations of dependent apps"
+        },
+        "deploymentTemplate": {
+          "type": "object",
+          "properties": {
+            "spec": {
+              "type": "object",
+              "properties": {
+                "patchData": {
+                  "type": "string",
+                  "description": "String with details of the patch to be used for updating"
+                }
+              }
+            }
+          }
+        },
+        "configMap": {
+          "type": "object",
+          "properties": {
+            "names": {
+              "type": "array",
+              "items": {
+                "type": "string",
+                "pattern": "^[a-z]+[a-z0-9\\-\\?]*[a-z0-9]+$"
+              },
+              "description": "Name of all ConfigMaps to be updated"
+            },
+            "patchData": {
+              "type": "string",
+              "description": "String with details of the patch to be used for updating"
+            }
+          }
+        },
+        "secret": {
+          "type": "object",
+          "properties": {
+            "names": {
+              "type": "array",
+              "items": {
+                "type": "string"
+              },
+              "description": "Name of all Secrets to be updated"
+            },
+            "patchData": {
+              "type": "string",
+              "description": "String with details of the patch to be used for updating"
+            }
+          }
+        }
+      }
+    }
+  }
+}', NOW(), 1
+WHERE NOT EXISTS (
+    SELECT 1 FROM "public"."bulk_edit_config"
+    WHERE api_version = 'v1beta1' AND kind = 'application'
+);
+
+COMMIT;
diff --git a/specs/bulkEdit/v1beta1/bulk_update.yaml b/specs/bulkEdit/v1beta1/bulk_edit.yaml
similarity index 100%
rename from specs/bulkEdit/v1beta1/bulk_update.yaml
rename to specs/bulkEdit/v1beta1/bulk_edit.yaml
diff --git a/specs/bulkEdit/v1beta1/schema.json b/specs/bulkEdit/v1beta1/schema.json
index fd6d253e47..4b08570461 100644
--- a/specs/bulkEdit/v1beta1/schema.json
+++ b/specs/bulkEdit/v1beta1/schema.json
@@ -10,7 +10,7 @@
   ],
   "properties": {
     "apiVersion": {
-      "const": "batch/v1beta1"
+      "const": "v1beta1"
     },
     "kind": {
       "const": "Application"

From 243220fae9ac6520604d94277f844f98df13d80c Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Mon, 30 Jun 2025 12:10:00 +0530
Subject: [PATCH 03/22] chore: updated method names

---
 api/restHandler/BulkUpdateRestHandler.go    | 36 +++++++++++----------
 api/router/BulkUpdateRouter.go              |  6 ++--
 pkg/bulkAction/service/BulkUpdateService.go |  4 +--
 3 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/api/restHandler/BulkUpdateRestHandler.go b/api/restHandler/BulkUpdateRestHandler.go
index 8ba45a1d0c..800456d79a 100644
--- a/api/restHandler/BulkUpdateRestHandler.go
+++ b/api/restHandler/BulkUpdateRestHandler.go
@@ -66,9 +66,9 @@ type BulkEditRestHandler interface {
 }
 
 type BulkEditV1Beta1RestHandler interface {
-	FindBulkUpdateReadme(w http.ResponseWriter, r *http.Request)
-	GetImpactedAppsName(w http.ResponseWriter, r *http.Request)
-	BulkUpdate(w http.ResponseWriter, r *http.Request)
+	GetBulkEditConfig(w http.ResponseWriter, r *http.Request)
+	DryRunBulkEdit(w http.ResponseWriter, r *http.Request)
+	BulkEdit(w http.ResponseWriter, r *http.Request)
 }
 
 type BulkUpdateRestHandlerImpl struct {
@@ -135,7 +135,7 @@ func NewBulkUpdateRestHandlerImpl(pipelineBuilder pipeline.PipelineBuilder, logg
 	}
 }
 
-func (handler BulkUpdateRestHandlerImpl) FindBulkUpdateReadme(w http.ResponseWriter, r *http.Request) {
+func (handler BulkUpdateRestHandlerImpl) GetBulkEditConfig(w http.ResponseWriter, r *http.Request) {
 	vars := mux.Vars(r)
 	apiVersion := vars["apiVersion"]
 	kind := vars["kind"]
@@ -165,7 +165,8 @@ func (handler BulkUpdateRestHandlerImpl) CheckAuthForImpactedObjects(AppId int,
 	return true
 
 }
-func (handler BulkUpdateRestHandlerImpl) GetImpactedAppsName(w http.ResponseWriter, r *http.Request) {
+
+func (handler BulkUpdateRestHandlerImpl) DryRunBulkEdit(w http.ResponseWriter, r *http.Request) {
 	decoder := json.NewDecoder(r.Body)
 	var script bean.BulkUpdateScript
 	err := decoder.Decode(&script)
@@ -180,34 +181,34 @@ func (handler BulkUpdateRestHandlerImpl) GetImpactedAppsName(w http.ResponseWrit
 		return
 	}
 	token := r.Header.Get("token")
-	impactedApps, err := handler.bulkUpdateService.GetBulkAppName(script.Spec)
+	impactedObjects, err := handler.bulkUpdateService.DryRunBulkEdit(script.Spec)
 	if err != nil {
 		common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
 		return
 	}
 	appResourceObjects, envResourceObjects := handler.enforcerUtil.GetRbacObjectsForAllAppsAndEnvironments()
-	for _, deploymentTemplateImpactedApp := range impactedApps.DeploymentTemplate {
+	for _, deploymentTemplateImpactedApp := range impactedObjects.DeploymentTemplate {
 		ok := handler.CheckAuthForImpactedObjects(deploymentTemplateImpactedApp.AppId, deploymentTemplateImpactedApp.EnvId, appResourceObjects, envResourceObjects, token)
 		if !ok {
 			common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
 			return
 		}
 	}
-	for _, configMapImpactedApp := range impactedApps.ConfigMap {
+	for _, configMapImpactedApp := range impactedObjects.ConfigMap {
 		ok := handler.CheckAuthForImpactedObjects(configMapImpactedApp.AppId, configMapImpactedApp.EnvId, appResourceObjects, envResourceObjects, token)
 		if !ok {
 			common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
 			return
 		}
 	}
-	for _, secretImpactedApp := range impactedApps.Secret {
+	for _, secretImpactedApp := range impactedObjects.Secret {
 		ok := handler.CheckAuthForImpactedObjects(secretImpactedApp.AppId, secretImpactedApp.EnvId, appResourceObjects, envResourceObjects, token)
 		if !ok {
 			common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
 			return
 		}
 	}
-	common.WriteJsonResp(w, err, impactedApps, http.StatusOK)
+	common.WriteJsonResp(w, err, impactedObjects, http.StatusOK)
 }
 
 func (handler BulkUpdateRestHandlerImpl) CheckAuthForBulkUpdate(AppId int, EnvId int, AppName string, rbacObjects map[int]string, token string) bool {
@@ -224,7 +225,8 @@ func (handler BulkUpdateRestHandlerImpl) CheckAuthForBulkUpdate(AppId int, EnvId
 	return true
 
 }
-func (handler BulkUpdateRestHandlerImpl) BulkUpdate(w http.ResponseWriter, r *http.Request) {
+
+func (handler BulkUpdateRestHandlerImpl) BulkEdit(w http.ResponseWriter, r *http.Request) {
 	userId, err := handler.userAuthService.GetLoggedInUser(r)
 	if userId == 0 || err != nil {
 		common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
@@ -244,28 +246,28 @@ func (handler BulkUpdateRestHandlerImpl) BulkUpdate(w http.ResponseWriter, r *ht
 		return
 	}
 	token := r.Header.Get("token")
-	impactedApps, err := handler.bulkUpdateService.GetBulkAppName(script.Spec)
+	impactedObjects, err := handler.bulkUpdateService.DryRunBulkEdit(script.Spec)
 	if err != nil {
 		common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
 		return
 	}
 	rbacObjects := handler.enforcerUtil.GetRbacObjectsForAllApps(helper.CustomApp)
-	for _, deploymentTemplateImpactedApp := range impactedApps.DeploymentTemplate {
+	for _, deploymentTemplateImpactedApp := range impactedObjects.DeploymentTemplate {
 		ok := handler.CheckAuthForBulkUpdate(deploymentTemplateImpactedApp.AppId, deploymentTemplateImpactedApp.EnvId, deploymentTemplateImpactedApp.AppName, rbacObjects, token)
 		if !ok {
 			common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
 			return
 		}
 	}
-	for _, configMapImpactedApp := range impactedApps.ConfigMap {
-		ok := handler.CheckAuthForBulkUpdate(configMapImpactedApp.AppId, configMapImpactedApp.EnvId, configMapImpactedApp.AppName, rbacObjects, token)
+	for _, impactedConfigMap := range impactedObjects.ConfigMap {
+		ok := handler.CheckAuthForBulkUpdate(impactedConfigMap.AppId, impactedConfigMap.EnvId, impactedConfigMap.AppName, rbacObjects, token)
 		if !ok {
 			common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
 			return
 		}
 	}
-	for _, secretImpactedApp := range impactedApps.Secret {
-		ok := handler.CheckAuthForBulkUpdate(secretImpactedApp.AppId, secretImpactedApp.EnvId, secretImpactedApp.AppName, rbacObjects, token)
+	for _, impactedSecret := range impactedObjects.Secret {
+		ok := handler.CheckAuthForBulkUpdate(impactedSecret.AppId, impactedSecret.EnvId, impactedSecret.AppName, rbacObjects, token)
 		if !ok {
 			common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
 			return
diff --git a/api/router/BulkUpdateRouter.go b/api/router/BulkUpdateRouter.go
index 8c4067df94..d620040617 100644
--- a/api/router/BulkUpdateRouter.go
+++ b/api/router/BulkUpdateRouter.go
@@ -37,7 +37,7 @@ func NewBulkUpdateRouterImpl(handler restHandler.BulkUpdateRestHandler) *BulkUpd
 }
 
 func (router BulkUpdateRouterImpl) initBulkUpdateRouter(bulkRouter *mux.Router) {
-	bulkRouter.Path("/{apiVersion}/{kind}/readme").HandlerFunc(router.restHandler.FindBulkUpdateReadme).Methods("GET")
+	bulkRouter.Path("/{apiVersion}/{kind}/readme").HandlerFunc(router.restHandler.GetBulkEditConfig).Methods("GET")
 	// Initialize v1beta1 routes
 	router.initV1beta1Router(bulkRouter)
 	// Initialize v1beta2 routes
@@ -47,8 +47,8 @@ func (router BulkUpdateRouterImpl) initBulkUpdateRouter(bulkRouter *mux.Router)
 }
 
 func (router BulkUpdateRouterImpl) initV1beta1Router(bulkRouter *mux.Router) {
-	bulkRouter.Path("/v1beta1/application/dryrun").HandlerFunc(router.restHandler.GetImpactedAppsName).Methods("POST")
-	bulkRouter.Path("/v1beta1/application").HandlerFunc(router.restHandler.BulkUpdate).Methods("POST")
+	bulkRouter.Path("/v1beta1/application/dryrun").HandlerFunc(router.restHandler.DryRunBulkEdit).Methods("POST")
+	bulkRouter.Path("/v1beta1/application").HandlerFunc(router.restHandler.BulkEdit).Methods("POST")
 
 	bulkRouter.Path("/v1beta1/hibernate").HandlerFunc(router.restHandler.BulkHibernate).Methods("POST")
 	bulkRouter.Path("/v1beta1/unhibernate").HandlerFunc(router.restHandler.BulkUnHibernate).Methods("POST")
diff --git a/pkg/bulkAction/service/BulkUpdateService.go b/pkg/bulkAction/service/BulkUpdateService.go
index c63caf26f0..1d4688144c 100644
--- a/pkg/bulkAction/service/BulkUpdateService.go
+++ b/pkg/bulkAction/service/BulkUpdateService.go
@@ -68,7 +68,7 @@ import (
 
 type BulkUpdateService interface {
 	GetBulkEditConfig(apiVersion, kind string) (response *bean4.BulkEditConfigResponse, err error)
-	GetBulkAppName(bulkUpdateRequest *bean4.BulkUpdatePayload) (*bean4.ImpactedObjectsResponse, error)
+	DryRunBulkEdit(bulkUpdateRequest *bean4.BulkUpdatePayload) (*bean4.ImpactedObjectsResponse, error)
 	ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error)
 	BulkUpdateDeploymentTemplate(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.DeploymentTemplateBulkUpdateResponse
 	BulkUpdateConfigMap(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse
@@ -180,7 +180,7 @@ func (impl BulkUpdateServiceImpl) GetBulkEditConfig(apiVersion, kind string) (*b
 	return response, nil
 }
 
-func (impl BulkUpdateServiceImpl) GetBulkAppName(bulkUpdatePayload *bean4.BulkUpdatePayload) (*bean4.ImpactedObjectsResponse, error) {
+func (impl BulkUpdateServiceImpl) DryRunBulkEdit(bulkUpdatePayload *bean4.BulkUpdatePayload) (*bean4.ImpactedObjectsResponse, error) {
 	impactedObjectsResponse := &bean4.ImpactedObjectsResponse{}
 	deploymentTemplateImpactedObjects := []*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp{}
 	configMapImpactedObjects := []*bean4.CmAndSecretImpactedObjectsResponseForOneApp{}

From 1111cc90196bcc3446c69c04483cb7409f7da02b Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Mon, 7 Jul 2025 12:36:14 +0530
Subject: [PATCH 04/22] chore: common refactoring for bulk edit v2

---
 Wire.go                                       |   6 +-
 api/restHandler/BulkUpdateRestHandler.go      |   2 +-
 .../chartConfig/ConfigMapRepository.go        |  40 ++
 .../repository/BulkEditRepository.go          |  49 +-
 .../repository/BulkEditRepository_ent.go      |  20 +
 pkg/bulkAction/service/BulkUpdateService.go   | 418 ++++++++++--------
 tests/pipeline/BulkUpdateService_test.go      |   4 +-
 tests/pipeline/ChartService_test.go           |  11 +-
 wire_gen.go                                   |   6 +-
 9 files changed, 331 insertions(+), 225 deletions(-)
 rename internal/sql/repository/bulkUpdate/BulkUpdateRepository.go => pkg/bulkAction/repository/BulkEditRepository.go (79%)
 create mode 100644 pkg/bulkAction/repository/BulkEditRepository_ent.go

diff --git a/Wire.go b/Wire.go
index 9e0bbff87b..90fbd3f9c9 100644
--- a/Wire.go
+++ b/Wire.go
@@ -102,7 +102,6 @@ import (
 	app2 "github.com/devtron-labs/devtron/internal/sql/repository/app"
 	appStatusRepo "github.com/devtron-labs/devtron/internal/sql/repository/appStatus"
 	appWorkflow2 "github.com/devtron-labs/devtron/internal/sql/repository/appWorkflow"
-	"github.com/devtron-labs/devtron/internal/sql/repository/bulkUpdate"
 	"github.com/devtron-labs/devtron/internal/sql/repository/chartConfig"
 	dockerRegistryRepository "github.com/devtron-labs/devtron/internal/sql/repository/dockerRegistry"
 	"github.com/devtron-labs/devtron/internal/sql/repository/helper"
@@ -127,6 +126,7 @@ import (
 	"github.com/devtron-labs/devtron/pkg/build"
 	"github.com/devtron-labs/devtron/pkg/build/artifacts/imageTagging"
 	pipeline6 "github.com/devtron-labs/devtron/pkg/build/pipeline"
+	repository11 "github.com/devtron-labs/devtron/pkg/bulkAction/repository"
 	"github.com/devtron-labs/devtron/pkg/bulkAction/service"
 	"github.com/devtron-labs/devtron/pkg/chart"
 	"github.com/devtron-labs/devtron/pkg/chart/gitOpsConfig"
@@ -266,8 +266,8 @@ func InitializeApp() (*App, error) {
 		app.NewAppService,
 		wire.Bind(new(app.AppService), new(*app.AppServiceImpl)),
 
-		bulkUpdate.NewBulkUpdateRepository,
-		wire.Bind(new(bulkUpdate.BulkUpdateRepository), new(*bulkUpdate.BulkUpdateRepositoryImpl)),
+		repository11.NewBulkEditRepository,
+		wire.Bind(new(repository11.BulkEditRepository), new(*repository11.BulkEditRepositoryImpl)),
 
 		chartConfig.NewEnvConfigOverrideRepository,
 		wire.Bind(new(chartConfig.EnvConfigOverrideRepository), new(*chartConfig.EnvConfigOverrideRepositoryImpl)),
diff --git a/api/restHandler/BulkUpdateRestHandler.go b/api/restHandler/BulkUpdateRestHandler.go
index 800456d79a..c17e1cfb56 100644
--- a/api/restHandler/BulkUpdateRestHandler.go
+++ b/api/restHandler/BulkUpdateRestHandler.go
@@ -275,7 +275,7 @@ func (handler BulkUpdateRestHandlerImpl) BulkEdit(w http.ResponseWriter, r *http
 	}
 	isSuperAdmin := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionCreate, "*")
 	userMetadata := util2.GetUserMetadata(r.Context(), userId, isSuperAdmin)
-	response := handler.bulkUpdateService.BulkUpdate(r.Context(), script.Spec, userMetadata)
+	response := handler.bulkUpdateService.BulkEdit(r.Context(), script.Spec, userMetadata)
 	common.WriteJsonResp(w, nil, response, http.StatusOK)
 }
 
diff --git a/internal/sql/repository/chartConfig/ConfigMapRepository.go b/internal/sql/repository/chartConfig/ConfigMapRepository.go
index 764378765c..1816be1cd8 100644
--- a/internal/sql/repository/chartConfig/ConfigMapRepository.go
+++ b/internal/sql/repository/chartConfig/ConfigMapRepository.go
@@ -42,6 +42,13 @@ type ConfigMapRepository interface {
 	GetConfigNamesForAppAndEnvLevel(appId int, envId int) ([]bean.ConfigNameAndType, error)
 }
 
+type ConfigModel interface {
+	GetAppId() int
+	GetSecretData() string
+	GetConfigMapData() string
+	GetEnvironmentId() *int
+}
+
 type ConfigMapRepositoryImpl struct {
 	dbConnection *pg.DB
 	Logger       *zap.SugaredLogger
@@ -64,6 +71,23 @@ type ConfigMapAppModel struct {
 	SecretData    string   `sql:"secret_data"`
 	sql.AuditLog
 }
+
+func (c *ConfigMapAppModel) GetAppId() int {
+	return c.AppId
+}
+
+func (c *ConfigMapAppModel) GetSecretData() string {
+	return c.SecretData
+}
+
+func (c *ConfigMapAppModel) GetConfigMapData() string {
+	return c.ConfigMapData
+}
+
+func (c *ConfigMapAppModel) GetEnvironmentId() *int {
+	return nil
+}
+
 type cMCSNames struct {
 	Id     int    `json:"id"`
 	CMName string `json:"cm_name"`
@@ -162,6 +186,22 @@ type ConfigMapEnvModel struct {
 	sql.AuditLog
 }
 
+func (c *ConfigMapEnvModel) GetAppId() int {
+	return c.AppId
+}
+
+func (c *ConfigMapEnvModel) GetSecretData() string {
+	return c.SecretData
+}
+
+func (c *ConfigMapEnvModel) GetConfigMapData() string {
+	return c.ConfigMapData
+}
+
+func (c *ConfigMapEnvModel) GetEnvironmentId() *int {
+	return &c.EnvironmentId
+}
+
 func (impl ConfigMapRepositoryImpl) CreateEnvLevel(model *ConfigMapEnvModel) (*ConfigMapEnvModel, error) {
 	currentTime := time.Now()
 	model.CreatedOn = currentTime
diff --git a/internal/sql/repository/bulkUpdate/BulkUpdateRepository.go b/pkg/bulkAction/repository/BulkEditRepository.go
similarity index 79%
rename from internal/sql/repository/bulkUpdate/BulkUpdateRepository.go
rename to pkg/bulkAction/repository/BulkEditRepository.go
index 7858efde0b..366ac66b23 100644
--- a/internal/sql/repository/bulkUpdate/BulkUpdateRepository.go
+++ b/pkg/bulkAction/repository/BulkEditRepository.go
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package bulkUpdate
+package repository
 
 import (
 	"github.com/devtron-labs/devtron/internal/sql/repository/app"
@@ -46,7 +46,7 @@ type BulkEditConfig struct {
 	Schema     string   `sql:"schema"`
 }
 
-type BulkUpdateRepository interface {
+type BulkEditRepository interface {
 	FindBulkEditConfig(apiVersion, kind string) (*BulkEditConfig, error)
 
 	// methods for Deployment Template :
@@ -70,15 +70,18 @@ type BulkUpdateRepository interface {
 	BulkUpdateSecretDataForGlobalById(id int, patch string) error
 	BulkUpdateConfigMapDataForEnvById(id int, patch string) error
 	BulkUpdateSecretDataForEnvById(id int, patch string) error
+
+	// BulkEditRepositoryEnt is used for ent-specific operations.
+	BulkEditRepositoryEnt
 }
 
-func NewBulkUpdateRepository(dbConnection *pg.DB,
-	logger *zap.SugaredLogger) *BulkUpdateRepositoryImpl {
-	return &BulkUpdateRepositoryImpl{dbConnection: dbConnection,
+func NewBulkEditRepository(dbConnection *pg.DB,
+	logger *zap.SugaredLogger) *BulkEditRepositoryImpl {
+	return &BulkEditRepositoryImpl{dbConnection: dbConnection,
 		logger: logger}
 }
 
-type BulkUpdateRepositoryImpl struct {
+type BulkEditRepositoryImpl struct {
 	dbConnection *pg.DB
 	logger       *zap.SugaredLogger
 }
@@ -118,7 +121,7 @@ func appendBuildSecretNameQuery(q *orm.Query, secretNames []string) *orm.Query {
 	return q.Where("secret_data LIKE ANY (array[?])", pg.In(secretNamesLikeClause))
 }
 
-func (repositoryImpl BulkUpdateRepositoryImpl) FindBulkEditConfig(apiVersion, kind string) (*BulkEditConfig, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindBulkEditConfig(apiVersion, kind string) (*BulkEditConfig, error) {
 	bulkEditConfig := &BulkEditConfig{}
 	err := repositoryImpl.dbConnection.
 		Model(bulkEditConfig).
@@ -128,7 +131,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindBulkEditConfig(apiVersion, ki
 	return bulkEditConfig, err
 }
 
-func (repositoryImpl BulkUpdateRepositoryImpl) FindDeploymentTemplateBulkAppNameForGlobal(appNameIncludes []string, appNameExcludes []string) ([]*app.App, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindDeploymentTemplateBulkAppNameForGlobal(appNameIncludes []string, appNameExcludes []string) ([]*app.App, error) {
 	apps := []*app.App{}
 	q := repositoryImpl.dbConnection.
 		Model(&apps).Join("INNER JOIN charts ch ON app.id = ch.app_id").
@@ -139,7 +142,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindDeploymentTemplateBulkAppName
 	return apps, err
 }
 
-func (repositoryImpl BulkUpdateRepositoryImpl) FindDeploymentTemplateBulkAppNameForEnv(appNameIncludes []string, appNameExcludes []string, envId int) ([]*app.App, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindDeploymentTemplateBulkAppNameForEnv(appNameIncludes []string, appNameExcludes []string, envId int) ([]*app.App, error) {
 	apps := []*app.App{}
 	q := repositoryImpl.dbConnection.
 		Model(&apps).Join("INNER JOIN charts ch ON app.id = ch.app_id").
@@ -151,7 +154,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindDeploymentTemplateBulkAppName
 	err := q.Select()
 	return apps, err
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) FindCMBulkAppModelForGlobal(appNameIncludes []string, appNameExcludes []string, configMapNames []string) ([]*chartConfig.ConfigMapAppModel, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindCMBulkAppModelForGlobal(appNameIncludes []string, appNameExcludes []string, configMapNames []string) ([]*chartConfig.ConfigMapAppModel, error) {
 	CmAndSecretAppModel := []*chartConfig.ConfigMapAppModel{}
 	q := repositoryImpl.dbConnection.
 		Model(&CmAndSecretAppModel).Join("INNER JOIN app ON app.id = config_map_app_model.app_id").
@@ -161,7 +164,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindCMBulkAppModelForGlobal(appNa
 	err := q.Select()
 	return CmAndSecretAppModel, err
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) FindSecretBulkAppModelForGlobal(appNameIncludes []string, appNameExcludes []string, secretNames []string) ([]*chartConfig.ConfigMapAppModel, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindSecretBulkAppModelForGlobal(appNameIncludes []string, appNameExcludes []string, secretNames []string) ([]*chartConfig.ConfigMapAppModel, error) {
 	CmAndSecretAppModel := []*chartConfig.ConfigMapAppModel{}
 	q := repositoryImpl.dbConnection.
 		Model(&CmAndSecretAppModel).Join("INNER JOIN app ON app.id = config_map_app_model.app_id").
@@ -171,7 +174,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindSecretBulkAppModelForGlobal(a
 	err := q.Select()
 	return CmAndSecretAppModel, err
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) FindCMBulkAppModelForEnv(appNameIncludes []string, appNameExcludes []string, envId int, configMapNames []string) ([]*chartConfig.ConfigMapEnvModel, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindCMBulkAppModelForEnv(appNameIncludes []string, appNameExcludes []string, envId int, configMapNames []string) ([]*chartConfig.ConfigMapEnvModel, error) {
 	CmAndSecretEnvModel := []*chartConfig.ConfigMapEnvModel{}
 	q := repositoryImpl.dbConnection.
 		Model(&CmAndSecretEnvModel).Join("INNER JOIN app ON app.id = config_map_env_model.app_id").
@@ -182,7 +185,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindCMBulkAppModelForEnv(appNameI
 	err := q.Select()
 	return CmAndSecretEnvModel, err
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) FindSecretBulkAppModelForEnv(appNameIncludes []string, appNameExcludes []string, envId int, secretNames []string) ([]*chartConfig.ConfigMapEnvModel, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindSecretBulkAppModelForEnv(appNameIncludes []string, appNameExcludes []string, envId int, secretNames []string) ([]*chartConfig.ConfigMapEnvModel, error) {
 	CmAndSecretEnvModel := []*chartConfig.ConfigMapEnvModel{}
 	q := repositoryImpl.dbConnection.
 		Model(&CmAndSecretEnvModel).Join("INNER JOIN app ON app.id = config_map_env_model.app_id").
@@ -193,7 +196,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindSecretBulkAppModelForEnv(appN
 	err := q.Select()
 	return CmAndSecretEnvModel, err
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) FindAppByChartId(chartId int) (*app.App, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindAppByChartId(chartId int) (*app.App, error) {
 	app := &app.App{}
 	err := repositoryImpl.dbConnection.
 		Model(app).Join("INNER JOIN charts ch ON app.id = ch.app_id").
@@ -203,7 +206,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindAppByChartId(chartId int) (*a
 		Select()
 	return app, err
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) FindAppByChartEnvId(chartEnvId int) (*app.App, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindAppByChartEnvId(chartEnvId int) (*app.App, error) {
 	app := &app.App{}
 	err := repositoryImpl.dbConnection.
 		Model(app).Join("INNER JOIN charts ch ON app.id = ch.app_id").
@@ -214,7 +217,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindAppByChartEnvId(chartEnvId in
 		Select()
 	return app, err
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) FindBulkChartsByAppNameSubstring(appNameIncludes []string, appNameExcludes []string) ([]*chartRepoRepository.Chart, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindBulkChartsByAppNameSubstring(appNameIncludes []string, appNameExcludes []string) ([]*chartRepoRepository.Chart, error) {
 	charts := []*chartRepoRepository.Chart{}
 	q := repositoryImpl.dbConnection.
 		Model(&charts).Join("INNER JOIN app ON app.id=app_id ").
@@ -225,7 +228,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindBulkChartsByAppNameSubstring(
 	return charts, err
 }
 
-func (repositoryImpl BulkUpdateRepositoryImpl) FindBulkChartsEnvByAppNameSubstring(appNameIncludes []string, appNameExcludes []string, envId int) ([]*chartConfig.EnvConfigOverride, error) {
+func (repositoryImpl BulkEditRepositoryImpl) FindBulkChartsEnvByAppNameSubstring(appNameIncludes []string, appNameExcludes []string, envId int) ([]*chartConfig.EnvConfigOverride, error) {
 	charts := []*chartConfig.EnvConfigOverride{}
 	q := repositoryImpl.dbConnection.
 		Model(&charts).Join("INNER JOIN charts ch ON ch.id=env_config_override.chart_id").
@@ -238,7 +241,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) FindBulkChartsEnvByAppNameSubstri
 	err := q.Select()
 	return charts, err
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateChartsValuesYamlAndGlobalOverrideById(id int, patchValuesYml string, patchGlobalOverrideYml string) error {
+func (repositoryImpl BulkEditRepositoryImpl) BulkUpdateChartsValuesYamlAndGlobalOverrideById(id int, patchValuesYml string, patchGlobalOverrideYml string) error {
 	chart := &chartRepoRepository.Chart{}
 	_, err := repositoryImpl.dbConnection.
 		Model(chart).
@@ -252,7 +255,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateChartsValuesYamlAndGlob
 	}
 	return nil
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateChartsEnvYamlOverrideById(id int, patch string) error {
+func (repositoryImpl BulkEditRepositoryImpl) BulkUpdateChartsEnvYamlOverrideById(id int, patch string) error {
 	chartEnv := &chartConfig.EnvConfigOverride{}
 	_, err := repositoryImpl.dbConnection.
 		Model(chartEnv).
@@ -265,7 +268,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateChartsEnvYamlOverrideBy
 	}
 	return nil
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateConfigMapDataForGlobalById(id int, patch string) error {
+func (repositoryImpl BulkEditRepositoryImpl) BulkUpdateConfigMapDataForGlobalById(id int, patch string) error {
 	CmAppModel := &chartConfig.ConfigMapAppModel{}
 	_, err := repositoryImpl.dbConnection.
 		Model(CmAppModel).
@@ -278,7 +281,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateConfigMapDataForGlobalB
 	}
 	return nil
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateSecretDataForGlobalById(id int, patch string) error {
+func (repositoryImpl BulkEditRepositoryImpl) BulkUpdateSecretDataForGlobalById(id int, patch string) error {
 	SecretAppModel := &chartConfig.ConfigMapAppModel{}
 	_, err := repositoryImpl.dbConnection.
 		Model(SecretAppModel).
@@ -291,7 +294,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateSecretDataForGlobalById
 	}
 	return nil
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateConfigMapDataForEnvById(id int, patch string) error {
+func (repositoryImpl BulkEditRepositoryImpl) BulkUpdateConfigMapDataForEnvById(id int, patch string) error {
 	CmEnvModel := &chartConfig.ConfigMapEnvModel{}
 	_, err := repositoryImpl.dbConnection.
 		Model(CmEnvModel).
@@ -304,7 +307,7 @@ func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateConfigMapDataForEnvById
 	}
 	return nil
 }
-func (repositoryImpl BulkUpdateRepositoryImpl) BulkUpdateSecretDataForEnvById(id int, patch string) error {
+func (repositoryImpl BulkEditRepositoryImpl) BulkUpdateSecretDataForEnvById(id int, patch string) error {
 	SecretEnvModel := &chartConfig.ConfigMapEnvModel{}
 	_, err := repositoryImpl.dbConnection.
 		Model(SecretEnvModel).
diff --git a/pkg/bulkAction/repository/BulkEditRepository_ent.go b/pkg/bulkAction/repository/BulkEditRepository_ent.go
new file mode 100644
index 0000000000..1bcb98cd4c
--- /dev/null
+++ b/pkg/bulkAction/repository/BulkEditRepository_ent.go
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2024. Devtron Inc.
+ *
+ * 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.
+ */
+
+package repository
+
+type BulkEditRepositoryEnt interface {
+}
diff --git a/pkg/bulkAction/service/BulkUpdateService.go b/pkg/bulkAction/service/BulkUpdateService.go
index 1d4688144c..ee73238e42 100644
--- a/pkg/bulkAction/service/BulkUpdateService.go
+++ b/pkg/bulkAction/service/BulkUpdateService.go
@@ -28,7 +28,6 @@ import (
 	"github.com/devtron-labs/devtron/internal/sql/models"
 	"github.com/devtron-labs/devtron/internal/sql/repository/app"
 	"github.com/devtron-labs/devtron/internal/sql/repository/appWorkflow"
-	"github.com/devtron-labs/devtron/internal/sql/repository/bulkUpdate"
 	"github.com/devtron-labs/devtron/internal/sql/repository/chartConfig"
 	"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
 	"github.com/devtron-labs/devtron/internal/util"
@@ -38,6 +37,7 @@ import (
 	"github.com/devtron-labs/devtron/pkg/build/trigger"
 	"github.com/devtron-labs/devtron/pkg/bulkAction/adaptor"
 	bean4 "github.com/devtron-labs/devtron/pkg/bulkAction/bean"
+	"github.com/devtron-labs/devtron/pkg/bulkAction/repository"
 	"github.com/devtron-labs/devtron/pkg/bulkAction/utils"
 	chartRepoRepository "github.com/devtron-labs/devtron/pkg/chartRepo/repository"
 	repository2 "github.com/devtron-labs/devtron/pkg/cluster/environment/repository"
@@ -56,6 +56,7 @@ import (
 	repository5 "github.com/devtron-labs/devtron/pkg/variables/repository"
 	util2 "github.com/devtron-labs/devtron/util"
 	"github.com/devtron-labs/devtron/util/rbac"
+	"github.com/devtron-labs/devtron/util/sliceUtil"
 	jsonpatch "github.com/evanphx/json-patch"
 	"github.com/go-pg/pg"
 	"github.com/tidwall/gjson"
@@ -69,11 +70,11 @@ import (
 type BulkUpdateService interface {
 	GetBulkEditConfig(apiVersion, kind string) (response *bean4.BulkEditConfigResponse, err error)
 	DryRunBulkEdit(bulkUpdateRequest *bean4.BulkUpdatePayload) (*bean4.ImpactedObjectsResponse, error)
+	BulkEdit(ctx context.Context, bulkUpdateRequest *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) (bulkUpdateResponse *bean4.BulkUpdateResponse)
 	ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error)
 	BulkUpdateDeploymentTemplate(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.DeploymentTemplateBulkUpdateResponse
 	BulkUpdateConfigMap(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse
 	BulkUpdateSecret(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse
-	BulkUpdate(ctx context.Context, bulkUpdateRequest *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) (bulkUpdateResponse *bean4.BulkUpdateResponse)
 	// BulkHibernate deprecated
 	BulkHibernate(ctx context.Context, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token string, appObject string, envObject string) bool, userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error)
 	BulkHibernateV1(ctx context.Context, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token string, appObject string, envObject string) bool, userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error)
@@ -88,7 +89,7 @@ type BulkUpdateService interface {
 }
 
 type BulkUpdateServiceImpl struct {
-	bulkUpdateRepository             bulkUpdate.BulkUpdateRepository
+	bulkEditRepository               repository.BulkEditRepository
 	logger                           *zap.SugaredLogger
 	environmentRepository            repository2.EnvironmentRepository
 	pipelineRepository               pipelineConfig.PipelineRepository
@@ -109,7 +110,7 @@ type BulkUpdateServiceImpl struct {
 	ciHandlerService                 trigger.HandlerService
 }
 
-func NewBulkUpdateServiceImpl(bulkUpdateRepository bulkUpdate.BulkUpdateRepository,
+func NewBulkUpdateServiceImpl(bulkUpdateRepository repository.BulkEditRepository,
 	logger *zap.SugaredLogger,
 	environmentRepository repository2.EnvironmentRepository,
 	pipelineRepository pipelineConfig.PipelineRepository,
@@ -130,7 +131,7 @@ func NewBulkUpdateServiceImpl(bulkUpdateRepository bulkUpdate.BulkUpdateReposito
 	ciHandlerService trigger.HandlerService,
 ) *BulkUpdateServiceImpl {
 	return &BulkUpdateServiceImpl{
-		bulkUpdateRepository:             bulkUpdateRepository,
+		bulkEditRepository:               bulkUpdateRepository,
 		logger:                           logger,
 		environmentRepository:            environmentRepository,
 		pipelineRepository:               pipelineRepository,
@@ -160,7 +161,7 @@ const (
 )
 
 func (impl BulkUpdateServiceImpl) GetBulkEditConfig(apiVersion, kind string) (*bean4.BulkEditConfigResponse, error) {
-	bulkEditConfig, err := impl.bulkUpdateRepository.FindBulkEditConfig(apiVersion, kind)
+	bulkEditConfig, err := impl.bulkEditRepository.FindBulkEditConfig(apiVersion, kind)
 	response := &bean4.BulkEditConfigResponse{}
 	if err != nil {
 		impl.logger.Errorw("error in fetching batch operation example", "err", err)
@@ -180,11 +181,171 @@ func (impl BulkUpdateServiceImpl) GetBulkEditConfig(apiVersion, kind string) (*b
 	return response, nil
 }
 
+func (impl BulkUpdateServiceImpl) getImpactedBaseSecrets(cmAndSecretReq *bean4.CmAndSecretTask, appNameIncludes, appNameExcludes []string) ([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, error) {
+	return impl.getImpactedSecrets(cmAndSecretReq, appNameIncludes, appNameExcludes, 0)
+}
+
+func (impl BulkUpdateServiceImpl) getImpactedSecrets(cmAndSecretReq *bean4.CmAndSecretTask, appNameIncludes, appNameExcludes []string, envId int) ([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, error) {
+	if cmAndSecretReq == nil || cmAndSecretReq.Spec == nil || len(cmAndSecretReq.Spec.Names) == 0 {
+		return make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0), nil
+	}
+	secretNames := util2.GetCopyByValueObject(cmAndSecretReq.Spec.Names)
+	var secretModels []chartConfig.ConfigModel
+	if envId > 0 {
+		secretEnvModels, err := impl.bulkEditRepository.FindSecretBulkAppModelForEnv(appNameIncludes, appNameExcludes, envId, secretNames)
+		if err != nil {
+			impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
+			return nil, err
+		}
+		secretModels = sliceUtil.NewSliceFromFuncExec(secretEnvModels, func(model *chartConfig.ConfigMapEnvModel) chartConfig.ConfigModel {
+			return model
+		})
+	} else {
+		secretAppModels, err := impl.bulkEditRepository.FindSecretBulkAppModelForGlobal(appNameIncludes, appNameExcludes, secretNames)
+		if err != nil {
+			impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
+			return make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0), err
+		}
+		secretModels = sliceUtil.NewSliceFromFuncExec(secretAppModels, func(model *chartConfig.ConfigMapAppModel) chartConfig.ConfigModel {
+			return model
+		})
+	}
+	secretImpactedObjects := make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0, len(secretModels))
+	secretSpecNames := make(map[string]bool)
+	if len(secretModels) != 0 {
+		for _, name := range cmAndSecretReq.Spec.Names {
+			secretSpecNames[name] = true
+		}
+	}
+	for _, secretAppModel := range secretModels {
+		var finalSecretNames []string
+		existingSecretNames := gjson.Get(secretAppModel.GetSecretData(), "secrets.#.name")
+		for _, secretName := range existingSecretNames.Array() {
+			_, contains := secretSpecNames[secretName.String()]
+			if contains == true {
+				finalSecretNames = append(finalSecretNames, secretName.String())
+			}
+		}
+		if len(finalSecretNames) != 0 {
+			appDetailsById, _ := impl.appRepository.FindById(secretAppModel.GetAppId())
+			secretImpactedObject := &bean4.CmAndSecretImpactedObjectsResponseForOneApp{
+				AppId:   secretAppModel.GetAppId(),
+				AppName: appDetailsById.AppName,
+				Names:   finalSecretNames,
+			}
+			if envId > 0 {
+				secretImpactedObject.EnvId = envId
+			}
+			secretImpactedObjects = append(secretImpactedObjects, secretImpactedObject)
+		}
+	}
+	return secretImpactedObjects, nil
+}
+
+func (impl BulkUpdateServiceImpl) getImpactedBaseConfigMaps(cmAndSecretReq *bean4.CmAndSecretTask, appNameIncludes, appNameExcludes []string) ([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, error) {
+	return impl.getImpactedConfigMaps(cmAndSecretReq, appNameIncludes, appNameExcludes, 0)
+}
+
+func (impl BulkUpdateServiceImpl) getImpactedConfigMaps(cmAndSecretReq *bean4.CmAndSecretTask, appNameIncludes, appNameExcludes []string, envId int) ([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, error) {
+	if cmAndSecretReq == nil || cmAndSecretReq.Spec == nil || len(cmAndSecretReq.Spec.Names) == 0 {
+		return make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0), nil
+	}
+	cmNames := util2.GetCopyByValueObject(cmAndSecretReq.Spec.Names)
+	var configMapModels []chartConfig.ConfigModel
+	if envId > 0 {
+		configMapEnvModels, err := impl.bulkEditRepository.FindCMBulkAppModelForEnv(appNameIncludes, appNameExcludes, envId, cmNames)
+		if err != nil {
+			impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
+			return nil, err
+		}
+		configMapModels = sliceUtil.NewSliceFromFuncExec(configMapEnvModels, func(model *chartConfig.ConfigMapEnvModel) chartConfig.ConfigModel {
+			return model
+		})
+	} else {
+		configMapAppModels, err := impl.bulkEditRepository.FindCMBulkAppModelForGlobal(appNameIncludes, appNameExcludes, cmNames)
+		if err != nil {
+			impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
+			return make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0), err
+		}
+		configMapModels = sliceUtil.NewSliceFromFuncExec(configMapAppModels, func(model *chartConfig.ConfigMapAppModel) chartConfig.ConfigModel {
+			return model
+		})
+	}
+	configMapImpactedObjects := make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0, len(configMapModels))
+	configMapSpecNames := make(map[string]bool)
+	if len(configMapModels) != 0 {
+		for _, name := range cmAndSecretReq.Spec.Names {
+			configMapSpecNames[name] = true
+		}
+	}
+	for _, configMapAppModel := range configMapModels {
+		var finalConfigMapNames []string
+		configMapNames := gjson.Get(configMapAppModel.GetConfigMapData(), "maps.#.name")
+		for _, configMapName := range configMapNames.Array() {
+			_, contains := configMapSpecNames[configMapName.String()]
+			if contains == true {
+				finalConfigMapNames = append(finalConfigMapNames, configMapName.String())
+			}
+		}
+		if len(finalConfigMapNames) != 0 {
+			appDetailsById, err := impl.appRepository.FindById(configMapAppModel.GetAppId())
+			if err != nil {
+				impl.logger.Errorw("error in fetching app details by id", "err", err, "appId", configMapAppModel.GetAppId())
+				return nil, err
+			}
+			configMapImpactedObject := &bean4.CmAndSecretImpactedObjectsResponseForOneApp{
+				AppId:   configMapAppModel.GetAppId(),
+				AppName: appDetailsById.AppName,
+				Names:   finalConfigMapNames,
+			}
+			if envId > 0 {
+				configMapImpactedObject.EnvId = envId
+			}
+			configMapImpactedObjects = append(configMapImpactedObjects, configMapImpactedObject)
+		}
+	}
+	return configMapImpactedObjects, nil
+}
+
+func (impl BulkUpdateServiceImpl) getImpactedBaseDeploymentTemplates(deploymentTemplateReq *bean4.DeploymentTemplateTask, appNameIncludes, appNameExcludes []string) ([]*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp, error) {
+	return impl.getImpactedDeploymentTemplates(deploymentTemplateReq, appNameIncludes, appNameExcludes, 0)
+}
+
+func (impl BulkUpdateServiceImpl) getImpactedDeploymentTemplates(deploymentTemplateReq *bean4.DeploymentTemplateTask, appNameIncludes, appNameExcludes []string, envId int) ([]*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp, error) {
+	if deploymentTemplateReq == nil || deploymentTemplateReq.Spec == nil {
+		return make([]*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp, 0), nil
+	}
+	var impactedAppObjects []*app.App
+	var err error
+	if envId > 0 {
+		impactedAppObjects, err = impl.bulkEditRepository.FindDeploymentTemplateBulkAppNameForEnv(appNameIncludes, appNameExcludes, envId)
+		if err != nil {
+			impl.logger.Errorw("error in fetching bulk app names for env", "envId", envId, "err", err)
+			return nil, err
+		}
+	} else {
+		impactedAppObjects, err = impl.bulkEditRepository.FindDeploymentTemplateBulkAppNameForGlobal(appNameIncludes, appNameExcludes)
+		if err != nil {
+			impl.logger.Errorw("error in fetching bulk app names for global", "err", err)
+			return make([]*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp, 0), err
+		}
+	}
+	deploymentTemplateImpactedObjects := make([]*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp, 0, len(impactedAppObjects))
+	for _, appModel := range impactedAppObjects {
+		deploymentTemplateImpactedObject := &bean4.DeploymentTemplateImpactedObjectsResponseForOneApp{
+			AppId:   appModel.Id,
+			AppName: appModel.AppName,
+		}
+		if envId > 0 {
+			deploymentTemplateImpactedObject.EnvId = envId
+		}
+		deploymentTemplateImpactedObjects = append(deploymentTemplateImpactedObjects, deploymentTemplateImpactedObject)
+	}
+	return deploymentTemplateImpactedObjects, nil
+}
+
 func (impl BulkUpdateServiceImpl) DryRunBulkEdit(bulkUpdatePayload *bean4.BulkUpdatePayload) (*bean4.ImpactedObjectsResponse, error) {
 	impactedObjectsResponse := &bean4.ImpactedObjectsResponse{}
-	deploymentTemplateImpactedObjects := []*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp{}
-	configMapImpactedObjects := []*bean4.CmAndSecretImpactedObjectsResponseForOneApp{}
-	secretImpactedObjects := []*bean4.CmAndSecretImpactedObjectsResponseForOneApp{}
 	var appNameIncludes []string
 	var appNameExcludes []string
 	if bulkUpdatePayload.Includes == nil || len(bulkUpdatePayload.Includes.Names) == 0 {
@@ -195,190 +356,66 @@ func (impl BulkUpdateServiceImpl) DryRunBulkEdit(bulkUpdatePayload *bean4.BulkUp
 	if bulkUpdatePayload.Excludes != nil && len(bulkUpdatePayload.Excludes.Names) > 0 {
 		appNameExcludes = bulkUpdatePayload.Excludes.Names
 	}
+	deploymentTemplateImpactedObjects := make([]*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp, 0)
+	configMapImpactedObjects := make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0)
+	secretImpactedObjects := make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0)
 	if bulkUpdatePayload.Global {
-		//For Deployment Template
-		if bulkUpdatePayload.DeploymentTemplate != nil && bulkUpdatePayload.DeploymentTemplate.Spec != nil {
-			appsGlobalDT, err := impl.bulkUpdateRepository.
-				FindDeploymentTemplateBulkAppNameForGlobal(appNameIncludes, appNameExcludes)
-			if err != nil {
-				impl.logger.Errorw("error in fetching bulk app names for global", "err", err)
-				return nil, err
-			}
-			for _, app := range appsGlobalDT {
-				deploymentTemplateImpactedObject := &bean4.DeploymentTemplateImpactedObjectsResponseForOneApp{
-					AppId:   app.Id,
-					AppName: app.AppName,
-				}
-				deploymentTemplateImpactedObjects = append(deploymentTemplateImpactedObjects, deploymentTemplateImpactedObject)
-			}
+		// For Deployment Template
+		impactedBaseDeploymentTemplates, err := impl.getImpactedBaseDeploymentTemplates(bulkUpdatePayload.DeploymentTemplate, appNameIncludes, appNameExcludes)
+		if err != nil {
+			impl.logger.Errorw("error in fetching impacted base deployment templates", "err", err)
+			return nil, err
 		}
+		deploymentTemplateImpactedObjects = append(deploymentTemplateImpactedObjects, impactedBaseDeploymentTemplates...)
 
-		//For ConfigMap
-		if bulkUpdatePayload.ConfigMap != nil && bulkUpdatePayload.ConfigMap.Spec != nil && len(bulkUpdatePayload.ConfigMap.Spec.Names) != 0 {
-			cmNames := util2.GetCopyByValueObject(bulkUpdatePayload.ConfigMap.Spec.Names)
-			configMapAppModels, err := impl.bulkUpdateRepository.FindCMBulkAppModelForGlobal(appNameIncludes, appNameExcludes, cmNames)
-			if err != nil {
-				impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
-				return nil, err
-			}
-			configMapSpecNames := make(map[string]bool)
-			if len(configMapAppModels) != 0 {
-				for _, name := range bulkUpdatePayload.ConfigMap.Spec.Names {
-					configMapSpecNames[name] = true
-				}
-			}
-			for _, configMapAppModel := range configMapAppModels {
-				var finalConfigMapNames []string
-				configMapNames := gjson.Get(configMapAppModel.ConfigMapData, "maps.#.name")
-				for _, configMapName := range configMapNames.Array() {
-					_, contains := configMapSpecNames[configMapName.String()]
-					if contains == true {
-						finalConfigMapNames = append(finalConfigMapNames, configMapName.String())
-					}
-				}
-				if len(finalConfigMapNames) != 0 {
-					appDetailsById, _ := impl.appRepository.FindById(configMapAppModel.AppId)
-					configMapImpactedObject := &bean4.CmAndSecretImpactedObjectsResponseForOneApp{
-						AppId:   configMapAppModel.AppId,
-						AppName: appDetailsById.AppName,
-						Names:   finalConfigMapNames,
-					}
-					configMapImpactedObjects = append(configMapImpactedObjects, configMapImpactedObject)
-				}
-			}
+		// For ConfigMap
+		impactedBaseConfigMaps, err := impl.getImpactedBaseConfigMaps(bulkUpdatePayload.ConfigMap, appNameIncludes, appNameExcludes)
+		if err != nil {
+			impl.logger.Errorw("error in fetching impacted base config maps", "err", err)
+			return nil, err
 		}
-		//For Secret
-		if bulkUpdatePayload.Secret != nil && bulkUpdatePayload.Secret.Spec != nil && len(bulkUpdatePayload.Secret.Spec.Names) != 0 {
-			secretNames := util2.GetCopyByValueObject(bulkUpdatePayload.Secret.Spec.Names)
-			secretAppModels, err := impl.bulkUpdateRepository.FindSecretBulkAppModelForGlobal(appNameIncludes, appNameExcludes, secretNames)
-			if err != nil {
-				impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
-				return nil, err
-			}
-			secretSpecNames := make(map[string]bool)
-			if len(secretAppModels) != 0 {
-				for _, name := range bulkUpdatePayload.Secret.Spec.Names {
-					secretSpecNames[name] = true
-				}
-			}
-			for _, secretAppModel := range secretAppModels {
-				var finalSecretNames []string
-				secretNames := gjson.Get(secretAppModel.SecretData, "secrets.#.name")
-				for _, secretName := range secretNames.Array() {
-					_, contains := secretSpecNames[secretName.String()]
-					if contains == true {
-						finalSecretNames = append(finalSecretNames, secretName.String())
-					}
-				}
-				if len(finalSecretNames) != 0 {
-					appDetailsById, _ := impl.appRepository.FindById(secretAppModel.AppId)
-					secretImpactedObject := &bean4.CmAndSecretImpactedObjectsResponseForOneApp{
-						AppId:   secretAppModel.AppId,
-						AppName: appDetailsById.AppName,
-						Names:   finalSecretNames,
-					}
-					secretImpactedObjects = append(secretImpactedObjects, secretImpactedObject)
-				}
-			}
+		configMapImpactedObjects = append(configMapImpactedObjects, impactedBaseConfigMaps...)
+
+		// For Secret
+		impactedBaseSecrets, err := impl.getImpactedBaseSecrets(bulkUpdatePayload.Secret, appNameIncludes, appNameExcludes)
+		if err != nil {
+			impl.logger.Errorw("error in fetching impacted base secrets", "err", err)
+			return nil, err
 		}
+		secretImpactedObjects = append(secretImpactedObjects, impactedBaseSecrets...)
 	}
 
 	for _, envId := range bulkUpdatePayload.EnvIds {
-		//For Deployment Template
-		if bulkUpdatePayload.DeploymentTemplate != nil && bulkUpdatePayload.DeploymentTemplate.Spec != nil {
-			appsNotGlobalDT, err := impl.bulkUpdateRepository.
-				FindDeploymentTemplateBulkAppNameForEnv(appNameIncludes, appNameExcludes, envId)
-			if err != nil {
-				impl.logger.Errorw("error in fetching bulk app names for env", "err", err)
-				return nil, err
-			}
-			for _, app := range appsNotGlobalDT {
-				deploymentTemplateImpactedObject := &bean4.DeploymentTemplateImpactedObjectsResponseForOneApp{
-					AppId:   app.Id,
-					AppName: app.AppName,
-					EnvId:   envId,
-				}
-				deploymentTemplateImpactedObjects = append(deploymentTemplateImpactedObjects, deploymentTemplateImpactedObject)
-			}
+		// For Deployment Template
+		impactedEnvDeploymentTemplates, err := impl.getImpactedDeploymentTemplates(bulkUpdatePayload.DeploymentTemplate, appNameIncludes, appNameExcludes, envId)
+		if err != nil {
+			impl.logger.Errorw("error in fetching impacted base deployment templates", "envId", envId, "err", err)
+			return nil, err
 		}
-		//For ConfigMap
-		if bulkUpdatePayload.ConfigMap != nil && bulkUpdatePayload.ConfigMap.Spec != nil && len(bulkUpdatePayload.ConfigMap.Spec.Names) != 0 {
-			cmNames := util2.GetCopyByValueObject(bulkUpdatePayload.ConfigMap.Spec.Names)
-			configMapEnvModels, err := impl.bulkUpdateRepository.FindCMBulkAppModelForEnv(appNameIncludes, appNameExcludes, envId, cmNames)
-			if err != nil {
-				impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
-				return nil, err
-			}
-			configMapSpecNames := make(map[string]bool)
-			if len(configMapEnvModels) != 0 {
-				for _, name := range bulkUpdatePayload.ConfigMap.Spec.Names {
-					configMapSpecNames[name] = true
-				}
-			}
-			for _, configMapEnvModel := range configMapEnvModels {
-				var finalConfigMapNames []string
-				configMapNames := gjson.Get(configMapEnvModel.ConfigMapData, "maps.#.name")
-				for _, configMapName := range configMapNames.Array() {
-					_, contains := configMapSpecNames[configMapName.String()]
-					if contains == true {
-						finalConfigMapNames = append(finalConfigMapNames, configMapName.String())
-					}
-				}
+		deploymentTemplateImpactedObjects = append(deploymentTemplateImpactedObjects, impactedEnvDeploymentTemplates...)
 
-				if len(finalConfigMapNames) != 0 {
-					appDetailsById, _ := impl.appRepository.FindById(configMapEnvModel.AppId)
-					configMapImpactedObject := &bean4.CmAndSecretImpactedObjectsResponseForOneApp{
-						AppId:   configMapEnvModel.AppId,
-						AppName: appDetailsById.AppName,
-						EnvId:   envId,
-						Names:   finalConfigMapNames,
-					}
-					configMapImpactedObjects = append(configMapImpactedObjects, configMapImpactedObject)
-				}
-			}
+		// For ConfigMap
+		impactedEnvConfigMaps, err := impl.getImpactedConfigMaps(bulkUpdatePayload.ConfigMap, appNameIncludes, appNameExcludes, envId)
+		if err != nil {
+			impl.logger.Errorw("error in fetching impacted base config maps", "envId", envId, "err", err)
+			return nil, err
 		}
-		//For Secret
-		if bulkUpdatePayload.Secret != nil && bulkUpdatePayload.Secret.Spec != nil && len(bulkUpdatePayload.Secret.Spec.Names) != 0 {
-			secretNames := util2.GetCopyByValueObject(bulkUpdatePayload.Secret.Spec.Names)
-			secretEnvModels, err := impl.bulkUpdateRepository.FindSecretBulkAppModelForEnv(appNameIncludes, appNameExcludes, envId, secretNames)
-			if err != nil {
-				impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
-				return nil, err
-			}
-			secretSpecNames := make(map[string]bool)
-			if len(secretEnvModels) != 0 {
-				for _, name := range bulkUpdatePayload.Secret.Spec.Names {
-					secretSpecNames[name] = true
-				}
-			}
-			for _, secretEnvModel := range secretEnvModels {
-				var finalSecretNames []string
-				secretNames := gjson.Get(secretEnvModel.SecretData, "secrets.#.name")
-				for _, secretName := range secretNames.Array() {
-					_, contains := secretSpecNames[secretName.String()]
-					if contains == true {
-						finalSecretNames = append(finalSecretNames, secretName.String())
-					}
-				}
+		configMapImpactedObjects = append(configMapImpactedObjects, impactedEnvConfigMaps...)
 
-				if len(finalSecretNames) != 0 {
-					appDetailsById, _ := impl.appRepository.FindById(secretEnvModel.AppId)
-					secretImpactedObject := &bean4.CmAndSecretImpactedObjectsResponseForOneApp{
-						AppId:   secretEnvModel.AppId,
-						AppName: appDetailsById.AppName,
-						EnvId:   envId,
-						Names:   finalSecretNames,
-					}
-					secretImpactedObjects = append(secretImpactedObjects, secretImpactedObject)
-				}
-			}
+		// For Secret
+		impactedEnvSecrets, err := impl.getImpactedSecrets(bulkUpdatePayload.Secret, appNameIncludes, appNameExcludes, envId)
+		if err != nil {
+			impl.logger.Errorw("error in fetching impacted base secrets", "envId", envId, "err", err)
+			return nil, err
 		}
+		secretImpactedObjects = append(secretImpactedObjects, impactedEnvSecrets...)
 	}
 	impactedObjectsResponse.DeploymentTemplate = deploymentTemplateImpactedObjects
 	impactedObjectsResponse.ConfigMap = configMapImpactedObjects
 	impactedObjectsResponse.Secret = secretImpactedObjects
 	return impactedObjectsResponse, nil
 }
+
 func (impl BulkUpdateServiceImpl) ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error) {
 	modified, err := patch.Apply([]byte(target))
 	if err != nil {
@@ -409,7 +446,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Conte
 	}
 	var charts []*chartRepoRepository.Chart
 	if bulkUpdatePayload.Global {
-		charts, err = impl.bulkUpdateRepository.FindBulkChartsByAppNameSubstring(appNameIncludes, appNameExcludes)
+		charts, err = impl.bulkEditRepository.FindBulkChartsByAppNameSubstring(appNameIncludes, appNameExcludes)
 		if err != nil {
 			impl.logger.Error("error in fetching charts by app name substring")
 			deploymentTemplateBulkUpdateResponse.Message = append(deploymentTemplateBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps globally : %s", err.Error()))
@@ -418,7 +455,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Conte
 				deploymentTemplateBulkUpdateResponse.Message = append(deploymentTemplateBulkUpdateResponse.Message, "No matching apps to update globally")
 			} else {
 				for _, chart := range charts {
-					appDetailsByChart, _ := impl.bulkUpdateRepository.FindAppByChartId(chart.Id)
+					appDetailsByChart, _ := impl.bulkEditRepository.FindAppByChartId(chart.Id)
 					appId := appDetailsByChart.Id
 					if validationErr := impl.isBaseDTConfigUpdateAllowed(ctx, appId, userMetadata); validationErr != nil {
 						deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, adaptor.GetDeploymentTemplateBulkUpdateResponseForOneApp(appId, appDetailsByChart.AppName, 0, validationErr.Error()))
@@ -444,7 +481,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Conte
 							}
 							deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, bulkUpdateFailedResponse)
 						} else {
-							err = impl.bulkUpdateRepository.BulkUpdateChartsValuesYamlAndGlobalOverrideById(chart.Id, modifiedValuesYml, modifiedGlobalOverrideYml)
+							err = impl.bulkEditRepository.BulkUpdateChartsValuesYamlAndGlobalOverrideById(chart.Id, modifiedValuesYml, modifiedGlobalOverrideYml)
 							if err != nil {
 								impl.logger.Errorw("error in bulk updating charts", "err", err)
 								bulkUpdateFailedResponse := &bean4.DeploymentTemplateBulkUpdateResponseForOneApp{
@@ -488,7 +525,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Conte
 	}
 	var chartsEnv []*chartConfig.EnvConfigOverride
 	for _, envId := range bulkUpdatePayload.EnvIds {
-		chartsEnv, err = impl.bulkUpdateRepository.FindBulkChartsEnvByAppNameSubstring(appNameIncludes, appNameExcludes, envId)
+		chartsEnv, err = impl.bulkEditRepository.FindBulkChartsEnvByAppNameSubstring(appNameIncludes, appNameExcludes, envId)
 		if err != nil {
 			impl.logger.Errorw("error in fetching charts(for env) by app name substring", "err", err)
 			deploymentTemplateBulkUpdateResponse.Message = append(deploymentTemplateBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps for envId = %d , %s", envId, err.Error()))
@@ -497,7 +534,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Conte
 				deploymentTemplateBulkUpdateResponse.Message = append(deploymentTemplateBulkUpdateResponse.Message, fmt.Sprintf("No matching apps to update for envId = %d", envId))
 			} else {
 				for _, chartEnv := range chartsEnv {
-					appDetailsByChart, _ := impl.bulkUpdateRepository.FindAppByChartEnvId(chartEnv.Id)
+					appDetailsByChart, _ := impl.bulkEditRepository.FindAppByChartEnvId(chartEnv.Id)
 					appId := appDetailsByChart.Id
 					if validationErr := impl.isEnvDTConfigUpdateAllowed(ctx, appId, envId, userMetadata); validationErr != nil {
 						deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, adaptor.GetDeploymentTemplateBulkUpdateResponseForOneApp(appId, appDetailsByChart.AppName, envId, validationErr.Error()))
@@ -514,7 +551,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Conte
 						}
 						deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, bulkUpdateFailedResponse)
 					} else {
-						err = impl.bulkUpdateRepository.BulkUpdateChartsEnvYamlOverrideById(chartEnv.Id, modified)
+						err = impl.bulkEditRepository.BulkUpdateChartsEnvYamlOverrideById(chartEnv.Id, modified)
 						if err != nil {
 							impl.logger.Errorw("error in bulk updating charts", "err", err)
 							bulkUpdateFailedResponse := &bean4.DeploymentTemplateBulkUpdateResponseForOneApp{
@@ -581,7 +618,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(ctx context.Context, bulkU
 		for _, name := range bulkUpdatePayload.ConfigMap.Spec.Names {
 			configMapSpecNames[name] = true
 		}
-		configMapAppModels, err := impl.bulkUpdateRepository.FindCMBulkAppModelForGlobal(appNameIncludes, appNameExcludes, bulkUpdatePayload.ConfigMap.Spec.Names)
+		configMapAppModels, err := impl.bulkEditRepository.FindCMBulkAppModelForGlobal(appNameIncludes, appNameExcludes, bulkUpdatePayload.ConfigMap.Spec.Names)
 		if err != nil {
 			impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
 			configMapBulkUpdateResponse.Message = append(configMapBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps globally : %s", err.Error()))
@@ -637,7 +674,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(ctx context.Context, bulkU
 						}
 					}
 					if _, ok := messageCmNamesMap["Updated Successfully"]; ok {
-						err := impl.bulkUpdateRepository.BulkUpdateConfigMapDataForGlobalById(configMapAppModel.Id, configMapAppModel.ConfigMapData)
+						err := impl.bulkEditRepository.BulkUpdateConfigMapDataForGlobalById(configMapAppModel.Id, configMapAppModel.ConfigMapData)
 						if err != nil {
 							impl.logger.Errorw("error in bulk updating charts", "err", err)
 							messageCmNamesMap[fmt.Sprintf("Error in updating in db : %s", err.Error())] = messageCmNamesMap["Updated Successfully"]
@@ -679,7 +716,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(ctx context.Context, bulkU
 		for _, name := range bulkUpdatePayload.ConfigMap.Spec.Names {
 			configMapSpecNames[name] = true
 		}
-		configMapEnvModels, err := impl.bulkUpdateRepository.FindCMBulkAppModelForEnv(appNameIncludes, appNameExcludes, envId, bulkUpdatePayload.ConfigMap.Spec.Names)
+		configMapEnvModels, err := impl.bulkEditRepository.FindCMBulkAppModelForEnv(appNameIncludes, appNameExcludes, envId, bulkUpdatePayload.ConfigMap.Spec.Names)
 		if err != nil {
 			impl.logger.Errorw("error in fetching bulk app model for env", "err", err)
 			configMapBulkUpdateResponse.Message = append(configMapBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps for env: %d , %s", envId, err.Error()))
@@ -728,7 +765,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(ctx context.Context, bulkU
 						}
 					}
 					if _, ok := messageCmNamesMap["Updated Successfully"]; ok {
-						err := impl.bulkUpdateRepository.BulkUpdateConfigMapDataForEnvById(configMapEnvModel.Id, configMapEnvModel.ConfigMapData)
+						err := impl.bulkEditRepository.BulkUpdateConfigMapDataForEnvById(configMapEnvModel.Id, configMapEnvModel.ConfigMapData)
 						if err != nil {
 							impl.logger.Errorw("error in bulk updating charts", "err", err)
 							messageCmNamesMap[fmt.Sprintf("Error in updating in db : %s", err.Error())] = messageCmNamesMap["Updated Successfully"]
@@ -773,6 +810,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(ctx context.Context, bulkU
 	}
 	return configMapBulkUpdateResponse
 }
+
 func (impl BulkUpdateServiceImpl) BulkUpdateSecret(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.CmAndSecretBulkUpdateResponse {
 	secretBulkUpdateResponse := &bean4.CmAndSecretBulkUpdateResponse{}
 	var appNameIncludes []string
@@ -792,7 +830,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(ctx context.Context, bulkUpda
 		for _, name := range bulkUpdatePayload.Secret.Spec.Names {
 			secretSpecNames[name] = true
 		}
-		secretAppModels, err := impl.bulkUpdateRepository.FindSecretBulkAppModelForGlobal(appNameIncludes, appNameExcludes, bulkUpdatePayload.Secret.Spec.Names)
+		secretAppModels, err := impl.bulkEditRepository.FindSecretBulkAppModelForGlobal(appNameIncludes, appNameExcludes, bulkUpdatePayload.Secret.Spec.Names)
 		if err != nil {
 			impl.logger.Errorw("error in fetching bulk app model for global", "err", err)
 			secretBulkUpdateResponse.Message = append(secretBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps globally : %s", err.Error()))
@@ -848,7 +886,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(ctx context.Context, bulkUpda
 						}
 					}
 					if _, ok := messageSecretNamesMap["Updated Successfully"]; ok {
-						err := impl.bulkUpdateRepository.BulkUpdateSecretDataForGlobalById(secretAppModel.Id, secretAppModel.SecretData)
+						err := impl.bulkEditRepository.BulkUpdateSecretDataForGlobalById(secretAppModel.Id, secretAppModel.SecretData)
 						if err != nil {
 							impl.logger.Errorw("error in bulk updating secrets", "err", err)
 							messageSecretNamesMap[fmt.Sprintf("Error in updating in db : %s", err.Error())] = messageSecretNamesMap["Updated Successfully"]
@@ -891,7 +929,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(ctx context.Context, bulkUpda
 		for _, name := range bulkUpdatePayload.Secret.Spec.Names {
 			secretSpecNames[name] = true
 		}
-		secretEnvModels, err := impl.bulkUpdateRepository.FindSecretBulkAppModelForEnv(appNameIncludes, appNameExcludes, envId, bulkUpdatePayload.Secret.Spec.Names)
+		secretEnvModels, err := impl.bulkEditRepository.FindSecretBulkAppModelForEnv(appNameIncludes, appNameExcludes, envId, bulkUpdatePayload.Secret.Spec.Names)
 		if err != nil {
 			impl.logger.Errorw("error in fetching bulk app model for env", "err", err)
 			secretBulkUpdateResponse.Message = append(secretBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps for env: %d , %s", envId, err.Error()))
@@ -947,7 +985,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(ctx context.Context, bulkUpda
 						}
 					}
 					if _, ok := messageSecretNamesMap["Updated Successfully"]; ok {
-						err := impl.bulkUpdateRepository.BulkUpdateSecretDataForEnvById(secretEnvModel.Id, secretEnvModel.SecretData)
+						err := impl.bulkEditRepository.BulkUpdateSecretDataForEnvById(secretEnvModel.Id, secretEnvModel.SecretData)
 						if err != nil {
 							impl.logger.Errorw("error in bulk updating charts", "err", err)
 							messageSecretNamesMap[fmt.Sprintf("Error in updating in db : %s", err.Error())] = messageSecretNamesMap["Updated Successfully"]
@@ -992,7 +1030,8 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(ctx context.Context, bulkUpda
 	}
 	return secretBulkUpdateResponse
 }
-func (impl BulkUpdateServiceImpl) BulkUpdate(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.BulkUpdateResponse {
+
+func (impl BulkUpdateServiceImpl) BulkEdit(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.BulkUpdateResponse {
 	bulkUpdateResponse := &bean4.BulkUpdateResponse{}
 	var deploymentTemplateBulkUpdateResponse *bean4.DeploymentTemplateBulkUpdateResponse
 	var configMapBulkUpdateResponse *bean4.CmAndSecretBulkUpdateResponse
@@ -1191,6 +1230,7 @@ func (impl BulkUpdateServiceImpl) buildHibernateUnHibernateRequestForHelmPipelin
 	}
 	return appIdentifier, hibernateRequest, nil
 }
+
 func (impl BulkUpdateServiceImpl) BulkUnHibernate(ctx context.Context, request *bean4.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token string, appObject string, envObject string) bool,
 	userMetadata *bean6.UserMetadata) (*bean4.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error) {
 	var pipelines []*pipelineConfig.Pipeline
diff --git a/tests/pipeline/BulkUpdateService_test.go b/tests/pipeline/BulkUpdateService_test.go
index 5d2456809e..8434a13d85 100644
--- a/tests/pipeline/BulkUpdateService_test.go
+++ b/tests/pipeline/BulkUpdateService_test.go
@@ -17,9 +17,11 @@
 package pipeline
 
 import (
+	"context"
 	"encoding/csv"
 	"encoding/json"
 	"fmt"
+	"github.com/devtron-labs/devtron/pkg/auth/user/util"
 	"github.com/devtron-labs/devtron/pkg/bulkAction/bean"
 	"io"
 	"log"
@@ -110,7 +112,7 @@ func TestBulkUpdate(t *testing.T) {
 	for _, tt := range tests {
 		testname := fmt.Sprintf("%s,%s", tt.Payload.Includes, tt.Payload.Excludes)
 		t.Run(testname, func(t *testing.T) {
-			got := bulkUpdateService.BulkUpdate(tt.Payload)
+			got := bulkUpdateService.BulkEdit(context.Background(), tt.Payload, util.GetUserMetadata(context.Background(), 1, true))
 			if got.DeploymentTemplate.Message[len(got.DeploymentTemplate.Message)-1] != tt.deploymentTemplateWant {
 				t.Errorf("got %s, want %s", got, tt.deploymentTemplateWant)
 			}
diff --git a/tests/pipeline/ChartService_test.go b/tests/pipeline/ChartService_test.go
index 06aca529ef..d3bed00199 100644
--- a/tests/pipeline/ChartService_test.go
+++ b/tests/pipeline/ChartService_test.go
@@ -17,12 +17,14 @@
 package pipeline
 
 import (
+	"context"
 	"encoding/csv"
 	"encoding/json"
 	"fmt"
-	"github.com/devtron-labs/devtron/internal/sql/repository/bulkUpdate"
 	"github.com/devtron-labs/devtron/internal/util"
+	userUtil "github.com/devtron-labs/devtron/pkg/auth/user/util"
 	"github.com/devtron-labs/devtron/pkg/bulkAction/bean"
+	"github.com/devtron-labs/devtron/pkg/bulkAction/repository"
 	"github.com/devtron-labs/devtron/pkg/bulkAction/service"
 	"github.com/devtron-labs/devtron/pkg/sql"
 	jsonpatch "github.com/evanphx/json-patch"
@@ -35,16 +37,15 @@ import (
 )
 
 var bulkUpdateService *service.BulkUpdateServiceImpl
-var bulkUpdateRepository bulkUpdate.BulkUpdateRepositoryImpl
 
 func setup() {
 	config, _ := sql.GetConfig()
 	logger, _ := util.NewSugardLogger()
 	dbConnection, _ := sql.NewDbConnection(config, logger)
-	bulkUpdateRepository := bulkUpdate.NewBulkUpdateRepository(dbConnection, logger)
+	bulkUpdateRepository := repository.NewBulkEditRepository(dbConnection, logger)
 	bulkUpdateService = service.NewBulkUpdateServiceImpl(bulkUpdateRepository, nil, nil, nil, nil, nil,
 		nil, nil, nil, nil, nil, nil, nil,
-		nil, nil, nil, nil, nil)
+		nil, nil, nil, nil, nil, nil)
 }
 
 func TestBulkUpdateDeploymentTemplate(t *testing.T) {
@@ -108,7 +109,7 @@ func TestBulkUpdateDeploymentTemplate(t *testing.T) {
 	for _, tt := range tests {
 		testname := fmt.Sprintf("%s,%s", tt.Payload.Includes, tt.Payload.Excludes)
 		t.Run(testname, func(t *testing.T) {
-			got := bulkUpdateService.BulkUpdateDeploymentTemplate(tt.Payload)
+			got := bulkUpdateService.BulkUpdateDeploymentTemplate(context.Background(), tt.Payload, userUtil.GetUserMetadata(context.Background(), 1, true))
 			if got != tt.want {
 				t.Errorf("got %s, want %s", got, tt.want)
 			}
diff --git a/wire_gen.go b/wire_gen.go
index 2ee6a3b5e6..106c5b552b 100644
--- a/wire_gen.go
+++ b/wire_gen.go
@@ -96,7 +96,6 @@ import (
 	"github.com/devtron-labs/devtron/internal/sql/repository/app"
 	"github.com/devtron-labs/devtron/internal/sql/repository/appStatus"
 	"github.com/devtron-labs/devtron/internal/sql/repository/appWorkflow"
-	"github.com/devtron-labs/devtron/internal/sql/repository/bulkUpdate"
 	"github.com/devtron-labs/devtron/internal/sql/repository/chartConfig"
 	"github.com/devtron-labs/devtron/internal/sql/repository/deploymentConfig"
 	repository9 "github.com/devtron-labs/devtron/internal/sql/repository/dockerRegistry"
@@ -157,6 +156,7 @@ import (
 	pipeline2 "github.com/devtron-labs/devtron/pkg/build/pipeline"
 	read14 "github.com/devtron-labs/devtron/pkg/build/pipeline/read"
 	"github.com/devtron-labs/devtron/pkg/build/trigger"
+	repository30 "github.com/devtron-labs/devtron/pkg/bulkAction/repository"
 	service8 "github.com/devtron-labs/devtron/pkg/bulkAction/service"
 	"github.com/devtron-labs/devtron/pkg/chart"
 	"github.com/devtron-labs/devtron/pkg/chart/gitOpsConfig"
@@ -952,9 +952,9 @@ func InitializeApp() (*App, error) {
 	}
 	telemetryRestHandlerImpl := restHandler.NewTelemetryRestHandlerImpl(sugaredLogger, telemetryEventClientImplExtended, enforcerImpl, userServiceImpl)
 	telemetryRouterImpl := router.NewTelemetryRouterImpl(sugaredLogger, telemetryRestHandlerImpl)
-	bulkUpdateRepositoryImpl := bulkUpdate.NewBulkUpdateRepository(db, sugaredLogger)
+	bulkEditRepositoryImpl := repository30.NewBulkEditRepository(db, sugaredLogger)
 	deployedAppServiceImpl := deployedApp.NewDeployedAppServiceImpl(sugaredLogger, k8sCommonServiceImpl, devtronAppsHandlerServiceImpl, environmentRepositoryImpl, pipelineRepositoryImpl, cdWorkflowRepositoryImpl)
-	bulkUpdateServiceImpl := service8.NewBulkUpdateServiceImpl(bulkUpdateRepositoryImpl, sugaredLogger, environmentRepositoryImpl, pipelineRepositoryImpl, appRepositoryImpl, deploymentTemplateHistoryServiceImpl, configMapHistoryServiceImpl, pipelineBuilderImpl, enforcerUtilImpl, ciHandlerImpl, ciPipelineRepositoryImpl, appWorkflowRepositoryImpl, appWorkflowServiceImpl, scopedVariableManagerImpl, deployedAppMetricsServiceImpl, chartRefServiceImpl, deployedAppServiceImpl, cdPipelineEventPublishServiceImpl, handlerServiceImpl)
+	bulkUpdateServiceImpl := service8.NewBulkUpdateServiceImpl(bulkEditRepositoryImpl, sugaredLogger, environmentRepositoryImpl, pipelineRepositoryImpl, appRepositoryImpl, deploymentTemplateHistoryServiceImpl, configMapHistoryServiceImpl, pipelineBuilderImpl, enforcerUtilImpl, ciHandlerImpl, ciPipelineRepositoryImpl, appWorkflowRepositoryImpl, appWorkflowServiceImpl, scopedVariableManagerImpl, deployedAppMetricsServiceImpl, chartRefServiceImpl, deployedAppServiceImpl, cdPipelineEventPublishServiceImpl, handlerServiceImpl)
 	bulkUpdateRestHandlerImpl := restHandler.NewBulkUpdateRestHandlerImpl(pipelineBuilderImpl, sugaredLogger, bulkUpdateServiceImpl, chartServiceImpl, propertiesConfigServiceImpl, userServiceImpl, enforcerImpl, ciHandlerImpl, validate, clientImpl, ciPipelineRepositoryImpl, pipelineRepositoryImpl, enforcerUtilImpl, environmentServiceImpl, gitRegistryConfigImpl, dockerRegistryConfigImpl, cdHandlerImpl, appCloneServiceImpl, appWorkflowServiceImpl, materialRepositoryImpl)
 	bulkUpdateRouterImpl := router.NewBulkUpdateRouterImpl(bulkUpdateRestHandlerImpl)
 	webhookSecretValidatorImpl := gitWebhook.NewWebhookSecretValidatorImpl(sugaredLogger)

From bac664bba91eb4ebf3d9becc25d423c47be05552 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Sun, 13 Jul 2025 04:11:41 +0530
Subject: [PATCH 05/22] feat: added dryrun bulk edit v1beta2

---
 .../repository/BulkEditRepository.go          | 53 ++++++++++++-------
 pkg/team/repository/TeamRepository.go         | 18 +++----
 pkg/team/repository/TeamRepository_ent.go     | 20 +++++++
 3 files changed, 61 insertions(+), 30 deletions(-)
 create mode 100644 pkg/team/repository/TeamRepository_ent.go

diff --git a/pkg/bulkAction/repository/BulkEditRepository.go b/pkg/bulkAction/repository/BulkEditRepository.go
index 366ac66b23..f77d7040b8 100644
--- a/pkg/bulkAction/repository/BulkEditRepository.go
+++ b/pkg/bulkAction/repository/BulkEditRepository.go
@@ -21,6 +21,7 @@ import (
 	"github.com/devtron-labs/devtron/internal/sql/repository/chartConfig"
 	chartRepoRepository "github.com/devtron-labs/devtron/pkg/chartRepo/repository"
 	"github.com/devtron-labs/devtron/util"
+	"github.com/devtron-labs/devtron/util/sliceUtil"
 	"github.com/go-pg/pg"
 	"github.com/go-pg/pg/orm"
 	"go.uber.org/zap"
@@ -97,28 +98,40 @@ func appendBuildAppNameQuery(q *orm.Query, appNameIncludes []string, appNameExcl
 
 }
 
-func appendBuildCMNameQuery(q *orm.Query, configMapNames []string) *orm.Query {
-	if len(configMapNames) == 0 {
-		return q
+func appendBuildCMNameLikeQuery(q *orm.Query, configMapNames []string) *orm.Query {
+	// replacing configMapName with "%configMapName%"
+	configMapNamesLikeClause := sliceUtil.NewSliceFromFuncExec(configMapNames, func(secretName string) string {
+		return util.GetLIKEClauseQueryParam(secretName)
+	})
+	return appendBuildCMNameQuery(q, configMapNamesLikeClause, nil)
+}
+
+func appendBuildCMNameQuery(q *orm.Query, configMapNameIncludes, configMapNameExcludes []string) *orm.Query {
+	if len(configMapNameIncludes) != 0 {
+		q = q.Where("config_map_data LIKE ANY (array[?])", pg.In(configMapNameIncludes))
 	}
-	//replacing configMapName with "%configMapName%"
-	configMapNamesLikeClause := make([]string, len(configMapNames))
-	for i := range configMapNames {
-		configMapNamesLikeClause[i] = util.GetLIKEClauseQueryParam(configMapNames[i])
+	if len(configMapNameExcludes) != 0 {
+		q = q.Where("config_map_data NOT LIKE ALL (array[?])", pg.In(configMapNameExcludes))
 	}
-	return q.Where("config_map_data LIKE ANY (array[?])", pg.In(configMapNamesLikeClause))
+	return q
 }
 
-func appendBuildSecretNameQuery(q *orm.Query, secretNames []string) *orm.Query {
-	if len(secretNames) == 0 {
-		return q
+func appendBuildSecretNameLikeQuery(q *orm.Query, secretNames []string) *orm.Query {
+	// replacing secretName with "%secretName%"
+	secretNamesLikeClause := sliceUtil.NewSliceFromFuncExec(secretNames, func(secretName string) string {
+		return util.GetLIKEClauseQueryParam(secretName)
+	})
+	return appendBuildSecretNameQuery(q, secretNamesLikeClause, nil)
+}
+
+func appendBuildSecretNameQuery(q *orm.Query, secretNameIncludes, secretNameExcludes []string) *orm.Query {
+	if len(secretNameIncludes) != 0 {
+		q = q.Where("secret_data LIKE ANY (array[?])", pg.In(secretNameIncludes))
 	}
-	//replacing secretName with "%secretName%"
-	secretNamesLikeClause := make([]string, len(secretNames))
-	for i := range secretNames {
-		secretNamesLikeClause[i] = util.GetLIKEClauseQueryParam(secretNames[i])
+	if len(secretNameExcludes) != 0 {
+		q = q.Where("secret_data NOT LIKE ALL (array[?])", pg.In(secretNameExcludes))
 	}
-	return q.Where("secret_data LIKE ANY (array[?])", pg.In(secretNamesLikeClause))
+	return q
 }
 
 func (repositoryImpl BulkEditRepositoryImpl) FindBulkEditConfig(apiVersion, kind string) (*BulkEditConfig, error) {
@@ -160,7 +173,7 @@ func (repositoryImpl BulkEditRepositoryImpl) FindCMBulkAppModelForGlobal(appName
 		Model(&CmAndSecretAppModel).Join("INNER JOIN app ON app.id = config_map_app_model.app_id").
 		Where("app.active = ?", true)
 	q = appendBuildAppNameQuery(q, appNameIncludes, appNameExcludes)
-	q = appendBuildCMNameQuery(q, configMapNames)
+	q = appendBuildCMNameLikeQuery(q, configMapNames)
 	err := q.Select()
 	return CmAndSecretAppModel, err
 }
@@ -170,7 +183,7 @@ func (repositoryImpl BulkEditRepositoryImpl) FindSecretBulkAppModelForGlobal(app
 		Model(&CmAndSecretAppModel).Join("INNER JOIN app ON app.id = config_map_app_model.app_id").
 		Where("app.active = ?", true)
 	q = appendBuildAppNameQuery(q, appNameIncludes, appNameExcludes)
-	q = appendBuildSecretNameQuery(q, secretNames)
+	q = appendBuildSecretNameLikeQuery(q, secretNames)
 	err := q.Select()
 	return CmAndSecretAppModel, err
 }
@@ -181,7 +194,7 @@ func (repositoryImpl BulkEditRepositoryImpl) FindCMBulkAppModelForEnv(appNameInc
 		Where("app.active = ?", true).
 		Where("config_map_env_model.environment_id = ? ", envId)
 	q = appendBuildAppNameQuery(q, appNameIncludes, appNameExcludes)
-	q = appendBuildCMNameQuery(q, configMapNames)
+	q = appendBuildCMNameLikeQuery(q, configMapNames)
 	err := q.Select()
 	return CmAndSecretEnvModel, err
 }
@@ -192,7 +205,7 @@ func (repositoryImpl BulkEditRepositoryImpl) FindSecretBulkAppModelForEnv(appNam
 		Where("app.active = ?", true).
 		Where("config_map_env_model.environment_id = ? ", envId)
 	q = appendBuildAppNameQuery(q, appNameIncludes, appNameExcludes)
-	q = appendBuildSecretNameQuery(q, secretNames)
+	q = appendBuildSecretNameLikeQuery(q, secretNames)
 	err := q.Select()
 	return CmAndSecretEnvModel, err
 }
diff --git a/pkg/team/repository/TeamRepository.go b/pkg/team/repository/TeamRepository.go
index e73ff3bda9..d3e0695956 100644
--- a/pkg/team/repository/TeamRepository.go
+++ b/pkg/team/repository/TeamRepository.go
@@ -39,6 +39,7 @@ type TeamRepository interface {
 	GetConnection() *pg.DB
 	FindByIds(ids []*int) ([]*Team, error)
 	FindAllActiveTeamNames() ([]string, error)
+	TeamRepositoryEnt
 }
 type TeamRepositoryImpl struct {
 	dbConnection *pg.DB
@@ -95,18 +96,15 @@ func (impl TeamRepositoryImpl) MarkTeamDeleted(team *Team, tx *pg.Tx) error {
 	return err
 }
 
-func (repo TeamRepositoryImpl) FindByIds(ids []*int) ([]*Team, error) {
+func (impl TeamRepositoryImpl) FindByIds(ids []*int) ([]*Team, error) {
+	if len(ids) == 0 {
+		return nil, nil
+	}
 	var objects []*Team
-	err := repo.dbConnection.Model(&objects).Where("active = ?", true).Where("id in (?)", pg.In(ids)).Select()
+	err := impl.dbConnection.Model(&objects).Where("active = ?", true).Where("id in (?)", pg.In(ids)).Select()
 	return objects, err
 }
 
-func (repo TeamRepositoryImpl) GetConnection() *pg.DB {
-	return repo.dbConnection
-}
-
-type TeamRbacObjects struct {
-	AppName  string `json:"appName"`
-	TeamName string `json:"teamName"`
-	AppId    int    `json:"appId"`
+func (impl TeamRepositoryImpl) GetConnection() *pg.DB {
+	return impl.dbConnection
 }
diff --git a/pkg/team/repository/TeamRepository_ent.go b/pkg/team/repository/TeamRepository_ent.go
new file mode 100644
index 0000000000..763623f666
--- /dev/null
+++ b/pkg/team/repository/TeamRepository_ent.go
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2020-2024. Devtron Inc.
+ *
+ * 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.
+ */
+
+package repository
+
+type TeamRepositoryEnt interface {
+}

From 13360bfea995ee3d3cb00b6537712e739f017af1 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Mon, 14 Jul 2025 02:47:40 +0530
Subject: [PATCH 06/22] chore: oss ent refactorings

---
 Wire.go                                         | 2 ++
 pkg/bulkAction/service/BulkUpdateService.go     | 4 +++-
 pkg/bulkAction/service/BulkUpdateService_ent.go | 7 +++++++
 wire_gen.go                                     | 3 ++-
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Wire.go b/Wire.go
index 90fbd3f9c9..aa474e3631 100644
--- a/Wire.go
+++ b/Wire.go
@@ -370,6 +370,8 @@ func InitializeApp() (*App, error) {
 		wire.Bind(new(chart.ChartService), new(*chart.ChartServiceImpl)),
 		read2.NewChartReadServiceImpl,
 		wire.Bind(new(read2.ChartReadService), new(*read2.ChartReadServiceImpl)),
+
+		service.NewBulkUpdateServiceEntImpl,
 		service.NewBulkUpdateServiceImpl,
 		wire.Bind(new(service.BulkUpdateService), new(*service.BulkUpdateServiceImpl)),
 
diff --git a/pkg/bulkAction/service/BulkUpdateService.go b/pkg/bulkAction/service/BulkUpdateService.go
index ee73238e42..dfe62030c1 100644
--- a/pkg/bulkAction/service/BulkUpdateService.go
+++ b/pkg/bulkAction/service/BulkUpdateService.go
@@ -108,6 +108,7 @@ type BulkUpdateServiceImpl struct {
 	deployedAppService               deployedApp.DeployedAppService
 	cdPipelineEventPublishService    out.CDPipelineEventPublishService
 	ciHandlerService                 trigger.HandlerService
+	*BulkUpdateServiceEntImpl
 }
 
 func NewBulkUpdateServiceImpl(bulkUpdateRepository repository.BulkEditRepository,
@@ -129,6 +130,7 @@ func NewBulkUpdateServiceImpl(bulkUpdateRepository repository.BulkEditRepository
 	deployedAppService deployedApp.DeployedAppService,
 	cdPipelineEventPublishService out.CDPipelineEventPublishService,
 	ciHandlerService trigger.HandlerService,
+	bulkUpdateServiceEntImpl *BulkUpdateServiceEntImpl,
 ) *BulkUpdateServiceImpl {
 	return &BulkUpdateServiceImpl{
 		bulkEditRepository:               bulkUpdateRepository,
@@ -150,8 +152,8 @@ func NewBulkUpdateServiceImpl(bulkUpdateRepository repository.BulkEditRepository
 		deployedAppService:               deployedAppService,
 		cdPipelineEventPublishService:    cdPipelineEventPublishService,
 		ciHandlerService:                 ciHandlerService,
+		BulkUpdateServiceEntImpl:         bulkUpdateServiceEntImpl,
 	}
-
 }
 
 const (
diff --git a/pkg/bulkAction/service/BulkUpdateService_ent.go b/pkg/bulkAction/service/BulkUpdateService_ent.go
index d0eeb8d2d6..c95d38a539 100644
--- a/pkg/bulkAction/service/BulkUpdateService_ent.go
+++ b/pkg/bulkAction/service/BulkUpdateService_ent.go
@@ -9,6 +9,13 @@ import (
 type BulkUpdateServiceEnt interface {
 }
 
+type BulkUpdateServiceEntImpl struct {
+}
+
+func NewBulkUpdateServiceEntImpl() *BulkUpdateServiceEntImpl {
+	return nil
+}
+
 func (impl BulkUpdateServiceImpl) isEnvDTConfigUpdateAllowed(ctx context.Context, appId, envId int, userMetadata *userBean.UserMetadata) error {
 	return nil
 }
diff --git a/wire_gen.go b/wire_gen.go
index 106c5b552b..438375fd08 100644
--- a/wire_gen.go
+++ b/wire_gen.go
@@ -954,7 +954,8 @@ func InitializeApp() (*App, error) {
 	telemetryRouterImpl := router.NewTelemetryRouterImpl(sugaredLogger, telemetryRestHandlerImpl)
 	bulkEditRepositoryImpl := repository30.NewBulkEditRepository(db, sugaredLogger)
 	deployedAppServiceImpl := deployedApp.NewDeployedAppServiceImpl(sugaredLogger, k8sCommonServiceImpl, devtronAppsHandlerServiceImpl, environmentRepositoryImpl, pipelineRepositoryImpl, cdWorkflowRepositoryImpl)
-	bulkUpdateServiceImpl := service8.NewBulkUpdateServiceImpl(bulkEditRepositoryImpl, sugaredLogger, environmentRepositoryImpl, pipelineRepositoryImpl, appRepositoryImpl, deploymentTemplateHistoryServiceImpl, configMapHistoryServiceImpl, pipelineBuilderImpl, enforcerUtilImpl, ciHandlerImpl, ciPipelineRepositoryImpl, appWorkflowRepositoryImpl, appWorkflowServiceImpl, scopedVariableManagerImpl, deployedAppMetricsServiceImpl, chartRefServiceImpl, deployedAppServiceImpl, cdPipelineEventPublishServiceImpl, handlerServiceImpl)
+	bulkUpdateServiceEntImpl := service8.NewBulkUpdateServiceEntImpl()
+	bulkUpdateServiceImpl := service8.NewBulkUpdateServiceImpl(bulkEditRepositoryImpl, sugaredLogger, environmentRepositoryImpl, pipelineRepositoryImpl, appRepositoryImpl, deploymentTemplateHistoryServiceImpl, configMapHistoryServiceImpl, pipelineBuilderImpl, enforcerUtilImpl, ciHandlerImpl, ciPipelineRepositoryImpl, appWorkflowRepositoryImpl, appWorkflowServiceImpl, scopedVariableManagerImpl, deployedAppMetricsServiceImpl, chartRefServiceImpl, deployedAppServiceImpl, cdPipelineEventPublishServiceImpl, handlerServiceImpl, bulkUpdateServiceEntImpl)
 	bulkUpdateRestHandlerImpl := restHandler.NewBulkUpdateRestHandlerImpl(pipelineBuilderImpl, sugaredLogger, bulkUpdateServiceImpl, chartServiceImpl, propertiesConfigServiceImpl, userServiceImpl, enforcerImpl, ciHandlerImpl, validate, clientImpl, ciPipelineRepositoryImpl, pipelineRepositoryImpl, enforcerUtilImpl, environmentServiceImpl, gitRegistryConfigImpl, dockerRegistryConfigImpl, cdHandlerImpl, appCloneServiceImpl, appWorkflowServiceImpl, materialRepositoryImpl)
 	bulkUpdateRouterImpl := router.NewBulkUpdateRouterImpl(bulkUpdateRestHandlerImpl)
 	webhookSecretValidatorImpl := gitWebhook.NewWebhookSecretValidatorImpl(sugaredLogger)

From a4ae89b32142fc4bb31b4dd67c651ec6d1f0c4d4 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Tue, 15 Jul 2025 05:02:13 +0530
Subject: [PATCH 07/22] chore: code restructurings

---
 .../{adaptor => adapter}/adaptor.go           |  2 +-
 pkg/bulkAction/bean/bean.go                   |  4 --
 pkg/bulkAction/service/BulkUpdateService.go   | 53 ++++++++++++++-----
 .../service/BulkUpdateService_ent.go          | 16 ++++++
 pkg/bulkAction/utils/utils.go                 |  9 ++++
 5 files changed, 67 insertions(+), 17 deletions(-)
 rename pkg/bulkAction/{adaptor => adapter}/adaptor.go (97%)

diff --git a/pkg/bulkAction/adaptor/adaptor.go b/pkg/bulkAction/adapter/adaptor.go
similarity index 97%
rename from pkg/bulkAction/adaptor/adaptor.go
rename to pkg/bulkAction/adapter/adaptor.go
index 8662ade5bd..1c469eb9f0 100644
--- a/pkg/bulkAction/adaptor/adaptor.go
+++ b/pkg/bulkAction/adapter/adaptor.go
@@ -1,4 +1,4 @@
-package adaptor
+package adapter
 
 import "github.com/devtron-labs/devtron/pkg/bulkAction/bean"
 
diff --git a/pkg/bulkAction/bean/bean.go b/pkg/bulkAction/bean/bean.go
index 9be99a79d7..6a777834b2 100644
--- a/pkg/bulkAction/bean/bean.go
+++ b/pkg/bulkAction/bean/bean.go
@@ -16,8 +16,6 @@
 
 package bean
 
-import "errors"
-
 type NameIncludesExcludes struct {
 	Names []string `json:"names"`
 }
@@ -161,5 +159,3 @@ type PipelineAndWfBulkActionResponseDto struct {
 	CiPipelineRespDtos  []*CiBulkActionResponseDto `json:"ciPipelines"`
 	AppWfRespDtos       []*WfBulkActionResponseDto `json:"appWorkflows"`
 }
-
-var ErrConfigProtectionEnabled = errors.New("config protection enabled")
diff --git a/pkg/bulkAction/service/BulkUpdateService.go b/pkg/bulkAction/service/BulkUpdateService.go
index dfe62030c1..82c83c6196 100644
--- a/pkg/bulkAction/service/BulkUpdateService.go
+++ b/pkg/bulkAction/service/BulkUpdateService.go
@@ -35,7 +35,7 @@ import (
 	bean6 "github.com/devtron-labs/devtron/pkg/auth/user/bean"
 	bean2 "github.com/devtron-labs/devtron/pkg/bean"
 	"github.com/devtron-labs/devtron/pkg/build/trigger"
-	"github.com/devtron-labs/devtron/pkg/bulkAction/adaptor"
+	"github.com/devtron-labs/devtron/pkg/bulkAction/adapter"
 	bean4 "github.com/devtron-labs/devtron/pkg/bulkAction/bean"
 	"github.com/devtron-labs/devtron/pkg/bulkAction/repository"
 	"github.com/devtron-labs/devtron/pkg/bulkAction/utils"
@@ -46,7 +46,7 @@ import (
 	"github.com/devtron-labs/devtron/pkg/deployment/manifest/configMapAndSecret"
 	"github.com/devtron-labs/devtron/pkg/deployment/manifest/deployedAppMetrics"
 	"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate"
-	"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/adapter"
+	dtAdapter "github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/adapter"
 	"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/chartRef"
 	bean3 "github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/chartRef/bean"
 	"github.com/devtron-labs/devtron/pkg/eventProcessor/out"
@@ -419,12 +419,7 @@ func (impl BulkUpdateServiceImpl) DryRunBulkEdit(bulkUpdatePayload *bean4.BulkUp
 }
 
 func (impl BulkUpdateServiceImpl) ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error) {
-	modified, err := patch.Apply([]byte(target))
-	if err != nil {
-		impl.logger.Errorw("error in applying JSON patch", "err", err)
-		return "Patch Failed", err
-	}
-	return string(modified), err
+	return utils.ApplyJsonPatch(patch, target)
 }
 
 func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.DeploymentTemplateBulkUpdateResponse {
@@ -460,7 +455,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Conte
 					appDetailsByChart, _ := impl.bulkEditRepository.FindAppByChartId(chart.Id)
 					appId := appDetailsByChart.Id
 					if validationErr := impl.isBaseDTConfigUpdateAllowed(ctx, appId, userMetadata); validationErr != nil {
-						deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, adaptor.GetDeploymentTemplateBulkUpdateResponseForOneApp(appId, appDetailsByChart.AppName, 0, validationErr.Error()))
+						deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, adapter.GetDeploymentTemplateBulkUpdateResponseForOneApp(appId, appDetailsByChart.AppName, 0, validationErr.Error()))
 						continue
 					}
 					modifiedValuesYml, err := impl.ApplyJsonPatch(deploymentTemplatePatch, chart.Values)
@@ -539,7 +534,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Conte
 					appDetailsByChart, _ := impl.bulkEditRepository.FindAppByChartEnvId(chartEnv.Id)
 					appId := appDetailsByChart.Id
 					if validationErr := impl.isEnvDTConfigUpdateAllowed(ctx, appId, envId, userMetadata); validationErr != nil {
-						deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, adaptor.GetDeploymentTemplateBulkUpdateResponseForOneApp(appId, appDetailsByChart.AppName, envId, validationErr.Error()))
+						deploymentTemplateBulkUpdateResponse.Failure = append(deploymentTemplateBulkUpdateResponse.Failure, adapter.GetDeploymentTemplateBulkUpdateResponseForOneApp(appId, appDetailsByChart.AppName, envId, validationErr.Error()))
 						continue
 					}
 					modified, err := impl.ApplyJsonPatch(deploymentTemplatePatch, chartEnv.EnvOverrideValues)
@@ -579,7 +574,7 @@ func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Conte
 								return nil
 							}
 							chartEnv.EnvOverrideValues = modified
-							chartEnvDTO := adapter.EnvOverrideDBToDTO(chartEnv)
+							chartEnvDTO := dtAdapter.EnvOverrideDBToDTO(chartEnv)
 							err = impl.deploymentTemplateHistoryService.CreateDeploymentTemplateHistoryFromEnvOverrideTemplate(chartEnvDTO, nil, isAppMetricsEnabled, 0)
 							if err != nil {
 								impl.logger.Errorw("error in creating entry for env deployment template history", "err", err, "envOverride", chartEnv)
@@ -636,6 +631,10 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(ctx context.Context, bulkU
 						configMapBulkUpdateResponse.Message = append(configMapBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps globally : %s", err.Error()))
 						continue
 					}
+					if validationErr := impl.isBaseCMConfigUpdateAllowed(ctx, appId, userMetadata); validationErr != nil {
+						configMapBulkUpdateResponse.Failure = append(configMapBulkUpdateResponse.Failure, adapter.GetCmAndSecretBulkUpdateResponseForOneApp(appDetailsById.Id, appDetailsById.AppName, 0, []string{}, validationErr.Error()))
+						continue
+					}
 					configMapNames := gjson.Get(configMapAppModel.ConfigMapData, "maps.#.name")
 					messageCmNamesMap := make(map[string][]string)
 					for i, configMapName := range configMapNames.Array() {
@@ -727,6 +726,17 @@ func (impl BulkUpdateServiceImpl) BulkUpdateConfigMap(ctx context.Context, bulkU
 				configMapBulkUpdateResponse.Message = append(configMapBulkUpdateResponse.Message, fmt.Sprintf("No matching apps to update for envId : %d", envId))
 			} else {
 				for _, configMapEnvModel := range configMapEnvModels {
+					appId := configMapEnvModel.AppId
+					appDetailsById, err := impl.appRepository.FindById(appId)
+					if err != nil {
+						impl.logger.Errorw("error in fetching app details by id", "appId", appId, "err", err)
+						configMapBulkUpdateResponse.Message = append(configMapBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps for env : %s", err.Error()))
+						continue
+					}
+					if validationErr := impl.isEnvCMConfigUpdateAllowed(ctx, appId, envId, userMetadata); validationErr != nil {
+						configMapBulkUpdateResponse.Failure = append(configMapBulkUpdateResponse.Failure, adapter.GetCmAndSecretBulkUpdateResponseForOneApp(appDetailsById.Id, appDetailsById.AppName, envId, []string{}, validationErr.Error()))
+						continue
+					}
 					configMapNames := gjson.Get(configMapEnvModel.ConfigMapData, "maps.#.name")
 					messageCmNamesMap := make(map[string][]string)
 					for i, configMapName := range configMapNames.Array() {
@@ -842,6 +852,16 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(ctx context.Context, bulkUpda
 			} else {
 				for _, secretAppModel := range secretAppModels {
 					appId := secretAppModel.AppId
+					appDetailsById, err := impl.appRepository.FindById(appId)
+					if err != nil {
+						impl.logger.Errorw("error in fetching app details by id", "appId", appId, "err", err)
+						secretBulkUpdateResponse.Message = append(secretBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps globally : %s", err.Error()))
+						continue
+					}
+					if validationErr := impl.isBaseCSConfigUpdateAllowed(ctx, appId, userMetadata); validationErr != nil {
+						secretBulkUpdateResponse.Failure = append(secretBulkUpdateResponse.Failure, adapter.GetCmAndSecretBulkUpdateResponseForOneApp(appDetailsById.Id, appDetailsById.AppName, 0, []string{}, validationErr.Error()))
+						continue
+					}
 					secretNames := gjson.Get(secretAppModel.SecretData, "secrets.#.name")
 					messageSecretNamesMap := make(map[string][]string)
 					for i, secretName := range secretNames.Array() {
@@ -941,6 +961,16 @@ func (impl BulkUpdateServiceImpl) BulkUpdateSecret(ctx context.Context, bulkUpda
 			} else {
 				for _, secretEnvModel := range secretEnvModels {
 					appId := secretEnvModel.AppId
+					appDetailsById, err := impl.appRepository.FindById(appId)
+					if err != nil {
+						impl.logger.Errorw("error in fetching app details by id", "appId", appId, "err", err)
+						secretBulkUpdateResponse.Message = append(secretBulkUpdateResponse.Message, fmt.Sprintf("Unable to bulk update apps for env : %s", err.Error()))
+						continue
+					}
+					if validationErr := impl.isEnvCSConfigUpdateAllowed(ctx, appId, envId, userMetadata); validationErr != nil {
+						secretBulkUpdateResponse.Failure = append(secretBulkUpdateResponse.Failure, adapter.GetCmAndSecretBulkUpdateResponseForOneApp(appDetailsById.Id, appDetailsById.AppName, envId, []string{}, validationErr.Error()))
+						continue
+					}
 					secretNames := gjson.Get(secretEnvModel.SecretData, "secrets.#.name")
 					messageSecretNamesMap := make(map[string][]string)
 					for i, secretName := range secretNames.Array() {
@@ -1444,7 +1474,6 @@ func (impl BulkUpdateServiceImpl) BulkDeploy(ctx *util2.RequestCtx, request *bea
 		artifactResponse, err := impl.pipelineBuilder.RetrieveArtifactsByCDPipelineV2(pipeline, bean.CD_WORKFLOW_TYPE_DEPLOY, artifactsListingFilterOptions)
 		if err != nil {
 			impl.logger.Errorw("service err, GetArtifactsByCDPipeline", "err", err, "cdPipelineId", pipeline.Id)
-			//return nil, err
 			pipelineResponse := response[appKey]
 			pipelineResponse[appKey] = false
 			response[appKey] = pipelineResponse
diff --git a/pkg/bulkAction/service/BulkUpdateService_ent.go b/pkg/bulkAction/service/BulkUpdateService_ent.go
index c95d38a539..990f7e9d84 100644
--- a/pkg/bulkAction/service/BulkUpdateService_ent.go
+++ b/pkg/bulkAction/service/BulkUpdateService_ent.go
@@ -24,6 +24,22 @@ func (impl BulkUpdateServiceImpl) isBaseDTConfigUpdateAllowed(ctx context.Contex
 	return nil
 }
 
+func (impl BulkUpdateServiceImpl) isEnvCMConfigUpdateAllowed(ctx context.Context, appId, envId int, userMetadata *userBean.UserMetadata) error {
+	return nil
+}
+
+func (impl BulkUpdateServiceImpl) isBaseCMConfigUpdateAllowed(ctx context.Context, appId int, userMetadata *userBean.UserMetadata) error {
+	return nil
+}
+
+func (impl BulkUpdateServiceImpl) isEnvCSConfigUpdateAllowed(ctx context.Context, appId, envId int, userMetadata *userBean.UserMetadata) error {
+	return nil
+}
+
+func (impl BulkUpdateServiceImpl) isBaseCSConfigUpdateAllowed(ctx context.Context, appId int, userMetadata *userBean.UserMetadata) error {
+	return nil
+}
+
 func (impl BulkUpdateServiceImpl) BulkHibernateV1(ctx context.Context, request *bean.BulkApplicationForEnvironmentPayload, checkAuthForBulkActions func(token string, appObject string, envObject string) bool,
 	userMetadata *userBean.UserMetadata) (*bean.BulkApplicationHibernateUnhibernateForEnvironmentResponse, error) {
 	return nil, nil
diff --git a/pkg/bulkAction/utils/utils.go b/pkg/bulkAction/utils/utils.go
index b427905632..d9b4284534 100644
--- a/pkg/bulkAction/utils/utils.go
+++ b/pkg/bulkAction/utils/utils.go
@@ -2,6 +2,7 @@ package utils
 
 import (
 	"fmt"
+	jsonpatch "github.com/evanphx/json-patch"
 )
 
 // GenerateIdentifierKey returns the appKey and pipelineKey for a given pipeline.
@@ -11,3 +12,11 @@ func GenerateIdentifierKey(id int, name string) (appKey string) {
 	appKey = fmt.Sprintf("%d_%s", id, name)
 	return appKey
 }
+
+func ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error) {
+	modified, err := patch.Apply([]byte(target))
+	if err != nil {
+		return "Patch Failed", err
+	}
+	return string(modified), err
+}

From 4fe2e84503072d96f8e83f00dbad5b4e9aabdfd3 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Tue, 15 Jul 2025 05:13:35 +0530
Subject: [PATCH 08/22] feat: add JSONPathVersion and enhance optional pointer
 handling in templates

---
 go.mod                                        |   7 +-
 go.sum                                        |  14 ++-
 .../getkin/kin-openapi/openapi3/schema.go     |   7 +-
 .../kin-openapi/openapi3/schema_pattern.go    |  10 +-
 .../openapi3/schema_validation_settings.go    |  13 +++
 .../openapi3/validation_options.go            |   9 ++
 .../v2/cmd/oapi-codegen/oapi-codegen.go       |  15 ++-
 .../oapi-codegen/v2/pkg/codegen/codegen.go    |  13 ++-
 .../v2/pkg/codegen/configuration.go           |  59 ++++++++++
 .../oapi-codegen/v2/pkg/codegen/operations.go |  39 +++++--
 .../oapi-codegen/v2/pkg/codegen/schema.go     |  92 +++++++++------
 .../templates/additional-properties.tmpl      |   6 +-
 .../codegen/templates/chi/chi-middleware.tmpl |  14 +--
 .../templates/client-with-responses.tmpl      |   7 ++
 .../v2/pkg/codegen/templates/client.tmpl      |  30 ++---
 .../codegen/templates/echo/echo-wrappers.tmpl |  14 +--
 .../templates/fiber/fiber-middleware.tmpl     |  14 +--
 .../codegen/templates/gin/gin-wrappers.tmpl   |  14 +--
 .../templates/gorilla/gorilla-middleware.tmpl |  14 +--
 .../templates/iris/iris-middleware.tmpl       |  14 +--
 .../stdhttp/std-http-middleware.tmpl          |  14 +--
 .../union-and-additional-properties.tmpl      |   4 +-
 .../v2/pkg/codegen/templates/union.tmpl       |   4 +-
 .../oapi-codegen/v2/pkg/codegen/utils.go      |  31 +++--
 .../oapi-codegen/v2/pkg/util/loader.go        |  18 ++-
 .../openapi-overlay/pkg/overlay/apply.go      | 110 ++++++++++++------
 .../openapi-overlay/pkg/overlay/compare.go    |   3 +-
 .../openapi-overlay/pkg/overlay/schema.go     |   6 +-
 vendor/modules.txt                            |  16 ++-
 29 files changed, 416 insertions(+), 195 deletions(-)

diff --git a/go.mod b/go.mod
index 9488b84f6e..8374aff4a0 100644
--- a/go.mod
+++ b/go.mod
@@ -267,7 +267,7 @@ require (
 	github.com/fluxcd/helm-controller/api v1.3.0
 	github.com/fluxcd/pkg/apis/meta v1.13.0
 	github.com/fluxcd/source-controller/api v1.6.2
-	github.com/oapi-codegen/oapi-codegen/v2 v2.4.1
+	github.com/oapi-codegen/oapi-codegen/v2 v2.4.2-0.20250511160408-c8cf342fd5ea
 	sigs.k8s.io/controller-runtime v0.21.0
 )
 
@@ -309,14 +309,15 @@ require (
 	github.com/fluxcd/pkg/apis/acl v0.7.0 // indirect
 	github.com/fluxcd/pkg/apis/kustomize v1.10.0 // indirect
 	github.com/fxamacker/cbor/v2 v2.8.0 // indirect
-	github.com/getkin/kin-openapi v0.127.0 // indirect
+	github.com/getkin/kin-openapi v0.128.0 // indirect
 	github.com/google/go-github/v66 v66.0.0 // indirect
 	github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
 	github.com/invopop/yaml v0.3.1 // indirect
 	github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
 	github.com/perimeterx/marshmallow v1.1.5 // indirect
 	github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
-	github.com/speakeasy-api/openapi-overlay v0.9.0 // indirect
+	github.com/speakeasy-api/jsonpath v0.6.0 // indirect
+	github.com/speakeasy-api/openapi-overlay v0.10.2 // indirect
 	github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
 	github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
 	github.com/x448/float16 v0.8.4 // indirect
diff --git a/go.sum b/go.sum
index 92cfb4d6eb..c3565059b5 100644
--- a/go.sum
+++ b/go.sum
@@ -319,8 +319,8 @@ github.com/gammazero/deque v1.0.0 h1:LTmimT8H7bXkkCy6gZX7zNLtkbz4NdS2z8LZuor3j34
 github.com/gammazero/deque v1.0.0/go.mod h1:iflpYvtGfM3U8S8j+sZEKIak3SAKYpA5/SQewgfXDKo=
 github.com/gammazero/workerpool v1.1.3 h1:WixN4xzukFoN0XSeXF6puqEqFTl2mECI9S6W44HWy9Q=
 github.com/gammazero/workerpool v1.1.3/go.mod h1:wPjyBLDbyKnUn2XwwyD3EEwo9dHutia9/fwNmSHWACc=
-github.com/getkin/kin-openapi v0.127.0 h1:Mghqi3Dhryf3F8vR370nN67pAERW+3a95vomb3MAREY=
-github.com/getkin/kin-openapi v0.127.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM=
+github.com/getkin/kin-openapi v0.128.0 h1:jqq3D9vC9pPq1dGcOCv7yOp1DaEe7c/T1vzcLbITSp4=
+github.com/getkin/kin-openapi v0.128.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM=
 github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew=
@@ -674,8 +674,8 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS
 github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
 github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
 github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
-github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 h1:ykgG34472DWey7TSjd8vIfNykXgjOgYJZoQbKfEeY/Q=
-github.com/oapi-codegen/oapi-codegen/v2 v2.4.1/go.mod h1:N5+lY1tiTDV3V1BeHtOxeWXHoPVeApvsvjJqegfoaz8=
+github.com/oapi-codegen/oapi-codegen/v2 v2.4.2-0.20250511160408-c8cf342fd5ea h1:xBe5UepV2E8pY5ZVWD79CvGvhSUXGyM/TtSzM6YaPoE=
+github.com/oapi-codegen/oapi-codegen/v2 v2.4.2-0.20250511160408-c8cf342fd5ea/go.mod h1:MzpDMJAaekegzq+m6G+OjGTq2J81ziHrMebiFc1XmZ0=
 github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852/go.mod h1:eqOVx5Vwu4gd2mmMZvVZsgIqNSaW3xxRThUJ0k/TPk4=
 github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -788,8 +788,10 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
 github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
 github.com/skeema/knownhosts v1.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY=
 github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M=
-github.com/speakeasy-api/openapi-overlay v0.9.0 h1:Wrz6NO02cNlLzx1fB093lBlYxSI54VRhy1aSutx0PQg=
-github.com/speakeasy-api/openapi-overlay v0.9.0/go.mod h1:f5FloQrHA7MsxYg9djzMD5h6dxrHjVVByWKh7an8TRc=
+github.com/speakeasy-api/jsonpath v0.6.0 h1:IhtFOV9EbXplhyRqsVhHoBmmYjblIRh5D1/g8DHMXJ8=
+github.com/speakeasy-api/jsonpath v0.6.0/go.mod h1:ymb2iSkyOycmzKwbEAYPJV/yi2rSmvBCLZJcyD+VVWw=
+github.com/speakeasy-api/openapi-overlay v0.10.2 h1:VOdQ03eGKeiHnpb1boZCGm7x8Haj6gST0P3SGTX95GU=
+github.com/speakeasy-api/openapi-overlay v0.10.2/go.mod h1:n0iOU7AqKpNFfEt6tq7qYITC4f0yzVVdFw0S7hukemg=
 github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
 github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
 github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/schema.go b/vendor/github.com/getkin/kin-openapi/openapi3/schema.go
index 7be6bd38e2..f81196066a 100644
--- a/vendor/github.com/getkin/kin-openapi/openapi3/schema.go
+++ b/vendor/github.com/getkin/kin-openapi/openapi3/schema.go
@@ -9,7 +9,6 @@ import (
 	"math"
 	"math/big"
 	"reflect"
-	"regexp"
 	"sort"
 	"strconv"
 	"strings"
@@ -1019,7 +1018,7 @@ func (schema *Schema) validate(ctx context.Context, stack []*Schema) ([]*Schema,
 				}
 			}
 			if !validationOpts.schemaPatternValidationDisabled && schema.Pattern != "" {
-				if _, err := schema.compilePattern(); err != nil {
+				if _, err := schema.compilePattern(validationOpts.regexCompilerFunc); err != nil {
 					return stack, err
 				}
 			}
@@ -1729,10 +1728,10 @@ func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value
 	// "pattern"
 	if !settings.patternValidationDisabled && schema.Pattern != "" {
 		cpiface, _ := compiledPatterns.Load(schema.Pattern)
-		cp, _ := cpiface.(*regexp.Regexp)
+		cp, _ := cpiface.(RegexMatcher)
 		if cp == nil {
 			var err error
-			if cp, err = schema.compilePattern(); err != nil {
+			if cp, err = schema.compilePattern(settings.regexCompiler); err != nil {
 				if !settings.multiError {
 					return err
 				}
diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/schema_pattern.go b/vendor/github.com/getkin/kin-openapi/openapi3/schema_pattern.go
index 4794b6a0d8..5819713780 100644
--- a/vendor/github.com/getkin/kin-openapi/openapi3/schema_pattern.go
+++ b/vendor/github.com/getkin/kin-openapi/openapi3/schema_pattern.go
@@ -13,9 +13,14 @@ func intoGoRegexp(re string) string {
 }
 
 // NOTE: racey WRT [writes to schema.Pattern] vs [reads schema.Pattern then writes to compiledPatterns]
-func (schema *Schema) compilePattern() (cp *regexp.Regexp, err error) {
+func (schema *Schema) compilePattern(c RegexCompilerFunc) (cp RegexMatcher, err error) {
 	pattern := schema.Pattern
-	if cp, err = regexp.Compile(intoGoRegexp(pattern)); err != nil {
+	if c != nil {
+		cp, err = c(pattern)
+	} else {
+		cp, err = regexp.Compile(intoGoRegexp(pattern))
+	}
+	if err != nil {
 		err = &SchemaError{
 			Schema:      schema,
 			SchemaField: "pattern",
@@ -24,6 +29,7 @@ func (schema *Schema) compilePattern() (cp *regexp.Regexp, err error) {
 		}
 		return
 	}
+
 	var _ bool = compiledPatterns.CompareAndSwap(pattern, nil, cp)
 	return
 }
diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/schema_validation_settings.go b/vendor/github.com/getkin/kin-openapi/openapi3/schema_validation_settings.go
index 17aad2fa70..e9c1422bd8 100644
--- a/vendor/github.com/getkin/kin-openapi/openapi3/schema_validation_settings.go
+++ b/vendor/github.com/getkin/kin-openapi/openapi3/schema_validation_settings.go
@@ -7,6 +7,12 @@ import (
 // SchemaValidationOption describes options a user has when validating request / response bodies.
 type SchemaValidationOption func(*schemaValidationSettings)
 
+type RegexCompilerFunc func(expr string) (RegexMatcher, error)
+
+type RegexMatcher interface {
+	MatchString(s string) bool
+}
+
 type schemaValidationSettings struct {
 	failfast                    bool
 	multiError                  bool
@@ -16,6 +22,8 @@ type schemaValidationSettings struct {
 	readOnlyValidationDisabled  bool
 	writeOnlyValidationDisabled bool
 
+	regexCompiler RegexCompilerFunc
+
 	onceSettingDefaults sync.Once
 	defaultsSet         func()
 
@@ -70,6 +78,11 @@ func SetSchemaErrorMessageCustomizer(f func(err *SchemaError) string) SchemaVali
 	return func(s *schemaValidationSettings) { s.customizeMessageError = f }
 }
 
+// SetSchemaRegexCompiler allows to override the regex implementation used to validate field "pattern".
+func SetSchemaRegexCompiler(c RegexCompilerFunc) SchemaValidationOption {
+	return func(s *schemaValidationSettings) { s.regexCompiler = c }
+}
+
 func newSchemaValidationSettings(opts ...SchemaValidationOption) *schemaValidationSettings {
 	settings := &schemaValidationSettings{}
 	for _, opt := range opts {
diff --git a/vendor/github.com/getkin/kin-openapi/openapi3/validation_options.go b/vendor/github.com/getkin/kin-openapi/openapi3/validation_options.go
index 45563256ac..1d141d40a3 100644
--- a/vendor/github.com/getkin/kin-openapi/openapi3/validation_options.go
+++ b/vendor/github.com/getkin/kin-openapi/openapi3/validation_options.go
@@ -13,6 +13,7 @@ type ValidationOptions struct {
 	schemaFormatValidationEnabled                    bool
 	schemaPatternValidationDisabled                  bool
 	schemaExtensionsInRefProhibited                  bool
+	regexCompilerFunc                                RegexCompilerFunc
 	extraSiblingFieldsAllowed                        map[string]struct{}
 }
 
@@ -113,6 +114,14 @@ func ProhibitExtensionsWithRef() ValidationOption {
 	}
 }
 
+// SetRegexCompiler allows to override the regex implementation used to validate
+// field "pattern".
+func SetRegexCompiler(c RegexCompilerFunc) ValidationOption {
+	return func(options *ValidationOptions) {
+		options.regexCompilerFunc = c
+	}
+}
+
 // WithValidationOptions allows adding validation options to a context object that can be used when validating any OpenAPI type.
 func WithValidationOptions(ctx context.Context, opts ...ValidationOption) context.Context {
 	if len(opts) == 0 {
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen/oapi-codegen.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen/oapi-codegen.go
index 2d05cff92c..c41f3718d3 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen/oapi-codegen.go
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen/oapi-codegen.go
@@ -111,7 +111,7 @@ func main() {
 	flag.StringVar(&flagImportMapping, "import-mapping", "", "A dict from the external reference to golang package path.")
 	flag.StringVar(&flagExcludeSchemas, "exclude-schemas", "", "A comma separated list of schemas which must be excluded from generation.")
 	flag.StringVar(&flagResponseTypeSuffix, "response-type-suffix", "", "The suffix used for responses types.")
-	flag.BoolVar(&flagAliasTypes, "alias-types", false, "Alias type declarations of possible.")
+	flag.BoolVar(&flagAliasTypes, "alias-types", false, "Alias type declarations if possible.")
 	flag.BoolVar(&flagInitialismOverrides, "initialism-overrides", false, "Use initialism overrides.")
 
 	flag.Parse()
@@ -271,6 +271,15 @@ func main() {
 		errExit("configuration error: %v\n", err)
 	}
 
+	if warnings := opts.Generate.Warnings(); len(warnings) > 0 {
+		out := "WARNING: A number of warning(s) were returned when validating the GenerateOptions:"
+		for k, v := range warnings {
+			out += "\n- " + k + ": " + v
+		}
+
+		_, _ = fmt.Fprint(os.Stderr, out)
+	}
+
 	// If the user asked to output configuration, output it to stdout and exit
 	if flagOutputConfig {
 		buf, err := yaml.Marshal(opts)
@@ -297,11 +306,11 @@ func main() {
 	}
 
 	if strings.HasPrefix(swagger.OpenAPI, "3.1.") {
-		fmt.Println("WARNING: You are using an OpenAPI 3.1.x specification, which is not yet supported by oapi-codegen (https://github.com/oapi-codegen/oapi-codegen/issues/373) and so some functionality may not be available. Until oapi-codegen supports OpenAPI 3.1, it is recommended to downgrade your spec to 3.0.x")
+		fmt.Fprintln(os.Stderr, "WARNING: You are using an OpenAPI 3.1.x specification, which is not yet supported by oapi-codegen (https://github.com/oapi-codegen/oapi-codegen/issues/373) and so some functionality may not be available. Until oapi-codegen supports OpenAPI 3.1, it is recommended to downgrade your spec to 3.0.x")
 	}
 
 	if len(noVCSVersionOverride) > 0 {
-		opts.Configuration.NoVCSVersionOverride = &noVCSVersionOverride
+		opts.NoVCSVersionOverride = &noVCSVersionOverride
 	}
 
 	code, err := codegen.Generate(swagger, opts.Configuration)
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/codegen.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/codegen.go
index 632f649e23..facddb914d 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/codegen.go
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/codegen.go
@@ -47,6 +47,9 @@ var globalState struct {
 	options       Configuration
 	spec          *openapi3.T
 	importMapping importMap
+	// initialismsMap stores initialisms as "lower(initialism) -> initialism" map.
+	// List of initialisms was taken from https://staticcheck.io/docs/configuration/options/#initialisms.
+	initialismsMap map[string]string
 }
 
 // goImport represents a go package to be imported in the generated code
@@ -139,6 +142,12 @@ func Generate(spec *openapi3.T, opts Configuration) (string, error) {
 			opts.OutputOptions.NameNormalizer, NameNormalizers.Options())
 	}
 
+	if nameNormalizerFunction != NameNormalizerFunctionToCamelCaseWithInitialisms && len(opts.OutputOptions.AdditionalInitialisms) > 0 {
+		return "", fmt.Errorf("you have specified `additional-initialisms`, but the `name-normalizer` is not set to `ToCamelCaseWithInitialisms`. Please specify `name-normalizer: ToCamelCaseWithInitialisms` or remove the `additional-initialisms` configuration")
+	}
+
+	globalState.initialismsMap = makeInitialismsMap(opts.OutputOptions.AdditionalInitialisms)
+
 	// This creates the golang templates text package
 	TemplateFunctions["opts"] = func() Configuration { return globalState.options }
 	t := template.New("oapi-codegen").Funcs(TemplateFunctions)
@@ -955,7 +964,9 @@ func GetUserTemplateText(inputData string) (template string, err error) {
 		return "", fmt.Errorf("failed to execute GET request data from %s: %w", inputData, err)
 	}
 	if resp != nil {
-		defer resp.Body.Close()
+		defer func() {
+			_ = resp.Body.Close()
+		}()
 	}
 	if resp.StatusCode < 200 || resp.StatusCode >= 300 {
 		return "", fmt.Errorf("got non %d status code on GET %s", resp.StatusCode, inputData)
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/configuration.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/configuration.go
index c2d36f9df0..5608e227cd 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/configuration.go
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/configuration.go
@@ -132,6 +132,35 @@ func (oo GenerateOptions) Validate() map[string]string {
 	return nil
 }
 
+func (oo GenerateOptions) Warnings() map[string]string {
+	warnings := make(map[string]string)
+
+	if oo.StdHTTPServer {
+		if warning := oo.warningForStdHTTP(); warning != "" {
+			warnings["std-http-server"] = warning
+		}
+	}
+
+	return warnings
+}
+
+func (oo GenerateOptions) warningForStdHTTP() string {
+	pathToGoMod, mod, err := findAndParseGoModuleForDepth(".", maximumDepthToSearchForGoMod)
+	if err != nil {
+		return fmt.Sprintf("Encountered an error while trying to find a `go.mod` or a `tools.mod` in this directory, or %d levels above it: %v", maximumDepthToSearchForGoMod, err)
+	}
+
+	if mod == nil {
+		return fmt.Sprintf("Failed to find a `go.mod` or a `tools.mod` in this directory, or %d levels above it, so unable to validate that you're using Go 1.22+. If you start seeing API interactions resulting in a `404 page not found`, the Go directive (implying source compatibility for this module) needs to be bumped. See also: https://www.jvt.me/posts/2024/03/04/go-net-http-why-404/", maximumDepthToSearchForGoMod)
+	}
+
+	if !hasMinimalMinorGoDirective(minimumGoVersionForGenerateStdHTTPServer, mod) {
+		return fmt.Sprintf("Found a `go.mod` or a `tools.mod` at path %v, but it only had a version of %v, whereas the minimum required is 1.%d. It's very likely API interactions will result in a `404 page not found`. The Go directive (implying source compatibility for this module) needs to be bumped. See also: https://www.jvt.me/posts/2024/03/04/go-net-http-why-404/", pathToGoMod, mod.Go.Version, minimumGoVersionForGenerateStdHTTPServer)
+	}
+
+	return ""
+}
+
 // CompatibilityOptions specifies backward compatibility settings for the
 // code generator.
 type CompatibilityOptions struct {
@@ -195,6 +224,14 @@ type CompatibilityOptions struct {
 	//
 	// NOTE that this can be confusing to users of your OpenAPI specification, who may see a field present and therefore be expecting to see/use it in the request/response, without understanding the nuance of how `oapi-codegen` generates the code.
 	AllowUnexportedStructFieldNames bool `yaml:"allow-unexported-struct-field-names"`
+
+	// PreserveOriginalOperationIdCasingInEmbeddedSpec ensures that the `operationId` from the source spec is kept intact in case when embedding it into the Embedded Spec output.
+	// When `oapi-codegen` parses the original OpenAPI specification, it will apply the configured `output-options.name-normalizer` to each operation's `operationId` before that is used to generate code from.
+	// However, this is also applied to the copy of the `operationId`s in the `embedded-spec` generation, which means that the embedded OpenAPI specification is then out-of-sync with the input specificiation.
+	// To ensure that the `operationId` in the embedded spec is preserved as-is from the input specification, set this.
+	// NOTE that this will not impact generated code.
+	// NOTE that if you're using `include-operation-ids` or `exclude-operation-ids` you may want to ensure that the `operationId`s used are correct.
+	PreserveOriginalOperationIdCasingInEmbeddedSpec bool `yaml:"preserve-original-operation-id-casing-in-embedded-spec"`
 }
 
 func (co CompatibilityOptions) Validate() map[string]string {
@@ -226,6 +263,9 @@ type OutputOptions struct {
 	ClientTypeName string `yaml:"client-type-name,omitempty"`
 	// Whether to use the initialism overrides
 	InitialismOverrides bool `yaml:"initialism-overrides,omitempty"`
+	// AdditionalInitialisms is a list of additional initialisms to use when generating names.
+	// NOTE that this has no effect unless the `name-normalizer` is set to `ToCamelCaseWithInitialisms`
+	AdditionalInitialisms []string `yaml:"additional-initialisms,omitempty"`
 	// Whether to generate nullable type for nullable fields
 	NullableType bool `yaml:"nullable-type,omitempty"`
 
@@ -239,9 +279,28 @@ type OutputOptions struct {
 
 	// Overlay defines configuration for the OpenAPI Overlay (https://github.com/OAI/Overlay-Specification) to manipulate the OpenAPI specification before generation. This allows modifying the specification without needing to apply changes directly to it, making it easier to keep it up-to-date.
 	Overlay OutputOptionsOverlay `yaml:"overlay"`
+
+	// EnableYamlTags adds YAML tags to generated structs, in addition to default JSON ones
+	EnableYamlTags bool `yaml:"yaml-tags,omitempty"`
+
+	// ClientResponseBytesFunction decides whether to enable the generation of a `Bytes()` method on response objects for `ClientWithResponses`
+	ClientResponseBytesFunction bool `yaml:"client-response-bytes-function,omitempty"`
+
+	// PreferSkipOptionalPointer allows defining at a global level whether to omit the pointer for a type to indicate that the field/type is optional.
+	// This is the same as adding `x-go-type-skip-optional-pointer` to each field (manually, or using an OpenAPI Overlay)
+	PreferSkipOptionalPointer bool `yaml:"prefer-skip-optional-pointer,omitempty"`
+
+	// PreferSkipOptionalPointerOnContainerTypes allows disabling the generation of an "optional pointer" for an optional field that is a container type (such as a slice or a map), which ends up requiring an additional, unnecessary, `... != nil` check
+	PreferSkipOptionalPointerOnContainerTypes bool `yaml:"prefer-skip-optional-pointer-on-container-types,omitempty"`
 }
 
 func (oo OutputOptions) Validate() map[string]string {
+	if NameNormalizerFunction(oo.NameNormalizer) != NameNormalizerFunctionToCamelCaseWithInitialisms && len(oo.AdditionalInitialisms) > 0 {
+		return map[string]string{
+			"additional-initialisms": "You have specified `additional-initialisms`, but the `name-normalizer` is not set to `ToCamelCaseWithInitialisms`. Please specify `name-normalizer: ToCamelCaseWithInitialisms` or remove the `additional-initialisms` configuration",
+		}
+	}
+
 	return nil
 }
 
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/operations.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/operations.go
index 3b0f130162..e4d9784702 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/operations.go
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/operations.go
@@ -135,10 +135,17 @@ func (pd ParameterDefinition) GoName() string {
 	return SchemaNameToTypeName(goName)
 }
 
+// Deprecated: Use HasOptionalPointer, as it is clearer what the intent is.
 func (pd ParameterDefinition) IndirectOptional() bool {
 	return !pd.Required && !pd.Schema.SkipOptionalPointer
 }
 
+// HasOptionalPointer indicates whether the generated property has an optional pointer associated with it.
+// This takes into account the `x-go-type-skip-optional-pointer` extension, allowing a parameter definition to control whether the pointer should be skipped.
+func (pd ParameterDefinition) HasOptionalPointer() bool {
+	return pd.Required == false && pd.Schema.SkipOptionalPointer == false //nolint:staticcheck
+}
+
 type ParameterDefinitions []ParameterDefinition
 
 func (p ParameterDefinitions) FindByName(name string) *ParameterDefinition {
@@ -208,7 +215,8 @@ func DescribeSecurityDefinition(securityRequirements openapi3.SecurityRequiremen
 
 // OperationDefinition describes an Operation
 type OperationDefinition struct {
-	OperationId string // The operation_id description from Swagger, used to generate function names
+	// OperationId is the `operationId` field from the OpenAPI Specification, after going through a `nameNormalizer`, and will be used to generate function names
+	OperationId string
 
 	PathParams          []ParameterDefinition // Parameters in the path, eg, /path/:param
 	HeaderParams        []ParameterDefinition // Parameters in HTTP headers
@@ -299,7 +307,7 @@ func (o *OperationDefinition) GetResponseTypeDefinitions() ([]ResponseTypeDefini
 				if contentType.Schema != nil {
 					responseSchema, err := GenerateGoSchema(contentType.Schema, []string{o.OperationId, responseName})
 					if err != nil {
-						return nil, fmt.Errorf("Unable to determine Go type for %s.%s: %w", o.OperationId, contentTypeName, err)
+						return nil, fmt.Errorf("unable to determine Go type for %s.%s: %w", o.OperationId, contentTypeName, err)
 					}
 
 					var typeName string
@@ -308,7 +316,7 @@ func (o *OperationDefinition) GetResponseTypeDefinitions() ([]ResponseTypeDefini
 					// HAL+JSON:
 					case StringInArray(contentTypeName, contentTypesHalJSON):
 						typeName = fmt.Sprintf("HALJSON%s", nameNormalizer(responseName))
-					case "application/json" == contentTypeName:
+					case contentTypeName == "application/json":
 						// if it's the standard application/json
 						typeName = fmt.Sprintf("JSON%s", nameNormalizer(responseName))
 					// Vendored JSON
@@ -558,25 +566,34 @@ func OperationDefinitions(swagger *openapi3.T, initialismOverrides bool) ([]Oper
 		// Each path can have a number of operations, POST, GET, OPTIONS, etc.
 		pathOps := pathItem.Operations()
 		for _, opName := range SortedMapKeys(pathOps) {
+			// NOTE that this is a reference to the existing copy of the Operation, so any modifications will modify our shared copy of the spec
 			op := pathOps[opName]
+
 			if pathItem.Servers != nil {
 				op.Servers = &pathItem.Servers
 			}
+			// take a copy of operationId, so we don't modify the underlying spec
+			operationId := op.OperationID
 			// We rely on OperationID to generate function names, it's required
-			if op.OperationID == "" {
-				op.OperationID, err = generateDefaultOperationID(opName, requestPath, toCamelCaseFunc)
+			if operationId == "" {
+				operationId, err = generateDefaultOperationID(opName, requestPath, toCamelCaseFunc)
 				if err != nil {
 					return nil, fmt.Errorf("error generating default OperationID for %s/%s: %s",
 						opName, requestPath, err)
 				}
 			} else {
-				op.OperationID = nameNormalizer(op.OperationID)
+				operationId = nameNormalizer(operationId)
+			}
+			operationId = typeNamePrefix(operationId) + operationId
+
+			if !globalState.options.Compatibility.PreserveOriginalOperationIdCasingInEmbeddedSpec {
+				// update the existing, shared, copy of the spec if we're not wanting to preserve it
+				op.OperationID = operationId
 			}
-			op.OperationID = typeNamePrefix(op.OperationID) + op.OperationID
 
 			// These are parameters defined for the specific path method that
 			// we're iterating over.
-			localParams, err := DescribeParameters(op.Parameters, []string{op.OperationID + "Params"})
+			localParams, err := DescribeParameters(op.Parameters, []string{operationId + "Params"})
 			if err != nil {
 				return nil, fmt.Errorf("error describing global parameters for %s/%s: %s",
 					opName, requestPath, err)
@@ -599,14 +616,14 @@ func OperationDefinitions(swagger *openapi3.T, initialismOverrides bool) ([]Oper
 				return nil, err
 			}
 
-			bodyDefinitions, typeDefinitions, err := GenerateBodyDefinitions(op.OperationID, op.RequestBody)
+			bodyDefinitions, typeDefinitions, err := GenerateBodyDefinitions(operationId, op.RequestBody)
 			if err != nil {
 				return nil, fmt.Errorf("error generating body definitions: %w", err)
 			}
 
 			ensureExternalRefsInRequestBodyDefinitions(&bodyDefinitions, pathItem.Ref)
 
-			responseDefinitions, err := GenerateResponseDefinitions(op.OperationID, op.Responses.Map())
+			responseDefinitions, err := GenerateResponseDefinitions(operationId, op.Responses.Map())
 			if err != nil {
 				return nil, fmt.Errorf("error generating response definitions: %w", err)
 			}
@@ -618,7 +635,7 @@ func OperationDefinitions(swagger *openapi3.T, initialismOverrides bool) ([]Oper
 				HeaderParams: FilterParameterDefinitionByType(allParams, "header"),
 				QueryParams:  FilterParameterDefinitionByType(allParams, "query"),
 				CookieParams: FilterParameterDefinitionByType(allParams, "cookie"),
-				OperationId:  nameNormalizer(op.OperationID),
+				OperationId:  nameNormalizer(operationId),
 				// Replace newlines in summary.
 				Summary:         op.Summary,
 				Method:          opName,
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/schema.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/schema.go
index 2cef0023fe..d2e64f9805 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/schema.go
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/schema.go
@@ -128,6 +128,12 @@ func (p Property) GoTypeDef() string {
 	return typeDef
 }
 
+// HasOptionalPointer indicates whether the generated property has an optional pointer associated with it.
+// This takes into account the `x-go-type-skip-optional-pointer` extension, allowing a parameter definition to control whether the pointer should be skipped.
+func (p Property) HasOptionalPointer() bool {
+	return p.Required == false && p.Schema.SkipOptionalPointer == false //nolint:staticcheck
+}
+
 // EnumDefinition holds type information for enum
 type EnumDefinition struct {
 	// Schema is the scheme of a type which has a list of enum values, eg, the
@@ -274,6 +280,8 @@ func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) {
 	outSchema := Schema{
 		Description: schema.Description,
 		OAPISchema:  schema,
+		// NOTE that SkipOptionalPointer will be defaulted to the global value, but can be overridden on a per-type/-field basis
+		SkipOptionalPointer: globalState.options.OutputOptions.PreferSkipOptionalPointer,
 	}
 
 	// AllOf is interesting, and useful. It's the union of a number of other
@@ -289,6 +297,16 @@ func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) {
 		return mergedSchema, nil
 	}
 
+	// Check x-go-type-skip-optional-pointer, which will override if the type
+	// should be a pointer or not when the field is optional.
+	if extension, ok := schema.Extensions[extPropGoTypeSkipOptionalPointer]; ok {
+		skipOptionalPointer, err := extParsePropGoTypeSkipOptionalPointer(extension)
+		if err != nil {
+			return outSchema, fmt.Errorf("invalid value for %q: %w", extPropGoTypeSkipOptionalPointer, err)
+		}
+		outSchema.SkipOptionalPointer = skipOptionalPointer
+	}
+
 	// Check x-go-type, which will completely override the definition of this
 	// schema with the provided type.
 	if extension, ok := schema.Extensions[extPropGoType]; ok {
@@ -302,16 +320,6 @@ func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) {
 		return outSchema, nil
 	}
 
-	// Check x-go-type-skip-optional-pointer, which will override if the type
-	// should be a pointer or not when the field is optional.
-	if extension, ok := schema.Extensions[extPropGoTypeSkipOptionalPointer]; ok {
-		skipOptionalPointer, err := extParsePropGoTypeSkipOptionalPointer(extension)
-		if err != nil {
-			return outSchema, fmt.Errorf("invalid value for %q: %w", extPropGoTypeSkipOptionalPointer, err)
-		}
-		outSchema.SkipOptionalPointer = skipOptionalPointer
-	}
-
 	// Schema type and format, eg. string / binary
 	t := schema.Type
 	// Handle objects and empty schemas first as a special case
@@ -325,10 +333,13 @@ func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) {
 				// We have an object with no properties. This is a generic object
 				// expressed as a map.
 				outType = "map[string]interface{}"
+				setSkipOptionalPointerForContainerType(&outSchema)
 			} else { // t == ""
 				// If we don't even have the object designator, we're a completely
 				// generic type.
 				outType = "interface{}"
+				// this should never have an "optional pointer", as it doesn't make sense to be a `*interface{}`
+				outSchema.SkipOptionalPointer = true
 			}
 			outSchema.GoType = outType
 			outSchema.DefineViaAlias = true
@@ -385,6 +396,7 @@ func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) {
 				// since we don't need them for a simple map.
 				outSchema.HasAdditionalProperties = false
 				outSchema.GoType = fmt.Sprintf("map[string]%s", additionalPropertiesType(outSchema))
+				setSkipOptionalPointerForContainerType(&outSchema)
 				return outSchema, nil
 			}
 
@@ -580,40 +592,34 @@ func oapiSchemaToGoType(schema *openapi3.Schema, path []string, outSchema *Schem
 		if sliceContains(globalState.options.OutputOptions.DisableTypeAliasesForType, "array") {
 			outSchema.DefineViaAlias = false
 		}
+		setSkipOptionalPointerForContainerType(outSchema)
 
 	} else if t.Is("integer") {
 		// We default to int if format doesn't ask for something else.
-		if f == "int64" {
-			outSchema.GoType = "int64"
-		} else if f == "int32" {
-			outSchema.GoType = "int32"
-		} else if f == "int16" {
-			outSchema.GoType = "int16"
-		} else if f == "int8" {
-			outSchema.GoType = "int8"
-		} else if f == "int" {
-			outSchema.GoType = "int"
-		} else if f == "uint64" {
-			outSchema.GoType = "uint64"
-		} else if f == "uint32" {
-			outSchema.GoType = "uint32"
-		} else if f == "uint16" {
-			outSchema.GoType = "uint16"
-		} else if f == "uint8" {
-			outSchema.GoType = "uint8"
-		} else if f == "uint" {
-			outSchema.GoType = "uint"
-		} else {
+		switch f {
+		case "int64",
+			"int32",
+			"int16",
+			"int8",
+			"int",
+			"uint64",
+			"uint32",
+			"uint16",
+			"uint8",
+			"uint":
+			outSchema.GoType = f
+		default:
 			outSchema.GoType = "int"
 		}
 		outSchema.DefineViaAlias = true
 	} else if t.Is("number") {
 		// We default to float for "number"
-		if f == "double" {
+		switch f {
+		case "double":
 			outSchema.GoType = "float64"
-		} else if f == "float" || f == "" {
+		case "float", "":
 			outSchema.GoType = "float32"
-		} else {
+		default:
 			return fmt.Errorf("invalid number format: %s", f)
 		}
 		outSchema.DefineViaAlias = true
@@ -628,6 +634,7 @@ func oapiSchemaToGoType(schema *openapi3.Schema, path []string, outSchema *Schem
 		switch f {
 		case "byte":
 			outSchema.GoType = "[]byte"
+			setSkipOptionalPointerForContainerType(outSchema)
 		case "email":
 			outSchema.GoType = "openapi_types.Email"
 		case "date":
@@ -728,11 +735,17 @@ func GenFieldsFromProperties(props []Property) []string {
 
 		if !omitEmpty {
 			fieldTags["json"] = p.JsonFieldName
+			if globalState.options.OutputOptions.EnableYamlTags {
+				fieldTags["yaml"] = p.JsonFieldName
+			}
 			if p.NeedsFormTag {
 				fieldTags["form"] = p.JsonFieldName
 			}
 		} else {
 			fieldTags["json"] = p.JsonFieldName + ",omitempty"
+			if globalState.options.OutputOptions.EnableYamlTags {
+				fieldTags["yaml"] = p.JsonFieldName + ",omitempty"
+			}
 			if p.NeedsFormTag {
 				fieldTags["form"] = p.JsonFieldName + ",omitempty"
 			}
@@ -889,3 +902,14 @@ func generateUnion(outSchema *Schema, elements openapi3.SchemaRefs, discriminato
 
 	return nil
 }
+
+// setSkipOptionalPointerForContainerType ensures that the "optional pointer" is skipped on container types (such as a slice or a map).
+// This is controlled using the `prefer-skip-optional-pointer-on-container-types` Output Option
+// NOTE that it is still possible to override this on a per-field basis with `x-go-type-skip-optional-pointer`
+func setSkipOptionalPointerForContainerType(outSchema *Schema) {
+	if !globalState.options.OutputOptions.PreferSkipOptionalPointerOnContainerTypes {
+		return
+	}
+
+	outSchema.SkipOptionalPointer = true
+}
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/additional-properties.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/additional-properties.tmpl
index 7b7c0ace4b..2f450582d1 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/additional-properties.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/additional-properties.tmpl
@@ -53,12 +53,12 @@ func (a {{.TypeName}}) MarshalJSON() ([]byte, error) {
     var err error
     object := make(map[string]json.RawMessage)
 {{range .Schema.Properties}}
-{{if not .Required}}if a.{{.GoFieldName}} != nil { {{end}}
+{{if .HasOptionalPointer}}if a.{{.GoFieldName}} != nil { {{end}}
     object["{{.JsonFieldName}}"], err = json.Marshal(a.{{.GoFieldName}})
     if err != nil {
         return nil, fmt.Errorf("error marshaling '{{.JsonFieldName}}': %w", err)
     }
-{{if not .Required}} }{{end}}
+{{if .HasOptionalPointer}} }{{end}}
 {{end}}
     for fieldName, field := range a.AdditionalProperties {
 		object[fieldName], err = json.Marshal(field)
@@ -69,4 +69,4 @@ func (a {{.TypeName}}) MarshalJSON() ([]byte, error) {
 	return json.Marshal(object)
 }
 {{end}}
-{{end}}
\ No newline at end of file
+{{end}}
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-middleware.tmpl
index 9423a67f2c..97866fca6a 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-middleware.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/chi/chi-middleware.tmpl
@@ -58,7 +58,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
         if paramValue := r.URL.Query().Get("{{.ParamName}}"); paramValue != "" {
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}paramValue
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue
         {{end}}
 
         {{if .IsJson}}
@@ -69,7 +69,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
             return
           }
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}value
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
         {{end}}
         }{{if .Required}} else {
             siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "{{.ParamName}}"})
@@ -98,7 +98,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           }
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}valueList[0]
+          params.{{.GoName}} = {{if .HasOptionalPointer }}&{{end}}valueList[0]
         {{end}}
 
         {{if .IsJson}}
@@ -117,7 +117,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           }
         {{end}}
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}{{.GoName}}
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}}
 
         } {{if .Required}}else {
             err := fmt.Errorf("Header parameter {{.ParamName}} is required, but not found")
@@ -135,7 +135,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
       if cookie, err = r.Cookie("{{.ParamName}}"); err == nil {
 
       {{- if .IsPassThrough}}
-        params.{{.GoName}} = {{if not .Required}}&{{end}}cookie.Value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value
       {{end}}
 
       {{- if .IsJson}}
@@ -154,7 +154,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           return
         }
 
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       {{- if .IsStyled}}
@@ -164,7 +164,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err})
           return
         }
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       }
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client-with-responses.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client-with-responses.tmpl
index 908f21476a..3b85500a8d 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client-with-responses.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client-with-responses.tmpl
@@ -74,6 +74,13 @@ func (r {{genResponseTypeName $opid | ucFirst}}) StatusCode() int {
     }
     return 0
 }
+
+{{ if opts.OutputOptions.ClientResponseBytesFunction }}
+// Bytes is a convenience method to retrieve the raw bytes from the HTTP response
+func (r {{genResponseTypeName $opid | ucFirst}}) Bytes() []byte {
+    return r.Body
+}
+{{end}}
 {{end}}
 
 
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client.tmpl
index 10ee5644d2..822e11097a 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/client.tmpl
@@ -197,12 +197,12 @@ func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamAr
     if params != nil {
         queryValues := queryURL.Query()
             {{range $paramIdx, $param := .QueryParams}}
-            {{if not .Required}} if params.{{.GoName}} != nil { {{end}}
+            {{if .HasOptionalPointer}} if params.{{.GoName}} != nil { {{end}}
             {{if .IsPassThrough}}
-            queryValues.Add("{{.ParamName}}", {{if not .Required}}*{{end}}params.{{.GoName}})
+            queryValues.Add("{{.ParamName}}", {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}})
             {{end}}
             {{if .IsJson}}
-            if queryParamBuf, err := json.Marshal({{if not .Required}}*{{end}}params.{{.GoName}}); err != nil {
+            if queryParamBuf, err := json.Marshal({{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}); err != nil {
                 return nil, err
             } else {
                 queryValues.Add("{{.ParamName}}", string(queryParamBuf))
@@ -210,7 +210,7 @@ func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamAr
 
             {{end}}
             {{if .IsStyled}}
-            if queryFrag, err := runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationQuery, {{if not .Required}}*{{end}}params.{{.GoName}}); err != nil {
+            if queryFrag, err := runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationQuery, {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}); err != nil {
                 return nil, err
             } else if parsed, err := url.ParseQuery(queryFrag); err != nil {
                return nil, err
@@ -222,7 +222,7 @@ func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamAr
                }
             }
             {{end}}
-            {{if not .Required}}}{{end}}
+            {{if .HasOptionalPointer}}}{{end}}
         {{end}}
         queryURL.RawQuery = queryValues.Encode()
     }
@@ -236,27 +236,27 @@ func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamAr
 {{ if .HeaderParams }}
     if params != nil {
     {{range $paramIdx, $param := .HeaderParams}}
-        {{if not .Required}} if params.{{.GoName}} != nil { {{end}}
+        {{if .HasOptionalPointer}} if params.{{.GoName}} != nil { {{end}}
         var headerParam{{$paramIdx}} string
         {{if .IsPassThrough}}
-        headerParam{{$paramIdx}} = {{if not .Required}}*{{end}}params.{{.GoName}}
+        headerParam{{$paramIdx}} = {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}
         {{end}}
         {{if .IsJson}}
         var headerParamBuf{{$paramIdx}} []byte
-        headerParamBuf{{$paramIdx}}, err = json.Marshal({{if not .Required}}*{{end}}params.{{.GoName}})
+        headerParamBuf{{$paramIdx}}, err = json.Marshal({{if .HasOptionalPointer}}*{{end}}params.{{.GoName}})
         if err != nil {
             return nil, err
         }
         headerParam{{$paramIdx}} = string(headerParamBuf{{$paramIdx}})
         {{end}}
         {{if .IsStyled}}
-        headerParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationHeader, {{if not .Required}}*{{end}}params.{{.GoName}})
+        headerParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationHeader, {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}})
         if err != nil {
             return nil, err
         }
         {{end}}
         req.Header.Set("{{.ParamName}}", headerParam{{$paramIdx}})
-        {{if not .Required}}}{{end}}
+        {{if .HasOptionalPointer}}}{{end}}
     {{end}}
     }
 {{- end }}{{/* if .HeaderParams */}}
@@ -264,21 +264,21 @@ func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamAr
 {{ if .CookieParams }}
     if params != nil {
     {{range $paramIdx, $param := .CookieParams}}
-        {{if not .Required}} if params.{{.GoName}} != nil { {{end}}
+        {{if .HasOptionalPointer}} if params.{{.GoName}} != nil { {{end}}
         var cookieParam{{$paramIdx}} string
         {{if .IsPassThrough}}
-        cookieParam{{$paramIdx}} = {{if not .Required}}*{{end}}params.{{.GoName}}
+        cookieParam{{$paramIdx}} = {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}}
         {{end}}
         {{if .IsJson}}
         var cookieParamBuf{{$paramIdx}} []byte
-        cookieParamBuf{{$paramIdx}}, err = json.Marshal({{if not .Required}}*{{end}}params.{{.GoName}})
+        cookieParamBuf{{$paramIdx}}, err = json.Marshal({{if .HasOptionalPointer}}*{{end}}params.{{.GoName}})
         if err != nil {
             return nil, err
         }
         cookieParam{{$paramIdx}} = url.QueryEscape(string(cookieParamBuf{{$paramIdx}}))
         {{end}}
         {{if .IsStyled}}
-        cookieParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("simple", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationCookie, {{if not .Required}}*{{end}}params.{{.GoName}})
+        cookieParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("simple", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationCookie, {{if .HasOptionalPointer}}*{{end}}params.{{.GoName}})
         if err != nil {
             return nil, err
         }
@@ -288,7 +288,7 @@ func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamAr
             Value:cookieParam{{$paramIdx}},
         }
         req.AddCookie(cookie{{$paramIdx}})
-        {{if not .Required}}}{{end}}
+        {{if .HasOptionalPointer}}}{{end}}
     {{ end -}}
     }
 {{- end }}{{/* if .CookieParams */}}
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-wrappers.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-wrappers.tmpl
index 1603c3d5c8..ea7b75eaad 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-wrappers.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/echo/echo-wrappers.tmpl
@@ -44,7 +44,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx echo.Context) error {
     {{else}}
     if paramValue := ctx.QueryParam("{{.ParamName}}"); paramValue != "" {
     {{if .IsPassThrough}}
-    params.{{.GoName}} = {{if not .Required}}&{{end}}paramValue
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue
     {{end}}
     {{if .IsJson}}
     var value {{.TypeDef}}
@@ -52,7 +52,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx echo.Context) error {
     if err != nil {
         return echo.NewHTTPError(http.StatusBadRequest, "Error unmarshaling parameter '{{.ParamName}}' as JSON")
     }
-    params.{{.GoName}} = {{if not .Required}}&{{end}}value
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
     {{end}}
     }{{if .Required}} else {
         return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query argument {{.ParamName}} is required, but not found"))
@@ -70,7 +70,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx echo.Context) error {
             return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Expected one value for {{.ParamName}}, got %d", n))
         }
 {{if .IsPassThrough}}
-        params.{{.GoName}} = {{if not .Required}}&{{end}}valueList[0]
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0]
 {{end}}
 {{if .IsJson}}
         err = json.Unmarshal([]byte(valueList[0]), &{{.GoName}})
@@ -84,7 +84,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx echo.Context) error {
             return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter {{.ParamName}}: %s", err))
         }
 {{end}}
-        params.{{.GoName}} = {{if not .Required}}&{{end}}{{.GoName}}
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}}
         } {{if .Required}}else {
             return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Header parameter {{.ParamName}} is required, but not found"))
         }{{end}}
@@ -94,7 +94,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx echo.Context) error {
 {{range .CookieParams}}
     if cookie, err := ctx.Cookie("{{.ParamName}}"); err == nil {
     {{if .IsPassThrough}}
-    params.{{.GoName}} = {{if not .Required}}&{{end}}cookie.Value
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value
     {{end}}
     {{if .IsJson}}
     var value {{.TypeDef}}
@@ -107,7 +107,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx echo.Context) error {
     if err != nil {
         return echo.NewHTTPError(http.StatusBadRequest, "Error unmarshaling parameter '{{.ParamName}}' as JSON")
     }
-    params.{{.GoName}} = {{if not .Required}}&{{end}}value
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
     {{end}}
     {{if .IsStyled}}
     var value {{.TypeDef}}
@@ -115,7 +115,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx echo.Context) error {
     if err != nil {
         return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter {{.ParamName}}: %s", err))
     }
-    params.{{.GoName}} = {{if not .Required}}&{{end}}value
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
     {{end}}
     }{{if .Required}} else {
         return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query argument {{.ParamName}} is required, but not found"))
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-middleware.tmpl
index 0904c7894d..e44f4836cb 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-middleware.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/fiber/fiber-middleware.tmpl
@@ -59,7 +59,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *fiber.Ctx) error {
         if paramValue := c.Query("{{.ParamName}}"); paramValue != "" {
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}paramValue
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue
         {{end}}
 
         {{if .IsJson}}
@@ -69,7 +69,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *fiber.Ctx) error {
             return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON: %w", err).Error())
           }
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}value
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
         {{end}}
         }{{if .Required}} else {
             err = fmt.Errorf("Query argument {{.ParamName}} is required, but not found")
@@ -93,7 +93,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *fiber.Ctx) error {
           var {{.GoName}} {{.TypeDef}}
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}value
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
         {{end}}
 
         {{if .IsJson}}
@@ -110,7 +110,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *fiber.Ctx) error {
           }
         {{end}}
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}{{.GoName}}
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}}
 
         } {{if .Required}}else {
             err = fmt.Errorf("Header parameter {{.ParamName}} is required, but not found: %w", err)
@@ -126,7 +126,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *fiber.Ctx) error {
       if cookie = c.Cookies("{{.ParamName}}"); cookie == "" {
 
       {{- if .IsPassThrough}}
-        params.{{.GoName}} = {{if not .Required}}&{{end}}cookie
+        params.{{.GoName}} = {{if .HasOptionalPointer}}}&{{end}}cookie
       {{end}}
 
       {{- if .IsJson}}
@@ -142,7 +142,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *fiber.Ctx) error {
           return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Error unmarshaling parameter '{{.ParamName}}' as JSON: %w", err).Error())
         }
 
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       {{- if .IsStyled}}
@@ -151,7 +151,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *fiber.Ctx) error {
         if err != nil {
           return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err).Error())
         }
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       }
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-wrappers.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-wrappers.tmpl
index 8f1a6b229f..3bc02e5d7f 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-wrappers.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gin/gin-wrappers.tmpl
@@ -55,7 +55,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) {
         if paramValue := c.Query("{{.ParamName}}"); paramValue != "" {
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}paramValue
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue
         {{end}}
 
         {{if .IsJson}}
@@ -66,7 +66,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) {
             return
           }
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}value
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
         {{end}}
         }{{if .Required}} else {
            siw.ErrorHandler(c, fmt.Errorf("Query argument {{.ParamName}} is required, but not found"), http.StatusBadRequest)
@@ -96,7 +96,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) {
           }
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}valueList[0]
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0]
         {{end}}
 
         {{if .IsJson}}
@@ -115,7 +115,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) {
           }
         {{end}}
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}{{.GoName}}
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}}
 
         } {{if .Required}}else {
             siw.ErrorHandler(c, fmt.Errorf("Header parameter {{.ParamName}} is required, but not found"), http.StatusBadRequest)
@@ -132,7 +132,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) {
       if cookie, err = c.Cookie("{{.ParamName}}"); err == nil {
 
       {{- if .IsPassThrough}}
-        params.{{.GoName}} = {{if not .Required}}&{{end}}cookie
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie
       {{end}}
 
       {{- if .IsJson}}
@@ -150,7 +150,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) {
             return
         }
 
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       {{- if .IsStyled}}
@@ -160,7 +160,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) {
             siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter {{.ParamName}}: %w", err), http.StatusBadRequest)
             return
         }
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       }
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-middleware.tmpl
index 85b04c89fa..e8aa9799f0 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-middleware.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/gorilla/gorilla-middleware.tmpl
@@ -58,7 +58,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
         if paramValue := r.URL.Query().Get("{{.ParamName}}"); paramValue != "" {
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}paramValue
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue
         {{end}}
 
         {{if .IsJson}}
@@ -69,7 +69,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
             return
           }
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}value
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
         {{end}}
         }{{if .Required}} else {
             siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "{{.ParamName}}"})
@@ -98,7 +98,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           }
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}valueList[0]
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0]
         {{end}}
 
         {{if .IsJson}}
@@ -117,7 +117,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           }
         {{end}}
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}{{.GoName}}
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}}
 
         } {{if .Required}}else {
             err = fmt.Errorf("Header parameter {{.ParamName}} is required, but not found")
@@ -135,7 +135,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
       if cookie, err = r.Cookie("{{.ParamName}}"); err == nil {
 
       {{- if .IsPassThrough}}
-        params.{{.GoName}} = {{if not .Required}}&{{end}}cookie.Value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value
       {{end}}
 
       {{- if .IsJson}}
@@ -154,7 +154,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           return
         }
 
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       {{- if .IsStyled}}
@@ -164,7 +164,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err})
           return
         }
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       }
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-middleware.tmpl
index ae40439ef4..814e6bc4e4 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-middleware.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/iris/iris-middleware.tmpl
@@ -55,7 +55,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx iris.Context) {
     {{else}}
     if paramValue := ctx.QueryParam("{{.ParamName}}"); paramValue != "" {
     {{if .IsPassThrough}}
-    params.{{.GoName}} = {{if not .Required}}&{{end}}paramValue
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue
     {{end}}
     {{if .IsJson}}
     var value {{.TypeDef}}
@@ -65,7 +65,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx iris.Context) {
         ctx.WriteString("Error unmarshaling parameter '{{.ParamName}}' as JSON")
         return
     }
-    params.{{.GoName}} = {{if not .Required}}&{{end}}value
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
     {{end}}
     }{{if .Required}} else {
         ctx.StatusCode(http.StatusBadRequest)
@@ -87,7 +87,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx iris.Context) {
             return
         }
 {{if .IsPassThrough}}
-        params.{{.GoName}} = {{if not .Required}}&{{end}}valueList[0]
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0]
 {{end}}
 {{if .IsJson}}
         err = json.Unmarshal([]byte(valueList[0]), &{{.GoName}})
@@ -105,7 +105,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx iris.Context) {
             return
         }
 {{end}}
-        params.{{.GoName}} = {{if not .Required}}&{{end}}{{.GoName}}
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}}
         } {{if .Required}}else {
             ctx.StatusCode(http.StatusBadRequest)
             ctx.WriteString("Header {{.ParamName}} is required, but not found")
@@ -117,7 +117,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx iris.Context) {
 {{range .CookieParams}}
     if cookie, err := ctx.Cookie("{{.ParamName}}"); err == nil {
     {{if .IsPassThrough}}
-    params.{{.GoName}} = {{if not .Required}}&{{end}}cookie.Value
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value
     {{end}}
     {{if .IsJson}}
     var value {{.TypeDef}}
@@ -134,7 +134,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx iris.Context) {
         ctx.WriteString("Error unmarshaling parameter '{{.ParamName}}' as JSON")
         return
     }
-    params.{{.GoName}} = {{if not .Required}}&{{end}}value
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
     {{end}}
     {{if .IsStyled}}
     var value {{.TypeDef}}
@@ -144,7 +144,7 @@ func (w *ServerInterfaceWrapper) {{.OperationId}} (ctx iris.Context) {
         ctx.Writef("Invalid format for parameter {{.ParamName}}: %s", err)
         return
     }
-    params.{{.GoName}} = {{if not .Required}}&{{end}}value
+    params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
     {{end}}
     }{{if .Required}} else {
         ctx.StatusCode(http.StatusBadRequest)
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-middleware.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-middleware.tmpl
index 19f1fe2950..09977358c8 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-middleware.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/stdhttp/std-http-middleware.tmpl
@@ -58,7 +58,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
         if paramValue := r.URL.Query().Get("{{.ParamName}}"); paramValue != "" {
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}paramValue
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}paramValue
         {{end}}
 
         {{if .IsJson}}
@@ -69,7 +69,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
             return
           }
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}value
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
         {{end}}
         }{{if .Required}} else {
             siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "{{.ParamName}}"})
@@ -98,7 +98,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           }
 
         {{if .IsPassThrough}}
-          params.{{.GoName}} = {{if not .Required}}&{{end}}valueList[0]
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}valueList[0]
         {{end}}
 
         {{if .IsJson}}
@@ -117,7 +117,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           }
         {{end}}
 
-          params.{{.GoName}} = {{if not .Required}}&{{end}}{{.GoName}}
+          params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}{{.GoName}}
 
         } {{if .Required}}else {
             err := fmt.Errorf("Header parameter {{.ParamName}} is required, but not found")
@@ -135,7 +135,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
       if cookie, err = r.Cookie("{{.ParamName}}"); err == nil {
 
       {{- if .IsPassThrough}}
-        params.{{.GoName}} = {{if not .Required}}&{{end}}cookie.Value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}cookie.Value
       {{end}}
 
       {{- if .IsJson}}
@@ -154,7 +154,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           return
         }
 
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       {{- if .IsStyled}}
@@ -164,7 +164,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
           siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err})
           return
         }
-        params.{{.GoName}} = {{if not .Required}}&{{end}}value
+        params.{{.GoName}} = {{if .HasOptionalPointer}}&{{end}}value
       {{end}}
 
       }
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union-and-additional-properties.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union-and-additional-properties.tmpl
index 79b4c67b2e..1c48092ccf 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union-and-additional-properties.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union-and-additional-properties.tmpl
@@ -54,12 +54,12 @@ func (a {{.TypeName}}) MarshalJSON() ([]byte, error) {
         }
     }
 {{range .Schema.Properties}}
-{{if not .Required}}if a.{{.GoFieldName}} != nil { {{end}}
+{{if .HasOptionalPointer}}if a.{{.GoFieldName}} != nil { {{end}}
     object["{{.JsonFieldName}}"], err = json.Marshal(a.{{.GoFieldName}})
     if err != nil {
         return nil, fmt.Errorf("error marshaling '{{.JsonFieldName}}': %w", err)
     }
-{{if not .Required}} }{{end}}
+{{if .HasOptionalPointer}} }{{end}}
 {{end}}
     for fieldName, field := range a.AdditionalProperties {
 		object[fieldName], err = json.Marshal(field)
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union.tmpl b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union.tmpl
index 464fb11c43..c0385f82e3 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union.tmpl
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/templates/union.tmpl
@@ -102,12 +102,12 @@
               }
             }
             {{range .Schema.Properties}}
-            {{if not .Required}}if t.{{.GoFieldName}} != nil { {{end}}
+            {{if .HasOptionalPointer}}if t.{{.GoFieldName}} != nil { {{end}}
                 object["{{.JsonFieldName}}"], err = json.Marshal(t.{{.GoFieldName}})
                 if err != nil {
                     return nil, fmt.Errorf("error marshaling '{{.JsonFieldName}}': %w", err)
                 }
-            {{if not .Required}} }{{end}}
+            {{if .HasOptionalPointer}} }{{end}}
             {{end -}}
             b, err = json.Marshal(object)
         {{end -}}
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/utils.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/utils.go
index e82d5e3e3c..6ecf27433c 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/utils.go
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen/utils.go
@@ -283,7 +283,7 @@ func ToCamelCaseWithDigits(s string) string {
 func ToCamelCaseWithInitialisms(s string) string {
 	parts := camelCaseMatchParts.FindAllString(ToCamelCaseWithDigits(s), -1)
 	for i := range parts {
-		if v, ok := initialismsMap[strings.ToLower(parts[i])]; ok {
+		if v, ok := globalState.initialismsMap[strings.ToLower(parts[i])]; ok {
 			parts[i] = v
 		}
 	}
@@ -292,19 +292,26 @@ func ToCamelCaseWithInitialisms(s string) string {
 
 var camelCaseMatchParts = regexp.MustCompile(`[\p{Lu}\d]+([\p{Ll}\d]+|$)`)
 
-// initialismsMap stores initialisms as "lower(initialism) -> initialism" map.
-// List of initialisms was taken from https://staticcheck.io/docs/configuration/options/#initialisms.
-var initialismsMap = makeInitialismsMap([]string{
+var initialismsList = []string{
 	"ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON",
 	"QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID",
 	"URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS",
-})
+}
+
+// targetWordRegex is a regex that matches all initialisms.
+var targetWordRegex *regexp.Regexp
+
+func makeInitialismsMap(additionalInitialisms []string) map[string]string {
+	l := append(initialismsList, additionalInitialisms...)
 
-func makeInitialismsMap(l []string) map[string]string {
 	m := make(map[string]string, len(l))
 	for i := range l {
 		m[strings.ToLower(l[i])] = l[i]
 	}
+
+	// Create a regex to match the initialisms
+	targetWordRegex = regexp.MustCompile(`(?i)(` + strings.Join(l, "|") + `)`)
+
 	return m
 }
 
@@ -315,8 +322,6 @@ func ToCamelCaseWithInitialism(str string) string {
 func replaceInitialism(s string) string {
 	// These strings do not apply CamelCase
 	// Do not do CamelCase when these characters match when the preceding character is lowercase
-	// ["Acl", "Api", "Ascii", "Cpu", "Css", "Dns", "Eof", "Guid", "Html", "Http", "Https", "Id", "Ip", "Json", "Qps", "Ram", "Rpc", "Sla", "Smtp", "Sql", "Ssh", "Tcp", "Tls", "Ttl", "Udp", "Ui", "Gid", "Uid", "Uuid", "Uri", "Url", "Utf8", "Vm", "Xml", "Xmpp", "Xsrf", "Xss", "Sip", "Rtp", "Amqp", "Db", "Ts"]
-	targetWordRegex := regexp.MustCompile(`(?i)(Acl|Api|Ascii|Cpu|Css|Dns|Eof|Guid|Html|Http|Https|Id|Ip|Json|Qps|Ram|Rpc|Sla|Smtp|Sql|Ssh|Tcp|Tls|Ttl|Udp|Ui|Gid|Uid|Uuid|Uri|Url|Utf8|Vm|Xml|Xmpp|Xsrf|Xss|Sip|Rtp|Amqp|Db|Ts)`)
 	return targetWordRegex.ReplaceAllStringFunc(s, func(s string) string {
 		// If the preceding character is lowercase, do not do CamelCase
 		if unicode.IsLower(rune(s[0])) {
@@ -623,6 +628,12 @@ func SwaggerUriToGorillaUri(uri string) string {
 //	{?param}
 //	{?param*}
 func SwaggerUriToStdHttpUri(uri string) string {
+	// https://pkg.go.dev/net/http#hdr-Patterns-ServeMux
+	// The special wildcard {$} matches only the end of the URL. For example, the pattern "/{$}" matches only the path "/", whereas the pattern "/" matches every path.
+	if uri == "/" {
+		return "/{$}"
+	}
+
 	return pathParamRE.ReplaceAllString(uri, "{$1}")
 }
 
@@ -805,6 +816,8 @@ func typeNamePrefix(name string) (prefix string) {
 			prefix += "Caret"
 		case '%':
 			prefix += "Percent"
+		case '_':
+			prefix += "Underscore"
 		default:
 			// Prepend "N" to schemas starting with a number
 			if prefix == "" && unicode.IsDigit(r) {
@@ -1086,7 +1099,7 @@ func isAdditionalPropertiesExplicitFalse(s *openapi3.Schema) bool {
 		return false
 	}
 
-	return *s.AdditionalProperties.Has == false //nolint:gosimple
+	return *s.AdditionalProperties.Has == false //nolint:staticcheck
 }
 
 func sliceContains[E comparable](s []E, v E) bool {
diff --git a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/loader.go b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/loader.go
index b10e594304..89830a8c44 100644
--- a/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/loader.go
+++ b/vendor/github.com/oapi-codegen/oapi-codegen/v2/pkg/util/loader.go
@@ -4,6 +4,7 @@ import (
 	"bytes"
 	"fmt"
 	"net/url"
+	"path/filepath"
 	"strings"
 
 	"github.com/getkin/kin-openapi/openapi3"
@@ -65,29 +66,34 @@ func LoadSwaggerWithOverlay(filePath string, opts LoadSwaggerWithOverlayOpts) (s
 
 	err = overlay.Validate()
 	if err != nil {
-		return nil, fmt.Errorf("The Overlay in %#v was not valid: %v", opts.Path, err)
+		return nil, fmt.Errorf("the Overlay in %#v was not valid: %v", opts.Path, err)
 	}
 
 	if opts.Strict {
 		err, vs := overlay.ApplyToStrict(&node)
 		if err != nil {
-			return nil, fmt.Errorf("Failed to apply Overlay %#v to specification %#v: %v\nAdditionally, the following validation errors were found:\n- %s", opts.Path, filePath, err, strings.Join(vs, "\n- "))
+			return nil, fmt.Errorf("failed to apply Overlay %#v to specification %#v: %v\nAdditionally, the following validation errors were found:\n- %s", opts.Path, filePath, err, strings.Join(vs, "\n- "))
 		}
 	} else {
 		err = overlay.ApplyTo(&node)
 		if err != nil {
-			return nil, fmt.Errorf("Failed to apply Overlay %#v to specification %#v: %v", opts.Path, filePath, err)
+			return nil, fmt.Errorf("failed to apply Overlay %#v to specification %#v: %v", opts.Path, filePath, err)
 		}
 	}
 
 	b, err := yaml.Marshal(&node)
 	if err != nil {
-		return nil, fmt.Errorf("Failed to serialize Overlay'd specification %#v: %v", opts.Path, err)
+		return nil, fmt.Errorf("failed to serialize Overlay'd specification %#v: %v", opts.Path, err)
 	}
 
-	swagger, err = openapi3.NewLoader().LoadFromData(b)
+	loader := openapi3.NewLoader()
+	loader.IsExternalRefsAllowed = true
+
+	swagger, err = loader.LoadFromDataWithPath(b, &url.URL{
+		Path: filepath.ToSlash(filePath),
+	})
 	if err != nil {
-		return nil, fmt.Errorf("Failed to serialize Overlay'd specification %#v: %v", opts.Path, err)
+		return nil, fmt.Errorf("failed to serialize Overlay'd specification %#v: %v", opts.Path, err)
 	}
 
 	return swagger, nil
diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/apply.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/apply.go
index 8cd9aaea07..faaaf9230a 100644
--- a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/apply.go
+++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/apply.go
@@ -2,7 +2,8 @@ package overlay
 
 import (
 	"fmt"
-	"github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath"
+	"github.com/speakeasy-api/jsonpath/pkg/jsonpath/config"
+	"github.com/speakeasy-api/jsonpath/pkg/jsonpath/token"
 	"gopkg.in/yaml.v3"
 	"strings"
 )
@@ -13,9 +14,9 @@ func (o *Overlay) ApplyTo(root *yaml.Node) error {
 	for _, action := range o.Actions {
 		var err error
 		if action.Remove {
-			err = applyRemoveAction(root, action)
+			err = o.applyRemoveAction(root, action, nil)
 		} else {
-			err = applyUpdateAction(root, action, &[]string{})
+			err = o.applyUpdateAction(root, action, &[]string{})
 		}
 
 		if err != nil {
@@ -29,41 +30,51 @@ func (o *Overlay) ApplyTo(root *yaml.Node) error {
 func (o *Overlay) ApplyToStrict(root *yaml.Node) (error, []string) {
 	multiError := []string{}
 	warnings := []string{}
+	hasFilterExpression := false
 	for i, action := range o.Actions {
-		err := validateSelectorHasAtLeastOneTarget(root, action)
+		tokens := token.NewTokenizer(action.Target, config.WithPropertyNameExtension()).Tokenize()
+		for _, tok := range tokens {
+			if tok.Token == token.FILTER {
+				hasFilterExpression = true
+			}
+		}
+
+		actionWarnings := []string{}
+		err := o.validateSelectorHasAtLeastOneTarget(root, action)
 		if err != nil {
 			multiError = append(multiError, err.Error())
 		}
 		if action.Remove {
-			err = applyRemoveAction(root, action)
+			err = o.applyRemoveAction(root, action, &actionWarnings)
 		} else {
-			actionWarnings := []string{}
-			err = applyUpdateAction(root, action, &actionWarnings)
-			for _, warning := range actionWarnings {
-				warnings = append(warnings, fmt.Sprintf("update action (%v / %v) target=%s: %s", i+1, len(o.Actions), action.Target, warning))
-			}
+			err = o.applyUpdateAction(root, action, &actionWarnings)
+		}
+		for _, warning := range actionWarnings {
+			warnings = append(warnings, fmt.Sprintf("update action (%v / %v) target=%s: %s", i+1, len(o.Actions), action.Target, warning))
 		}
 	}
+
+	if hasFilterExpression && !o.UsesRFC9535() {
+		warnings = append(warnings, "overlay has a filter expression but lacks `x-speakeasy-jsonpath: rfc9535` extension. Deprecated jsonpath behaviour in use. See overlay.speakeasy.com for the implementation playground.")
+	}
+
 	if len(multiError) > 0 {
 		return fmt.Errorf("error applying overlay (strict): %v", strings.Join(multiError, ",")), warnings
 	}
 	return nil, warnings
 }
 
-func validateSelectorHasAtLeastOneTarget(root *yaml.Node, action Action) error {
+func (o *Overlay) validateSelectorHasAtLeastOneTarget(root *yaml.Node, action Action) error {
 	if action.Target == "" {
 		return nil
 	}
 
-	p, err := yamlpath.NewPath(action.Target)
+	p, err := o.NewPath(action.Target, nil)
 	if err != nil {
 		return err
 	}
 
-	nodes, err := p.Find(root)
-	if err != nil {
-		return err
-	}
+	nodes := p.Query(root)
 
 	if len(nodes) == 0 {
 		return fmt.Errorf("selector %q did not match any targets", action.Target)
@@ -72,19 +83,19 @@ func validateSelectorHasAtLeastOneTarget(root *yaml.Node, action Action) error {
 	return nil
 }
 
-func applyRemoveAction(root *yaml.Node, action Action) error {
+func (o *Overlay) applyRemoveAction(root *yaml.Node, action Action, warnings *[]string) error {
 	if action.Target == "" {
 		return nil
 	}
 
 	idx := newParentIndex(root)
 
-	p, err := yamlpath.NewPath(action.Target)
+	p, err := o.NewPath(action.Target, warnings)
 	if err != nil {
 		return err
 	}
 
-	nodes, err := p.Find(root)
+	nodes := p.Query(root)
 	if err != nil {
 		return err
 	}
@@ -106,8 +117,13 @@ func removeNode(idx parentIndex, node *yaml.Node) {
 		if child == node {
 			switch parent.Kind {
 			case yaml.MappingNode:
-				// we have to delete the key too
-				parent.Content = append(parent.Content[:i-1], parent.Content[i+1:]...)
+				if i%2 == 1 {
+					// if we select a value, we should delete the key too
+					parent.Content = append(parent.Content[:i-1], parent.Content[i+1:]...)
+				} else {
+					// if we select a key, we should delete the value
+					parent.Content = append(parent.Content[:i], parent.Content[i+2:]...)
+				}
 				return
 			case yaml.SequenceNode:
 				parent.Content = append(parent.Content[:i], parent.Content[i+1:]...)
@@ -117,7 +133,7 @@ func removeNode(idx parentIndex, node *yaml.Node) {
 	}
 }
 
-func applyUpdateAction(root *yaml.Node, action Action, warnings *[]string) error {
+func (o *Overlay) applyUpdateAction(root *yaml.Node, action Action, warnings *[]string) error {
 	if action.Target == "" {
 		return nil
 	}
@@ -126,22 +142,19 @@ func applyUpdateAction(root *yaml.Node, action Action, warnings *[]string) error
 		return nil
 	}
 
-	p, err := yamlpath.NewPath(action.Target)
-	if err != nil {
-		return err
-	}
-
-	nodes, err := p.Find(root)
+	p, err := o.NewPath(action.Target, warnings)
 	if err != nil {
 		return err
 	}
 
+	nodes := p.Query(root)
 	prior, err := yaml.Marshal(root)
 	if err != nil {
 		return err
 	}
+
 	for _, node := range nodes {
-		if err := updateNode(node, action.Update); err != nil {
+		if err := updateNode(node, &action.Update); err != nil {
 			return err
 		}
 	}
@@ -156,14 +169,14 @@ func applyUpdateAction(root *yaml.Node, action Action, warnings *[]string) error
 	return nil
 }
 
-func updateNode(node *yaml.Node, updateNode yaml.Node) error {
+func updateNode(node *yaml.Node, updateNode *yaml.Node) error {
 	mergeNode(node, updateNode)
 	return nil
 }
 
-func mergeNode(node *yaml.Node, merge yaml.Node) {
+func mergeNode(node *yaml.Node, merge *yaml.Node) {
 	if node.Kind != merge.Kind {
-		*node = merge
+		*node = *clone(merge)
 		return
 	}
 	switch node.Kind {
@@ -178,7 +191,7 @@ func mergeNode(node *yaml.Node, merge yaml.Node) {
 
 // mergeMappingNode will perform a shallow merge of the merge node into the main
 // node.
-func mergeMappingNode(node *yaml.Node, merge yaml.Node) {
+func mergeMappingNode(node *yaml.Node, merge *yaml.Node) {
 NextKey:
 	for i := 0; i < len(merge.Content); i += 2 {
 		mergeKey := merge.Content[i].Value
@@ -187,16 +200,39 @@ NextKey:
 		for j := 0; j < len(node.Content); j += 2 {
 			nodeKey := node.Content[j].Value
 			if nodeKey == mergeKey {
-				mergeNode(node.Content[j+1], *mergeValue)
+				mergeNode(node.Content[j+1], mergeValue)
 				continue NextKey
 			}
 		}
 
-		node.Content = append(node.Content, merge.Content[i], mergeValue)
+		node.Content = append(node.Content, merge.Content[i], clone(mergeValue))
 	}
 }
 
 // mergeSequenceNode will append the merge node's content to the original node.
-func mergeSequenceNode(node *yaml.Node, merge yaml.Node) {
-	node.Content = append(node.Content, merge.Content...)
+func mergeSequenceNode(node *yaml.Node, merge *yaml.Node) {
+	node.Content = append(node.Content, clone(merge).Content...)
+}
+
+func clone(node *yaml.Node) *yaml.Node {
+	newNode := &yaml.Node{
+		Kind:        node.Kind,
+		Style:       node.Style,
+		Tag:         node.Tag,
+		Value:       node.Value,
+		Anchor:      node.Anchor,
+		HeadComment: node.HeadComment,
+		LineComment: node.LineComment,
+		FootComment: node.FootComment,
+	}
+	if node.Alias != nil {
+		newNode.Alias = clone(node.Alias)
+	}
+	if node.Content != nil {
+		newNode.Content = make([]*yaml.Node, len(node.Content))
+		for i, child := range node.Content {
+			newNode.Content[i] = clone(child)
+		}
+	}
+	return newNode
 }
diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/compare.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/compare.go
index 1aa8d2f316..33dff6a480 100644
--- a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/compare.go
+++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/compare.go
@@ -18,7 +18,8 @@ func Compare(title string, y1 *yaml.Node, y2 yaml.Node) (*Overlay, error) {
 	}
 
 	return &Overlay{
-		Version: "1.0.0",
+		Version:         "1.0.0",
+		JSONPathVersion: "rfc9535",
 		Info: Info{
 			Title:   title,
 			Version: "0.0.0",
diff --git a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/schema.go b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/schema.go
index db38422025..f4408f0fa5 100644
--- a/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/schema.go
+++ b/vendor/github.com/speakeasy-api/openapi-overlay/pkg/overlay/schema.go
@@ -13,10 +13,12 @@ type Extensions map[string]any
 type Overlay struct {
 	Extensions `yaml:"-,inline"`
 
-	// Version is the version of the overlay configuration. As the RFC was never
-	// really ratifies, this value does not mean much.
+	// Version is the version of the overlay configuration. This is only ever expected to be 1.0.0
 	Version string `yaml:"overlay"`
 
+	// JSONPathVersion should be set to rfc9535, and is used for backwards compatability purposes
+	JSONPathVersion string `yaml:"x-speakeasy-jsonpath,omitempty"`
+
 	// Info describes the metadata for the overlay.
 	Info Info `yaml:"info"`
 
diff --git a/vendor/modules.txt b/vendor/modules.txt
index e3b4716e91..5b47d24092 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -686,7 +686,7 @@ github.com/gammazero/deque
 # github.com/gammazero/workerpool v1.1.3
 ## explicit; go 1.18
 github.com/gammazero/workerpool
-# github.com/getkin/kin-openapi v0.127.0
+# github.com/getkin/kin-openapi v0.128.0
 ## explicit; go 1.20
 github.com/getkin/kin-openapi/openapi3
 # github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
@@ -1129,8 +1129,8 @@ github.com/nats-io/nkeys
 # github.com/nats-io/nuid v1.0.1
 ## explicit
 github.com/nats-io/nuid
-# github.com/oapi-codegen/oapi-codegen/v2 v2.4.1
-## explicit; go 1.21.0
+# github.com/oapi-codegen/oapi-codegen/v2 v2.4.2-0.20250511160408-c8cf342fd5ea
+## explicit; go 1.22
 github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen
 github.com/oapi-codegen/oapi-codegen/v2/pkg/codegen
 github.com/oapi-codegen/oapi-codegen/v2/pkg/util
@@ -1228,8 +1228,13 @@ github.com/sirupsen/logrus
 # github.com/skeema/knownhosts v1.3.0
 ## explicit; go 1.17
 github.com/skeema/knownhosts
-# github.com/speakeasy-api/openapi-overlay v0.9.0
-## explicit; go 1.21.0
+# github.com/speakeasy-api/jsonpath v0.6.0
+## explicit; go 1.22
+github.com/speakeasy-api/jsonpath/pkg/jsonpath
+github.com/speakeasy-api/jsonpath/pkg/jsonpath/config
+github.com/speakeasy-api/jsonpath/pkg/jsonpath/token
+# github.com/speakeasy-api/openapi-overlay v0.10.2
+## explicit; go 1.22
 github.com/speakeasy-api/openapi-overlay/pkg/loader
 github.com/speakeasy-api/openapi-overlay/pkg/overlay
 # github.com/spf13/cobra v1.9.1
@@ -1476,6 +1481,7 @@ golang.org/x/exp/slices
 # golang.org/x/mod v0.24.0
 ## explicit; go 1.23.0
 golang.org/x/mod/internal/lazyregexp
+golang.org/x/mod/modfile
 golang.org/x/mod/module
 golang.org/x/mod/semver
 # golang.org/x/net v0.40.0

From 56faf8ec4bf86842ca80630af83284d4c0c942e3 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Wed, 16 Jul 2025 03:40:32 +0530
Subject: [PATCH 09/22] feat: implement GetLatestEnvironmentProperties method
 in ChartService and refactor PropertiesConfigService

---
 pkg/chart/ChartService.go                     | 44 ++++++++++++++++++-
 .../DeploymentTemplateValidationService.go    |  2 +-
 pkg/pipeline/PropertiesConfig.go              | 39 +---------------
 3 files changed, 45 insertions(+), 40 deletions(-)

diff --git a/pkg/chart/ChartService.go b/pkg/chart/ChartService.go
index fb2307542d..4ffe242cbf 100644
--- a/pkg/chart/ChartService.go
+++ b/pkg/chart/ChartService.go
@@ -42,6 +42,7 @@ import (
 	"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/chartRef"
 	chartRefBean "github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/chartRef/bean"
 	"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/read"
+	pipelineBean "github.com/devtron-labs/devtron/pkg/pipeline/bean"
 	"github.com/devtron-labs/devtron/pkg/sql"
 	"github.com/devtron-labs/devtron/pkg/variables"
 	variablesRepository "github.com/devtron-labs/devtron/pkg/variables/repository"
@@ -75,7 +76,7 @@ type ChartService interface {
 	IsGitOpsRepoAlreadyRegistered(gitOpsRepoUrl string, appId int) (bool, error)
 
 	GetDeploymentTemplateDataByAppIdAndCharRefId(appId, chartRefId int) (map[string]interface{}, error)
-
+	GetLatestEnvironmentProperties(appId, environmentId int) (environmentProperties *pipelineBean.EnvironmentProperties, err error)
 	ChartServiceEnt
 }
 
@@ -1140,3 +1141,44 @@ func (impl *ChartServiceImpl) GetDeploymentTemplateDataByAppIdAndCharRefId(appId
 	}
 	return appConfigResponse, nil
 }
+
+func (impl *ChartServiceImpl) GetLatestEnvironmentProperties(appId, environmentId int) (environmentProperties *pipelineBean.EnvironmentProperties, err error) {
+	env, err := impl.environmentRepository.FindById(environmentId)
+	if err != nil {
+		impl.logger.Errorw("error in finding env by id", "envId", environmentId, "err", err)
+		return environmentProperties, err
+	}
+	envOverride, err := impl.envConfigOverrideReadService.ActiveEnvConfigOverride(appId, environmentId)
+	if err != nil {
+		impl.logger.Errorw("error in finding ActiveEnvConfigOverride", "appId", appId, "envId", environmentId, "err", err)
+		return environmentProperties, err
+	}
+	if envOverride.Id == 0 {
+		impl.logger.Warnw("No env config exists with tag latest for given appId and envId", "envId", environmentId)
+		return environmentProperties, nil
+	}
+	r := json.RawMessage("{}")
+	err = r.UnmarshalJSON([]byte(envOverride.EnvOverrideValues))
+	if err != nil {
+		return environmentProperties, err
+	}
+	environmentProperties = &pipelineBean.EnvironmentProperties{
+		Id:                envOverride.Id,
+		Status:            envOverride.Status,
+		EnvOverrideValues: r,
+		ManualReviewed:    envOverride.ManualReviewed,
+		Active:            envOverride.Active,
+		Namespace:         env.Namespace,
+		Description:       env.Description,
+		EnvironmentId:     environmentId,
+		EnvironmentName:   env.Name,
+		Latest:            envOverride.Latest,
+		ChartRefId:        envOverride.Chart.ChartRefId,
+		IsOverride:        envOverride.IsOverride,
+		IsBasicViewLocked: envOverride.IsBasicViewLocked,
+		CurrentViewEditor: envOverride.CurrentViewEditor,
+		MergeStrategy:     envOverride.MergeStrategy,
+		ClusterId:         env.ClusterId,
+	}
+	return environmentProperties, nil
+}
diff --git a/pkg/deployment/manifest/deploymentTemplate/validator/DeploymentTemplateValidationService.go b/pkg/deployment/manifest/deploymentTemplate/validator/DeploymentTemplateValidationService.go
index 0f4b280e83..ced11858c4 100644
--- a/pkg/deployment/manifest/deploymentTemplate/validator/DeploymentTemplateValidationService.go
+++ b/pkg/deployment/manifest/deploymentTemplate/validator/DeploymentTemplateValidationService.go
@@ -84,7 +84,7 @@ func (impl *DeploymentTemplateValidationServiceImpl) DeploymentTemplateValidate(
 	var templatejson interface{}
 	err = json.Unmarshal([]byte(templatejsonstring), &templatejson)
 	if err != nil {
-		fmt.Println("Error:", err)
+		impl.logger.Errorw("json Schema parsing error", "err", err)
 		return false, err
 	}
 
diff --git a/pkg/pipeline/PropertiesConfig.go b/pkg/pipeline/PropertiesConfig.go
index 65a9de1398..ed1891b3f3 100644
--- a/pkg/pipeline/PropertiesConfig.go
+++ b/pkg/pipeline/PropertiesConfig.go
@@ -601,44 +601,7 @@ func (impl *PropertiesConfigServiceImpl) GetAppIdByChartEnvId(chartEnvId int) (*
 }
 
 func (impl *PropertiesConfigServiceImpl) GetLatestEnvironmentProperties(appId, environmentId int) (environmentProperties *bean.EnvironmentProperties, err error) {
-	env, err := impl.environmentRepository.FindById(environmentId)
-	if err != nil {
-		return nil, err
-	}
-	// step 1
-	envOverride, err := impl.envConfigOverrideReadService.ActiveEnvConfigOverride(appId, environmentId)
-	if err != nil {
-		return nil, err
-	}
-	if envOverride.Id == 0 {
-		//return nil, errors.New("No env config exists with tag latest for given appId and envId")
-		impl.logger.Warnw("No env config exists with tag latest for given appId and envId", "envId", environmentId)
-	} else {
-		r := json.RawMessage("{}")
-		err = r.UnmarshalJSON([]byte(envOverride.EnvOverrideValues))
-		if err != nil {
-			return nil, err
-		}
-		environmentProperties = &bean.EnvironmentProperties{
-			Id:                envOverride.Id,
-			Status:            envOverride.Status,
-			EnvOverrideValues: r,
-			ManualReviewed:    envOverride.ManualReviewed,
-			Active:            envOverride.Active,
-			Namespace:         env.Namespace,
-			Description:       env.Description,
-			EnvironmentId:     environmentId,
-			EnvironmentName:   env.Name,
-			Latest:            envOverride.Latest,
-			ChartRefId:        envOverride.Chart.ChartRefId,
-			IsOverride:        envOverride.IsOverride,
-			IsBasicViewLocked: envOverride.IsBasicViewLocked,
-			CurrentViewEditor: envOverride.CurrentViewEditor,
-			MergeStrategy:     envOverride.MergeStrategy,
-			ClusterId:         env.ClusterId,
-		}
-	}
-	return environmentProperties, nil
+	return impl.chartService.GetLatestEnvironmentProperties(appId, environmentId)
 }
 
 func (impl *PropertiesConfigServiceImpl) ResetEnvironmentProperties(id int, userId int32) (bool, error) {

From b392a66d2320e758018abc0fcc74386c66577762 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Wed, 16 Jul 2025 03:52:51 +0530
Subject: [PATCH 10/22] updated migration script

---
 scripts/sql/34204000_bulk_edit_config.up.sql | 383 ++++++++++++++++++-
 1 file changed, 380 insertions(+), 3 deletions(-)

diff --git a/scripts/sql/34204000_bulk_edit_config.up.sql b/scripts/sql/34204000_bulk_edit_config.up.sql
index a123e7a2d1..3a16a5c0ba 100644
--- a/scripts/sql/34204000_bulk_edit_config.up.sql
+++ b/scripts/sql/34204000_bulk_edit_config.up.sql
@@ -5,7 +5,7 @@ CREATE SEQUENCE IF NOT EXISTS id_seq_bulk_edit_config;
 
 -- Create a new table
 CREATE TABLE IF NOT EXISTS "public"."bulk_edit_config" (
-    "id"            INTEGER             NOT NULL DEFAULT nextval('id_seq_workflow_config_snapshot'::regclass),
+                                                           "id"            INTEGER             NOT NULL DEFAULT nextval('id_seq_workflow_config_snapshot'::regclass),
     "api_version"   VARCHAR(255) NOT NULL,
     "kind"          VARCHAR(255) NOT NULL,
     "readme"        TEXT,
@@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS "public"."bulk_edit_config" (
     "updated_by"    INTEGER,
     PRIMARY KEY ("id"),
     UNIQUE ("api_version", "kind")
-);
+    );
 
 -- Insert data from bulk_update_readme (assuming only one row for 'v1beta1/application')
 INSERT INTO "public"."bulk_edit_config" ("api_version", "kind", "readme", "schema", "created_on", "created_by")
@@ -205,9 +205,386 @@ The following tables list the configurable parameters of the Payload component i
     }
   }
 }', NOW(), 1
-WHERE NOT EXISTS (
+    WHERE NOT EXISTS (
     SELECT 1 FROM "public"."bulk_edit_config"
     WHERE api_version = 'v1beta1' AND kind = 'application'
 );
 
+-- Insert data from bulk_update_readme (assuming only one row for 'v1beta1/application')
+INSERT INTO "public"."bulk_edit_config" ("api_version", "kind", "readme", "schema", "created_on", "created_by")
+SELECT 'v1beta2', 'application','# Bulk Update - Application
+
+This feature helps you to update Deployment Template, ConfigMaps & Secrets for multiple apps in one go! You can filter the apps on the basis of environments, global flag, and app names(we provide support for both substrings included and excluded in the app name).
+
+## Example
+
+Example below will select all applications having `abc and xyz` present in their name and out of those will exclude applications having `abcd and xyza` in their name. Since global flag is false and envId 23 is provided, it will make changes in envId 23 and not in global deployment template for this application.
+
+If you want to update globally then please set `global: true`. If you have provided envId by deployment template, configMap or secret is not overridden for that particular environment then it will not apply the changes.
+Also, of all the provided names of configMaps/secrets, for every app & environment override only the name that are present in them will be considered.
+
+```
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      type: criteria|global
+      project:
+        includes:
+          names:
+            - "%abc%"
+            - "%xyz%"
+        excludes:
+          names:
+            - "%abcd%"
+            - "%xyza%"
+      app:
+        includes:
+          names:
+            - "%abc%"
+            - "%xyz%"
+        excludes:
+          names:
+            - "%abcd%"
+            - "%xyza%"
+      env:
+        type: prod|non-prod
+        includes:
+          names:
+            - "%abc%"
+            - "%xyz%"
+        excludes:
+          names:
+            - "%abcd%"
+            - "%xyza%"
+  deploymentTemplate:
+    match:
+      include-base-config: true|false
+      chart:
+        name: RolloutDeployment
+        version:
+          value: 4.20.0
+          operator: EQUAL|GREATER|LESS|GREATER_EQUAL|LESS_EQUAL
+        custom: true|false
+    operation:
+      action: update
+      field: values|version
+      patchJson: ''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''
+      chartVersion: "4.20.0"
+  configMap:
+    spec:
+      match:
+        type: environment|volume
+        include-base-config: true|false
+        includes:
+          names:
+            - "%abc%"
+            - "%xyz%"
+        excludes:
+          names:
+            - "%abcd%"
+            - "%xyza%"
+      operation:
+        action: create|update|delete
+        field: data
+        patchJson: ''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''
+        value: {{ .Value }}
+  secret:
+    spec:
+      match:
+        type: environment|volume
+        include-base-config: true|false
+        includes:
+          names:
+            - "%abc%"
+            - "%xyz%"
+        excludes:
+          names:
+            - "%abcd%"
+            - "%xyza%"
+      operation:
+        action: create|update|delete
+        field: data
+        patchJson: ''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''
+        value: {{ .Value }}
+```
+
+## Payload Configuration
+
+
+The following tables list the configurable parameters of the Payload component in the Script and their description along with example. Also, if you do not need to apply updates on all the tasks, i.e. Deployment Template, ConfigMaps & Secrets, leave the Spec object empty for that respective task.
+
+| Parameter                      | Description                        | Example                                                    |
+| -------------------------- | ---------------------------------- | ---------------------------------------------------------- |
+| `includes.names `        | Will filter apps having exact string or similar substrings                 | `["app%","%abc", "xyz"]` (will include all apps having `"app%"` **OR** `"%abc"` as one of their substring, example - app1, app-test, test-abc etc. **OR** application with name xyz)    |
+| `excludes.names`          | Will filter apps not having exact string or similar substrings.              | `["%z","%y", "abc"]`       (will filter out all apps having `"%z"` **OR** `"%y"` as one of their substring, example - appz, test-app-y etc. **OR** application with name abc)                                        |
+| `envIds`       | List of envIds to be updated for the selected applications.           | `[1,2,3]`                                                   |
+| `global`       | Flag to update global deployment template of applications.            | `true`,`false`                                                        |
+| `deploymentTemplate.spec.patchJson`       | String having the update operation(you can apply more than one changes at a time). It supports [JSON patch ](http://jsonpatch.com/) specifications for update. | `''[ { "op": "add", "path": "/MaxSurge", "value": 1 }, { "op": "replace", "path": "/GracePeriod", "value": "30" }]''` |
+| `configMap.spec.names`      | Names of all ConfigMaps to be updated. | `configmap1`,`configmap2`,`configmap3` |
+| `secret.spec.names`      | Names of all Secrets to be updated. | `secret1`,`secret2`|
+| `configMap.spec.patchJson` / `secret.spec.patchJson`       | String having the update operation for ConfigMaps/Secrets(you can apply more than one changes at a time). It supports [JSON patch ](http://jsonpatch.com/) specifications for update. | `''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''`(Replace the `{key}` part to the key you want to perform operation on & the `{value}`is the key''s corresponding value |
+','{
+  "$schema": "https://json-schema.org/draft/2020-12/schema",
+  "title": "Bulk Edit Application batch/v1beta2 Schema",
+  "type": "object",
+  "description": "Input Script for bulk edit",
+  "required": [
+    "apiVersion",
+    "kind",
+    "spec"
+  ],
+  "properties": {
+    "apiVersion": {
+      "const": "batch/v1beta2"
+    },
+    "kind": {
+      "const": "Application"
+    },
+    "spec": {
+      "type": "object",
+      "properties": {
+        "anyOf": [
+          {
+            "required": [
+              "deploymentTemplate"
+            ]
+          },
+          {
+            "required": [
+              "configMap"
+            ]
+          },
+          {
+            "required": [
+              "secret"
+            ]
+          }
+        ],
+        "selectors": {
+          "type": "object",
+          "properties": {
+            "match": {
+              "type": "object",
+              "properties": {
+                "type": {
+                  "type": "string",
+                  "enum": ["criteria", "global"]
+                },
+                "project": {
+                  "type": "object",
+                  "properties": {
+                    "includes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    },
+                    "excludes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    }
+                  }
+                },
+                "app": {
+                  "type": "object",
+                  "properties": {
+                    "includes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    },
+                    "excludes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    }
+                  }
+                },
+                "env": {
+                  "type": "object",
+                  "properties": {
+                    "type": {
+                      "type": "string",
+                      "enum": ["prod", "non-prod"]
+                    },
+                    "includes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    },
+                    "excludes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    }
+                  }
+                }
+              }
+            }
+          }
+        },
+        "deploymentTemplate": {
+          "type": "object",
+          "properties": {
+            "match": {
+              "type": "object",
+              "properties": {
+                "include-base-config": {
+                  "type": "boolean"
+                },
+                "chart": {
+                  "type": "object",
+                  "properties": {
+                    "name": {
+                      "type": "string"
+                    },
+                    "version": {
+                      "type": "object",
+                      "properties": {
+                        "value": {
+                          "type": "string",
+                          "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
+                        },
+                        "operator": {
+                          "type": "string",
+                          "enum": ["EQUAL", "GREATER", "LESS", "GREATER_EQUAL", "LESS_EQUAL"]
+                        }
+                      }
+                    },
+                    "custom": {
+                      "type": "boolean"
+                    }
+                  }
+                }
+              }
+            },
+            "operation": {
+              "type": "object",
+              "properties": {
+                "action": {
+                  "type": "string",
+                  "enum": ["update"]
+                },
+                "field": {
+                  "type": "string",
+                  "enum": ["values", "version"]
+                },
+                "patchJson": {
+                  "type": "string"
+                },
+                "chartVersion": {
+                  "type": "string",
+                  "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
+                }
+              }
+            }
+          }
+        },
+        "configMap": {
+          "type": "object",
+          "properties": {
+            "spec": {
+              "type": "object",
+              "properties": {
+                "match": {
+                  "type": "object",
+                  "properties": {
+                    "type": {
+                      "type": "string",
+                      "enum": ["environment", "volume"]
+                    },
+                    "include-base-config": {
+                      "type": "boolean"
+                    },
+                    "includes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    },
+                    "excludes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    }
+                  }
+                },
+                "operation": {
+                  "type": "object",
+                  "properties": {
+                    "action": {
+                      "type": "string",
+                      "enum": ["create", "update", "delete"]
+                    },
+                    "field": {
+                      "type": "string",
+                      "enum": ["data"]
+                    },
+                    "patchJson": {
+                      "type": "string"
+                    },
+                    "value": {
+                      "type": "string"
+                    }
+                  }
+                }
+              }
+            }
+          }
+        },
+        "secret": {
+          "type": "object",
+          "properties": {
+            "spec": {
+              "type": "object",
+              "properties": {
+                "match": {
+                  "type": "object",
+                  "properties": {
+                    "type": {
+                      "type": "string",
+                      "enum": ["environment", "volume"]
+                    },
+                    "include-base-config": {
+                      "type": "boolean"
+                    },
+                    "includes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    },
+                    "excludes": {
+                      "$ref": "#/definitions/NameIncludesExcludes"
+                    }
+                  }
+                },
+                "operation": {
+                  "type": "object",
+                  "properties": {
+                    "action": {
+                      "type": "string",
+                      "enum": ["create", "update", "delete"]
+                    },
+                    "field": {
+                      "type": "string",
+                      "enum": ["data"]
+                    },
+                    "patchJson": {
+                      "type": "string"
+                    },
+                    "value": {
+                      "type": "string"
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  },
+  "definitions": {
+    "NameIncludesExcludes": {
+      "type": "object",
+      "properties": {
+        "names": {
+          "type": "array",
+          "items": {
+            "type": "string",
+            "pattern": "^[a-z%]+[a-z0-9%\\-\\?]*[a-z0-9%]+$"
+          }
+        }
+      }
+    }
+  }
+}', NOW(), 1
+    WHERE NOT EXISTS (
+    SELECT 1 FROM "public"."bulk_edit_config"
+    WHERE api_version = 'v1beta2' AND kind = 'application'
+);
+
 COMMIT;

From 04ec1831cbe90e1ddaf0c6ac2678768ed503cab6 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Wed, 16 Jul 2025 03:55:14 +0530
Subject: [PATCH 11/22] updated migration script

---
 scripts/sql/34204000_bulk_edit_config.up.sql | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/sql/34204000_bulk_edit_config.up.sql b/scripts/sql/34204000_bulk_edit_config.up.sql
index 3a16a5c0ba..11e0e93f69 100644
--- a/scripts/sql/34204000_bulk_edit_config.up.sql
+++ b/scripts/sql/34204000_bulk_edit_config.up.sql
@@ -5,7 +5,7 @@ CREATE SEQUENCE IF NOT EXISTS id_seq_bulk_edit_config;
 
 -- Create a new table
 CREATE TABLE IF NOT EXISTS "public"."bulk_edit_config" (
-                                                           "id"            INTEGER             NOT NULL DEFAULT nextval('id_seq_workflow_config_snapshot'::regclass),
+    "id"            INTEGER             NOT NULL DEFAULT nextval('id_seq_workflow_config_snapshot'::regclass),
     "api_version"   VARCHAR(255) NOT NULL,
     "kind"          VARCHAR(255) NOT NULL,
     "readme"        TEXT,
@@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS "public"."bulk_edit_config" (
     "updated_by"    INTEGER,
     PRIMARY KEY ("id"),
     UNIQUE ("api_version", "kind")
-    );
+);
 
 -- Insert data from bulk_update_readme (assuming only one row for 'v1beta1/application')
 INSERT INTO "public"."bulk_edit_config" ("api_version", "kind", "readme", "schema", "created_on", "created_by")
@@ -205,7 +205,7 @@ The following tables list the configurable parameters of the Payload component i
     }
   }
 }', NOW(), 1
-    WHERE NOT EXISTS (
+WHERE NOT EXISTS (
     SELECT 1 FROM "public"."bulk_edit_config"
     WHERE api_version = 'v1beta1' AND kind = 'application'
 );
@@ -582,7 +582,7 @@ The following tables list the configurable parameters of the Payload component i
     }
   }
 }', NOW(), 1
-    WHERE NOT EXISTS (
+WHERE NOT EXISTS (
     SELECT 1 FROM "public"."bulk_edit_config"
     WHERE api_version = 'v1beta2' AND kind = 'application'
 );

From 19bb1a01e832bd0e445b5a59f48413fd010e017f Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Thu, 17 Jul 2025 02:17:24 +0530
Subject: [PATCH 12/22] feat: update schema and SQL migration for batch API
 versioning and kind enumeration

---
 scripts/sql/34204000_bulk_edit_config.up.sql | 397 ++++++++++---------
 specs/bulkEdit/v1beta1/schema.json           |   6 +-
 2 files changed, 213 insertions(+), 190 deletions(-)

diff --git a/scripts/sql/34204000_bulk_edit_config.up.sql b/scripts/sql/34204000_bulk_edit_config.up.sql
index 11e0e93f69..2e326914b9 100644
--- a/scripts/sql/34204000_bulk_edit_config.up.sql
+++ b/scripts/sql/34204000_bulk_edit_config.up.sql
@@ -91,10 +91,12 @@ The following tables list the configurable parameters of the Payload component i
   ],
   "properties": {
     "apiVersion": {
-      "const": "v1beta1"
+      "type": "string",
+      "const": "batch/v1beta1"
     },
     "kind": {
-      "const": "Application"
+      "type": "string",
+      "enum": ["application", "Application"]
     },
     "spec": {
       "type": "object",
@@ -337,237 +339,256 @@ The following tables list the configurable parameters of the Payload component i
   ],
   "properties": {
     "apiVersion": {
+      "type": "string",
       "const": "batch/v1beta2"
     },
     "kind": {
-      "const": "Application"
+      "type": "string",
+      "enum": ["application", "Application"]
     },
     "spec": {
       "type": "object",
+      "required": [
+        "selectors"
+      ],
+      "anyOf": [
+        {
+          "$ref": "#/definitions/DeploymentTemplate"
+        },
+        {
+          "$ref": "#/definitions/ConfigMap"
+        },
+        {
+          "$ref": "#/definitions/Secret"
+        }
+      ],
       "properties": {
-        "anyOf": [
-          {
-            "required": [
-              "deploymentTemplate"
-            ]
-          },
-          {
-            "required": [
-              "configMap"
-            ]
-          },
-          {
-            "required": [
-              "secret"
-            ]
-          }
-        ],
         "selectors": {
+          "$ref": "#/definitions/Selectors"
+        }
+      }
+    }
+  },
+  "definitions": {
+    "Selectors": {"type": "object",
+      "properties": {
+        "match": {
           "type": "object",
           "properties": {
-            "match": {
+            "type": {
+              "type": "string",
+              "enum": ["criteria", "global"]
+            },
+            "project": {
               "type": "object",
               "properties": {
-                "type": {
-                  "type": "string",
-                  "enum": ["criteria", "global"]
-                },
-                "project": {
-                  "type": "object",
-                  "properties": {
-                    "includes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    },
-                    "excludes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    }
-                  }
-                },
-                "app": {
-                  "type": "object",
-                  "properties": {
-                    "includes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    },
-                    "excludes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    }
-                  }
+                "includes": {
+                  "$ref": "#/definitions/NameIncludesExcludes"
                 },
-                "env": {
-                  "type": "object",
-                  "properties": {
-                    "type": {
-                      "type": "string",
-                      "enum": ["prod", "non-prod"]
-                    },
-                    "includes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    },
-                    "excludes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    }
-                  }
+                "excludes": {
+                  "$ref": "#/definitions/NameIncludesExcludes"
                 }
               }
-            }
-          }
-        },
-        "deploymentTemplate": {
-          "type": "object",
-          "properties": {
-            "match": {
+            },
+            "app": {
               "type": "object",
               "properties": {
-                "include-base-config": {
-                  "type": "boolean"
+                "includes": {
+                  "$ref": "#/definitions/NameIncludesExcludes"
                 },
-                "chart": {
-                  "type": "object",
-                  "properties": {
-                    "name": {
-                      "type": "string"
-                    },
-                    "version": {
-                      "type": "object",
-                      "properties": {
-                        "value": {
-                          "type": "string",
-                          "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
-                        },
-                        "operator": {
-                          "type": "string",
-                          "enum": ["EQUAL", "GREATER", "LESS", "GREATER_EQUAL", "LESS_EQUAL"]
-                        }
-                      }
-                    },
-                    "custom": {
-                      "type": "boolean"
-                    }
-                  }
+                "excludes": {
+                  "$ref": "#/definitions/NameIncludesExcludes"
                 }
               }
             },
-            "operation": {
+            "env": {
               "type": "object",
               "properties": {
-                "action": {
-                  "type": "string",
-                  "enum": ["update"]
-                },
-                "field": {
+                "type": {
                   "type": "string",
-                  "enum": ["values", "version"]
+                  "enum": ["prod", "non-prod"]
                 },
-                "patchJson": {
-                  "type": "string"
+                "includes": {
+                  "$ref": "#/definitions/NameIncludesExcludes"
                 },
-                "chartVersion": {
-                  "type": "string",
-                  "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
+                "excludes": {
+                  "$ref": "#/definitions/NameIncludesExcludes"
                 }
               }
             }
           }
-        },
-        "configMap": {
-          "type": "object",
-          "properties": {
-            "spec": {
-              "type": "object",
-              "properties": {
-                "match": {
-                  "type": "object",
-                  "properties": {
-                    "type": {
-                      "type": "string",
-                      "enum": ["environment", "volume"]
-                    },
-                    "include-base-config": {
-                      "type": "boolean"
-                    },
-                    "includes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    },
-                    "excludes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    }
+        }
+      }
+    },
+    "Secret": {
+      "type": "object",
+      "required": [
+        "secret"
+      ],
+      "secret": {
+        "type": "object",
+        "properties": {
+          "spec": {
+            "type": "object",
+            "properties": {
+              "match": {
+                "type": "object",
+                "properties": {
+                  "type": {
+                    "type": "string",
+                    "enum": ["environment", "volume"]
+                  },
+                  "include-base-config": {
+                    "type": "boolean"
+                  },
+                  "includes": {
+                    "$ref": "#/definitions/NameIncludesExcludes"
+                  },
+                  "excludes": {
+                    "$ref": "#/definitions/NameIncludesExcludes"
                   }
-                },
-                "operation": {
-                  "type": "object",
-                  "properties": {
-                    "action": {
-                      "type": "string",
-                      "enum": ["create", "update", "delete"]
-                    },
-                    "field": {
-                      "type": "string",
-                      "enum": ["data"]
-                    },
-                    "patchJson": {
-                      "type": "string"
-                    },
-                    "value": {
-                      "type": "string"
-                    }
+                }
+              },
+              "operation": {
+                "type": "object",
+                "properties": {
+                  "action": {
+                    "type": "string",
+                    "enum": ["create", "update", "delete"]
+                  },
+                  "field": {
+                    "type": "string",
+                    "enum": ["data"]
+                  },
+                  "patchJson": {
+                    "type": "string"
+                  },
+                  "value": {
+                    "type": "string"
                   }
                 }
               }
             }
           }
-        },
-        "secret": {
-          "type": "object",
-          "properties": {
-            "spec": {
-              "type": "object",
-              "properties": {
-                "match": {
-                  "type": "object",
-                  "properties": {
-                    "type": {
-                      "type": "string",
-                      "enum": ["environment", "volume"]
-                    },
-                    "include-base-config": {
-                      "type": "boolean"
-                    },
-                    "includes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    },
-                    "excludes": {
-                      "$ref": "#/definitions/NameIncludesExcludes"
-                    }
+        }
+      }
+    },
+    "ConfigMap": {
+      "type": "object",
+      "required": [
+        "configMap"
+      ],
+      "configMap": {
+        "type": "object",
+        "properties": {
+          "spec": {
+            "type": "object",
+            "properties": {
+              "match": {
+                "type": "object",
+                "properties": {
+                  "type": {
+                    "type": "string",
+                    "enum": ["environment", "volume"]
+                  },
+                  "include-base-config": {
+                    "type": "boolean"
+                  },
+                  "includes": {
+                    "$ref": "#/definitions/NameIncludesExcludes"
+                  },
+                  "excludes": {
+                    "$ref": "#/definitions/NameIncludesExcludes"
                   }
-                },
-                "operation": {
-                  "type": "object",
-                  "properties": {
-                    "action": {
-                      "type": "string",
-                      "enum": ["create", "update", "delete"]
-                    },
-                    "field": {
-                      "type": "string",
-                      "enum": ["data"]
-                    },
-                    "patchJson": {
-                      "type": "string"
-                    },
-                    "value": {
-                      "type": "string"
+                }
+              },
+              "operation": {
+                "type": "object",
+                "properties": {
+                  "action": {
+                    "type": "string",
+                    "enum": ["create", "update", "delete"]
+                  },
+                  "field": {
+                    "type": "string",
+                    "enum": ["data"]
+                  },
+                  "patchJson": {
+                    "type": "string"
+                  },
+                  "value": {
+                    "type": "string"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    },
+    "DeploymentTemplate": {
+      "type": "object",
+      "required": [
+        "deploymentTemplate"
+      ],
+      "deploymentTemplate": {
+        "type": "object",
+        "properties": {
+          "match": {
+            "type": "object",
+            "properties": {
+              "include-base-config": {
+                "type": "boolean"
+              },
+              "chart": {
+                "type": "object",
+                "properties": {
+                  "name": {
+                    "type": "string"
+                  },
+                  "version": {
+                    "type": "object",
+                    "properties": {
+                      "value": {
+                        "type": "string",
+                        "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
+                      },
+                      "operator": {
+                        "type": "string",
+                        "enum": ["EQUAL", "GREATER", "LESS", "GREATER_EQUAL", "LESS_EQUAL"]
+                      }
                     }
+                  },
+                  "custom": {
+                    "type": "boolean"
                   }
                 }
               }
             }
+          },
+          "operation": {
+            "type": "object",
+            "properties": {
+              "action": {
+                "type": "string",
+                "enum": ["update"]
+              },
+              "field": {
+                "type": "string",
+                "enum": ["values", "version"]
+              },
+              "patchJson": {
+                "type": "string"
+              },
+              "chartVersion": {
+                "type": "string",
+                "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
+              }
+            }
           }
         }
       }
-    }
-  },
-  "definitions": {
+    },
     "NameIncludesExcludes": {
       "type": "object",
       "properties": {
diff --git a/specs/bulkEdit/v1beta1/schema.json b/specs/bulkEdit/v1beta1/schema.json
index 4b08570461..1dca2bc4f2 100644
--- a/specs/bulkEdit/v1beta1/schema.json
+++ b/specs/bulkEdit/v1beta1/schema.json
@@ -10,10 +10,12 @@
   ],
   "properties": {
     "apiVersion": {
-      "const": "v1beta1"
+      "type": "string",
+      "const": "batch/v1beta1"
     },
     "kind": {
-      "const": "Application"
+      "type": "string",
+      "enum": ["application", "Application"]
     },
     "spec": {
       "type": "object",

From fedeef82527f4cd81282535483bc2c7d1864ad91 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Sun, 20 Jul 2025 04:57:01 +0530
Subject: [PATCH 13/22] feat: enhance bulk edit functionality for v1beta2 with
 improved selectors and detailed schema

---
 scripts/sql/34204000_bulk_edit_config.up.sql | 651 +++++++++++--------
 1 file changed, 373 insertions(+), 278 deletions(-)

diff --git a/scripts/sql/34204000_bulk_edit_config.up.sql b/scripts/sql/34204000_bulk_edit_config.up.sql
index 2e326914b9..bb48ab1ab0 100644
--- a/scripts/sql/34204000_bulk_edit_config.up.sql
+++ b/scripts/sql/34204000_bulk_edit_config.up.sql
@@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS "public"."bulk_edit_config" (
     UNIQUE ("api_version", "kind")
 );
 
--- Insert data from bulk_update_readme (assuming only one row for 'v1beta1/application')
+-- Insert data from bulk_edit_config for 'v1beta1/application'
 INSERT INTO "public"."bulk_edit_config" ("api_version", "kind", "readme", "schema", "created_on", "created_by")
 SELECT 'v1beta1', 'application','# Bulk Update - Application
 
@@ -212,260 +212,351 @@ WHERE NOT EXISTS (
     WHERE api_version = 'v1beta1' AND kind = 'application'
 );
 
--- Insert data from bulk_update_readme (assuming only one row for 'v1beta1/application')
+-- Insert data from bulk_edit_config for 'v1beta2/application'
 INSERT INTO "public"."bulk_edit_config" ("api_version", "kind", "readme", "schema", "created_on", "created_by")
-SELECT 'v1beta2', 'application','# Bulk Update - Application
+SELECT 'v1beta2', 'application','# Bulk Edit - Application (batch/v1beta2)
 
-This feature helps you to update Deployment Template, ConfigMaps & Secrets for multiple apps in one go! You can filter the apps on the basis of environments, global flag, and app names(we provide support for both substrings included and excluded in the app name).
+This feature enables bulk editing of **Deployment Templates**, **ConfigMaps**, and **Secrets** across multiple applications based on rich filtering criteria.
+The new `v1beta2` version brings better separation of concerns, improved selectors, and more granular control over the edit operations.
 
-## Example
+## Key Improvements over v1beta1
 
-Example below will select all applications having `abc and xyz` present in their name and out of those will exclude applications having `abcd and xyza` in their name. Since global flag is false and envId 23 is provided, it will make changes in envId 23 and not in global deployment template for this application.
+* Explicit `selectors.match` structure with `project`, `app`, and `env` scopes.
+* Chart version matching and chart-level filters in Deployment Templates.
+* Bulk creation and deletion of ConfigMaps and Secrets.
+* Bulk update Deployment Template version without affecting the existing values.
 
-If you want to update globally then please set `global: true`. If you have provided envId by deployment template, configMap or secret is not overridden for that particular environment then it will not apply the changes.
-Also, of all the provided names of configMaps/secrets, for every app & environment override only the name that are present in them will be considered.
+---
 
-```
+## Basic Example
+
+This example applies bulk edits to applications with the following criteria:
+
+- **Projects:**
+  Targets all applications in the `dev` project, but skips any in the `test` project.
+
+- **Application Names:**
+  Includes apps ending with `-dashboard` or `-server`, but skips any with `demo-` or `test-` in their names.
+  (`%` is a wildcard for any sequence of characters.)
+
+- **Environments:**
+  Only includes environments of type `non-prod` (`env.type = non-prod`).
+
+**What will be updated:**
+
+- **Deployment Templates:**
+  Updates the base Deployment Templates (and any environment-specific overrides) for the selected criteria.
+  Sets the number of replicas to `4`.
+
+- **ConfigMaps:**
+  Only affects ConfigMaps starting with `qa-cm-` or `prod-cm-`, and skips any that contain `dev` or `test` in their names.
+  Updates the base ConfigMaps (and any environment-specific overrides) for the selected criteria.
+  Adds a new key `FEAT_TEST_ENABLE` with value `true` and replaces the existing `LOG_LEVEL` with `-1`.
+
+- **Secrets:**
+  Only affects Secrets starting with `qa-secret-` or `prod-secret-`, and skips any that contain `dev` or `test` in their names.
+  Updates the base Secrets (and any environment-specific overrides) for the selected criteria.
+  Adds a new key `DB_PASSWORD` with value `********` and replaces the existing `ADMIN_PASSWORD` with `********`.
+
+```yaml
 apiVersion: batch/v1beta2
 kind: Application
 spec:
   selectors:
     match:
-      type: criteria|global
       project:
         includes:
-          names:
-            - "%abc%"
-            - "%xyz%"
+          names: ["dev"]
         excludes:
-          names:
-            - "%abcd%"
-            - "%xyza%"
+          names: ["test"]
       app:
         includes:
-          names:
-            - "%abc%"
-            - "%xyz%"
+          names: ["%-dashboard", "%-server"]
         excludes:
-          names:
-            - "%abcd%"
-            - "%xyza%"
+          names: ["%demo-%", "%test-%"]
       env:
-        type: prod|non-prod
-        includes:
-          names:
-            - "%abc%"
-            - "%xyz%"
-        excludes:
-          names:
-            - "%abcd%"
-            - "%xyza%"
+        type: non-prod
   deploymentTemplate:
     match:
-      include-base-config: true|false
-      chart:
-        name: RolloutDeployment
-        version:
-          value: 4.20.0
-          operator: EQUAL|GREATER|LESS|GREATER_EQUAL|LESS_EQUAL
-        custom: true|false
+      include-base-config: true
     operation:
       action: update
-      field: values|version
-      patchJson: ''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''
-      chartVersion: "4.20.0"
+      field: values
+      patchJson: ''[{ "op": "replace", "path": "/replicas", "value": 4 }]''
   configMap:
     spec:
       match:
-        type: environment|volume
-        include-base-config: true|false
+        include-base-config: true
         includes:
-          names:
-            - "%abc%"
-            - "%xyz%"
+          names: ["qa-cm-%", "prod-cm-%"]
         excludes:
-          names:
-            - "%abcd%"
-            - "%xyza%"
+          names: ["%dev%", "%test%"]
       operation:
-        action: create|update|delete
+        action: update
         field: data
-        patchJson: ''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''
-        value: {{ .Value }}
+        patchJson: ''[{ "op": "add", "path": "/FEAT_TEST_ENABLE}", "value": "true" },{"op": "replace","path":"/LOG_LEVEL","value": "-1"}]''
   secret:
     spec:
       match:
-        type: environment|volume
-        include-base-config: true|false
+        include-base-config: true
         includes:
-          names:
-            - "%abc%"
-            - "%xyz%"
+          names: ["qa-secret-%", "prod-secret-%"]
         excludes:
-          names:
-            - "%abcd%"
-            - "%xyza%"
-      operation:
-        action: create|update|delete
-        field: data
-        patchJson: ''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''
-        value: {{ .Value }}
+          names: ["%dev%", "%test%"]
+        operation:
+          action: update
+          field: data
+          patchJson: ''[{ "op": "add", "path": "/DB_PASSWORD}", "value": "********" },{"op": "replace","path":"/ADMIN_PASSWORD","value": "********"}]''
 ```
+---
 
-## Payload Configuration
+## Field Reference
 
+### Selectors
 
-The following tables list the configurable parameters of the Payload component in the Script and their description along with example. Also, if you do not need to apply updates on all the tasks, i.e. Deployment Template, ConfigMaps & Secrets, leave the Spec object empty for that respective task.
+| Field                     | Description                                                  |
+|---------------------------|--------------------------------------------------------------|
+| `selectors.match`         | At least one of `project`, `app`, or `env` must be specified |
+| `selectors.match.project` | Filter by project name (`includes` and/or `excludes`)        |
+| `selectors.match.app`     | Filter by app name (`includes` and/or `excludes`)            |
+| `selectors.match.env`     | Filter by environment type and name                          |
 
-| Parameter                      | Description                        | Example                                                    |
-| -------------------------- | ---------------------------------- | ---------------------------------------------------------- |
-| `includes.names `        | Will filter apps having exact string or similar substrings                 | `["app%","%abc", "xyz"]` (will include all apps having `"app%"` **OR** `"%abc"` as one of their substring, example - app1, app-test, test-abc etc. **OR** application with name xyz)    |
-| `excludes.names`          | Will filter apps not having exact string or similar substrings.              | `["%z","%y", "abc"]`       (will filter out all apps having `"%z"` **OR** `"%y"` as one of their substring, example - appz, test-app-y etc. **OR** application with name abc)                                        |
-| `envIds`       | List of envIds to be updated for the selected applications.           | `[1,2,3]`                                                   |
-| `global`       | Flag to update global deployment template of applications.            | `true`,`false`                                                        |
-| `deploymentTemplate.spec.patchJson`       | String having the update operation(you can apply more than one changes at a time). It supports [JSON patch ](http://jsonpatch.com/) specifications for update. | `''[ { "op": "add", "path": "/MaxSurge", "value": 1 }, { "op": "replace", "path": "/GracePeriod", "value": "30" }]''` |
-| `configMap.spec.names`      | Names of all ConfigMaps to be updated. | `configmap1`,`configmap2`,`configmap3` |
-| `secret.spec.names`      | Names of all Secrets to be updated. | `secret1`,`secret2`|
-| `configMap.spec.patchJson` / `secret.spec.patchJson`       | String having the update operation for ConfigMaps/Secrets(you can apply more than one changes at a time). It supports [JSON patch ](http://jsonpatch.com/) specifications for update. | `''[{ "op": "add", "path": "/{key}", "value": "{value}" },{"op": "replace","path":"/{key}","value": "{value}"}]''`(Replace the `{key}` part to the key you want to perform operation on & the `{value}`is the key''s corresponding value |
+### Deployment Template
+
+| Field                                          | Description                                                                                          |
+|------------------------------------------------|------------------------------------------------------------------------------------------------------|
+| `deploymentTemplate.match.include-base-config` | Whether to include base deployment configs                                                           |
+| `deploymentTemplate.match.chart.name`          | Deployment chart type filter                                                                         |
+| `deploymentTemplate.match.chart.version.value` | Deployment chart version filtering                                                                   |
+| `deploymentTemplate.operation.action`          | Supported: `update`                                                                                  |
+| `deploymentTemplate.operation.field`           | Supported: `values`, `version`. For `values`, use `patchJson` and for `version`, use `chartVersion`. |
+| `deploymentTemplate.operation.patchJson`       | JSON Patch string to apply (if `field` is `values`)                                                  |
+| `deploymentTemplate.operation.chartVersion`    | Chart version to set (if `field` is `version`)                                                       |
+
+### ConfigMap / Secret
+
+| Field                                             | Description                                                                                                                                                                                                                                                                                                       |
+|---------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `configMap/secret.spec.match.include-base-config` | Whether to include base configs                                                                                                                                                                                                                                                                                   |
+| `configMap/secret.spec.match.includes.names`      | Names to include                                                                                                                                                                                                                                                                                                  |
+| `configMap/secret.spec.match.excludes.names`      | Names to exclude                                                                                                                                                                                                                                                                                                  |
+| `configMap/secret.spec.operation.action`          | Supported: `create`, `update`, `delete`. For `create`/ `delete`, use `value`. For `update`, use `patchJson`.                                                                                                                                                                                                      |
+| `configMap/secret.spec.operation.field`           | Supported: `data`. Requires `patchJson` is specified.                                                                                                                                                                                                                                                             |
+| `configMap/secret.spec.operation.patchJson`       | JSON Patch string to apply. If `action` is `update`, this is required.                                                                                                                                                                                                                                            |
+| `configMap/secret.spec.operation.value`           | For `action` is `create`, value is a JSON string representing the ConfigMap/Secret data (e.g: "{\"name\":\"xyz\",\"type\":\"environment\",\"data\":{\"FEAT_TEST_ENABLE\":\"false\",\"LOG_LEVEL\":\"-1\"},\"mergeStrategy\":\"replace\"}"). For `delete`, the value is the name of the ConfigMap/Secret to delete. |
+
+---
 ','{
-  "$schema": "https://json-schema.org/draft/2020-12/schema",
+  "$schema": "http://json-schema.org/draft-04/schema#",
   "title": "Bulk Edit Application batch/v1beta2 Schema",
   "type": "object",
   "description": "Input Script for bulk edit",
-  "required": [
-    "apiVersion",
-    "kind",
-    "spec"
-  ],
+  "required": ["apiVersion", "kind", "spec"],
   "properties": {
     "apiVersion": {
       "type": "string",
-      "const": "batch/v1beta2"
+      "enum": ["batch/v1beta2"],
+      "description": "API version of the bulk edit schema"
     },
     "kind": {
       "type": "string",
-      "enum": ["application", "Application"]
+      "enum": ["application", "Application"],
+      "description": "Resource kind, must be ''application'' or ''Application''"
     },
     "spec": {
       "type": "object",
-      "required": [
-        "selectors"
-      ],
-      "anyOf": [
-        {
-          "$ref": "#/definitions/DeploymentTemplate"
+      "required": ["selectors"],
+      "description": "Specification for the bulk edit operation",
+      "properties": {
+        "selectors": {
+          "$ref": "#/definitions/Selectors",
+          "description": "Criteria to select target applications, projects, or environments"
         },
-        {
-          "$ref": "#/definitions/ConfigMap"
+        "deploymentTemplate": {
+          "$ref": "#/definitions/DeploymentTemplate",
+          "description": "Deployment template update specification"
         },
-        {
-          "$ref": "#/definitions/Secret"
+        "configMap": {
+          "$ref": "#/definitions/ConfigMap",
+          "description": "ConfigMap update specification"
+        },
+        "secret": {
+          "$ref": "#/definitions/Secret",
+          "description": "Secret update specification"
         }
+      },
+      "anyOf": [
+        { "required": ["deploymentTemplate"] },
+        { "required": ["configMap"] },
+        { "required": ["secret"] }
       ],
-      "properties": {
-        "selectors": {
-          "$ref": "#/definitions/Selectors"
-        }
-      }
+      "additionalProperties": false
     }
   },
+  "additionalProperties": false,
   "definitions": {
-    "Selectors": {"type": "object",
+    "Selectors": {
+      "type": "object",
+      "description": "Selectors to filter projects, apps, or environments",
       "properties": {
         "match": {
           "type": "object",
+          "description": "Match criteria for selection",
           "properties": {
-            "type": {
-              "type": "string",
-              "enum": ["criteria", "global"]
-            },
             "project": {
-              "type": "object",
-              "properties": {
-                "includes": {
-                  "$ref": "#/definitions/NameIncludesExcludes"
-                },
-                "excludes": {
-                  "$ref": "#/definitions/NameIncludesExcludes"
-                }
-              }
+              "$ref": "#/definitions/ProjectSelector",
+              "description": "Project selection criteria"
             },
             "app": {
+              "$ref": "#/definitions/AppSelector",
+              "description": "Application selection criteria"
+            },
+            "env": {
+              "$ref": "#/definitions/EnvSelector",
+              "description": "Environment selection criteria"
+            }
+          },
+          "anyOf": [
+            { "required": ["project"] },
+            { "required": ["app"] },
+            { "required": ["env"] }
+          ]
+        }
+      },
+      "additionalProperties": false
+    },
+    "ProjectSelector": {
+      "type": "object",
+      "description": "Selector for projects",
+      "properties": {
+        "includes": {
+          "$ref": "#/definitions/NameIncludesExcludes",
+          "description": "Projects to include"
+        },
+        "excludes": {
+          "$ref": "#/definitions/NameIncludesExcludes",
+          "description": "Projects to exclude"
+        }
+      },
+      "anyOf": [
+        { "required": ["includes"] },
+        { "required": ["excludes"] }
+      ]
+    },
+    "AppSelector": {
+      "type": "object",
+      "description": "Selector for applications",
+      "properties": {
+        "includes": {
+          "$ref": "#/definitions/NameIncludesExcludes",
+          "description": "Applications to include"
+        },
+        "excludes": {
+          "$ref": "#/definitions/NameIncludesExcludes",
+          "description": "Applications to exclude"
+        }
+      },
+      "anyOf": [
+        { "required": ["includes"] },
+        { "required": ["excludes"] }
+      ]
+    },
+    "EnvSelector": {
+      "type": "object",
+      "description": "Selector for environments",
+      "properties": {
+        "type": {
+          "type": "string",
+          "enum": ["prod", "non-prod"],
+          "description": "Type of environment: production or non-production"
+        },
+        "includes": {
+          "$ref": "#/definitions/NameIncludesExcludes",
+          "description": "Environments to include"
+        },
+        "excludes": {
+          "$ref": "#/definitions/NameIncludesExcludes",
+          "description": "Environments to exclude"
+        }
+      },
+      "anyOf": [
+        { "required": ["type"] },
+        { "required": ["includes"] },
+        { "required": ["excludes"] }
+      ]
+    },
+    "DeploymentTemplate": {
+      "type": "object",
+      "required": ["spec"],
+      "description": "Deployment template update specification",
+      "properties": {
+        "spec": {
+          "type": "object",
+          "required": ["operation"],
+          "description": "Specification for deployment template operation",
+          "properties": {
+            "match": {
               "type": "object",
+              "description": "Criteria to match deployment templates",
               "properties": {
-                "includes": {
-                  "$ref": "#/definitions/NameIncludesExcludes"
+                "include-base-config": {
+                  "type": "boolean",
+                  "description": "Whether to include base configuration"
                 },
-                "excludes": {
-                  "$ref": "#/definitions/NameIncludesExcludes"
+                "chart": {
+                  "type": "object",
+                  "required": ["name"],
+                  "description": "Chart selection criteria",
+                  "properties": {
+                    "name": {
+                      "type": "string",
+                      "description": "Deployment chart name"
+                    },
+                    "custom": {
+                      "type": "boolean",
+                      "description": "Whether the deployment chart is user uploaded (Not devtron managed)"
+                    },
+                    "version": {
+                      "type": "object",
+                      "required": ["value"],
+                      "description": "Chart version criteria",
+                      "properties": {
+                        "value": {
+                          "type": "string",
+                          "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
+                          "description": "Chart version value (semver)"
+                        },
+                        "operator": {
+                          "type": "string",
+                          "enum": ["EQUAL", "GREATER", "LESS", "GREATER_EQUAL", "LESS_EQUAL"],
+                          "description": "Operator for version comparison"
+                        }
+                      }
+                    }
+                  }
                 }
               }
             },
-            "env": {
+            "operation": {
               "type": "object",
+              "required": ["action", "field"],
+              "description": "Operation to perform on deployment template",
               "properties": {
-                "type": {
+                "action": {
                   "type": "string",
-                  "enum": ["prod", "non-prod"]
+                  "enum": ["update"],
+                  "description": "Action to perform (only ''update'' supported)"
                 },
-                "includes": {
-                  "$ref": "#/definitions/NameIncludesExcludes"
+                "field": {
+                  "type": "string",
+                  "enum": ["values", "version"],
+                  "description": "Field to update (values or version). For values, use patchJson; for version, use chartVersion"
                 },
-                "excludes": {
-                  "$ref": "#/definitions/NameIncludesExcludes"
-                }
-              }
-            }
-          }
-        }
-      }
-    },
-    "Secret": {
-      "type": "object",
-      "required": [
-        "secret"
-      ],
-      "secret": {
-        "type": "object",
-        "properties": {
-          "spec": {
-            "type": "object",
-            "properties": {
-              "match": {
-                "type": "object",
-                "properties": {
-                  "type": {
-                    "type": "string",
-                    "enum": ["environment", "volume"]
-                  },
-                  "include-base-config": {
-                    "type": "boolean"
-                  },
-                  "includes": {
-                    "$ref": "#/definitions/NameIncludesExcludes"
-                  },
-                  "excludes": {
-                    "$ref": "#/definitions/NameIncludesExcludes"
-                  }
-                }
-              },
-              "operation": {
-                "type": "object",
-                "properties": {
-                  "action": {
-                    "type": "string",
-                    "enum": ["create", "update", "delete"]
-                  },
-                  "field": {
-                    "type": "string",
-                    "enum": ["data"]
-                  },
-                  "patchJson": {
-                    "type": "string"
-                  },
-                  "value": {
-                    "type": "string"
-                  }
+                "patchJson": { "type": "string", "description": "JSON patch to apply" },
+                "chartVersion": {
+                  "type": "string",
+                  "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
+                  "description": "Chart version to update to"
                 }
               }
             }
@@ -475,50 +566,54 @@ The following tables list the configurable parameters of the Payload component i
     },
     "ConfigMap": {
       "type": "object",
-      "required": [
-        "configMap"
-      ],
-      "configMap": {
-        "type": "object",
-        "properties": {
-          "spec": {
-            "type": "object",
-            "properties": {
-              "match": {
-                "type": "object",
-                "properties": {
-                  "type": {
-                    "type": "string",
-                    "enum": ["environment", "volume"]
-                  },
-                  "include-base-config": {
-                    "type": "boolean"
-                  },
-                  "includes": {
-                    "$ref": "#/definitions/NameIncludesExcludes"
-                  },
-                  "excludes": {
-                    "$ref": "#/definitions/NameIncludesExcludes"
-                  }
+      "required": ["spec"],
+      "description": "ConfigMap update specification",
+      "properties": {
+        "spec": {
+          "type": "object",
+          "required": ["operation"],
+          "description": "Specification for ConfigMap operation",
+          "properties": {
+            "match": {
+              "type": "object",
+              "description": "Criteria to match ConfigMaps",
+              "properties": {
+                "include-base-config": {
+                  "type": "boolean",
+                  "description": "Whether to include base configuration"
+                },
+                "includes": {
+                  "$ref": "#/definitions/NameIncludesExcludes",
+                  "description": "ConfigMaps to include"
+                },
+                "excludes": {
+                  "$ref": "#/definitions/NameIncludesExcludes",
+                  "description": "ConfigMaps to exclude"
                 }
-              },
-              "operation": {
-                "type": "object",
-                "properties": {
-                  "action": {
-                    "type": "string",
-                    "enum": ["create", "update", "delete"]
-                  },
-                  "field": {
-                    "type": "string",
-                    "enum": ["data"]
-                  },
-                  "patchJson": {
-                    "type": "string"
-                  },
-                  "value": {
-                    "type": "string"
-                  }
+              }
+            },
+            "operation": {
+              "type": "object",
+              "required": ["action"],
+              "description": "Operation to perform on ConfigMap",
+              "properties": {
+                "action": {
+                  "type": "string",
+                  "enum": ["create", "update", "delete"],
+                  "description": "Action to perform (create, update, delete). For update, use field and patchJson and for create/ delete, use value."
+                },
+                "field": {
+                  "type": "string",
+                  "enum": ["data"],
+                  "description": "Field to update. Only ''data'' is supported. Use patchJson for updates."
+                },
+                "patchJson": {
+                  "type": "string",
+                  "description": "JSON patch to apply"
+                },
+                "value": {
+                  "type": "string",
+                  "description": "Value to set. For action ''create'', this should be a JSON string representing the ConfigMap data and for ''delete'', it should be the name of the ConfigMap to delete."
                 }
               }
             }
@@ -526,63 +621,57 @@ The following tables list the configurable parameters of the Payload component i
         }
       }
     },
-    "DeploymentTemplate": {
+    "Secret": {
       "type": "object",
-      "required": [
-        "deploymentTemplate"
-      ],
-      "deploymentTemplate": {
-        "type": "object",
-        "properties": {
-          "match": {
-            "type": "object",
-            "properties": {
-              "include-base-config": {
-                "type": "boolean"
-              },
-              "chart": {
-                "type": "object",
-                "properties": {
-                  "name": {
-                    "type": "string"
-                  },
-                  "version": {
-                    "type": "object",
-                    "properties": {
-                      "value": {
-                        "type": "string",
-                        "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
-                      },
-                      "operator": {
-                        "type": "string",
-                        "enum": ["EQUAL", "GREATER", "LESS", "GREATER_EQUAL", "LESS_EQUAL"]
-                      }
-                    }
-                  },
-                  "custom": {
-                    "type": "boolean"
-                  }
+      "required": ["spec"],
+      "description": "Secret update specification",
+      "properties": {
+        "spec": {
+          "type": "object",
+          "required": ["operation"],
+          "description": "Specification for Secret operation",
+          "properties": {
+            "match": {
+              "type": "object",
+              "description": "Criteria to match Secrets",
+              "properties": {
+                "include-base-config": {
+                  "type": "boolean",
+                  "description": "Whether to include base configuration"
+                },
+                "includes": {
+                  "$ref": "#/definitions/NameIncludesExcludes",
+                  "description": "Secrets to include"
+                },
+                "excludes": {
+                  "$ref": "#/definitions/NameIncludesExcludes",
+                  "description": "Secrets to exclude"
                 }
               }
-            }
-          },
-          "operation": {
-            "type": "object",
-            "properties": {
-              "action": {
-                "type": "string",
-                "enum": ["update"]
-              },
-              "field": {
-                "type": "string",
-                "enum": ["values", "version"]
-              },
-              "patchJson": {
-                "type": "string"
-              },
-              "chartVersion": {
-                "type": "string",
-                "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
+            },
+            "operation": {
+              "type": "object",
+              "required": ["action"],
+              "description": "Operation to perform on Secret",
+              "properties": {
+                "action": {
+                  "type": "string",
+                  "enum": ["create", "update", "delete"],
+                  "description": "Action to perform (create, update, delete). For update, use field and patchJson; for create/delete, use value."
+                },
+                "field": {
+                  "type": "string",
+                  "enum": ["data"],
+                  "description": "Field to update. Only ''data'' is supported. Use patchJson for updates."
+                },
+                "patchJson": {
+                  "type": "string",
+                  "description": "JSON patch to apply"
+                },
+                "value": {
+                  "type": "string",
+                  "description": "Value to set. For action ''create'', this should be a JSON string representing the Secret data and for ''delete'', it should be the name of the Secret to delete."
+                }
               }
             }
           }
@@ -591,15 +680,21 @@ The following tables list the configurable parameters of the Payload component i
     },
     "NameIncludesExcludes": {
       "type": "object",
+      "required": ["names"],
+      "description": "Names to include or exclude",
       "properties": {
         "names": {
           "type": "array",
           "items": {
             "type": "string",
-            "pattern": "^[a-z%]+[a-z0-9%\\-\\?]*[a-z0-9%]+$"
-          }
+            "pattern": "^[a-z%]+[a-z0-9%\\-\\?]*[a-z0-9%]+$",
+            "description": "Name pattern"
+          },
+          "minItems": 1,
+          "description": "List of names"
         }
-      }
+      },
+      "additionalProperties": false
     }
   }
 }', NOW(), 1

From 45f135f0a7fa399beb4e177abb0ebefdf7e4416e Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Sun, 20 Jul 2025 05:03:34 +0530
Subject: [PATCH 14/22] feat: feat: refine bulk edit documentation for v1beta2
 by improving field descriptions and removing redundant comments

---
 scripts/sql/34204000_bulk_edit_config.up.sql | 23 ++++++++------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/scripts/sql/34204000_bulk_edit_config.up.sql b/scripts/sql/34204000_bulk_edit_config.up.sql
index bb48ab1ab0..00e6b3f956 100644
--- a/scripts/sql/34204000_bulk_edit_config.up.sql
+++ b/scripts/sql/34204000_bulk_edit_config.up.sql
@@ -226,8 +226,6 @@ The new `v1beta2` version brings better separation of concerns, improved selecto
 * Bulk creation and deletion of ConfigMaps and Secrets.
 * Bulk update Deployment Template version without affecting the existing values.
 
----
-
 ## Basic Example
 
 This example applies bulk edits to applications with the following criteria:
@@ -308,7 +306,6 @@ spec:
           field: data
           patchJson: ''[{ "op": "add", "path": "/DB_PASSWORD}", "value": "********" },{"op": "replace","path":"/ADMIN_PASSWORD","value": "********"}]''
 ```
----
 
 ## Field Reference
 
@@ -335,17 +332,15 @@ spec:
 
 ### ConfigMap / Secret
 
-| Field                                             | Description                                                                                                                                                                                                                                                                                                       |
-|---------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| `configMap/secret.spec.match.include-base-config` | Whether to include base configs                                                                                                                                                                                                                                                                                   |
-| `configMap/secret.spec.match.includes.names`      | Names to include                                                                                                                                                                                                                                                                                                  |
-| `configMap/secret.spec.match.excludes.names`      | Names to exclude                                                                                                                                                                                                                                                                                                  |
-| `configMap/secret.spec.operation.action`          | Supported: `create`, `update`, `delete`. For `create`/ `delete`, use `value`. For `update`, use `patchJson`.                                                                                                                                                                                                      |
-| `configMap/secret.spec.operation.field`           | Supported: `data`. Requires `patchJson` is specified.                                                                                                                                                                                                                                                             |
-| `configMap/secret.spec.operation.patchJson`       | JSON Patch string to apply. If `action` is `update`, this is required.                                                                                                                                                                                                                                            |
-| `configMap/secret.spec.operation.value`           | For `action` is `create`, value is a JSON string representing the ConfigMap/Secret data (e.g: "{\"name\":\"xyz\",\"type\":\"environment\",\"data\":{\"FEAT_TEST_ENABLE\":\"false\",\"LOG_LEVEL\":\"-1\"},\"mergeStrategy\":\"replace\"}"). For `delete`, the value is the name of the ConfigMap/Secret to delete. |
-
----
+| Field                                             | Description                                                                                                                                                                                                                                                                                                                             |
+|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `configMap/secret.spec.match.include-base-config` | Whether to include base configs                                                                                                                                                                                                                                                                                                         |
+| `configMap/secret.spec.match.includes.names`      | Names to include                                                                                                                                                                                                                                                                                                                        |
+| `configMap/secret.spec.match.excludes.names`      | Names to exclude                                                                                                                                                                                                                                                                                                                        |
+| `configMap/secret.spec.operation.action`          | Supported: `create`, `update`, `delete`. For `create`/ `delete`, use `value`. For `update`, use `patchJson`.                                                                                                                                                                                                                            |
+| `configMap/secret.spec.operation.field`           | Supported: `data`. Requires `patchJson` is specified.                                                                                                                                                                                                                                                                                   |
+| `configMap/secret.spec.operation.patchJson`       | JSON Patch string to apply. If `action` is `update`, this is required.                                                                                                                                                                                                                                                                  |
+| `configMap/secret.spec.operation.value`           | For `action` is `create`, value is a JSON string representing the ConfigMap/Secret data (e.g: "{\\"name\\":\\"xyz\\",\\"type\\":\\"environment\\",\\"data\\":{\\"FEAT_TEST_ENABLE\\":\\"false\\",\\"LOG_LEVEL\\":\\"-1\\"},\\"mergeStrategy\\":\\"replace\\"}"). For `delete`, the value is the name of the ConfigMap/Secret to delete. |
 ','{
   "$schema": "http://json-schema.org/draft-04/schema#",
   "title": "Bulk Edit Application batch/v1beta2 Schema",

From 1078d3f096167861a6c90c6a287abdb61c63d32d Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Mon, 21 Jul 2025 11:28:52 +0530
Subject: [PATCH 15/22] feat: refactor bulk edit SQL migration for improved
 structure and clarity

---
 scripts/sql/34204000_bulk_edit_config.up.sql | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/scripts/sql/34204000_bulk_edit_config.up.sql b/scripts/sql/34204000_bulk_edit_config.up.sql
index 00e6b3f956..ead1f7f5af 100644
--- a/scripts/sql/34204000_bulk_edit_config.up.sql
+++ b/scripts/sql/34204000_bulk_edit_config.up.sql
@@ -275,12 +275,13 @@ spec:
       env:
         type: non-prod
   deploymentTemplate:
-    match:
-      include-base-config: true
-    operation:
-      action: update
-      field: values
-      patchJson: ''[{ "op": "replace", "path": "/replicas", "value": 4 }]''
+    spec:
+      match:
+        include-base-config: true
+      operation:
+        action: update
+        field: values
+        patchJson: ''[{ "op": "replace", "path": "/replicas", "value": 4 }]''
   configMap:
     spec:
       match:
@@ -301,10 +302,10 @@ spec:
           names: ["qa-secret-%", "prod-secret-%"]
         excludes:
           names: ["%dev%", "%test%"]
-        operation:
-          action: update
-          field: data
-          patchJson: ''[{ "op": "add", "path": "/DB_PASSWORD}", "value": "********" },{"op": "replace","path":"/ADMIN_PASSWORD","value": "********"}]''
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "add", "path": "/DB_PASSWORD}", "value": "********" },{"op": "replace","path":"/ADMIN_PASSWORD","value": "********"}]''
 ```
 
 ## Field Reference

From 3b3dba8215a8e294ff5cbe5f46778a539b0f87d1 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Tue, 22 Jul 2025 13:11:20 +0530
Subject: [PATCH 16/22] feat: fix error handling in bulk update response and
 utility function

---
 api/restHandler/BulkUpdateRestHandler.go | 2 +-
 pkg/bulkAction/utils/utils.go            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/api/restHandler/BulkUpdateRestHandler.go b/api/restHandler/BulkUpdateRestHandler.go
index c17e1cfb56..d02a8be6b8 100644
--- a/api/restHandler/BulkUpdateRestHandler.go
+++ b/api/restHandler/BulkUpdateRestHandler.go
@@ -208,7 +208,7 @@ func (handler BulkUpdateRestHandlerImpl) DryRunBulkEdit(w http.ResponseWriter, r
 			return
 		}
 	}
-	common.WriteJsonResp(w, err, impactedObjects, http.StatusOK)
+	common.WriteJsonResp(w, nil, impactedObjects, http.StatusOK)
 }
 
 func (handler BulkUpdateRestHandlerImpl) CheckAuthForBulkUpdate(AppId int, EnvId int, AppName string, rbacObjects map[int]string, token string) bool {
diff --git a/pkg/bulkAction/utils/utils.go b/pkg/bulkAction/utils/utils.go
index d9b4284534..c7ac65b52e 100644
--- a/pkg/bulkAction/utils/utils.go
+++ b/pkg/bulkAction/utils/utils.go
@@ -18,5 +18,5 @@ func ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error) {
 	if err != nil {
 		return "Patch Failed", err
 	}
-	return string(modified), err
+	return string(modified), nil
 }

From 04c03aba909d6861bfca45ccc03327eb1d6b9b94 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Wed, 23 Jul 2025 02:44:01 +0530
Subject: [PATCH 17/22] fix: JSON schema for selectors

---
 scripts/sql/34204000_bulk_edit_config.up.sql | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/sql/34204000_bulk_edit_config.up.sql b/scripts/sql/34204000_bulk_edit_config.up.sql
index ead1f7f5af..2945bf2e6e 100644
--- a/scripts/sql/34204000_bulk_edit_config.up.sql
+++ b/scripts/sql/34204000_bulk_edit_config.up.sql
@@ -501,7 +501,6 @@ spec:
                 },
                 "chart": {
                   "type": "object",
-                  "required": ["name"],
                   "description": "Chart selection criteria",
                   "properties": {
                     "name": {
@@ -514,7 +513,7 @@ spec:
                     },
                     "version": {
                       "type": "object",
-                      "required": ["value"],
+                      "required": ["value", "operator"],
                       "description": "Chart version criteria",
                       "properties": {
                         "value": {

From 84650b314bd7d18edbd40a0c585a0c0c15a15819 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Wed, 23 Jul 2025 02:57:54 +0530
Subject: [PATCH 18/22] chore: review comments incorporated

---
 pkg/bulkAction/service/BulkUpdateService.go | 54 +++++++++++++--------
 pkg/bulkAction/utils/utils.go               |  9 ----
 util/json/patch.go                          | 27 +++++++++++
 3 files changed, 61 insertions(+), 29 deletions(-)
 create mode 100644 util/json/patch.go

diff --git a/pkg/bulkAction/service/BulkUpdateService.go b/pkg/bulkAction/service/BulkUpdateService.go
index 82c83c6196..817ebfb1cb 100644
--- a/pkg/bulkAction/service/BulkUpdateService.go
+++ b/pkg/bulkAction/service/BulkUpdateService.go
@@ -55,6 +55,7 @@ import (
 	"github.com/devtron-labs/devtron/pkg/variables"
 	repository5 "github.com/devtron-labs/devtron/pkg/variables/repository"
 	util2 "github.com/devtron-labs/devtron/util"
+	"github.com/devtron-labs/devtron/util/json"
 	"github.com/devtron-labs/devtron/util/rbac"
 	"github.com/devtron-labs/devtron/util/sliceUtil"
 	jsonpatch "github.com/evanphx/json-patch"
@@ -358,33 +359,49 @@ func (impl BulkUpdateServiceImpl) DryRunBulkEdit(bulkUpdatePayload *bean4.BulkUp
 	if bulkUpdatePayload.Excludes != nil && len(bulkUpdatePayload.Excludes.Names) > 0 {
 		appNameExcludes = bulkUpdatePayload.Excludes.Names
 	}
-	deploymentTemplateImpactedObjects := make([]*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp, 0)
-	configMapImpactedObjects := make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0)
-	secretImpactedObjects := make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0)
+	deploymentTemplateImpactedObjects, configMapImpactedObjects,
+		secretImpactedObjects, err := impl.dryRunBulkEdit(bulkUpdatePayload, appNameIncludes, appNameExcludes)
+	if err != nil {
+		impl.logger.Errorw("error in dry-run bulk edit", "bulkUpdatePayload", bulkUpdatePayload, "err", err)
+		return nil, err
+	}
+	impactedObjectsResponse.DeploymentTemplate = deploymentTemplateImpactedObjects
+	impactedObjectsResponse.ConfigMap = configMapImpactedObjects
+	impactedObjectsResponse.Secret = secretImpactedObjects
+	return impactedObjectsResponse, nil
+}
+
+func (impl BulkUpdateServiceImpl) dryRunBulkEdit(bulkUpdatePayload *bean4.BulkUpdatePayload, appNameIncludes, appNameExcludes []string) (
+	dtImpactedObjects []*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp,
+	cmImpactedObjects, csImpactedObjects []*bean4.CmAndSecretImpactedObjectsResponseForOneApp, err error) {
+
+	dtImpactedObjects = make([]*bean4.DeploymentTemplateImpactedObjectsResponseForOneApp, 0)
+	cmImpactedObjects = make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0)
+	csImpactedObjects = make([]*bean4.CmAndSecretImpactedObjectsResponseForOneApp, 0)
 	if bulkUpdatePayload.Global {
 		// For Deployment Template
 		impactedBaseDeploymentTemplates, err := impl.getImpactedBaseDeploymentTemplates(bulkUpdatePayload.DeploymentTemplate, appNameIncludes, appNameExcludes)
 		if err != nil {
 			impl.logger.Errorw("error in fetching impacted base deployment templates", "err", err)
-			return nil, err
+			return dtImpactedObjects, cmImpactedObjects, csImpactedObjects, err
 		}
-		deploymentTemplateImpactedObjects = append(deploymentTemplateImpactedObjects, impactedBaseDeploymentTemplates...)
+		dtImpactedObjects = append(dtImpactedObjects, impactedBaseDeploymentTemplates...)
 
 		// For ConfigMap
 		impactedBaseConfigMaps, err := impl.getImpactedBaseConfigMaps(bulkUpdatePayload.ConfigMap, appNameIncludes, appNameExcludes)
 		if err != nil {
 			impl.logger.Errorw("error in fetching impacted base config maps", "err", err)
-			return nil, err
+			return dtImpactedObjects, cmImpactedObjects, csImpactedObjects, err
 		}
-		configMapImpactedObjects = append(configMapImpactedObjects, impactedBaseConfigMaps...)
+		cmImpactedObjects = append(cmImpactedObjects, impactedBaseConfigMaps...)
 
 		// For Secret
 		impactedBaseSecrets, err := impl.getImpactedBaseSecrets(bulkUpdatePayload.Secret, appNameIncludes, appNameExcludes)
 		if err != nil {
 			impl.logger.Errorw("error in fetching impacted base secrets", "err", err)
-			return nil, err
+			return dtImpactedObjects, cmImpactedObjects, csImpactedObjects, err
 		}
-		secretImpactedObjects = append(secretImpactedObjects, impactedBaseSecrets...)
+		csImpactedObjects = append(csImpactedObjects, impactedBaseSecrets...)
 	}
 
 	for _, envId := range bulkUpdatePayload.EnvIds {
@@ -392,34 +409,31 @@ func (impl BulkUpdateServiceImpl) DryRunBulkEdit(bulkUpdatePayload *bean4.BulkUp
 		impactedEnvDeploymentTemplates, err := impl.getImpactedDeploymentTemplates(bulkUpdatePayload.DeploymentTemplate, appNameIncludes, appNameExcludes, envId)
 		if err != nil {
 			impl.logger.Errorw("error in fetching impacted base deployment templates", "envId", envId, "err", err)
-			return nil, err
+			return dtImpactedObjects, cmImpactedObjects, csImpactedObjects, err
 		}
-		deploymentTemplateImpactedObjects = append(deploymentTemplateImpactedObjects, impactedEnvDeploymentTemplates...)
+		dtImpactedObjects = append(dtImpactedObjects, impactedEnvDeploymentTemplates...)
 
 		// For ConfigMap
 		impactedEnvConfigMaps, err := impl.getImpactedConfigMaps(bulkUpdatePayload.ConfigMap, appNameIncludes, appNameExcludes, envId)
 		if err != nil {
 			impl.logger.Errorw("error in fetching impacted base config maps", "envId", envId, "err", err)
-			return nil, err
+			return dtImpactedObjects, cmImpactedObjects, csImpactedObjects, err
 		}
-		configMapImpactedObjects = append(configMapImpactedObjects, impactedEnvConfigMaps...)
+		cmImpactedObjects = append(cmImpactedObjects, impactedEnvConfigMaps...)
 
 		// For Secret
 		impactedEnvSecrets, err := impl.getImpactedSecrets(bulkUpdatePayload.Secret, appNameIncludes, appNameExcludes, envId)
 		if err != nil {
 			impl.logger.Errorw("error in fetching impacted base secrets", "envId", envId, "err", err)
-			return nil, err
+			return dtImpactedObjects, cmImpactedObjects, csImpactedObjects, err
 		}
-		secretImpactedObjects = append(secretImpactedObjects, impactedEnvSecrets...)
+		csImpactedObjects = append(csImpactedObjects, impactedEnvSecrets...)
 	}
-	impactedObjectsResponse.DeploymentTemplate = deploymentTemplateImpactedObjects
-	impactedObjectsResponse.ConfigMap = configMapImpactedObjects
-	impactedObjectsResponse.Secret = secretImpactedObjects
-	return impactedObjectsResponse, nil
+	return dtImpactedObjects, cmImpactedObjects, csImpactedObjects, nil
 }
 
 func (impl BulkUpdateServiceImpl) ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error) {
-	return utils.ApplyJsonPatch(patch, target)
+	return json.ApplyJsonPatch(patch, target)
 }
 
 func (impl BulkUpdateServiceImpl) BulkUpdateDeploymentTemplate(ctx context.Context, bulkUpdatePayload *bean4.BulkUpdatePayload, userMetadata *bean6.UserMetadata) *bean4.DeploymentTemplateBulkUpdateResponse {
diff --git a/pkg/bulkAction/utils/utils.go b/pkg/bulkAction/utils/utils.go
index c7ac65b52e..b427905632 100644
--- a/pkg/bulkAction/utils/utils.go
+++ b/pkg/bulkAction/utils/utils.go
@@ -2,7 +2,6 @@ package utils
 
 import (
 	"fmt"
-	jsonpatch "github.com/evanphx/json-patch"
 )
 
 // GenerateIdentifierKey returns the appKey and pipelineKey for a given pipeline.
@@ -12,11 +11,3 @@ func GenerateIdentifierKey(id int, name string) (appKey string) {
 	appKey = fmt.Sprintf("%d_%s", id, name)
 	return appKey
 }
-
-func ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error) {
-	modified, err := patch.Apply([]byte(target))
-	if err != nil {
-		return "Patch Failed", err
-	}
-	return string(modified), nil
-}
diff --git a/util/json/patch.go b/util/json/patch.go
new file mode 100644
index 0000000000..dd29fcebb1
--- /dev/null
+++ b/util/json/patch.go
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2020-2024. Devtron Inc.
+ *
+ * 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.
+ */
+
+package json
+
+import "github.com/evanphx/json-patch"
+
+func ApplyJsonPatch(patch jsonpatch.Patch, target string) (string, error) {
+	modified, err := patch.Apply([]byte(target))
+	if err != nil {
+		return "Patch Failed", err
+	}
+	return string(modified), nil
+}

From 8d97acc9f919e7aa48feabef4a2c5396da687dc1 Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Wed, 23 Jul 2025 03:02:43 +0530
Subject: [PATCH 19/22] chore: review comments incorporated

---
 pkg/chart/ChartService.go                     | 39 +------------
 .../read/chartEnvConfigOverride.go            | 56 ++++++++++++++++++-
 2 files changed, 54 insertions(+), 41 deletions(-)

diff --git a/pkg/chart/ChartService.go b/pkg/chart/ChartService.go
index 8a1be7067b..726a6f9e3e 100644
--- a/pkg/chart/ChartService.go
+++ b/pkg/chart/ChartService.go
@@ -1140,42 +1140,5 @@ func (impl *ChartServiceImpl) GetDeploymentTemplateDataByAppIdAndCharRefId(appId
 }
 
 func (impl *ChartServiceImpl) GetLatestEnvironmentProperties(appId, environmentId int) (environmentProperties *pipelineBean.EnvironmentProperties, err error) {
-	env, err := impl.environmentRepository.FindById(environmentId)
-	if err != nil {
-		impl.logger.Errorw("error in finding env by id", "envId", environmentId, "err", err)
-		return environmentProperties, err
-	}
-	envOverride, err := impl.envConfigOverrideReadService.ActiveEnvConfigOverride(appId, environmentId)
-	if err != nil {
-		impl.logger.Errorw("error in finding ActiveEnvConfigOverride", "appId", appId, "envId", environmentId, "err", err)
-		return environmentProperties, err
-	}
-	if envOverride.Id == 0 {
-		impl.logger.Warnw("No env config exists with tag latest for given appId and envId", "envId", environmentId)
-		return environmentProperties, nil
-	}
-	r := json.RawMessage("{}")
-	err = r.UnmarshalJSON([]byte(envOverride.EnvOverrideValues))
-	if err != nil {
-		return environmentProperties, err
-	}
-	environmentProperties = &pipelineBean.EnvironmentProperties{
-		Id:                envOverride.Id,
-		Status:            envOverride.Status,
-		EnvOverrideValues: r,
-		ManualReviewed:    envOverride.ManualReviewed,
-		Active:            envOverride.Active,
-		Namespace:         env.Namespace,
-		Description:       env.Description,
-		EnvironmentId:     environmentId,
-		EnvironmentName:   env.Name,
-		Latest:            envOverride.Latest,
-		ChartRefId:        envOverride.Chart.ChartRefId,
-		IsOverride:        envOverride.IsOverride,
-		IsBasicViewLocked: envOverride.IsBasicViewLocked,
-		CurrentViewEditor: envOverride.CurrentViewEditor,
-		MergeStrategy:     envOverride.MergeStrategy,
-		ClusterId:         env.ClusterId,
-	}
-	return environmentProperties, nil
+	return impl.envConfigOverrideReadService.GetLatestEnvironmentProperties(appId, environmentId)
 }
diff --git a/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride.go b/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride.go
index e9303ff1c6..ff4c78c454 100644
--- a/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride.go
+++ b/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride.go
@@ -18,9 +18,12 @@ package read
 
 import (
 	"context"
+	"encoding/json"
 	"github.com/devtron-labs/devtron/internal/sql/repository/chartConfig"
+	"github.com/devtron-labs/devtron/pkg/cluster/environment/repository"
 	"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/adapter"
 	"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/bean"
+	pipelineBean "github.com/devtron-labs/devtron/pkg/pipeline/bean"
 	"github.com/go-pg/pg"
 	"go.opentelemetry.io/otel"
 	"go.uber.org/zap"
@@ -42,19 +45,25 @@ type EnvConfigOverrideService interface {
 	// EnvConfigOverride.Chart is not populated,
 	// as the chartRepoRepository.Chart contains the reference chart(in bytes).
 	GetAllOverridesForApp(ctx context.Context, appId int) ([]*bean.EnvConfigOverride, error)
+	GetLatestEnvironmentProperties(appId, environmentId int) (environmentProperties *pipelineBean.EnvironmentProperties, err error)
 	EnvConfigOverrideServiceEnt
 }
 
 type EnvConfigOverrideReadServiceImpl struct {
-	envConfigOverrideRepository chartConfig.EnvConfigOverrideRepository
 	logger                      *zap.SugaredLogger
+	environmentRepository       repository.EnvironmentRepository
+	envConfigOverrideRepository chartConfig.EnvConfigOverrideRepository
 }
 
-func NewEnvConfigOverrideReadServiceImpl(repository chartConfig.EnvConfigOverrideRepository, logger *zap.SugaredLogger,
+func NewEnvConfigOverrideReadServiceImpl(
+	logger *zap.SugaredLogger,
+	environmentRepository repository.EnvironmentRepository,
+	repository chartConfig.EnvConfigOverrideRepository,
 ) *EnvConfigOverrideReadServiceImpl {
 	return &EnvConfigOverrideReadServiceImpl{
-		envConfigOverrideRepository: repository,
 		logger:                      logger,
+		environmentRepository:       environmentRepository,
+		envConfigOverrideRepository: repository,
 	}
 }
 
@@ -221,3 +230,44 @@ func (impl EnvConfigOverrideReadServiceImpl) GetAllOverridesForApp(ctx context.C
 	}
 	return envConfigOverrides, nil
 }
+
+func (impl EnvConfigOverrideReadServiceImpl) GetLatestEnvironmentProperties(appId, environmentId int) (environmentProperties *pipelineBean.EnvironmentProperties, err error) {
+	env, err := impl.environmentRepository.FindById(environmentId)
+	if err != nil {
+		impl.logger.Errorw("error in finding env by id", "envId", environmentId, "err", err)
+		return environmentProperties, err
+	}
+	envOverride, err := impl.ActiveEnvConfigOverride(appId, environmentId)
+	if err != nil {
+		impl.logger.Errorw("error in finding ActiveEnvConfigOverride", "appId", appId, "envId", environmentId, "err", err)
+		return environmentProperties, err
+	}
+	if envOverride.Id == 0 {
+		impl.logger.Warnw("No env config exists with tag latest for given appId and envId", "envId", environmentId)
+		return environmentProperties, nil
+	}
+	r := json.RawMessage("{}")
+	err = r.UnmarshalJSON([]byte(envOverride.EnvOverrideValues))
+	if err != nil {
+		return environmentProperties, err
+	}
+	environmentProperties = &pipelineBean.EnvironmentProperties{
+		Id:                envOverride.Id,
+		Status:            envOverride.Status,
+		EnvOverrideValues: r,
+		ManualReviewed:    envOverride.ManualReviewed,
+		Active:            envOverride.Active,
+		Namespace:         env.Namespace,
+		Description:       env.Description,
+		EnvironmentId:     environmentId,
+		EnvironmentName:   env.Name,
+		Latest:            envOverride.Latest,
+		ChartRefId:        envOverride.Chart.ChartRefId,
+		IsOverride:        envOverride.IsOverride,
+		IsBasicViewLocked: envOverride.IsBasicViewLocked,
+		CurrentViewEditor: envOverride.CurrentViewEditor,
+		MergeStrategy:     envOverride.MergeStrategy,
+		ClusterId:         env.ClusterId,
+	}
+	return environmentProperties, nil
+}

From 006d7bfaed1bbf770a387bca19eca176ca5933cb Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Sat, 26 Jul 2025 06:59:07 +0530
Subject: [PATCH 20/22] feat: update receiver type for
 EnvConfigOverrideReadServiceImpl methods to pointer

---
 .../read/chartEnvConfigOverride.go            | 24 +++++++++----------
 .../read/chartEnvConfigOverride_ent.go        |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride.go b/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride.go
index ff4c78c454..bd0adf7b84 100644
--- a/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride.go
+++ b/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride.go
@@ -67,7 +67,7 @@ func NewEnvConfigOverrideReadServiceImpl(
 	}
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) GetByChartAndEnvironment(chartId, targetEnvironmentId int) (*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) GetByChartAndEnvironment(chartId, targetEnvironmentId int) (*bean.EnvConfigOverride, error) {
 	overrideDBObj, err := impl.envConfigOverrideRepository.GetByChartAndEnvironment(chartId, targetEnvironmentId)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "chartId", chartId, "targetEnvironmentId", targetEnvironmentId, "err", err)
@@ -82,7 +82,7 @@ func (impl EnvConfigOverrideReadServiceImpl) GetByChartAndEnvironment(chartId, t
 	return overrideDTO, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) ActiveEnvConfigOverride(appId, environmentId int) (*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) ActiveEnvConfigOverride(appId, environmentId int) (*bean.EnvConfigOverride, error) {
 	overrideDBObj, err := impl.envConfigOverrideRepository.ActiveEnvConfigOverride(appId, environmentId)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "appId", appId, "environmentId", environmentId, "err", err)
@@ -97,7 +97,7 @@ func (impl EnvConfigOverrideReadServiceImpl) ActiveEnvConfigOverride(appId, envi
 	return overrideDTO, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) GetByIdIncludingInactive(id int) (*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) GetByIdIncludingInactive(id int) (*bean.EnvConfigOverride, error) {
 	overrideDBObj, err := impl.envConfigOverrideRepository.GetByIdIncludingInactive(id)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "id", id, "err", err)
@@ -112,7 +112,7 @@ func (impl EnvConfigOverrideReadServiceImpl) GetByIdIncludingInactive(id int) (*
 	return overrideDTO, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) GetByEnvironment(targetEnvironmentId int) ([]*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) GetByEnvironment(targetEnvironmentId int) ([]*bean.EnvConfigOverride, error) {
 	overrideDBObjs, err := impl.envConfigOverrideRepository.GetByEnvironment(targetEnvironmentId)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "targetEnvironmentId", targetEnvironmentId, "err", err)
@@ -125,7 +125,7 @@ func (impl EnvConfigOverrideReadServiceImpl) GetByEnvironment(targetEnvironmentI
 	return envConfigOverrides, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) GetEnvConfigByChartId(chartId int) ([]*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) GetEnvConfigByChartId(chartId int) ([]*bean.EnvConfigOverride, error) {
 	overrideDBObjs, err := impl.envConfigOverrideRepository.GetEnvConfigByChartId(chartId)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "chartId", chartId, "err", err)
@@ -144,7 +144,7 @@ func (impl EnvConfigOverrideReadServiceImpl) GetEnvConfigByChartId(chartId int)
 	return envConfigOverrides, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) FindLatestChartForAppByAppIdAndEnvId(tx *pg.Tx, appId, targetEnvironmentId int) (*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) FindLatestChartForAppByAppIdAndEnvId(tx *pg.Tx, appId, targetEnvironmentId int) (*bean.EnvConfigOverride, error) {
 	overrideDBObj, err := impl.envConfigOverrideRepository.FindLatestChartForAppByAppIdAndEnvId(tx, appId, targetEnvironmentId)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "appId", appId, "targetEnvironmentId", targetEnvironmentId, "err", err)
@@ -159,7 +159,7 @@ func (impl EnvConfigOverrideReadServiceImpl) FindLatestChartForAppByAppIdAndEnvI
 	return overrideDTO, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) FindChartRefIdsForLatestChartForAppByAppIdAndEnvIds(appId int, targetEnvironmentIds []int) (map[int]int, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) FindChartRefIdsForLatestChartForAppByAppIdAndEnvIds(appId int, targetEnvironmentIds []int) (map[int]int, error) {
 	envChartMap, err := impl.envConfigOverrideRepository.FindChartRefIdsForLatestChartForAppByAppIdAndEnvIds(appId, targetEnvironmentIds)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "appId", appId, "targetEnvironmentIds", targetEnvironmentIds, "err", err)
@@ -168,7 +168,7 @@ func (impl EnvConfigOverrideReadServiceImpl) FindChartRefIdsForLatestChartForApp
 	return envChartMap, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) FindChartByAppIdAndEnvIdAndChartRefId(appId, targetEnvironmentId int, chartRefId int) (*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) FindChartByAppIdAndEnvIdAndChartRefId(appId, targetEnvironmentId int, chartRefId int) (*bean.EnvConfigOverride, error) {
 	overrideDBObj, err := impl.envConfigOverrideRepository.FindChartByAppIdAndEnvIdAndChartRefId(appId, targetEnvironmentId, chartRefId)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "appId", appId, "targetEnvironmentIds", targetEnvironmentId, "chartRefId", chartRefId, "err", err)
@@ -183,7 +183,7 @@ func (impl EnvConfigOverrideReadServiceImpl) FindChartByAppIdAndEnvIdAndChartRef
 	return overrideDTO, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) FindChartForAppByAppIdAndEnvId(appId, targetEnvironmentId int) (*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) FindChartForAppByAppIdAndEnvId(appId, targetEnvironmentId int) (*bean.EnvConfigOverride, error) {
 	overrideDBObj, err := impl.envConfigOverrideRepository.FindChartForAppByAppIdAndEnvId(appId, targetEnvironmentId)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "appId", appId, "targetEnvironmentId", targetEnvironmentId, "err", err)
@@ -198,7 +198,7 @@ func (impl EnvConfigOverrideReadServiceImpl) FindChartForAppByAppIdAndEnvId(appI
 	return overrideDTO, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) GetByAppIdEnvIdAndChartRefId(appId, envId int, chartRefId int) (*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) GetByAppIdEnvIdAndChartRefId(appId, envId int, chartRefId int) (*bean.EnvConfigOverride, error) {
 	overrideDBObj, err := impl.envConfigOverrideRepository.GetByAppIdEnvIdAndChartRefId(appId, envId, chartRefId)
 	if err != nil {
 		impl.logger.Errorw("error in getting chart env config override", "appId", appId, "envId", envId, "chartRefId", chartRefId, "err", err)
@@ -213,7 +213,7 @@ func (impl EnvConfigOverrideReadServiceImpl) GetByAppIdEnvIdAndChartRefId(appId,
 	return overrideDTO, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) GetAllOverridesForApp(ctx context.Context, appId int) ([]*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) GetAllOverridesForApp(ctx context.Context, appId int) ([]*bean.EnvConfigOverride, error) {
 	_, span := otel.Tracer("orchestrator").Start(ctx, "EnvConfigOverrideReadServiceImpl.GetAllOverridesForApp")
 	defer span.End()
 	overrideDBObjs, err := impl.envConfigOverrideRepository.GetAllOverridesForApp(appId)
@@ -231,7 +231,7 @@ func (impl EnvConfigOverrideReadServiceImpl) GetAllOverridesForApp(ctx context.C
 	return envConfigOverrides, nil
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) GetLatestEnvironmentProperties(appId, environmentId int) (environmentProperties *pipelineBean.EnvironmentProperties, err error) {
+func (impl *EnvConfigOverrideReadServiceImpl) GetLatestEnvironmentProperties(appId, environmentId int) (environmentProperties *pipelineBean.EnvironmentProperties, err error) {
 	env, err := impl.environmentRepository.FindById(environmentId)
 	if err != nil {
 		impl.logger.Errorw("error in finding env by id", "envId", environmentId, "err", err)
diff --git a/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride_ent.go b/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride_ent.go
index 23c4072a13..86a1e3af10 100644
--- a/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride_ent.go
+++ b/pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride_ent.go
@@ -21,6 +21,6 @@ import "github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTempla
 type EnvConfigOverrideServiceEnt interface {
 }
 
-func (impl EnvConfigOverrideReadServiceImpl) getOverrideDataWithUpdatedPatchDataUnResolved(overrideDTO *bean.EnvConfigOverride, appId int) (*bean.EnvConfigOverride, error) {
+func (impl *EnvConfigOverrideReadServiceImpl) getOverrideDataWithUpdatedPatchDataUnResolved(overrideDTO *bean.EnvConfigOverride, appId int) (*bean.EnvConfigOverride, error) {
 	return overrideDTO, nil
 }

From 19faed1d28f40b7f1745a2c36fff041852c3065f Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Thu, 31 Jul 2025 10:49:05 +0530
Subject: [PATCH 21/22] feat: enhance bulk edit script for v1beta2 with
 detailed introduction and improved structure

---
 scripts/sql/34204000_bulk_edit_config.up.sql | 661 +++++++++++++++++--
 1 file changed, 591 insertions(+), 70 deletions(-)

diff --git a/scripts/sql/34204000_bulk_edit_config.up.sql b/scripts/sql/34204000_bulk_edit_config.up.sql
index 2945bf2e6e..0bd18fc716 100644
--- a/scripts/sql/34204000_bulk_edit_config.up.sql
+++ b/scripts/sql/34204000_bulk_edit_config.up.sql
@@ -214,47 +214,601 @@ WHERE NOT EXISTS (
 
 -- Insert data from bulk_edit_config for 'v1beta2/application'
 INSERT INTO "public"."bulk_edit_config" ("api_version", "kind", "readme", "schema", "created_on", "created_by")
-SELECT 'v1beta2', 'application','# Bulk Edit - Application (batch/v1beta2)
+SELECT 'v1beta2', 'application','# New Script (v1beta2)
 
-This feature enables bulk editing of **Deployment Templates**, **ConfigMaps**, and **Secrets** across multiple applications based on rich filtering criteria.
-The new `v1beta2` version brings better separation of concerns, improved selectors, and more granular control over the edit operations.
+## Introduction
 
-## Key Improvements over v1beta1
+**v1beta2** is the latest YAML script to perform bulk edits to Deployment Templates, ConfigMaps, or Secrets across multiple applications. This version is currently available only to Enterprise users.
 
-* Explicit `selectors.match` structure with `project`, `app`, and `env` scopes.
-* Chart version matching and chart-level filters in Deployment Templates.
-* Bulk creation and deletion of ConfigMaps and Secrets.
-* Bulk update Deployment Template version without affecting the existing values.
+The script provides selectors for choosing the project, application, and environment within which you wish to edit the configs (can be used in combo). Moreover, you now have granular control over the update and delete operations you wish to perform on the configs.
 
-## Basic Example
+> **RBAC**: User needs to have [permissions](https://docs.devtron.ai/global-configurations/authorization/user-access#grant-specific-permissions) to apps and environments to edit their configs.
 
-This example applies bulk edits to applications with the following criteria:
+### Tree Structure of the Bulk Edit Script
 
-- **Projects:**
-  Targets all applications in the `dev` project, but skips any in the `test` project.
+Below is the visual structure of the script. Refer [Examples](#examples-with-full-script) and [YAML Template](#combined-yaml-template) to know more.
 
-- **Application Names:**
-  Includes apps ending with `-dashboard` or `-server`, but skips any with `demo-` or `test-` in their names.
-  (`%` is a wildcard for any sequence of characters.)
+```yaml
+v1beta2 Script
+├── apiVersion                            # (API version is batch/v1beta2)
+├── kind                                  # (Resource kind is Application)
+└── spec                                  # (Main configuration)
+    ├── selectors                         # (Target apps filter)
+    │   └── match                         # (Filter logic used in solo or combo)
+    │       ├── project                   # (Project filters)
+    │       │   ├── includes              # (Projects to include)
+    │       │   │   └── names             # (Array of project names)
+    │       │   └── excludes              # (Projects to exclude)
+    │       │       └── names             # (Array of project names)
+    │       │
+    │       ├── app                       # (Application filters)
+    │       │   ├── includes              # (Apps to include)
+    │       │   │   └── names             # (Array of app names)
+    │       │   └── excludes              # (Apps to exclude)
+    │       │       └── names             # (Array of app names)
+    │       │
+    │       └── env                       # (Environment filters)
+    │           ├── includes              # (Envs to include)
+    │           │   └── names             # (Array of env names)
+    │           ├── excludes              # (Envs to exclude)
+    │           │   └── names             # (Array of env names)
+    │           └── type                  # (prod / non-prod)
+    │
+    ├── deploymentTemplate                # (Edit deployment template)
+    │   └── spec                          # (Template spec)
+    │       ├── match                     # (Filter for DT)
+    │       │   ├── include-base-config   # (true or false)
+    │       │   └── chart                 # (Filter for charts)
+    │       │       ├── name              # (Enter chart type, e.g. Deployment)
+    │       │       ├── custom            # (true if it''s a user-uploaded custom chart)
+    │       │       └── version           # (Filter for chart version)
+    │       │            ├── value        # (Enter chart version, e.g. 4.20.0)
+    │       │            └── operator     # (EQUAL | LESS | GREATER | LESS_EQUAL | GREATER_EQUAL)
+    │       └── operation                 # (Edit operation)
+    │           ├── action                # (update only)
+    │           ├── field                 # (values / version)
+    │           ├── patchJson             # (Define if operation.field=values)
+    │           └── chartVersion          # (Define if operation.field=version)
+    │
+    ├── configMap                         # (Edit config maps)
+    │   └── spec                          # (ConfigMap spec)
+    │       ├── match                     # (Filter for ConfigMaps)
+    │       │   ├── include-base-config   # (true or false)
+    │       │   ├── includes              # (CMs to include)
+    │       │   │   └── names             # (Array of config map names)
+    │       │   └── excludes              # (CMs to exclude)
+    │       │       └── names             # (Array of config map names)
+    │       │
+    │       └── operation                 # (Edit operation)
+    │           ├── action                # (create/update/delete)
+    │           ├── field                 # (data)
+    │           ├── patchJson             # (JSON patch for update)
+    │           └── value                 # (Key-values for create/delete)
+    │
+    └── secret                            # (Edit secrets)
+        └── spec                          # (Secret spec)
+            ├── match                     # (Filter for Secrets)
+            │   ├── include-base-config   # (true or false)
+            │   ├── includes              # (Secrets to include)
+            │   │   └── names             # (Array of secret names)
+            │   └── excludes              # (Secrets to exclude)
+            │       └── names             # (Array of secret names)
+            │
+            └── operation                 # (Edit operation)
+                ├── action                # (create/update/delete)
+                ├── field                 # (data)
+                ├── patchJson             # (JSON patch for update)
+                └── value                 # (Key-values for create/delete)
+```
+
+We recommend you to perform bulk edits in 4 parts:
 
-- **Environments:**
-  Only includes environments of type `non-prod` (`env.type = non-prod`).
+1. [Use Selector Block](#step-1-use-selector-block)
+2. [Choose the Configs](#step-2-choose-the-configs)
+3. [Specify the Operation](#step-3-specify-the-operation)
+4. [Run the Script](#step-4-run-the-script)
 
-**What will be updated:**
+---
 
-- **Deployment Templates:**
-  Updates the base Deployment Templates (and any environment-specific overrides) for the selected criteria.
-  Sets the number of replicas to `4`.
+## Step 1: Use Selector Block
 
-- **ConfigMaps:**
-  Only affects ConfigMaps starting with `qa-cm-` or `prod-cm-`, and skips any that contain `dev` or `test` in their names.
-  Updates the base ConfigMaps (and any environment-specific overrides) for the selected criteria.
-  Adds a new key `FEAT_TEST_ENABLE` with value `true` and replaces the existing `LOG_LEVEL` with `-1`.
+In Devtron, configs like Deployment Template, ConfigMaps, and Secrets are specified within application. So you need to determine the target applications initially.
 
-- **Secrets:**
-  Only affects Secrets starting with `qa-secret-` or `prod-secret-`, and skips any that contain `dev` or `test` in their names.
-  Updates the base Secrets (and any environment-specific overrides) for the selected criteria.
-  Adds a new key `DB_PASSWORD` with value `********` and replaces the existing `ADMIN_PASSWORD` with `********`.
+In the first part, we will look at the selector script required to filter the applications. Only the applications that match your selector logic will have their Deployment Template, ConfigMap, or Secret available for edits.
+
+```yaml
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      project:
+        includes:
+            names: ["dev-project", "qa-project"]
+        excludes:
+            names: ["test-project"]
+      app:
+        includes:
+            names: ["%-dashboard"]
+        excludes:
+            names: ["demo-%"]
+      env:
+        includes:
+            names: ["staging", "dev"]
+        excludes:
+            names: ["%qa%"]
+        type: non-prod
+# Next Steps: Add spec.deploymentTemplate, spec.configMap, and/or spec.secret (check Step 2 and 3)
+```
+
+You can use `project`, `app`, `env` selectors with the following lists:
+* `includes.names` - A list to specify the ones we need to edit.
+* `excludes.names` - A list to specify the ones which are not to be edited.
+
+In **includes** and **excludes**, you can give the names of your projects/apps/environments. Additionally, you may use wildcard patterns (like `%-dashboard%`).
+
+
+
+---
+
+## Step 2: Choose the Configs
+
+Here you can filter the Deployment Templates, ConfigMaps, and Secrets you wish to edit (refer the block below).
+
+### Deployment Templates
+
+After you add the selector block, add `deploymentTemplate` object.
+
+```yaml
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors: # Add selector logic (check Step 1)
+  deploymentTemplate:
+    spec:
+      match:
+        chart:
+          name: "Deployment" ## Name of the deployment chart
+          custom: false ## Set as true if using your uploaded custom deployment chart
+          version:
+            value: "4.20.0"
+            operator: EQUAL ## Supports "GREATER", "LESS", "GREATER_EQUAL", "LESS_EQUAL"
+      operation: # Add operation object (check Step 3)
+```
+
+#### What you can do?
+* Add or remove Helm values defined in your chart
+* Update the chart version itself
+* When editing deployment templates, you may choose whether to apply changes to only environment-specific overrides or also to the base configuration:
+    * When `true`, your operations apply to base deployment template shared across environments
+    * When `false` or omitted, changes apply only to environment-level deployment templates
+* Combine with `configMap` and `secret` objects in the same script
+
+> **Next Step**: [Add operations for your Deployment Template(s)](#on-deployment-templates)
+
+### ConfigMaps
+
+```yaml
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors: # Add selector logic (check Step 1)
+  configMap:
+    spec:
+      match:
+        include-base-config: true
+        includes:
+          names: ["qa-cm-%", "prod-cm-%"]
+        excludes:
+          names: ["%dev%", "%test%"]
+      operation: # Add operation object (check Step 3)
+```
+
+#### What you can do?
+* Add new keys, e.g., `FEATURE_ENABLE_X: true`
+* Update existing keys
+* Delete keys or the entire ConfigMap by name
+* Include Base Configuration
+    * This allows updates to the base-level ConfigMap
+    * Environment-level ConfigMaps remain unaffected if this flag is not set
+* Combine with `deploymentTemplate` and `secret` objects in the same script.
+
+> **Next Step**: [Add operations for your ConfigMap(s)](#on-configmaps)
+
+### Secrets
+
+```yaml
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors: # Add selector logic (check Step 1)
+  secret:
+    spec:
+      match:
+        include-base-config: true
+        includes:
+          names: ["qa-secret-%", "prod-secret-%"]
+        excludes:
+          names: ["%dev%", "%test%"]
+      operation: # Add operation object (check Step 3)
+```
+
+#### What you can do?
+* Add or update secret keys, e.g., `API_KEY: efd32tr6tsjbf43765`
+* Delete keys or the entire Secret by name
+* Same usage pattern as ConfigMaps using `action`, `field: data`, and `value`/`patchJson`.
+* Include Base Configuration
+    * Enables edits on base-level Secret
+    * Use this to update secrets across environments from a single source of truth
+* Combine with `deploymentTemplate` and `configMap` objects in the same script
+
+> **Next Step**: [Add operations for your Secret(s)](#on-secrets)
+---
+
+## Step 3: Specify the Operation
+
+Add the operation to be performed on the selected Deployment Templates, ConfigMaps, and Secrets.
+
+
+### On Deployment Templates
+
+Supports only using `action: update`, `field: values` or `field: version`, and corresponding `patchJson` or `chartVersion`.
+
+#### Configure memory to `250Mi`
+
+```yaml
+...
+...
+... # Add the following in deploymentTemplate.spec
+      operation:
+        action: update
+        field: values
+        patchJson: ''[{ "op": "replace", "path": "/resources/requests/memory", "value": "250Mi" }]''
+```
+
+#### Add a new value `ENABLE_AUTOSCALING: true`
+
+```yaml
+...
+...
+... # Add the following in deploymentTemplate.spec
+      operation:
+        action: update
+        field: values
+        patchJson: ''[{ "op": "add", "path": "/ENABLE_AUTOSCALING", "value": true }]''
+```
+
+#### Update deployment chart version to `4.30.1`
+
+```yaml
+...
+...
+... # Add the following in deploymentTemplate.spec
+      operation:
+        action: update
+        field: version
+        chartVersion: "4.30.1"
+```
+
+### On ConfigMaps
+
+#### Add `FEATURE_ENABLE_X` key in existing ConfigMap
+
+```yaml
+...
+...
+... # Add the following in configMap.spec
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "add", "path": "/FEATURE_ENABLE_X", "value": "true" }]''
+```
+
+#### Update existing key `FEATURE_ENABLE_X`
+
+```yaml
+...
+...
+... # Add the following in configMap.spec
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "replace", "path": "/FEATURE_ENABLE_X", "value": "false" }]''
+```
+
+#### Remove existing key `FEATURE_ENABLE_X: true` from ConfigMap
+
+```yaml
+...
+...
+... # Add the following in configMap.spec
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "remove", "path": "/FEATURE_ENABLE_X" }]''
+```
+
+#### Delete ConfigMap
+
+```yaml
+...
+...
+... # Add the following in configMap.spec
+      operation:
+        action: delete
+        field: data
+        value: banking-cm # In ''value'', enter the name of the ConfigMap to delete
+```
+
+
+### On Secrets
+
+#### Add `API_TOKEN` key in existing secret
+
+```yaml
+...
+...
+... # Add the following in secret.spec
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "add", "path": "/API_TOKEN", "value": "u4hg847598fc" }]''
+```
+
+#### Update `DB_PASSWORD` key in secret
+
+```yaml
+...
+...
+... # Add the following in secret.spec
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "replace", "path": "/DB_PASSWORD", "value": "root@123" }]''
+```
+
+#### Remove `API_KEY` key in secret
+
+```yaml
+...
+...
+... # Add the following in secret.spec
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "remove", "path": "/API_KEY" }]''
+```
+
+#### Add multiple secret keys
+
+```yaml
+...
+...
+... # Add the following in secret.spec
+      operation:
+        action: update
+        field: data
+        patchJson: ''[
+          { "op": "add", "path": "/TOKEN", "value": "shc24235" },
+          { "op": "replace", "path": "/API_KEY", "value": "u4hg847598fc" }
+        ]''
+```
+
+#### Delete Secret
+
+```yaml
+...
+...
+... # Add the following in secret.spec
+      operation:
+        action: delete
+        field: data
+        value: banking-secret # In ''value'', enter the name of the secret to delete
+```
+
+---
+
+## Step 4: Run the Script
+
+Before running the script, make sure to check the impacted applications and configs, by clicking the **Show Impacted Objects** button. We recommend you to do this just so you don''t end up unintentionally editing any config (Deployment Templates, ConfigMaps, and Secrets).
+
+Next, click **Run** to execute the script. The output of the script execution will be shown in the **Output** tab in the bottom drawer.
+
+---
+
+## Examples (With Full Script)
+
+### Edit Deployment Template
+
+**CASE 1**: Update `replicaCount` in only Base Deployment Templates of `devtron` project
+
+```YAML
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      project:
+        includes:
+          names:
+            - devtron
+  deploymentTemplate:
+    spec:
+      match:
+        include-base-config: true
+      operation:
+        action: update
+        field: values
+        patchJson: ''[{ "op": "replace", "path": "/replicaCount", "value": 2 }]''
+```
+
+**CASE 2**: Remove `replicaCount` in only Base Deployment Templates of all applications (names) that end with `-sanity-app`
+
+```YAML
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      app:
+        includes:
+          names:
+            - "%-sanity-app"
+  deploymentTemplate:
+    spec:
+      match:
+        include-base-config: true
+      operation:
+        action: update
+        field: values
+        patchJson: ''[{ "op": "remove", "path": "/replicaCount" }]''
+```
+
+**CASE 3**: Add `replicaCount` in both (Base + Env Override) Deployment Templates of all applications (names) having at least one prod environment (excluding any environment name containing `virtual`)
+
+```YAML
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      env:
+        type: prod
+        excludes:
+          names:
+            - "%virtual%"
+  deploymentTemplate:
+    spec:
+      match:
+        include-base-config: true
+      operation:
+        action: update
+        field: values
+        patchJson: ''[{ "op": "add", "path": "/replicaCount", "value": 2 }]''
+```
+
+**CASE 4**: Change Deployment Chart Version (Only Env Override) to `4.30.0` for all `non-prod` environments having `Rollout Deployment` chart and version `<= 4.20.0`
+
+```YAML
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      env:
+        type: non-prod
+  deploymentTemplate:
+    spec:
+      match:
+        chart:
+          name: "Rollout Deployment"
+          version:
+            value: 4.20.0
+            operator: LESS_EQUAL
+      operation:
+        action: update
+        field: version
+        chartVersion: 4.30.0
+```
+
+### Edit ConfigMap
+
+**CASE 1**: Update `USE_GIT_CLI` in `orchestrator-cm` in only Base ConfigMap of all projects (names) that starts with `go-lang`
+
+```YAML
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      project:
+        includes:
+          names:
+            - "go-lang%"
+  configMap:
+    spec:
+      match:
+        include-base-config: true
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "replace", "path": "/USE_GIT_CLI", "value": "true" }]''
+```
+
+**CASE 2**: Remove `USE_GIT_CLI` in `orchestrator-cm` in only Base ConfigMap of all applications, except for the ConfigMaps with name `orchestrator-cm`
+
+```YAML
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      app:
+        includes:
+          names:
+            - "%%" # %% Wildcard for all applications
+  configMap:
+    spec:
+      match:
+        include-base-config: true
+        excludes:
+          names:
+            - orchestrator-cm
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "remove", "path": "/USE_GIT_CLI" }]''
+```
+
+**CASE 3**: Add `USE_GIT_CLI` in `orchestrator-cm` in both (Base + Env Override) ConfigMaps of all applications (names) having at least one `non-prod` environment (excluding any environment name containing `virtual`)
+
+```YAML
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      env:
+        type: non-prod
+        excludes:
+          names:
+            - "%virtual%"
+  configMap:
+    spec:
+      match:
+        include-base-config: true
+      operation:
+        action: update
+        field: data
+        patchJson: ''[{ "op": "add", "path": "/USE_GIT_CLI", "value": "true" }]''
+```
+
+**CASE 4**: Delete a ConfigMap named `orchestrator-cm` (Only From Env Override) from all `non-prod` environments except for the applications with name `orchestrator-app`
+
+```YAML
+apiVersion: batch/v1beta2
+kind: Application
+spec:
+  selectors:
+    match:
+      app:
+        excludes:
+          names:
+            - orchestrator-app
+      env:
+        type: non-prod
+  configMap:
+    spec:
+      operation:
+        action: delete
+        value: orchestrator-cm
+```
+
+---
+
+## Combined YAML Template
+
+You can use the below script as a template if you wish to edit Deployment Templates, ConfigMaps, Secrets of one or more apps in bulk.
 
 ```yaml
 apiVersion: batch/v1beta2
@@ -278,10 +832,12 @@ spec:
     spec:
       match:
         include-base-config: true
-      operation:
-        action: update
-        field: values
-        patchJson: ''[{ "op": "replace", "path": "/replicas", "value": 4 }]''
+        chart:
+          name: "Deployment"
+          custom: false
+          version:
+            value: "4.20.0"
+            operator: LESS_EQUAL
   configMap:
     spec:
       match:
@@ -293,7 +849,7 @@ spec:
       operation:
         action: update
         field: data
-        patchJson: ''[{ "op": "add", "path": "/FEAT_TEST_ENABLE}", "value": "true" },{"op": "replace","path":"/LOG_LEVEL","value": "-1"}]''
+        patchJson: ''[{ "op": "add", "path": "/FEAT_TEST_ENABLE", "value": "true" },{"op": "replace","path":"/LOG_LEVEL","value": "-1"}]''
   secret:
     spec:
       match:
@@ -305,43 +861,8 @@ spec:
       operation:
         action: update
         field: data
-        patchJson: ''[{ "op": "add", "path": "/DB_PASSWORD}", "value": "********" },{"op": "replace","path":"/ADMIN_PASSWORD","value": "********"}]''
+        patchJson: ''[{ "op": "add", "path": "/DB_PASSWORD", "value": "********" },{"op": "replace","path":"/ADMIN_PASSWORD","value": "********"}]''
 ```
-
-## Field Reference
-
-### Selectors
-
-| Field                     | Description                                                  |
-|---------------------------|--------------------------------------------------------------|
-| `selectors.match`         | At least one of `project`, `app`, or `env` must be specified |
-| `selectors.match.project` | Filter by project name (`includes` and/or `excludes`)        |
-| `selectors.match.app`     | Filter by app name (`includes` and/or `excludes`)            |
-| `selectors.match.env`     | Filter by environment type and name                          |
-
-### Deployment Template
-
-| Field                                          | Description                                                                                          |
-|------------------------------------------------|------------------------------------------------------------------------------------------------------|
-| `deploymentTemplate.match.include-base-config` | Whether to include base deployment configs                                                           |
-| `deploymentTemplate.match.chart.name`          | Deployment chart type filter                                                                         |
-| `deploymentTemplate.match.chart.version.value` | Deployment chart version filtering                                                                   |
-| `deploymentTemplate.operation.action`          | Supported: `update`                                                                                  |
-| `deploymentTemplate.operation.field`           | Supported: `values`, `version`. For `values`, use `patchJson` and for `version`, use `chartVersion`. |
-| `deploymentTemplate.operation.patchJson`       | JSON Patch string to apply (if `field` is `values`)                                                  |
-| `deploymentTemplate.operation.chartVersion`    | Chart version to set (if `field` is `version`)                                                       |
-
-### ConfigMap / Secret
-
-| Field                                             | Description                                                                                                                                                                                                                                                                                                                             |
-|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| `configMap/secret.spec.match.include-base-config` | Whether to include base configs                                                                                                                                                                                                                                                                                                         |
-| `configMap/secret.spec.match.includes.names`      | Names to include                                                                                                                                                                                                                                                                                                                        |
-| `configMap/secret.spec.match.excludes.names`      | Names to exclude                                                                                                                                                                                                                                                                                                                        |
-| `configMap/secret.spec.operation.action`          | Supported: `create`, `update`, `delete`. For `create`/ `delete`, use `value`. For `update`, use `patchJson`.                                                                                                                                                                                                                            |
-| `configMap/secret.spec.operation.field`           | Supported: `data`. Requires `patchJson` is specified.                                                                                                                                                                                                                                                                                   |
-| `configMap/secret.spec.operation.patchJson`       | JSON Patch string to apply. If `action` is `update`, this is required.                                                                                                                                                                                                                                                                  |
-| `configMap/secret.spec.operation.value`           | For `action` is `create`, value is a JSON string representing the ConfigMap/Secret data (e.g: "{\\"name\\":\\"xyz\\",\\"type\\":\\"environment\\",\\"data\\":{\\"FEAT_TEST_ENABLE\\":\\"false\\",\\"LOG_LEVEL\\":\\"-1\\"},\\"mergeStrategy\\":\\"replace\\"}"). For `delete`, the value is the name of the ConfigMap/Secret to delete. |
 ','{
   "$schema": "http://json-schema.org/draft-04/schema#",
   "title": "Bulk Edit Application batch/v1beta2 Schema",

From 343373f21ecdc736d5174d6a8c97c76cd57649ea Mon Sep 17 00:00:00 2001
From: Ash-exp 
Date: Thu, 31 Jul 2025 10:52:02 +0530
Subject: [PATCH 22/22] chore: rename bulk edit SQL migration files for
 consistency

---
 ...lk_edit_config.down.sql => 34304200_bulk_edit_config.down.sql} | 0
 ...0_bulk_edit_config.up.sql => 34304200_bulk_edit_config.up.sql} | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename scripts/sql/{34204000_bulk_edit_config.down.sql => 34304200_bulk_edit_config.down.sql} (100%)
 rename scripts/sql/{34204000_bulk_edit_config.up.sql => 34304200_bulk_edit_config.up.sql} (100%)

diff --git a/scripts/sql/34204000_bulk_edit_config.down.sql b/scripts/sql/34304200_bulk_edit_config.down.sql
similarity index 100%
rename from scripts/sql/34204000_bulk_edit_config.down.sql
rename to scripts/sql/34304200_bulk_edit_config.down.sql
diff --git a/scripts/sql/34204000_bulk_edit_config.up.sql b/scripts/sql/34304200_bulk_edit_config.up.sql
similarity index 100%
rename from scripts/sql/34204000_bulk_edit_config.up.sql
rename to scripts/sql/34304200_bulk_edit_config.up.sql